http-string-parser
http-string-parser copied to clipboard
Missing headers with same names (like Set-Cookie)
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: ''
}
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?
Would you be willing to send a PR with a fix?
No, I wrote my own parser.