cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: http keep-alive when mongoose + libcurl

From: Dannoy Lee <dannoy.lee_at_gmail.com>
Date: Fri, 24 Dec 2010 16:05:27 +0800

Hi,
   Dan,thank you for answer me so quickly.Here I try to make the things more
specific.
   First, I try persistant.c(I modified it a bit , see attachment) example
with my modified mongoose http server without authentication and following
location. And my persistant runs well.
   Second, I add authentication and "Location" header to response client
request, my persistant hangs.

=======================================
Here is the OK log:
[xxx_at_localhost ok]$ ./persist
* About to connect() to localhost port 8081 (#0)
* Trying 127.0.0.1... * connected
* Connected to localhost (127.0.0.1) port 8081 (#0)
* Server auth using Digest with user 'lijin'
> GET /my HTTP/1.1
Host: localhost:8081
Accept: */*

< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Connection: Keep-Alive
Connection: Keep-Alive
< Content-length: 2
Content-length: 2

<
* Excess found in a non pipelined read: excess = 17, size = 2, maxdownload =
2, bytecount = 0
* Connection #0 to host localhost left intact
* Re-using existing connection! (#0) with host localhost
* Connected to localhost (127.0.0.1) port 8081 (#0)
* Server auth using Digest with user 'lijin'
> GET /my HTTP/1.1
Host: localhost:8081
Accept: */*

< HTTP/1.1 200 OK
<hHTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Connection: Keep-Alive
Connection: Keep-Alive
< Content-length: 2
Content-length: 2

<
* Excess found in a non pipelined read: excess = 17, size = 2, maxdownload =
2, bytecount = 0
* Connection #0 to host localhost left intact
* Closing connection #0
<h[xxx_at_localhost ok]$

===================================
And here is the BAD log:

[xxx_at_localhost bad]$ ./persist
* About to connect() to localhost port 8081 (#0)
* Trying 127.0.0.1... * connected
* Connected to localhost (127.0.0.1) port 8081 (#0)
* Server auth using Digest with user 'lijin'
> GET /my HTTP/1.1
Host: localhost:8081
Accept: */*

< HTTP/1.1 401 Unauthorized
HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Digest qop="auth", realm="my_at_example.com",
nonce="1293176855"
WWW-Authenticate: Digest qop="auth", realm="my_at_example.com",
nonce="1293176855"
* no chunk, no close, no size. Assume close to signal end

<
Quit
[xxx_at_localhost bad]$

    And my app is in attachment.
    My environments:
        curl-7.21.2
        Linux localhost.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 03:28:30
EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

    Thank you!~

On Tue, Dec 21, 2010 at 3:13 PM, Dan Fandrich <dan_at_coneharvesters.com>wrote:

> On Tue, Dec 21, 2010 at 12:02:17PM +0800, Dannoy Lee wrote:
> > It seems mongoose handle keep-alive correctly.But when I use this
> feature
> > to talk with libcurl(I use easy interface),libcurl will do select all the
> same
> > after it receive response from server in the following funcion(transfer.c
> > line:1249):
> > static CURLcode
> > Transfer(struct connectdata *conn)
> > And the following curl_easy_perform() doesn't execute, which makes
> the
> > application hangs up here.
> >
> > Is this a bug? Or I have not understood correctly?
>
> The curl test suite tests many combinations of keep-alive and Connection:
> close connections and they all normally pass. You'll have to be more
> specific in what you see happening in the code and what you expect to see.
> If you can illustrate the problem with code and debug logs, it will be
> easier for us to understand.
>
> >>> Dan
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>

-- 
Dannoy.Lee love you all.


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2010-12-24