[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27948 - libmicrohttpd/src/microhttpd
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27948 - libmicrohttpd/src/microhttpd |
Date: |
Fri, 12 Jul 2013 10:53:09 +0200 |
Author: grothoff
Date: 2013-07-12 10:53:09 +0200 (Fri, 12 Jul 2013)
New Revision: 27948
Modified:
libmicrohttpd/src/microhttpd/connection.c
Log:
-update readiness state immediately after response is queued, to avoid going
through another 'idle' event loop
Modified: libmicrohttpd/src/microhttpd/connection.c
===================================================================
--- libmicrohttpd/src/microhttpd/connection.c 2013-07-12 08:51:22 UTC (rev
27947)
+++ libmicrohttpd/src/microhttpd/connection.c 2013-07-12 08:53:09 UTC (rev
27948)
@@ -228,49 +228,6 @@
/**
- * Queue a response to be transmitted to the client (as soon as
- * possible but after MHD_AccessHandlerCallback returns).
- *
- * @param connection the connection identifying the client
- * @param status_code HTTP status code (i.e. 200 for OK)
- * @param response response to transmit
- * @return MHD_NO on error (i.e. reply already sent),
- * MHD_YES on success or if message has been queued
- */
-int
-MHD_queue_response (struct MHD_Connection *connection,
- unsigned int status_code, struct MHD_Response *response)
-{
- if ( (NULL == connection) ||
- (NULL == response) ||
- (NULL != connection->response) ||
- ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) &&
- (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) )
- return MHD_NO;
- MHD_increment_response_rc (response);
- connection->response = response;
- connection->responseCode = status_code;
- if ( (NULL != connection->method) &&
- (0 == strcasecmp (connection->method, MHD_HTTP_METHOD_HEAD)) )
- {
- /* if this is a "HEAD" request, pretend that we
- have already sent the full message body */
- connection->response_write_position = response->total_size;
- }
- if (MHD_CONNECTION_HEADERS_PROCESSED == connection->state)
- {
- /* response was queued "early",
- refuse to read body / footers or further
- requests! */
- (void) SHUTDOWN (connection->socket_fd, SHUT_RD);
- connection->read_closed = MHD_YES;
- connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
- }
- return MHD_YES;
-}
-
-
-/**
* Do we (still) need to send a 100 continue
* message for this connection?
*
@@ -2595,4 +2552,48 @@
}
+/**
+ * Queue a response to be transmitted to the client (as soon as
+ * possible but after MHD_AccessHandlerCallback returns).
+ *
+ * @param connection the connection identifying the client
+ * @param status_code HTTP status code (i.e. 200 for OK)
+ * @param response response to transmit
+ * @return MHD_NO on error (i.e. reply already sent),
+ * MHD_YES on success or if message has been queued
+ */
+int
+MHD_queue_response (struct MHD_Connection *connection,
+ unsigned int status_code, struct MHD_Response *response)
+{
+ if ( (NULL == connection) ||
+ (NULL == response) ||
+ (NULL != connection->response) ||
+ ( (MHD_CONNECTION_HEADERS_PROCESSED != connection->state) &&
+ (MHD_CONNECTION_FOOTERS_RECEIVED != connection->state) ) )
+ return MHD_NO;
+ MHD_increment_response_rc (response);
+ connection->response = response;
+ connection->responseCode = status_code;
+ if ( (NULL != connection->method) &&
+ (0 == strcasecmp (connection->method, MHD_HTTP_METHOD_HEAD)) )
+ {
+ /* if this is a "HEAD" request, pretend that we
+ have already sent the full message body */
+ connection->response_write_position = response->total_size;
+ }
+ if (MHD_CONNECTION_HEADERS_PROCESSED == connection->state)
+ {
+ /* response was queued "early",
+ refuse to read body / footers or further
+ requests! */
+ (void) SHUTDOWN (connection->socket_fd, SHUT_RD);
+ connection->read_closed = MHD_YES;
+ connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
+ }
+ MHD_connection_update_event_loop_info (connection);
+ return MHD_YES;
+}
+
+
/* end of connection.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27948 - libmicrohttpd/src/microhttpd,
gnunet <=