[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r19349 - in libmicrohttpd: . src/daemon src/include src/tes
From: |
gnunet |
Subject: |
[GNUnet-SVN] r19349 - in libmicrohttpd: . src/daemon src/include src/testcurl |
Date: |
Tue, 24 Jan 2012 16:08:41 +0100 |
Author: grothoff
Date: 2012-01-24 16:08:41 +0100 (Tue, 24 Jan 2012)
New Revision: 19349
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/configure.ac
libmicrohttpd/src/daemon/daemon.c
libmicrohttpd/src/include/microhttpd.h
libmicrohttpd/src/testcurl/daemontest_get.c
Log:
add check for sin_len
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2012-01-24 15:01:16 UTC (rev 19348)
+++ libmicrohttpd/ChangeLog 2012-01-24 15:08:41 UTC (rev 19349)
@@ -1,3 +1,7 @@
+Tue Jan 24 16:07:53 CET 2012
+ Added configure check for sin_len in 'struct sockaddr' and adding
+ code to initialize this field if it exists now. -CG
+
Mon Jan 23 14:02:26 CET 2012
Fixed double-free if specified cipher was not valid (during
MHD_daemon_start). Releasing 0.9.18. -CG
Modified: libmicrohttpd/configure.ac
===================================================================
--- libmicrohttpd/configure.ac 2012-01-24 15:01:16 UTC (rev 19348)
+++ libmicrohttpd/configure.ac 2012-01-24 15:08:41 UTC (rev 19349)
@@ -64,6 +64,18 @@
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_C_BIGENDIAN
+
+
+AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
+ [ AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [Do we have sockaddr_in.sin_len?])
+ ],
+ [],
+ [
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ ])
+
AC_CHECK_PROG(HAVE_CURL_BINARY,[curl],true,false)
AM_CONDITIONAL(HAVE_CURL_BINARY,$HAVE_CURL_BINARY)
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2012-01-24 15:01:16 UTC (rev 19348)
+++ libmicrohttpd/src/daemon/daemon.c 2012-01-24 15:08:41 UTC (rev 19349)
@@ -2187,6 +2187,9 @@
memset (&servaddr6, 0, sizeof (struct sockaddr_in6));
servaddr6.sin6_family = AF_INET6;
servaddr6.sin6_port = htons (port);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ servaddr6.sin6_len = sizeof (struct sockaddr_in6);
+#endif
servaddr = (struct sockaddr *) &servaddr6;
}
else
@@ -2195,6 +2198,9 @@
memset (&servaddr4, 0, sizeof (struct sockaddr_in));
servaddr4.sin_family = AF_INET;
servaddr4.sin_port = htons (port);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ servaddr4.sin_len = sizeof (struct sockaddr_in);
+#endif
servaddr = (struct sockaddr *) &servaddr4;
}
}
Modified: libmicrohttpd/src/include/microhttpd.h
===================================================================
--- libmicrohttpd/src/include/microhttpd.h 2012-01-24 15:01:16 UTC (rev
19348)
+++ libmicrohttpd/src/include/microhttpd.h 2012-01-24 15:08:41 UTC (rev
19349)
@@ -1378,6 +1378,69 @@
/**
+ * Function called after a protocol upgrade response was sent
+ * successfully and the socket should now be controlled by some
+ * protocol other than HTTP. Note that from this point on, MHD will
+ * consider this connection to be "complete", so it will no longer be
+ * counted as an active connection for the
+ * MHD_OPTION_PER_IP_CONNECTION_LIMIT or the
+ * MHD_OPTION_CONNECTION_LIMIT. After this function returns, the
+ * MHD_RequestCompletedCallback will be called and all resources of
+ * the connection (except for the socket itself) will be released.
+ *
+ * @param cls closure
+ * @param connection original HTTP connection handle,
+ * giving the function a last chance
+ * to inspect the original HTTP request
+ * @param con_cls value as set by the last call to the
+ * MHD_AccessHandlerCallback; will afterwards
+ * be also given to the MHD_RequestCompletedCallback
+ * @param upgrade_socket TCP socket that was upgraded from HTTP
+ * to some other protocol. This function must
+ * take over the communication and is ultimately
+ * responsible for closing the socket.
+ */
+typedef void (*MHD_UpgradeHandler)(void *cls,
+ struct MHD_Connection *connection,
+ void **con_cls,
+ int upgrade_socket);
+
+
+/**
+ * Create a response object that can be used for 101 UPGRADE
+ * responses, for example to implement websockets. After sending the
+ * response, control over the socket is given to the callback (which
+ * can then, for example, start some bi-directional communication).
+ * If the response is queued for multiple connections, the callback
+ * will be called with a socket for each connection. The callback
+ * will ONLY be called if the response header was successfully passed
+ * to the OS; if there are communication errors before, the usual MHD
+ * connection error handling code will be performed.
+ *
+ * Setting the correct HTTP code (i.e. MHD_HTTP_SWITCHING_PROTOCOLS)
+ * and setting correct HTTP headers for the upgrade must be done
+ * manually (this way, it is possible to implement most existing
+ * WebSocket version using this API; in fact, this API might be useful
+ * for any protocol switch, not just web sockets). Note that
+ * draft-ietf-hybi-thewebsocketprotocol-00 cannot be implemented this
+ * way as the header "HTTP/1.1 101 WebSocket Protocol Handshake"
+ * cannot be generated; instead, MHD will always produce "HTTP/1.1 101
+ * Switching Protocols" (if the response 101 is used).
+ *
+ * As usual, the response object can be extended with header
+ * information and then be used any number of times (as long as the
+ * header information is not connection-specific).
+ *
+ * @param upgrade_handler function to call with the 'upgraded' socket
+ * @param upgrade_handler_cls closure for 'upgrade_handler'
+ * @return NULL on error (i.e. invalid arguments, out of memory)
+ */
+struct MHD_Response *
+MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
+ void *upgrade_handler_cls);
+
+
+/**
* Destroy a response object and associated resources. Note that
* libmicrohttpd may keep some of the resources around if the response
* is still in the queue for some clients, so the memory may not
Modified: libmicrohttpd/src/testcurl/daemontest_get.c
===================================================================
--- libmicrohttpd/src/testcurl/daemontest_get.c 2012-01-24 15:01:16 UTC (rev
19348)
+++ libmicrohttpd/src/testcurl/daemontest_get.c 2012-01-24 15:08:41 UTC (rev
19349)
@@ -257,7 +257,7 @@
fd_set ws;
fd_set es;
int max;
- int running;
+ int running;
struct CURLMsg *msg;
time_t start;
struct timeval tv;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r19349 - in libmicrohttpd: . src/daemon src/include src/testcurl,
gnunet <=