cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Crash in curl library while processing HTTP HEAD response

From: isshed <isshed.sip_at_gmail.com>
Date: Thu, 18 Aug 2016 16:56:31 +0530

Hi Daniel,

Thanks for the reply.

Actually server is using HTTP/1.1 but the header response is coming as
plain text "404 - Error: Page Not Found.\r\n" and without any headers.

I can reproduce it every-time. I will not merge the code as it is I
will remove the printfs this is added just for my loggings.

The scenario is as follows.

My application is using HTTPS and sending HEAD request, and is getting
the above response. I am new for curl lib and am not having much
understanding of HTTP protocols versions. Also as my application is
using HTTPs I can not see the wire-capture. Is there anyway I can
setup server as I can see this problem with one of my customer
servers. Below is the backtrace I am getting

#############################
#0 0x40a91ab0 in ?? ()
#1 0x00463b48 in Curl_client_write (conn=0x15ea3d0, type=1,
ptr=0x1<Address 0x1 out of bounds>, len=0) at
/Code/ThirdParty/curl/lib/sendf.c:494
#2 0x00463b48 in Curl_client_write (conn=0x15ea3d0, type=1,
ptr=0x15f53d0 "404 - Error: Page Not Found.\r\n", len=30) at
/Code/ThirdParty/curl/lib/sendf.c:494
#3 0x00466704 in readwrite_data (done=<value optimized out>,
didwhat=<value optimized out>, k=<value optimized out>, conn=<value
optimized out>, data=<value optimized out>) at
/Code/ThirdParty/curl/lib/transfer.c:613
#4 Curl_readwrite (conn=0x15ea3d0, done=0x15ea490 "") at
/Code/ThirdParty/curl/lib/transfer.c:1620
#5 0x00466ee4 in Transfer (conn=<value optimized out>) at
/Code/ThirdParty/curl/lib/transfer.c:1876
#6 Curl_perform (data=0x15d4670) at /Code/ThirdParty/curl/lib/transfer.c:2501
#############################

Thanks,

On Thu, Aug 18, 2016 at 3:20 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Thu, 18 Aug 2016, isshed wrote:
>
>> I am new to the curl library. I am facing a crash in the curl library
>> while processing HTTP HEAD Request. After analyzing the crash dump I found
>> that HEAD response is coming as "404 - Error: Page Not Found.\r\n" which is
>> in plain text.
>
>
> You mean you get no headers at all back and just that body? Thus being
> "HTTP/0.9" ?
>
>> I guess this is the problem. readwrite_http_headers() function could
>> not parse it
>
>
> ...
>
>> Please let me know which fix I should finalize. Or do you suggest some new
>> fix. if this has some problem. I am eagerly waiting for your reply.
>
>
> We can't have code that writes to stdout like that, but before we consider
> the fix, can we try to reproduce problem reliably?
>
> I just wrote up test 1144 and pushed to git [1] that attempts to reproduce
> but I can't make curl crash on that. Can you? Or can you detect how that
> test case differs from your scenario?
>
> [1] = https://github.com/curl/curl/commit/cdd61dc35
>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-08-18