aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac12
-rw-r--r--src/daemon/daemon.c6
-rw-r--r--src/include/microhttpd.h63
-rw-r--r--src/testcurl/daemontest_get.c2
5 files changed, 86 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ecf7219..d95b3690 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Tue Jan 24 16:07:53 CET 2012
2 Added configure check for sin_len in 'struct sockaddr' and adding
3 code to initialize this field if it exists now. -CG
4
1Mon Jan 23 14:02:26 CET 2012 5Mon Jan 23 14:02:26 CET 2012
2 Fixed double-free if specified cipher was not valid (during 6 Fixed double-free if specified cipher was not valid (during
3 MHD_daemon_start). Releasing 0.9.18. -CG 7 MHD_daemon_start). Releasing 0.9.18. -CG
diff --git a/configure.ac b/configure.ac
index e273a458..8e3ee5dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,18 @@ AM_PROG_CC_C_O
64AC_LIBTOOL_WIN32_DLL 64AC_LIBTOOL_WIN32_DLL
65AC_PROG_LIBTOOL 65AC_PROG_LIBTOOL
66AC_C_BIGENDIAN 66AC_C_BIGENDIAN
67
68
69AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
70 [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
71 ],
72 [],
73 [
74 #include <sys/types.h>
75 #include <sys/socket.h>
76 #include <netinet/in.h>
77 ])
78
67AC_CHECK_PROG(HAVE_CURL_BINARY,[curl],true,false) 79AC_CHECK_PROG(HAVE_CURL_BINARY,[curl],true,false)
68AM_CONDITIONAL(HAVE_CURL_BINARY,$HAVE_CURL_BINARY) 80AM_CONDITIONAL(HAVE_CURL_BINARY,$HAVE_CURL_BINARY)
69 81
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index b844ce38..61d00fb7 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -2187,6 +2187,9 @@ MHD_start_daemon_va (unsigned int options,
2187 memset (&servaddr6, 0, sizeof (struct sockaddr_in6)); 2187 memset (&servaddr6, 0, sizeof (struct sockaddr_in6));
2188 servaddr6.sin6_family = AF_INET6; 2188 servaddr6.sin6_family = AF_INET6;
2189 servaddr6.sin6_port = htons (port); 2189 servaddr6.sin6_port = htons (port);
2190#if HAVE_SOCKADDR_IN_SIN_LEN
2191 servaddr6.sin6_len = sizeof (struct sockaddr_in6);
2192#endif
2190 servaddr = (struct sockaddr *) &servaddr6; 2193 servaddr = (struct sockaddr *) &servaddr6;
2191 } 2194 }
2192 else 2195 else
@@ -2195,6 +2198,9 @@ MHD_start_daemon_va (unsigned int options,
2195 memset (&servaddr4, 0, sizeof (struct sockaddr_in)); 2198 memset (&servaddr4, 0, sizeof (struct sockaddr_in));
2196 servaddr4.sin_family = AF_INET; 2199 servaddr4.sin_family = AF_INET;
2197 servaddr4.sin_port = htons (port); 2200 servaddr4.sin_port = htons (port);
2201#if HAVE_SOCKADDR_IN_SIN_LEN
2202 servaddr4.sin_len = sizeof (struct sockaddr_in);
2203#endif
2198 servaddr = (struct sockaddr *) &servaddr4; 2204 servaddr = (struct sockaddr *) &servaddr4;
2199 } 2205 }
2200 } 2206 }
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 14c63fa3..1ee99e99 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1378,6 +1378,69 @@ MHD_create_response_from_fd_at_offset (size_t size,
1378 1378
1379 1379
1380/** 1380/**
1381 * Function called after a protocol upgrade response was sent
1382 * successfully and the socket should now be controlled by some
1383 * protocol other than HTTP. Note that from this point on, MHD will
1384 * consider this connection to be "complete", so it will no longer be
1385 * counted as an active connection for the
1386 * MHD_OPTION_PER_IP_CONNECTION_LIMIT or the
1387 * MHD_OPTION_CONNECTION_LIMIT. After this function returns, the
1388 * MHD_RequestCompletedCallback will be called and all resources of
1389 * the connection (except for the socket itself) will be released.
1390 *
1391 * @param cls closure
1392 * @param connection original HTTP connection handle,
1393 * giving the function a last chance
1394 * to inspect the original HTTP request
1395 * @param con_cls value as set by the last call to the
1396 * MHD_AccessHandlerCallback; will afterwards
1397 * be also given to the MHD_RequestCompletedCallback
1398 * @param upgrade_socket TCP socket that was upgraded from HTTP
1399 * to some other protocol. This function must
1400 * take over the communication and is ultimately
1401 * responsible for closing the socket.
1402 */
1403typedef void (*MHD_UpgradeHandler)(void *cls,
1404 struct MHD_Connection *connection,
1405 void **con_cls,
1406 int upgrade_socket);
1407
1408
1409/**
1410 * Create a response object that can be used for 101 UPGRADE
1411 * responses, for example to implement websockets. After sending the
1412 * response, control over the socket is given to the callback (which
1413 * can then, for example, start some bi-directional communication).
1414 * If the response is queued for multiple connections, the callback
1415 * will be called with a socket for each connection. The callback
1416 * will ONLY be called if the response header was successfully passed
1417 * to the OS; if there are communication errors before, the usual MHD
1418 * connection error handling code will be performed.
1419 *
1420 * Setting the correct HTTP code (i.e. MHD_HTTP_SWITCHING_PROTOCOLS)
1421 * and setting correct HTTP headers for the upgrade must be done
1422 * manually (this way, it is possible to implement most existing
1423 * WebSocket version using this API; in fact, this API might be useful
1424 * for any protocol switch, not just web sockets). Note that
1425 * draft-ietf-hybi-thewebsocketprotocol-00 cannot be implemented this
1426 * way as the header "HTTP/1.1 101 WebSocket Protocol Handshake"
1427 * cannot be generated; instead, MHD will always produce "HTTP/1.1 101
1428 * Switching Protocols" (if the response 101 is used).
1429 *
1430 * As usual, the response object can be extended with header
1431 * information and then be used any number of times (as long as the
1432 * header information is not connection-specific).
1433 *
1434 * @param upgrade_handler function to call with the 'upgraded' socket
1435 * @param upgrade_handler_cls closure for 'upgrade_handler'
1436 * @return NULL on error (i.e. invalid arguments, out of memory)
1437 */
1438struct MHD_Response *
1439MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
1440 void *upgrade_handler_cls);
1441
1442
1443/**
1381 * Destroy a response object and associated resources. Note that 1444 * Destroy a response object and associated resources. Note that
1382 * libmicrohttpd may keep some of the resources around if the response 1445 * libmicrohttpd may keep some of the resources around if the response
1383 * is still in the queue for some clients, so the memory may not 1446 * is still in the queue for some clients, so the memory may not
diff --git a/src/testcurl/daemontest_get.c b/src/testcurl/daemontest_get.c
index 0cb78a68..ddb3f2e0 100644
--- a/src/testcurl/daemontest_get.c
+++ b/src/testcurl/daemontest_get.c
@@ -257,7 +257,7 @@ testExternalGet ()
257 fd_set ws; 257 fd_set ws;
258 fd_set es; 258 fd_set es;
259 int max; 259 int max;
260 int running; 260 int running;
261 struct CURLMsg *msg; 261 struct CURLMsg *msg;
262 time_t start; 262 time_t start;
263 struct timeval tv; 263 struct timeval tv;