Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mystifying HTTP Response #56

Open
sfhacker opened this issue Sep 12, 2019 · 0 comments
Open

Mystifying HTTP Response #56

sfhacker opened this issue Sep 12, 2019 · 0 comments

Comments

@sfhacker
Copy link

Ciao.
I'm new to this project and I'm keen to adopt it.

I have been trying to parse some HTTP response from an external web service and I always get -1.

Complete and intact HTTP Response

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache,no-cache
Content-Length: 1732
Content-Type: text/html
Expires: Thu, 12 Sep 2019 10:07:06 GMT
X-Powered-By: ASP.NET
Date: Thu, 12 Sep 2019 10:08:06 GMT
Set-Cookie: BIGipServerPool_SID_HTTP=!/l5OSz5Q2+lit5ui4p74SMEs3Svp+Nu1zwy7t2ZkQLTILXOoD27803XkdHn2hNIFvnp9qBuid9+lfA8=; expires=Thu, 12-Sep-2019 20:08:44 GMT; path=/; Httponly; Secure
Set-Cookie: f5_cspm=1234;

<title>SID</title><script language='javascript' type='text/javascript'>function inicio() { parent.Modal_Cerrar(); } </script><script id="f5_cspm">(function(){var f5_cspm={f5_p:'HMKADNMFJNNCCKNDGGHGJEGIFLCGEJFLJGDKBLEIFHDFNOJNDJIEEBGFMPPJHNBOODMBAMDNAAMDCFGHGJGAOLHCAAJOJPJMFKJLCOBLMEPJCIIKGJLKPGBOGBHOPJCO',setCharAt:function(str,index,chr){if(index>str.length-1)return str;return str.substr(0,index)+chr+str.substr(index+1);},get_byte:function(str,i){var s=(i/16)|0;i=(i&15);s=s*32;return((str.charCodeAt(i+16+s)-65)<<4)|(str.charCodeAt(i+s)-65);},set_byte:function(str,i,b){var s=(i/16)|0;i=(i&15);s=s*32;str=f5_cspm.setCharAt(str,(i+16+s),String.fromCharCode((b>>4)+65));str=f5_cspm.setCharAt(str,(i+s),String.fromCharCode((b&15)+65));return str;},set_latency:function(str,latency){latency=latency&0xffff;str=f5_cspm.set_byte(str,40,(latency>>8));str=f5_cspm.set_byte(str,41,(latency&0xff));str=f5_cspm.set_byte(str,35,2);return str;},wait_perf_data:function(){try{var wp=window.performance.timing;if(wp.loadEventEnd>0){var res=wp.loadEventEnd-wp.navigationStart;if(res<60001){var cookie_val=f5_cspm.set_latency(f5_cspm.f5_p,res);window.document.cookie='f5avr1505004186aaaaaaaaaaaaaaaa='+encodeURIComponent(cookie_val)+';path=/';} return;}} catch(err){return;} setTimeout(f5_cspm.wait_perf_data,100);return;},go:function(){var chunk=window.document.cookie.split(/\s*;\s*/);for(var i=0;i

Code snippet

prevbuflen = 0;
	status = 0;
	num_headers = 0;
    pret = phr_parse_response(captchaBuffer, ret, &minor_version, &status, &path, &path_len, headers, &num_headers, prevbuflen);
    if (pret < 0) {
		fprintf(stderr, "\tERROR parsing response header [%d]\n", pret);

        // return (EXIT_FAILURE);
	}

I always get -1 from phr_parse_response.
I would appreciate any help/hint/pointer/ etc. I know nothing about the code base.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant