http-string-parser icon indicating copy to clipboard operation
http-string-parser copied to clipboard

Missing headers with same names (like Set-Cookie)

Open myadzel opened this issue 8 years ago • 2 comments

Parsing this response

HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Security-Policy: script-src 'self'
Strict-Transport-Security: max-age=31536000
Set-Cookie: JSESSIONID=1AF9A42DC89C0CD2620ECE5449074DF1.PPM1-1; Path=/itg/; HttpOnly
Set-Cookie: JSESSIONID=1AF9A42DC89C0CD2620ECE5449074DF1.PPM1-1; path=/itg; HTTPOnly
Accept-Language: ru_RU
Cache-Control: no-cache, post-check=0, pre-check=0
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 25 Oct 2017 12:57:35 GMT
Server: 

produce result without second Set-Cookie header

{
     'X-Frame-Options': 'SAMEORIGIN',
     'X-XSS-Protection': '1; mode=block',
     'X-Content-Security-Policy': 'script-src \'self\'',
     'Strict-Transport-Security': 'max-age=31536000',
     'Set-Cookie': 'JSESSIONID=1AF9A42DC89C0CD2620ECE5449074DF1.PPM1-1; path=/itg; HTTPOnly',
     'Accept-Language': 'ru_RU',
     'Cache-Control': 'no-cache, post-check=0, pre-check=0',
     'Content-Type': 'text/html;charset=UTF-8',
     'Transfer-Encoding': 'chunked',
     Date: 'Wed, 25 Oct 2017 12:57:35 GMT',
     Server: ''
}

myadzel avatar Oct 27 '17 19:10 myadzel

My hunch would be that http-string-parser is internally using an object instead of an array to store the HTTP headers. Would you be willing to send a PR with a fix?

honzajavorek avatar Nov 02 '17 10:11 honzajavorek

Would you be willing to send a PR with a fix?

No, I wrote my own parser.

myadzel avatar Nov 02 '17 13:11 myadzel