cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: problem with libcurl 7.7.2 and solaris7 HTTP POST

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 27 Apr 2001 08:28:50 +0200 (MET DST)

On Thu, 26 Apr 2001, Brad Burdick wrote:

> I am trying to use libcurl 7.7.2 on a solaris7 system. The particular
> application is multi-threaded, but that isn't the problem as I can
> reproduce the error with the curl app itself.

I do like those problems. It makes debugging easier! ;-)

> The remote server is running IIS4.0, in case that matters.

It might, although I doubt it.

> % curl -d '<POST data here>' -v <URL here>
> * Connected to <remote> (192.168.10.10)
> > POST /path/to/interface.asp HTTP/1.1
> User-Agent: curl/7.7.2 (sparc-sun-solaris2.7) libcurl 7.7.2
> Host: <remote>
> Pragma: no-cache
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> Content-Length: 490
> Content-Type: application/x-www-form-urlencoded
>
> <POST data here>
> ^C%

That looks fine enough.

> The problem is that curl/libcurl never seems to get the server HTTP
> response.

That worse.

> The POST operation itself completes successfully and using Perl's LWP
> POST app works as expected.

There may be several explanations to that, one of them could be that libcurl
uses HTTP 1.1.

> I've run snoop to capture traffic to the remote server and I see the HTTP
> 200 OK response coming back to me, but curl/libcurl just waits until it
> timesout on the connection or is aborted.

Would it be possible for me to try this on that URL, if you send it to me
privately? We will need to step into the Transfer() function in
lib/transfer.c to see that it behaves correctly...

> I did notice in the snoop output that curl/libcurl gets back an
>
> HTTP: ----- HyperText Transfer Protocol -----
> HTTP:
> HTTP: HTTP/1.1 100 Continue
> HTTP: Server: Microsoft-IIS/4.0
> HTTP: Date: Thu, 26 Apr 2001 01:58:49 GMT

Yes, this is a HTTP 1.1-feature. (The 100-Continue code is explain in section
8.2.3 in RFC2616.).

But libcurl is aware of this and should notice if this is received and then
proceed to expect another set of headers.

> HTTP: HTTP/1.1 200 OK
> HTTP: Server: Microsoft-IIS/4.0
> HTTP: Date: Thu, 26 Apr 2001 01:58:50 GMT
> HTTP: Content-Length: 0
> HTTP: Content-Type: text/html
> HTTP: Set-Cookie: ASPSESSIONIDGQQQGGEN=HGDPMEHBBNODFLNLLMGLGLDH; path=/
> HTTP: Cache-control: private
>
> status after the initial POST attempt. I don't see this using the Perl
> POST app.

Once again, it may be due to HTTP version or something. I figure you will see
this as yet another problem, as you probably didn't want an empty result back
from the server?

> Is the Content-Length: 0 on the response an issue?

Yes. It says there's no response data. This would of course imply that
libcurl should stop reading as soon as all the headers have been received,
and obviously it didn't.

There is a bug in the treatment of 'Content-Length: 0'. I can actually see
that in the code now. It basically does maxdownload = Content-Length and then
later on if(maxdownload) then blablabla. But that would equal true of
Content-Length is 0...

> Any help greatly appreciated.

I'll have to check this out a little more. I'll get back to you as soon as I
think I have a fix...

Thanks for a good report!

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-04-27