curl-library
http keep-alive when mongoose + libcurl
Date: Tue, 21 Dec 2010 12:02:17 +0800
Hi,
I wanna study http protocol. And my teacher suggested me study mongoose
http server(http://code.google.com/p/mongoose/) and libcurl.
After weeks of study, I have a puzzlement about http keep-alive
mechanism.
In rfc2616 section 8(
http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html) describe http 1.1
suggest both server and client treat most of connections persistent, and I
see mongoose code:
// HTTP 1.1 assumes keep alive if "Connection:" header is not set
768 // This function must tolerate situations when connection info is not
769 // set up, for example if request parsing failed.
770 static int should_keep_alive(const struct mg_connection *conn) {
771 const char *http_version = conn->request_info.http_version;
772 const char *header = mg_get_header(conn, "Connection");
773 return (header == NULL && http_version && !strcmp(http_version,
"1.1")) ||
774 (header != NULL && !mg_strcasecmp(header, "keep-alive"));
775 }
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?
-- Dannoy.Lee .
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-21