Hey folks,
I think this is probably more related to Medusa than Quixote, but I'm
not
sure...
With both Apache and IIS, (what I'm familiar with) usually the environment
variables HTTP_HOST and SERVER_NAME usually seem to agree (exceptions noted
below *), and they both reflect what the browser requested (e.g., what the
user typed in the address bar).
With Medusa, HTTP_HOST reflects the requested URL, but SERVER_NAME seems to
be whatever Medusa deduces it to be, (the machine's hostname, I guess) or
whatever is specified as the server name in the Medusa setup/construction
(I'm not so sure about that, as I haven't dug much, yet).
This came up, because Quixote relies on SERVER_NAME when get_server() is
called...
So, Medusa not playing fair makes it more difficult to perform properly in a
'web-server-agnostic' way. I.e., it makes it trickier to write a portable
quixote web app (portable between Medusa and Apache, for example), because
get_server() doesn't work as it should (or to be more precise, how *I* think
it should... I may be misunderstanding the intent here, however)
Of course, I can always use get_environ("HTTP_HOST"), and in fact that's
what I'm doing right now, but... It feels hackish.
Any opinions out there? Am I doing things wrongly here?
If you're wondering why this even came up, it's because I'm doing something
sorta like virtual hosting, and I'd like to do in a server like Medusa:
light, easy to deploy, single process, etc... I'm tossing around the idea of
looking into Twisted for this, but it looks like overkill for what I have in
mind.
That Built in HTTP server that was kicking around a week or so ago is really
what I want, I think!
Jason Sibre
* exceptions
With both IIS and Apache, if I specifiy the standard port in the URL, this
is what happens:
ex.
http://localhost:80/ -> HTTP_HOST = localhost:80
SERVER_NAME = localhost
https://localhost:443/ -> HTTP_HOST = localhost:443
SERVER_NAME = localhost
... and the server seems to redirect to the SERVER_NAME url, or mozilla
fixes it for me... Prolly mozilla, come to think of it.