That did the trick! Thank you very much... will this be in the head soon? I was using 0.9.28....
* About to connect() to 127.0.0.1 port 5000 (#0) * Trying 127.0.0.1... connected * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0) > GET /ready.html HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 > zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: 127.0.0.1:5000 > Accept: */* > Connection: Keep-Alive > < HTTP/1.1 200 OK < Content-Length: 2 < Connection: keep-alive < 1 * Connection #0 to host 127.0.0.1 left intact * Re-using existing connection! (#0) with host 127.0.0.1 * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0) > GET /classify.html?url=ibm.com HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 > zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: 127.0.0.1:5000 > Accept: */* > Connection: Keep-Alive > < HTTP/1.1 200 OK < Content-Length: 4 < Connection: keep-alive < 998 * Connection #0 to host 127.0.0.1 left intact * Re-using existing connection! (#0) with host 127.0.0.1 * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0) > GET /classify.html?url=http://slashdot.org HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 > zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: 127.0.0.1:5000 > Accept: */* > Connection: Keep-Alive > < HTTP/1.1 200 OK < Content-Length: 9 < Connection: keep-alive < 29 33 35 * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 ________________________________________ From: [email protected] [[email protected]] on behalf of Christian Grothoff [[email protected]] Sent: Thursday, August 08, 2013 1:59 AM To: [email protected] Subject: Re: [libmicrohttpd] Connection: Keep-Alive Hi! First if all, thanks for reporting. I found one issue where I had recently missed a check, could you try with SVN 28450? This might / should fix your problem. Second, in a production setting, the HTTP spec says that you must not turn of the 'date' header (as you do in your example code), unless you do not have an RTC on your system. So you might want to not set that option in your test. Finally, MHD_USE_EPOLL_TURBO can make MHD _slower_ unless you're really running your systems at extremely high loads. So for most servers, this setting is also not a good idea. Happy hacking! Christian On 08/07/13 21:28, Derrick Bradbury wrote: > Hi all... > > I've been putting together an app that requires a persistant connection > for 30 seconds, drop and re-establish. > > Everything is working except for the keepalive... > > From everything I've read, HTTP/1.1 should have keepalive enabled by > default, and in MHD, you must close it by adding the header (Connection: > close). > > Problem is, that when I get a request, the header has a "keep-alive" > request, but MHD returns a "Connection: close"... > > * About to connect() to 127.0.0.1 port 5000 (#0) > * Trying 127.0.0.1... connected > * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0) > > GET /ready.html HTTP/1.1 > > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 > NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > > Host: 127.0.0.1:5000 > > Accept: */* > > Connection: Keep-Alive > > > < HTTP/1.1 200 OK > < Connection: close > < Content-Length: 2 > < > 1 > * Closing connection #0 > * About to connect() to 127.0.0.1 port 5000 (#0) > * Trying 127.0.0.1... connected > * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0) > > GET /classify.html?url=ibm.com HTTP/1.1 > > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 > NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > > Host: 127.0.0.1:5000 > > Accept: */* > > Connection: Keep-Alive > > > < HTTP/1.1 200 OK > < Connection: close > < Content-Length: 6 > < > 33 > 66 > * Closing connection #0 > > > If I manually add a "Connection: Keep-Alive" header, the client thinks > there should be a persistant connection, but the server still closes the > connection: > > * About to connect() to 127.0.0.1 port 5000 (#0) > * Trying 127.0.0.1... connected > * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0) > > GET /ready.html HTTP/1.1 > > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 > NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > > Host: 127.0.0.1:5000 > > Accept: */* > > Connection: Keep-Alive > > > < HTTP/1.1 200 OK > < Content-Length: 2 > < Connection: keep-alive > < > 1 > * Connection #0 to host 127.0.0.1 left intact > * Connection #0 seems to be dead! > * Closing connection #0 > * About to connect() to 127.0.0.1 port 5000 (#0) > * Trying 127.0.0.1... connected > * Connected to 127.0.0.1 (127.0.0.1) port 5000 (#0) > > GET /classify.html?url=ibm.com HTTP/1.1 > > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 > NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > > Host: 127.0.0.1:5000 > > Accept: */* > > Connection: Keep-Alive > > > < HTTP/1.1 200 OK > < Content-Length: 4 > < Connection: keep-alive > < > 998 > * Connection #0 to host 127.0.0.1 left intact > * Connection #0 seems to be dead! > * Closing connection #0 > > > > Here is my daemon definition: > daemon = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | > MHD_SUPPRESS_DATE_NO_CLOCK > | MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO, > options.port, > NULL, NULL, &answer_to_connection, NULL, > MHD_OPTION_THREAD_POOL_SIZE, (unsigned int) > options.threads, > MHD_OPTION_CONNECTION_LIMIT, (unsigned int) > 12000, MHD_OPTION_END); > > > and my response being built: > > response = MHD_create_response_from_buffer (strlen (page), (void*) > page, MHD_RESPMEM_PERSISTENT); > ret = MHD_add_response_header(response,"Connection","keep-alive"); > > ret = MHD_queue_response (connection, MHD_HTTP_OK, response); > > MHD_destroy_response (response); > > > Am I needing a different response, or setting? > > Thanks! > Derrick > >
