Cinder-Protocol icon indicating copy to clipboard operation
Cinder-Protocol copied to clipboard

Issue parsing big header

Open xumo opened this issue 7 years ago • 0 comments

If the header is bigger than 512 (bytes?), the size of the buffer I thinks, then it only parses it partialy. If Conten-Length is not foeund then it doesn't even keep reading to get the body part.

For now I just hack my way arround this, but it would be great if the HttpResponse::parseHeader sets mHasHeader to true only if it reaches the end of a header and appends the remaining in subsequent passes.

This is the kind of response I'm getting from a Laravel(php) service:

First response

HTTP/1.1 200 OK
Date: Wed, 19 Jul 2017 09:13:30 GMT
Server: Apache/2.4.26 (Win32) OpenSSL/1.0.2l PHP/7.1.7
X-Powered-By: PHP/7.1.7
Cache-Control: no-cache, private
X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
Set-Cookie: XSRF-TOKEN=eyJpdiI6IjdLSHdwTU1DTTI3UUh1VjFuNDlBd1E9PSIsInZhbHVlIjoiemN0WXR1NThRc0hpMjlUSkhBRVNaTFVKcUlzeG5VZ3NaUTFlUlAxcGtwQXJXSWdMejRWVXBPc0xIM3ZYMjZERStqbjlxXC9DdUphVncwWU5hKzlxdXJBPT0iLCJtYWMiOiJhMTdiZmI1YmYzNDM4YmNlOWRlMGU5M2U5ZjNjZWI5OGY2ODFjMWYwNzA3N2ViODEwMTI4MmI5NGMxZmQxMjF

In a second pass

hIn0%3D; expires=Wed, 19-Jul-2017 11:13:31 GMT; Max-Age=7200; path=/
Set-Cookie: laravel_session=JCCr9pQ7G3K2xqccFZllgJHNRGo45HiMSQs18yvz; expires=Wed, 19-Jul-2017 11:13:31 GMT; Max-Age=7200; path=/; HttpOnly
Content-Length: 71
Content-Type: text/json; charset=UTF-8

{"code":0,"data":"viMZYFp1qfRSZtyX9ISBb1uA5KJjxclTgm7OK05D","error":[]}

The Set-Cookie line gets broken, tha might be dificutl for the parser to handle, but I'll dig into it later.~

xumo avatar Jul 19 '17 09:07 xumo