diff options
-rw-r--r-- | AUTHORS | 6 | ||||
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | doc/libmicrohttpd.texi | 45 | ||||
-rw-r--r-- | src/include/microhttpd.h | 16 | ||||
-rw-r--r-- | src/microhttpd/.gitignore | 1 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 10 | ||||
-rw-r--r-- | src/microhttpd/internal.h | 6 |
8 files changed, 80 insertions, 15 deletions
@@ -61,3 +61,9 @@ Silvio Clecio <silvioprog@gmail.com> | |||
61 | Documentation contributions also came from: | 61 | Documentation contributions also came from: |
62 | Marco Maggi <marco.maggi-ipsu@poste.it> | 62 | Marco Maggi <marco.maggi-ipsu@poste.it> |
63 | Sebastian Gerhardt <sebgerhardt@gmx.net> | 63 | Sebastian Gerhardt <sebgerhardt@gmx.net> |
64 | |||
65 | Special thanks to: | ||
66 | Florian Weimer <fweimer@redhat.com> | ||
67 | Ramakrishnan Muthukrishnan <ram@leastauthority.com> | ||
68 | Gervasa Markham <grev@mozilla.com> | ||
69 | Liz Steininger <liz@leastauthority.com> | ||
@@ -1,3 +1,8 @@ | |||
1 | Tue 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 | |||
1 | Thu Apr 27 22:31:00 CEST 2017 | 6 | Thu 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 | # |
23 | AC_PREREQ([2.64]) | 23 | AC_PREREQ([2.64]) |
24 | LT_PREREQ([2.4.0]) | 24 | LT_PREREQ([2.4.0]) |
25 | AC_INIT([GNU Libmicrohttpd],[0.9.53],[libmicrohttpd@gnu.org]) | 25 | AC_INIT([GNU Libmicrohttpd],[0.9.54],[libmicrohttpd@gnu.org]) |
26 | AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) | 26 | AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) |
27 | AC_CONFIG_HEADERS([MHD_config.h]) | 27 | AC_CONFIG_HEADERS([MHD_config.h]) |
28 | AC_CONFIG_MACRO_DIR([m4]) | 28 | AC_CONFIG_MACRO_DIR([m4]) |
29 | 29 | ||
30 | LIB_VERSION_CURRENT=53 | 30 | LIB_VERSION_CURRENT=54 |
31 | LIB_VERSION_REVISION=0 | 31 | LIB_VERSION_REVISION=0 |
32 | LIB_VERSION_AGE=41 | 32 | LIB_VERSION_AGE=42 |
33 | AC_SUBST(LIB_VERSION_CURRENT) | 33 | AC_SUBST(LIB_VERSION_CURRENT) |
34 | AC_SUBST(LIB_VERSION_REVISION) | 34 | AC_SUBST(LIB_VERSION_REVISION) |
35 | AC_SUBST(LIB_VERSION_AGE) | 35 | AC_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 | ||
500 | Deprecated (use @code{MHD_OPTION_STRICT_FOR_CLIENT}). | ||
499 | Be pedantic about the protocol. | 501 | Be pedantic about the protocol. |
500 | Specifically, at the moment, this flag causes MHD to reject HTTP | 502 | Specifically, at the moment, this flag causes MHD to reject HTTP |
501 | 1.1 connections without a @code{Host} header. This is required by the | 503 | 1.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} | |||
504 | if you are testing clients against MHD, and @strong{OFF} in | 506 | if you are testing clients against MHD, and @strong{OFF} in |
505 | production. | 507 | production. |
506 | 508 | ||
507 | @item MHD_USE_PERMISSIVE_CHECKS | ||
508 | Be permissive about the protocol, allowing slight deviations that are | ||
509 | technically not allowed by the RFC. Specifically, at the moment, this | ||
510 | flag causes MHD to allow spaces in header field names. This is | ||
511 | disallowed 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 | |||
735 | zero, which means no limit on the number of connections | 730 | zero, which means no limit on the number of connections |
736 | from the same IP address. | 731 | from the same IP address. |
737 | 732 | ||
733 | @item MHD_OPTION_LISTEN_BACKLOG_SIZE | ||
734 | Set the size of the @code{listen()} back log queue of the TCP socket. | ||
735 | Takes an @code{unsigned int} as the argument. Default is the | ||
736 | platform-specific value of @code{SOMAXCONN}. | ||
737 | |||
738 | @item MHD_OPTION_STRICT_FOR_CLIENT | ||
739 | Specify how strict we should enforce the HTTP protocol. | ||
740 | Takes an @code{int} as the argument. Default is zero. | ||
741 | |||
742 | If set to 1, MHD will be strict about the protocol. Specifically, at | ||
743 | the moment, this flag uses MHD to reject HTTP 1.1 connections without | ||
744 | a "Host" header. This is required by the standard, but of course in | ||
745 | violation of the "be as liberal as possible in what you accept" norm. | ||
746 | It is recommended to set this to 1 if you are testing clients against | ||
747 | MHD, and 0 in production. | ||
748 | |||
749 | If set to -1 MHD will be permissive about the protocol, allowing | ||
750 | slight deviations that are technically not allowed by the | ||
751 | RFC. Specifically, at the moment, this flag causes MHD to allow spaces | ||
752 | in header field names. This is disallowed by the standard. | ||
753 | |||
754 | It is not recommended to set it to -1 on publicly available servers as | ||
755 | it 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 |
740 | Bind daemon to the supplied socket address. This option should be followed by a | 760 | Bind 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 | ||
2824 | Takes no extra arguments. | 2844 | Takes no extra arguments. |
2825 | 2845 | ||
2826 | @item MHD_CONNECTION_INFO_TIMEOUT | 2846 | @item MHD_CONNECTION_INFO_CONNECTION_TIMEOUT |
2827 | Returns pointer to an @code{unsigned int} that is the current timeout | 2847 | Returns pointer to an @code{unsigned int} that is the current timeout |
2828 | used for the connection (in seconds, 0 for no timeout). Note that | 2848 | used for the connection (in seconds, 0 for no timeout). Note that |
2829 | while suspended connections will not timeout, the timeout value | 2849 | while suspended connections will not timeout, the timeout value |
@@ -2831,6 +2851,15 @@ returned for suspended connections will be the timeout that the | |||
2831 | connection will use after it is resumed, and thus might not be zero. | 2851 | connection will use after it is resumed, and thus might not be zero. |
2832 | 2852 | ||
2833 | Takes no extra arguments. | 2853 | Takes no extra arguments. |
2854 | |||
2855 | @item MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE | ||
2856 | @cindex performance | ||
2857 | Returns pointer to an @code{size_t} that represents the size of the | ||
2858 | HTTP header received from the client. Only valid after the first callback | ||
2859 | to the access handler. | ||
2860 | |||
2861 | Takes 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 |
44 | test_upgrade_tls | 44 | test_upgrade_tls |
45 | test_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 | */ |