aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS6
-rw-r--r--ChangeLog5
-rw-r--r--configure.ac6
-rw-r--r--doc/libmicrohttpd.texi45
-rw-r--r--src/include/microhttpd.h16
-rw-r--r--src/microhttpd/.gitignore1
-rw-r--r--src/microhttpd/connection.c10
-rw-r--r--src/microhttpd/internal.h6
8 files changed, 80 insertions, 15 deletions
diff --git a/AUTHORS b/AUTHORS
index f927e0b0..e574a685 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -61,3 +61,9 @@ Silvio Clecio <silvioprog@gmail.com>
61Documentation contributions also came from: 61Documentation contributions also came from:
62Marco Maggi <marco.maggi-ipsu@poste.it> 62Marco Maggi <marco.maggi-ipsu@poste.it>
63Sebastian Gerhardt <sebgerhardt@gmx.net> 63Sebastian Gerhardt <sebgerhardt@gmx.net>
64
65Special thanks to:
66Florian Weimer <fweimer@redhat.com>
67Ramakrishnan Muthukrishnan <ram@leastauthority.com>
68Gervasa Markham <grev@mozilla.com>
69Liz Steininger <liz@leastauthority.com>
diff --git a/ChangeLog b/ChangeLog
index a8a87f84..655a703b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
1Tue May 2 18:37:53 CEST 2017
2 Update manual. -CG
3 Add MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE.
4 Releasing GNU libmicrohttpd 0.9.54. -CG
5
1Thu Apr 27 22:31:00 CEST 2017 6Thu Apr 27 22:31:00 CEST 2017
2 Replaced flags MHD_USE_PEDANTIC_CHECKS and MHD_USE_PERMISSIVE_CHECKS by 7 Replaced flags MHD_USE_PEDANTIC_CHECKS and MHD_USE_PERMISSIVE_CHECKS by
3 single option MHD_OPTION_STRICT_FOR_CLIENT. Flag MHD_USE_PEDANTIC_CHECKS 8 single option MHD_OPTION_STRICT_FOR_CLIENT. Flag MHD_USE_PEDANTIC_CHECKS
diff --git a/configure.ac b/configure.ac
index 31f18c30..afc3fed2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,14 +22,14 @@
22# 22#
23AC_PREREQ([2.64]) 23AC_PREREQ([2.64])
24LT_PREREQ([2.4.0]) 24LT_PREREQ([2.4.0])
25AC_INIT([GNU Libmicrohttpd],[0.9.53],[libmicrohttpd@gnu.org]) 25AC_INIT([GNU Libmicrohttpd],[0.9.54],[libmicrohttpd@gnu.org])
26AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) 26AM_INIT_AUTOMAKE([silent-rules] [subdir-objects])
27AC_CONFIG_HEADERS([MHD_config.h]) 27AC_CONFIG_HEADERS([MHD_config.h])
28AC_CONFIG_MACRO_DIR([m4]) 28AC_CONFIG_MACRO_DIR([m4])
29 29
30LIB_VERSION_CURRENT=53 30LIB_VERSION_CURRENT=54
31LIB_VERSION_REVISION=0 31LIB_VERSION_REVISION=0
32LIB_VERSION_AGE=41 32LIB_VERSION_AGE=42
33AC_SUBST(LIB_VERSION_CURRENT) 33AC_SUBST(LIB_VERSION_CURRENT)
34AC_SUBST(LIB_VERSION_REVISION) 34AC_SUBST(LIB_VERSION_REVISION)
35AC_SUBST(LIB_VERSION_AGE) 35AC_SUBST(LIB_VERSION_AGE)
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 7e95155b..bdbe3de7 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -496,6 +496,8 @@ that IPv4 addresses are returned by MHD in the IPv6-mapped format
496(the 'struct sockaddr_in6' format will be used for IPv4 and IPv6). 496(the 'struct sockaddr_in6' format will be used for IPv4 and IPv6).
497 497
498@item MHD_USE_PEDANTIC_CHECKS 498@item MHD_USE_PEDANTIC_CHECKS
499@cindex deprecated
500Deprecated (use @code{MHD_OPTION_STRICT_FOR_CLIENT}).
499Be pedantic about the protocol. 501Be pedantic about the protocol.
500Specifically, at the moment, this flag causes MHD to reject HTTP 502Specifically, at the moment, this flag causes MHD to reject HTTP
5011.1 connections without a @code{Host} header. This is required by the 5031.1 connections without a @code{Host} header. This is required by the
@@ -504,13 +506,6 @@ in what you accept'' norm. It is recommended to turn this @strong{ON}
504if you are testing clients against MHD, and @strong{OFF} in 506if you are testing clients against MHD, and @strong{OFF} in
505production. 507production.
506 508
507@item MHD_USE_PERMISSIVE_CHECKS
508Be permissive about the protocol, allowing slight deviations that are
509technically not allowed by the RFC. Specifically, at the moment, this
510flag causes MHD to allow spaces in header field names. This is
511disallowed by the standard.
512
513
514@item MHD_USE_POLL 509@item MHD_USE_POLL
515@cindex FD_SETSIZE 510@cindex FD_SETSIZE
516@cindex poll 511@cindex poll
@@ -735,6 +730,31 @@ should be followed by an @code{unsigned int}. The default is
735zero, which means no limit on the number of connections 730zero, which means no limit on the number of connections
736from the same IP address. 731from the same IP address.
737 732
733@item MHD_OPTION_LISTEN_BACKLOG_SIZE
734Set the size of the @code{listen()} back log queue of the TCP socket.
735Takes an @code{unsigned int} as the argument. Default is the
736platform-specific value of @code{SOMAXCONN}.
737
738@item MHD_OPTION_STRICT_FOR_CLIENT
739Specify how strict we should enforce the HTTP protocol.
740Takes an @code{int} as the argument. Default is zero.
741
742If set to 1, MHD will be strict about the protocol. Specifically, at
743the moment, this flag uses MHD to reject HTTP 1.1 connections without
744a "Host" header. This is required by the standard, but of course in
745violation of the "be as liberal as possible in what you accept" norm.
746It is recommended to set this to 1 if you are testing clients against
747MHD, and 0 in production.
748
749If set to -1 MHD will be permissive about the protocol, allowing
750slight deviations that are technically not allowed by the
751RFC. Specifically, at the moment, this flag causes MHD to allow spaces
752in header field names. This is disallowed by the standard.
753
754It is not recommended to set it to -1 on publicly available servers as
755it may potentially lower level of protection.
756
757
738@item MHD_OPTION_SOCK_ADDR 758@item MHD_OPTION_SOCK_ADDR
739@cindex bind, restricting bind 759@cindex bind, restricting bind
740Bind daemon to the supplied socket address. This option should be followed by a 760Bind daemon to the supplied socket address. This option should be followed by a
@@ -2823,7 +2843,7 @@ socket was first accepted. Note that this is NOT the same as the
2823 2843
2824Takes no extra arguments. 2844Takes no extra arguments.
2825 2845
2826@item MHD_CONNECTION_INFO_TIMEOUT 2846@item MHD_CONNECTION_INFO_CONNECTION_TIMEOUT
2827Returns pointer to an @code{unsigned int} that is the current timeout 2847Returns pointer to an @code{unsigned int} that is the current timeout
2828used for the connection (in seconds, 0 for no timeout). Note that 2848used for the connection (in seconds, 0 for no timeout). Note that
2829while suspended connections will not timeout, the timeout value 2849while suspended connections will not timeout, the timeout value
@@ -2831,6 +2851,15 @@ returned for suspended connections will be the timeout that the
2831connection will use after it is resumed, and thus might not be zero. 2851connection will use after it is resumed, and thus might not be zero.
2832 2852
2833Takes no extra arguments. 2853Takes no extra arguments.
2854
2855@item MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE
2856@cindex performance
2857Returns pointer to an @code{size_t} that represents the size of the
2858HTTP header received from the client. Only valid after the first callback
2859to the access handler.
2860
2861Takes no extra arguments.
2862
2834@end table 2863@end table
2835@end deftp 2864@end deftp
2836 2865
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 02bf38ab..ca0059fa 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -126,7 +126,7 @@ typedef intptr_t ssize_t;
126 * Current version of the library. 126 * Current version of the library.
127 * 0x01093001 = 1.9.30-1. 127 * 0x01093001 = 1.9.30-1.
128 */ 128 */
129#define MHD_VERSION 0x00095300 129#define MHD_VERSION 0x00095400
130 130
131/** 131/**
132 * MHD-internal return code for "YES". 132 * MHD-internal return code for "YES".
@@ -1677,6 +1677,11 @@ union MHD_ConnectionInfo
1677 MHD_socket connect_fd; 1677 MHD_socket connect_fd;
1678 1678
1679 /** 1679 /**
1680 * Size of the client's HTTP header.
1681 */
1682 size_t header_size;
1683
1684 /**
1680 * GNUtls session handle, of type "gnutls_session_t". 1685 * GNUtls session handle, of type "gnutls_session_t".
1681 */ 1686 */
1682 void * /* gnutls_session_t */ tls_session; 1687 void * /* gnutls_session_t */ tls_session;
@@ -1778,12 +1783,17 @@ enum MHD_ConnectionInfoType
1778 */ 1783 */
1779 MHD_CONNECTION_INFO_CONNECTION_SUSPENDED, 1784 MHD_CONNECTION_INFO_CONNECTION_SUSPENDED,
1780 1785
1781
1782 /** 1786 /**
1783 * Get connection timeout 1787 * Get connection timeout
1784 * @ingroup request 1788 * @ingroup request
1785 */ 1789 */
1786 MHD_CONNECTION_INFO_CONNECTION_TIMEOUT 1790 MHD_CONNECTION_INFO_CONNECTION_TIMEOUT,
1791
1792 /**
1793 * Return length of the client's HTTP request header.
1794 * @ingroup request
1795 */
1796 MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE
1787}; 1797};
1788 1798
1789 1799
diff --git a/src/microhttpd/.gitignore b/src/microhttpd/.gitignore
index 72fedae4..cf17abd7 100644
--- a/src/microhttpd/.gitignore
+++ b/src/microhttpd/.gitignore
@@ -42,3 +42,4 @@
42/gmon.out 42/gmon.out
43*.exe 43*.exe
44test_upgrade_tls 44test_upgrade_tls
45test_http_reasons
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 228af49b..4753d6eb 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1831,7 +1831,7 @@ call_connection_handler (struct MHD_Connection *connection)
1831 processed = 0; 1831 processed = 0;
1832 connection->client_aware = true; 1832 connection->client_aware = true;
1833 if (MHD_NO == 1833 if (MHD_NO ==
1834 connection->daemon->default_handler (connection->daemon-> default_handler_cls, 1834 connection->daemon->default_handler (connection->daemon->default_handler_cls,
1835 connection, 1835 connection,
1836 connection->url, 1836 connection->url,
1837 connection->method, 1837 connection->method,
@@ -2857,6 +2857,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2857 if (0 == line[0]) 2857 if (0 == line[0])
2858 { 2858 {
2859 connection->state = MHD_CONNECTION_HEADERS_RECEIVED; 2859 connection->state = MHD_CONNECTION_HEADERS_RECEIVED;
2860 connection->header_size = (size_t) (line - connection->read_buffer);
2860 continue; 2861 continue;
2861 } 2862 }
2862 if (MHD_NO == process_header_line (connection, 2863 if (MHD_NO == process_header_line (connection,
@@ -2892,6 +2893,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2892 if (0 == line[0]) 2893 if (0 == line[0])
2893 { 2894 {
2894 connection->state = MHD_CONNECTION_HEADERS_RECEIVED; 2895 connection->state = MHD_CONNECTION_HEADERS_RECEIVED;
2896 connection->header_size = (size_t) (line - connection->read_buffer);
2895 continue; 2897 continue;
2896 } 2898 }
2897 continue; 2899 continue;
@@ -3402,6 +3404,12 @@ MHD_get_connection_info (struct MHD_Connection *connection,
3402 case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT: 3404 case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT:
3403 connection->connection_timeout_dummy = (unsigned int)connection->connection_timeout; 3405 connection->connection_timeout_dummy = (unsigned int)connection->connection_timeout;
3404 return (const union MHD_ConnectionInfo *) &connection->connection_timeout_dummy; 3406 return (const union MHD_ConnectionInfo *) &connection->connection_timeout_dummy;
3407 case MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE:
3408 if ( (MHD_CONNECTION_HEADERS_RECEIVED > connection->state) ||
3409 (MHD_CONNECTION_CLOSED == connection->state) ||
3410 (MHD_CONNECTION_IN_CLEANUP == connection->state) )
3411 return NULL; /* invalid, too early! */
3412 return (const union MHD_ConnectionInfo *) &connection->header_size;
3405 default: 3413 default:
3406 return NULL; 3414 return NULL;
3407 } 3415 }
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index aac13d6c..3595f105 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -748,6 +748,12 @@ struct MHD_Connection
748 size_t write_buffer_append_offset; 748 size_t write_buffer_append_offset;
749 749
750 /** 750 /**
751 * Number of bytes we had in the HTTP header, set once we
752 * pass #MHD_CONNECTION_HEADERS_RECEIVED.
753 */
754 size_t header_size;
755
756 /**
751 * How many more bytes of the body do we expect 757 * How many more bytes of the body do we expect
752 * to read? #MHD_SIZE_UNKNOWN for unknown. 758 * to read? #MHD_SIZE_UNKNOWN for unknown.
753 */ 759 */