That's how it's done in Rack - I dislike it - at least as the
low-level server interface. You end up having to have checks
everywhere for the type of the value. It also does not allow one to
specify the order of the headers. The order is mostly irrelevent but,
for example, the RFC says
The order in which header fields with the same field-name are received
is therefore significant to the interpretation of the combined field value,
and thus a proxy MUST NOT change the order of these field values when
a message is forwarded.
So choosing a hash to represent headers would preclude one from
writing RFC conformant proxies in Node.
I fully expect higher level HTTP libraries to provide more
user-friendly API to message headers. But for a lowest-level
interfacing-with-web-server API, I think it's good.
> The fact are:
> - It's not easy to access a specific header with your API
> - It's a requirement to have the possibility to access to any
> information about the received HTTP headers, but some headers are
> quite already used and a direct access to them is a good benefit (but
> I agree it can be in a higher level library)
I agree with Ryan here (and with you I guess), that this should go into
a higher level library. I currently working on one [1] (although there's
not much there and it might go slow). There's also a list of projects on
the wiki [2] that might list things that go into that direction (e.g.
maybe node_chat already contains code that goes into that direction).
If you want to you can open an issue on coltrane [3] and I'll try to
integrate your suggestions. But I can't tell you when I'll be able to
get to it. The project is still early stages and I'm still figuring out
the basics.
Urban
[1] http://github.com/ujh/coltrane/tree/master
[2] http://wiki.github.com/ry/node
[3] http://github.com/ujh/coltrane/issues
> My speadsheet try to show the differents existing API to manipulate
> HTTP Servers incoming request's :
> http://spreadsheets.google.com/pub?key=rMWeXQ2LvhKWqQQ_zEdb8aQ&single=true&gid=0&output=html
> (accessible from : https://wiki.mozilla.org/ServerJS/WSGI )
> All contributions for this spreadsheet are welcome, I did it a bit
> quickly for my own needs.
BTW. Thanks for all the work on the spreadsheet! That seems like an
awesome resource to have.
Urban
> If you want to you can open an issue on coltrane [3] and I'll try to
> integrate your suggestions. But I can't tell you when I'll be able to
> get to it. The project is still early stages and I'm still figuring out
> the basics.
Did it myself: http://github.com/ujh/coltrane/issues/#issue/9 Any added
info is welcome.
Urban