aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
4 files changed, 29 insertions, 4 deletions
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 */