[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5424 - in libmicrohttpd: . src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5424 - in libmicrohttpd: . src/daemon |
Date: |
Wed, 8 Aug 2007 02:55:28 -0600 (MDT) |
Author: grothoff
Date: 2007-08-08 02:55:18 -0600 (Wed, 08 Aug 2007)
New Revision: 5424
Modified:
libmicrohttpd/README
libmicrohttpd/src/daemon/Makefile.am
libmicrohttpd/src/daemon/connection.c
libmicrohttpd/src/daemon/daemontest_get.c
libmicrohttpd/src/daemon/internal.h
Log:
mantis 1263
Modified: libmicrohttpd/README
===================================================================
--- libmicrohttpd/README 2007-08-08 08:37:00 UTC (rev 5423)
+++ libmicrohttpd/README 2007-08-08 08:55:18 UTC (rev 5424)
@@ -6,24 +6,25 @@
(or feature request). ARCH indicates that implementing this feature
may require non-trivial ARCHitectural changes in the code. API
indicates that implementing the feature will require API changes.
-TRIV indicates that implementing this feature should be TRIVial.
+TRIV indicates that implementing this feature should be TRIVial. TEST
+indicates that a testcase should be written before implementing the
+feature.
For http/1.1-compliance:
========================
connection.c:
-- support responding immediately with "100 CONTINUE" (http 1.1) (#1263, ARCH)
- send proper error code back if headers are too long
- (currently, we just close the connection) (#1222, ARCH)
-- support chunked requests from clients (#1260, ARCH)
+ (currently, we just close the connection) (#1222, ARCH, TEST)
+- support chunked requests from clients (#1260, TEST, TEST)
- send proper error code back if client forgot the "Host" header (#1264, TRIV)
- automatically add MHD_HTTP_HEADER_DATE if client "forgot" to add one (#1261,
TRIV)
- automatically drop body from responses to "HEAD" requests (#1262, TRIV)
For POST:
=========
-- find better way to handle POST data that does not fit into memory (#1221,
API)
-- add support to decode multipart/form-data (#1221)
+- find better way to handle POST data that does not fit into memory (#1221,
API, TEST)
+- add support to decode multipart/form-data (#1221, TEST)
For SSL:
========
Modified: libmicrohttpd/src/daemon/Makefile.am
===================================================================
--- libmicrohttpd/src/daemon/Makefile.am 2007-08-08 08:37:00 UTC (rev
5423)
+++ libmicrohttpd/src/daemon/Makefile.am 2007-08-08 08:55:18 UTC (rev
5424)
@@ -33,6 +33,7 @@
daemontest_get \
daemontest_post \
daemontest_put \
+ daemontest_get11 \
daemontest_post11 \
daemontest_put11
@@ -61,6 +62,12 @@
$(top_builddir)/src/daemon/libmicrohttpd.la \
@LIBCURL@
+daemontest_get11_SOURCES = \
+ daemontest_get.c
+daemontest_get11_LDADD = \
+ $(top_builddir)/src/daemon/libmicrohttpd.la \
+ @LIBCURL@
+
daemontest_post11_SOURCES = \
daemontest_post.c
daemontest_post11_LDADD = \
Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c 2007-08-08 08:37:00 UTC (rev
5423)
+++ libmicrohttpd/src/daemon/connection.c 2007-08-08 08:55:18 UTC (rev
5424)
@@ -35,6 +35,10 @@
*/
#define MHD_BUF_INC_SIZE 2048
+/**
+ * Message to transmit when http 1.1 request is received
+ */
+#define HTTP_100_CONTINUE "HTTP/1.1 100 Continue\r\n\r\n"
/**
* Get all of the headers from the request.
@@ -170,7 +174,11 @@
}
}
}
- if (connection->response != NULL) {
+ if ( (connection->response != NULL) ||
+ ( (connection->version != NULL) &&
+ (0 == strcasecmp(connection->version,
+ MHD_HTTP_VERSION_1_1)) &&
+ (connection->continuePos < strlen(HTTP_100_CONTINUE)) ) ) {
FD_SET(fd, write_fd_set);
if (fd > *max_fd)
*max_fd = fd;
@@ -921,6 +929,27 @@
struct MHD_Response * response;
int ret;
+ if ( (connection->version != NULL) &&
+ (0 == strcasecmp(connection->version,
+ MHD_HTTP_VERSION_1_1)) &&
+ (connection->continuePos < strlen(HTTP_100_CONTINUE)) ) {
+ ret = SEND(connection->socket_fd,
+ &HTTP_100_CONTINUE[connection->continuePos],
+ strlen(HTTP_100_CONTINUE) - connection->continuePos,
+ 0);
+ if (ret < 0) {
+ if (errno == EINTR)
+ return MHD_YES;
+ MHD_DLOG(connection->daemon,
+ "Failed to send data: %s\n",
+ STRERROR(errno));
+ CLOSE(connection->socket_fd);
+ connection->socket_fd = -1;
+ return MHD_YES;
+ }
+ connection->continuePos += ret;
+ return MHD_YES;
+ }
response = connection->response;
if(response == NULL) {
MHD_DLOG(connection->daemon,
@@ -1027,6 +1056,7 @@
(connection->headersReceived == 0) )
abort(); /* internal error */
MHD_destroy_response(response);
+ connection->continuePos = 0;
connection->responseCode = 0;
connection->response = NULL;
connection->headersReceived = 0;
Modified: libmicrohttpd/src/daemon/daemontest_get.c
===================================================================
--- libmicrohttpd/src/daemon/daemontest_get.c 2007-08-08 08:37:00 UTC (rev
5423)
+++ libmicrohttpd/src/daemon/daemontest_get.c 2007-08-08 08:55:18 UTC (rev
5424)
@@ -33,6 +33,8 @@
#include <string.h>
#include <time.h>
+static int oneone;
+
static int apc_all(void * cls,
const struct sockaddr * addr,
socklen_t addrlen) {
@@ -122,7 +124,15 @@
curl_easy_setopt(c,
CURLOPT_CONNECTTIMEOUT,
2L);
- // NOTE: use of CONNECTTIMEOUT without also
+ if (oneone)
+ curl_easy_setopt(c,
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_1);
+ else
+ curl_easy_setopt(c,
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_0);
+ // NOTE: use of CONNECTTIMEOUT without also
// setting NOSIGNAL results in really weird
// crashes on my system!
curl_easy_setopt(c,
@@ -184,7 +194,15 @@
curl_easy_setopt(c,
CURLOPT_TIMEOUT,
2L);
- curl_easy_setopt(c,
+ if (oneone)
+ curl_easy_setopt(c,
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_1);
+ else
+ curl_easy_setopt(c,
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt(c,
CURLOPT_CONNECTTIMEOUT,
2L);
// NOTE: use of CONNECTTIMEOUT without also
@@ -256,7 +274,15 @@
curl_easy_setopt(c,
CURLOPT_FAILONERROR,
1);
- curl_easy_setopt(c,
+ if (oneone)
+ curl_easy_setopt(c,
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_1);
+ else
+ curl_easy_setopt(c,
+ CURLOPT_HTTP_VERSION,
+ CURL_HTTP_VERSION_1_0);
+ curl_easy_setopt(c,
CURLOPT_TIMEOUT,
5L);
curl_easy_setopt(c,
@@ -364,6 +390,7 @@
char * const * argv) {
unsigned int errorCount = 0;
+ oneone = NULL != strstr(argv[0], "11");
if (0 != curl_global_init(CURL_GLOBAL_WIN32))
return 2;
errorCount += testInternalGet();
Modified: libmicrohttpd/src/daemon/internal.h
===================================================================
--- libmicrohttpd/src/daemon/internal.h 2007-08-08 08:37:00 UTC (rev 5423)
+++ libmicrohttpd/src/daemon/internal.h 2007-08-08 08:55:18 UTC (rev 5424)
@@ -272,6 +272,12 @@
size_t uploadSize;
/**
+ * Position in the 100 CONTINUE message that
+ * we need to send when receiving http 1.1 requests.
+ */
+ size_t continuePos;
+
+ /**
* Length of the foreign address.
*/
socklen_t addr_len;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5424 - in libmicrohttpd: . src/daemon,
gnunet <=