Package aquarium :: Package parse :: Module Host
[show private | hide private]
[frames | no frames]

Module aquarium.parse.Host

Parse the Host header.


Function Summary
  getHostnameRegex()
Return a regex for a valid hostname.
  parseHost(header, defaultReturnValue, isSecure)
Parse the Host header.

Function Details

getHostnameRegex()

Return a regex for a valid hostname.

There's not much point in being overly strict about what you'll accept in the HOST header, so I'll accept anything that's even vaguely similar to a hostname or IP.

parseHost(header=None, defaultReturnValue=(None, None), isSecure=False)

Parse the Host header.

header
This is the value of the Host header or None.
defaultReturnValue
Return this if the header is absent or malformed.
isSecure
Is the current connection over SSL? This will tell me the default port.

Return a tuple (serverName, serverPort).

We're not very strict about requiring the Host header.

See also: Host


Generated by Epydoc 2.1 on Mon Jan 1 16:34:19 2007 http://epydoc.sf.net