cURL cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1441 Handling of 4-digit HTTP response code

From: Balaji <bgsalunke09_at_users.sf.net>
Date: Tue, 28 Oct 2014 09:17:20 +0000

Thanks Daniel for quick fix.
I checked your code changes implemented as a part of this fix on git.
I think, we might need to handle HTTP status code which is more than 3 digit long returned from NCSA 1.5.x too.

---
** [bugs:#1441] Handling of 4-digit HTTP response code**
**Status:** closed-fixed
**Labels:** libcurl http curl 
**Created:** Mon Oct 27, 2014 11:55 AM UTC by Balaji
**Last Updated:** Mon Oct 27, 2014 03:30 PM UTC
**Owner:** Daniel Stenberg
1.	According to the HTTP documentation RFC-2616, status code should be only 3 digit integer.
http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1

2.	When I requested a URL using libcurl, in the response I received “HTTP/1.1 1064” response with 1064 as status code and following error:
	“libcurl error code 56: Illegal or missing hexadecimal sequence in chunked-encoding”
3.	The observations of response and cause of above error is :
    a.	When I request a URL (I can’t provide it) using libcurl, I received response status               
            code is: “HTTP/1.1 1064” i.e. (1064 - You have an error in your SQL syntax; check the  
            manual that corresponds to your MySQL server version for the right syntax to use near……..”)
    b.	Libcurl parses only first 3 digits of status code in “CURLcode 
            Curl_http_readwrite_headers()” method present in “libcurl/http.c” file.
    c.	Due to parsing of initial 3 digits only from status code (.i.e. in my case 106 from 
            1064); header parsing logic fails in the above method, resulting into above mentioned 
            libcurl error.
4.    Also when I request the URL using curl command line, I did not observe the libcurl error.
5.    Status code parsed by curl command line is also: 106.
I.e. Output of: curl --write-out %{http_code} --silent --output /dev/null <URL>
is 106.
6.    I also requested the same URL in Chrome, Mozila and IE browsers, they handle it properly and shows response code as “1064 OK”.

Why libcurl silently ignores the invalid status code received from web server?
Is it possible to scan all 4 digits from status code to resolve above libcurl error?

System Details:
Curl version: curl 7.12.1 (i686-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6
OS               : Linux 
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2014-10-28

These mail archives are generated by hypermail.