joyent/node — Issue #2750: duplicate http headers should not be dropped
Author: joachimkainz
Created: 2012-02-14 05:52:30+00:00
State: open

http headers can very legitimately contain duplicate header variables. For instance, when working with WebDAV duplicate headers are used frequently. Here is an example for a header used by subversion:

```
OPTIONS /svn HTTP/1.1
User-Agent: SVN/1.7.2 neon/0.29.6
Keep-Alive:
Connection: TE, Keep-Alive
TE: trailers
Host: jolira-tools.googlecode.com
Content-Type: text/xml
Accept-Encoding: gzip
DAV: http://subversion.tigris.org/xmlns/dav/svn/depth
DAV: http://subversion.tigris.org/xmlns/dav/svn/mergeinfo
DAV: http://subversion.tigris.org/xmlns/dav/svn/log-revprops
Content-Length: 104
Accept-Encoding: gzip

HTTP/1.1 200 OK
```

Other languages (such as Java) use an array to store headers for that reason.

The code change to support an array in lib/http.js is rather simple. I prototyped it in https://github.com/jolira/node/commit/0face422a4a008d9ae067510dc5bf4a3d4305f2f.