mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
mantis 1263
This commit is contained in:
@@ -6,24 +6,25 @@ reasonably complete. #XXXX refers to the respective Mantis bug report
|
||||
(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:
|
||||
========
|
||||
|
||||
@@ -33,6 +33,7 @@ check_PROGRAMS = \
|
||||
daemontest_get \
|
||||
daemontest_post \
|
||||
daemontest_put \
|
||||
daemontest_get11 \
|
||||
daemontest_post11 \
|
||||
daemontest_put11
|
||||
|
||||
@@ -61,6 +62,12 @@ daemontest_put_LDADD = \
|
||||
$(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 = \
|
||||
|
||||
+31
-1
@@ -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 @@ MHD_connection_get_fdset(struct MHD_Connection * connection,
|
||||
}
|
||||
}
|
||||
}
|
||||
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 @@ MHD_connection_handle_write(struct MHD_Connection * connection) {
|
||||
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 @@ MHD_connection_handle_write(struct MHD_Connection * connection) {
|
||||
(connection->headersReceived == 0) )
|
||||
abort(); /* internal error */
|
||||
MHD_destroy_response(response);
|
||||
connection->continuePos = 0;
|
||||
connection->responseCode = 0;
|
||||
connection->response = NULL;
|
||||
connection->headersReceived = 0;
|
||||
|
||||
@@ -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 @@ static int testInternalGet() {
|
||||
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 @@ static int testMultithreadedGet() {
|
||||
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 @@ static int testExternalGet() {
|
||||
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 @@ int main(int argc,
|
||||
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();
|
||||
|
||||
@@ -271,6 +271,12 @@ struct MHD_Connection {
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user