aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac3
-rw-r--r--src/include/microhttpd.h2
-rw-r--r--src/microhttpd/connection.c58
-rw-r--r--w32/VS2013/MHD_config.h8
5 files changed, 55 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index df3fa00d..fb912b1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Wed Nov 25 17:02:53 CET 2015
2 Remove 200ms delay observable with keep-alive on Darwin
3 and *BSD platfroms. -EG
4
1Tue Nov 10 15:25:48 CET 2015 5Tue Nov 10 15:25:48 CET 2015
2 Fix issue with shutdown if connection was resumed just 6 Fix issue with shutdown if connection was resumed just
3 before shutdown. -FC 7 before shutdown. -FC
diff --git a/configure.ac b/configure.ac
index 87113fd9..3f2a920b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -544,9 +544,6 @@ have_inet6=no
544]) 544])
545AC_MSG_RESULT($have_inet6) 545AC_MSG_RESULT($have_inet6)
546 546
547# TCP_CORK and TCP_NOPUSH
548AC_CHECK_DECLS([TCP_CORK, TCP_NOPUSH], [], [], [[#include <netinet/tcp.h>]])
549
550HIDDEN_VISIBILITY_CFLAGS="" 547HIDDEN_VISIBILITY_CFLAGS=""
551case "$host" in 548case "$host" in
552 *-*-mingw*) 549 *-*-mingw*)
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 42bcb191..371a60c6 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -130,7 +130,7 @@ typedef intptr_t ssize_t;
130 * Current version of the library. 130 * Current version of the library.
131 * 0x01093001 = 1.9.30-1. 131 * 0x01093001 = 1.9.30-1.
132 */ 132 */
133#define MHD_VERSION 0x00094602 133#define MHD_VERSION 0x00094603
134 134
135/** 135/**
136 * MHD-internal return code for "YES". 136 * MHD-internal return code for "YES".
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 3878f13a..9a65cfa3 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2422,14 +2422,29 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2422 } 2422 }
2423 connection->state = MHD_CONNECTION_HEADERS_SENDING; 2423 connection->state = MHD_CONNECTION_HEADERS_SENDING;
2424 2424
2425#if HAVE_DECL_TCP_CORK 2425 /* starting send, prefer fill full buffer before sending */
2426 /* starting header send, set TCP cork */ 2426#if defined(TCP_CORK)
2427 { 2427 { /* Send only full packets */
2428 const _MHD_SOCKOPT_BOOL_TYPE val = 1; 2428 const _MHD_SOCKOPT_BOOL_TYPE val = 1;
2429 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, &val, 2429 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, &val,
2430 sizeof (val)); 2430 sizeof (val));
2431 } 2431 }
2432#endif 2432#elif defined(TCP_NODELAY) || defined(TCP_NOPUSH)
2433#if defined(TCP_NOPUSH)
2434 { /* Buffer data before sending */
2435 const _MHD_SOCKOPT_BOOL_TYPE on_val = 1;
2436 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_NOPUSH, (const void*)&on_val,
2437 sizeof (on_val));
2438 }
2439#endif /* TCP_NOPUSH */
2440#if defined(TCP_NODELAY)
2441 { /* Enable Nagle's algorithm, even if it was disabled somehow */
2442 const _MHD_SOCKOPT_BOOL_TYPE off_val = 0;
2443 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_NODELAY, (const void*)&off_val,
2444 sizeof (off_val));
2445 }
2446#endif /* TCP_NODELAY */
2447#endif /* TCP_NODELAY || TCP_NOPUSH */
2433 break; 2448 break;
2434 case MHD_CONNECTION_HEADERS_SENDING: 2449 case MHD_CONNECTION_HEADERS_SENDING:
2435 /* no default action */ 2450 /* no default action */
@@ -2506,14 +2521,35 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2506 /* no default action */ 2521 /* no default action */
2507 break; 2522 break;
2508 case MHD_CONNECTION_FOOTERS_SENT: 2523 case MHD_CONNECTION_FOOTERS_SENT:
2509#if HAVE_DECL_TCP_CORK 2524 /* done sending, send last partial packet immediately if possible */
2510 /* done sending, uncork */ 2525#if defined(TCP_CORK)
2511 { 2526 { /* Flush buffered data, allow partial packets */
2512 const _MHD_SOCKOPT_BOOL_TYPE val = 0; 2527 const _MHD_SOCKOPT_BOOL_TYPE val = 0;
2513 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, &val, 2528 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_CORK, &val,
2514 sizeof (val)); 2529 sizeof (val));
2515 } 2530 }
2516#endif 2531#elif defined(TCP_NODELAY) || defined(TCP_NOPUSH)
2532#if defined(TCP_NODELAY)
2533 { /* Disable Nagle's algorithm to push partial packet */
2534 const _MHD_SOCKOPT_BOOL_TYPE on_val = 1;
2535 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_NODELAY, (const void*)&on_val,
2536 sizeof (on_val));
2537 }
2538#endif /* TCP_NODELAY */
2539#if defined(TCP_NOPUSH)
2540 { /* Send data without extra buffering, may flush pending data on some platforms */
2541 const _MHD_SOCKOPT_BOOL_TYPE off_val = 0;
2542 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_NOPUSH, (const void*)&off_val,
2543 sizeof (off_val));
2544 }
2545#endif /* TCP_NOPUSH */
2546 { /* force flush data with zero send otherwise Darwin and some BSD systems
2547 will add 5 seconds delay */
2548 const int dummy = 0;
2549 (void)send (connection->socket_fd, (const void*)&dummy, 0, 0);
2550 }
2551#endif /* TCP_NODELAY || TCP_NOPUSH */
2552
2517 end = 2553 end =
2518 MHD_get_response_header (connection->response, 2554 MHD_get_response_header (connection->response,
2519 MHD_HTTP_HEADER_CONNECTION); 2555 MHD_HTTP_HEADER_CONNECTION);
@@ -2557,6 +2593,12 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2557 else 2593 else
2558 { 2594 {
2559 /* can try to keep-alive */ 2595 /* can try to keep-alive */
2596#if !defined(TCP_CORK) && defined(TCP_NODELAY)
2597 /* Enable Nagle's algorithm */
2598 const _MHD_SOCKOPT_BOOL_TYPE off_val = 0;
2599 setsockopt (connection->socket_fd, IPPROTO_TCP, TCP_NODELAY, (const void*)&off_val,
2600 sizeof (off_val));
2601#endif /* !TCP_CORK && TCP_NODELAY */
2560 connection->version = NULL; 2602 connection->version = NULL;
2561 connection->state = MHD_CONNECTION_INIT; 2603 connection->state = MHD_CONNECTION_INIT;
2562 /* Reset the read buffer to the starting size, 2604 /* Reset the read buffer to the starting size,
diff --git a/w32/VS2013/MHD_config.h b/w32/VS2013/MHD_config.h
index 645389b2..6a305a50 100644
--- a/w32/VS2013/MHD_config.h
+++ b/w32/VS2013/MHD_config.h
@@ -62,14 +62,6 @@
62 don't. */ 62 don't. */
63#define HAVE_DECL_SOCK_NONBLOCK 0 63#define HAVE_DECL_SOCK_NONBLOCK 0
64 64
65/* Define to 1 if you have the declaration of `TCP_CORK', and to 0 if you
66 don't. */
67#define HAVE_DECL_TCP_CORK 0
68
69/* Define to 1 if you have the declaration of `TCP_NOPUSH', and to 0 if you
70 don't. */
71#define HAVE_DECL_TCP_NOPUSH 0
72
73/* Define to 1 if you have the `_lseeki64' function. */ 65/* Define to 1 if you have the `_lseeki64' function. */
74#define HAVE___LSEEKI64 1 66#define HAVE___LSEEKI64 1
75 67