[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13266 - in libmicrohttpd: . src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13266 - in libmicrohttpd: . src/daemon |
Date: |
Tue, 12 Oct 2010 15:45:59 +0200 |
Author: grothoff
Date: 2010-10-12 15:45:59 +0200 (Tue, 12 Oct 2010)
New Revision: 13266
Modified:
libmicrohttpd/ChangeLog
libmicrohttpd/src/daemon/connection.c
libmicrohttpd/src/daemon/connection.h
libmicrohttpd/src/daemon/connection_https.c
libmicrohttpd/src/daemon/daemon.c
Log:
bugfix
Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog 2010-10-12 13:45:56 UTC (rev 13265)
+++ libmicrohttpd/ChangeLog 2010-10-12 13:45:59 UTC (rev 13266)
@@ -1,3 +1,10 @@
+Tue Oct 12 15:41:51 CEST 2010
+ Fixed issue with data received via SSL being delayed in the
+ GNUtls buffer if sender stopped transmitting (but did not close
+ the connection) and MHD buffer size was smaller than last fragment,
+ resulting in possibly significantly delayed processing of
+ incoming data. -CG
+
Wed Sep 22 09:48:59 CEST 2010
Changed port argument from 'unsigned short' to 'uint16_t'.
Removed dead code when compiling with messages enabled.
Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c 2010-10-12 13:45:56 UTC (rev
13265)
+++ libmicrohttpd/src/daemon/connection.c 2010-10-12 13:45:59 UTC (rev
13266)
@@ -767,7 +767,7 @@
* connection is not waiting for any read or write events
*/
int
-MHD_connection_get_pollfd(struct MHD_Connection *connection, struct MHD_Pollfd
*p)
+MHD_connection_get_pollfd (struct MHD_Connection *connection, struct
MHD_Pollfd *p)
{
int fd;
@@ -2264,7 +2264,7 @@
}
void
-MHD_set_http_calbacks (struct MHD_Connection *connection)
+MHD_set_http_callbacks_ (struct MHD_Connection *connection)
{
connection->read_handler = &MHD_connection_handle_read;
connection->write_handler = &MHD_connection_handle_write;
Modified: libmicrohttpd/src/daemon/connection.h
===================================================================
--- libmicrohttpd/src/daemon/connection.h 2010-10-12 13:45:56 UTC (rev
13265)
+++ libmicrohttpd/src/daemon/connection.h 2010-10-12 13:45:59 UTC (rev
13266)
@@ -48,7 +48,7 @@
int MHD_connection_get_pollfd(struct MHD_Connection *connection,
struct MHD_Pollfd *p);
-void MHD_set_http_calbacks (struct MHD_Connection *connection);
+void MHD_set_http_callbacks_ (struct MHD_Connection *connection);
int MHD_connection_handle_read (struct MHD_Connection *connection);
Modified: libmicrohttpd/src/daemon/connection_https.c
===================================================================
--- libmicrohttpd/src/daemon/connection_https.c 2010-10-12 13:45:56 UTC (rev
13265)
+++ libmicrohttpd/src/daemon/connection_https.c 2010-10-12 13:45:59 UTC (rev
13266)
@@ -51,51 +51,7 @@
MHD_connection_close (connection, termination_code);
}
-/**
- * This function was created to handle per-connection processing that
- * has to happen even if the socket cannot be read or written to. All
- * implementations (multithreaded, external select, internal select)
- * call this function.
- *
- * @param connection being handled
- * @return MHD_YES if we should continue to process the
- * connection (not dead yet), MHD_NO if it died
- */
-static int
-MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
-{
- unsigned int timeout;
-#if DEBUG_STATES
- MHD_DLOG (connection->daemon, "%s: state: %s\n",
- __FUNCTION__, MHD_state_to_string (connection->state));
-#endif
- timeout = connection->daemon->connection_timeout;
- if ((connection->socket_fd != -1) && (timeout != 0)
- && (time (NULL) - timeout > connection->last_activity))
- {
- MHD_tls_connection_close (connection,
- MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
- return MHD_NO;
- }
- switch (connection->state)
- {
- /* on newly created connections we might reach here before any reply has
been received */
- case MHD_TLS_CONNECTION_INIT:
- return MHD_YES;
- /* close connection if necessary */
- case MHD_CONNECTION_CLOSED:
- if (connection->socket_fd != -1)
- MHD_tls_connection_close (connection,
- MHD_REQUEST_TERMINATED_COMPLETED_OK);
- return MHD_NO;
- default:
- return MHD_connection_handle_idle (connection);
- }
- return MHD_YES;
-}
-
-
/**
* This function handles a particular SSL/TLS connection when
* it has been determined that there is data to be read off a
@@ -193,7 +149,56 @@
return MHD_connection_handle_write (connection);
}
+
/**
+ * This function was created to handle per-connection processing that
+ * has to happen even if the socket cannot be read or written to. All
+ * implementations (multithreaded, external select, internal select)
+ * call this function.
+ *
+ * @param connection being handled
+ * @return MHD_YES if we should continue to process the
+ * connection (not dead yet), MHD_NO if it died
+ */
+static int
+MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
+{
+ unsigned int timeout;
+
+#if DEBUG_STATES
+ MHD_DLOG (connection->daemon, "%s: state: %s\n",
+ __FUNCTION__, MHD_state_to_string (connection->state));
+#endif
+ timeout = connection->daemon->connection_timeout;
+ if ((connection->socket_fd != -1) && (timeout != 0)
+ && (time (NULL) - timeout > connection->last_activity))
+ {
+ MHD_tls_connection_close (connection,
+ MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
+ return MHD_NO;
+ }
+ switch (connection->state)
+ {
+ /* on newly created connections we might reach here before any reply has
been received */
+ case MHD_TLS_CONNECTION_INIT:
+ return MHD_YES;
+ /* close connection if necessary */
+ case MHD_CONNECTION_CLOSED:
+ if (connection->socket_fd != -1)
+ MHD_tls_connection_close (connection,
+ MHD_REQUEST_TERMINATED_COMPLETED_OK);
+ return MHD_NO;
+ default:
+ if ( (0 != gnutls_record_check_pending (connection->tls_session)) &&
+ (MHD_YES != MHD_tls_connection_handle_read (connection)) )
+ return MHD_NO;
+ return MHD_connection_handle_idle (connection);
+ }
+ return MHD_YES;
+}
+
+
+/**
* Set connection callback function to be used through out
* the processing of this secure connection.
*/
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2010-10-12 13:45:56 UTC (rev 13265)
+++ libmicrohttpd/src/daemon/daemon.c 2010-10-12 13:45:59 UTC (rev 13266)
@@ -883,7 +883,7 @@
connection->last_activity = time (NULL);
/* set default connection handlers */
- MHD_set_http_calbacks (connection);
+ MHD_set_http_callbacks_ (connection);
connection->recv_cls = &recv_param_adapter;
connection->send_cls = &send_param_adapter;
#if HTTPS_SUPPORT
@@ -1062,6 +1062,11 @@
{
if (earliest_deadline > pos->last_activity + dto)
earliest_deadline = pos->last_activity + dto;
+#if HTTPS_SUPPORT
+ if ( (0 != (daemon->options & MHD_USE_SSL)) &&
+ (0 != gnutls_record_check_pending (pos->tls_session)) )
+ earliest_deadline = now;
+#endif
pos = pos->next;
}
if (earliest_deadline < now)
@@ -1071,6 +1076,7 @@
return MHD_YES;
}
+
/**
* Main select call.
*
@@ -1220,6 +1226,7 @@
#endif
}
+
/**
* Run webserver operations (without blocking unless
* in client callbacks). This method should be called
@@ -1242,6 +1249,7 @@
return MHD_YES;
}
+
/**
* Thread that runs the select loop until the daemon
* is explicitly shut down.
@@ -1264,6 +1272,7 @@
return NULL;
}
+
/**
* Start a webserver on the given port.
*
@@ -1395,7 +1404,7 @@
break;
#if HTTPS_SUPPORT
case MHD_OPTION_HTTPS_MEM_KEY:
- if (daemon->options & MHD_USE_SSL)
+ if (0 != (daemon->options & MHD_USE_SSL))
daemon->https_mem_key = va_arg (ap, const char *);
#if HAVE_MESSAGES
else
@@ -1405,7 +1414,7 @@
#endif
break;
case MHD_OPTION_HTTPS_MEM_CERT:
- if (daemon->options & MHD_USE_SSL)
+ if (0 != (daemon->options & MHD_USE_SSL))
daemon->https_mem_cert = va_arg (ap, const char *);
#if HAVE_MESSAGES
else
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13266 - in libmicrohttpd: . src/daemon,
gnunet <=