Commit Graph
698 Commits
Author SHA1 Message Date
Christian Grothoff 28cba57e89 0924 2012-12-25 17:44:31 +00:00
Christian Grothoff 166909d2ce I was was having problems receiving data from a client using POST with chunked encoding.
It turns out this client is violating the HTTP spec by setting the "Transfer-Encoding: Chunked"
as well as "Content-Length: 0"

Here are the client headers:
  POST /ee4/live.isml/Streams(Encoder1) HTTP/1.1
  Transfer-Encoding: Chunked
  User-Agent: ExpressionEncoder
  Host: 10.11.1.29
  Content-Length: 0
  Connection: Keep-Alive
  Cache-Control: no-cache

This is what HTTP 1.1 spec says (in section 4.4):
  Messages MUST NOT include both a Content-Length header field and a non-identity transfer-coding. If the message does include
  a non- identity transfer-coding, the Content-Length MUST be ignored.

libmicrohttpd does the opposite of what the 4.4 section says if both headers are present.  It only uses the content-length and ignores the
chunked encoding.
I patched libmicrohttpd with the attached patch that does the opposite.  It ignores the content-length if chunked encoding is also specified.
And with that patch libmicrohttpd can be a publishing point for MS Expression Encoder.

What is your take on this?

-eivind
=> answer: follow the spec ;-)
2012-12-18 20:25:37 +00:00
Christian Grothoff d9f458b2e6 force transmission of connection: close header 2012-12-06 09:20:32 +00:00
Christian Grothoff 2027b939dd Matthew Mundell wrote:
Hi

We've been having some mysterious parameter loss of POST parameters in
OpenVAS's GSA.  This only happens with IE8 and Chrome.  We saw this with
libmicrohttpd 0.9.19 and 0.9.20.

The cause looks to be an error in libmicrohttpd.  Patch to 0.9.20 to
resolve below.

In post_process_multipart in postprocessor.c the PP_Init state calls
find_boundary to find the first boundary.  If there is junk before the
first boundary it just reads over the junk.  However, it is also reading
over the actual boundary when there was too little data to determine
whether the next character is the start of the boundary.

In the error case Chrome seems to sends the POST request in multiple
writes.  The first chunk includes a single "-" from the first boundary at
end of the headers.  Thus libmicrohttpd has a partial boundary to deal
with.

I guess Chrome intends to send just the headers but gets the count wrong
due to sending the initial P of the POST on its own (all the browsers do
that for some reason).  Firefox on the other hand sends the headers and the
body in a single write, so it always works.

Thanks, and thanks for libmicrohttpd!

Matt
2012-12-05 18:28:17 +00:00
Christian Grothoff 802d1322f2 Ship its own version of tsearch and friends if not provided by platform.
On GNU based systems the tree related functions (tsearch, tfind, tdestroy)
are provided by the libc (with the interface specification in search.h). On
non-GNU systems this functionality may or may not be available. That's the
case for Android which ships its own, simplified, version of libc called
Bionic. Bionic does not contains neither search.h nor an implementation of
the above mentioned functions.

This patch adds detection for the presence of search.h and if the header file
is not found, it uses an internal version of search.h and functions tsearch,
tfind, and tdestroy. The internal version is based on the source code from
FreeBSD and is compiled if and only if the configure script did not find the
search.h header file.
 -- Jan Janak
2012-11-08 21:35:38 +00:00
Christian Grothoff dc6f6a872e Trying to fix issue reported by Matthieu:
>>
I face an issue while handling big https posts with libmicrohttpd 0.9.22.
I'm using an "external" select based on MHD_get_fdset and MHD_run.

Let's assume 16K of encrypted data arrive on the socket.
When the data arrives, my select correctly returns and MHD_run is called.

Do_read will first call gnu_tls to decrypt the data.
Apparently gnu_tls reads the full 16K so starting here, from the point of
view of socket/select, there is no more data to read.

Do_read however presents a buffer of only 9K to gnu_tls to retrieve the data
(9K as the result of a try_grow_read_buffer call).
So gnu_tls returns 9K of clear data and keeps the rest 7K in its own buffer
I think.
Do_read handles the 9K and then MHD_run returns;

Since from the socket point of view no data is pending read, select will
then wait until it finally timeout.
Only after this timeout, MHD_run is run again and the remaining 7K are
correctly processed.

I found two dirty workarounds for this issue :
1/ increase the MDH_BUF_INC_SIZE to an arbitrarily large value so it will
always be greater than gnu_tls own buffers
2/ run multiple MHD_run after each select (let's say 10 times)

What do you think of this issue ?
What could be a cleaner way of handling this ?
<<
Approach: detect that we *might* be in this situation because TLS fills
the entire buffer we give to gnuTLS.  If so, set timeout to 0 and read
again.
2012-10-22 11:07:36 +00:00
Christian Grothoff 42c501a9c4 -fix #if WINDOWS problems reported by Luis Garcia on the mailinglist 2012-10-15 23:34:56 +00:00
Christian Grothoff ad74bf4b44 releasing 0.9.22 2012-09-01 18:51:43 +00:00
Christian Grothoff 305acdf03a allowing independent enabling/disabling of digest and basic authentication (Mantis #2525) 2012-09-01 18:47:23 +00:00
Christian Grothoff a22321bf1a fixing #2531 2012-08-30 19:17:17 +00:00
Christian Grothoff 9d80af66d5 use int instead of enums in va_arg calls 2012-08-21 12:37:36 +00:00
Christian Grothoff aaecd079b6 reduce xbuf_size as suggested by Martin Velek on mailinglist 2012-08-21 12:33:51 +00:00
Christian Grothoff 15e3b096a4 -releasing 0.9.21 2012-07-19 19:56:54 +00:00
Christian Grothoff 3f2b73dd80 -additional code cleanup 2012-07-19 15:31:39 +00:00
Christian Grothoff a232740396 code cleanup, minor bug fixes, allow lookup up trailing values with key of NULL 2012-07-17 21:52:26 +00:00
Christian Grothoff ccd65de6a3 adding experimental extension 'HD_USE_NO_LISTEN_SOCKET' 2012-07-17 20:39:44 +00:00
Christian Grothoff e1111f82e9 -fixing sendfile mess 2012-07-17 20:16:23 +00:00
Christian Grothoff db45cd185e -LRN: log changes 2012-07-09 11:43:59 +00:00
Christian Grothoff dad819b72a LRN: MHD patches. Later will send patches for other issues, but at least
now it will compile.
2012-07-08 13:06:28 +00:00
Christian Grothoff 6a99b74bb8 -#2414: make listen and accepted sockets non-inheritable by default 2012-06-22 09:58:14 +00:00
Christian Grothoff 7782618769 Mike Crowe sends this patch:
Change various uses of time(NULL) to new MHD_monotonic_time() function to
make timeouts immune to the system real time clock changing. Leave one call
to time(2) which continues to use the real time for the HTTP Date: header.

If clock_gettime does not support CLOCK_MONOTONIC then fall through to
calling time(NULL) instead. This will be problematic if clock_gettime
sometimes fails and sometimes succeeds but that shouldn't happen.

The autoconf magic was lifted from
http://lists.gnu.org/archive/html/autoconf/2010-08/msg00035.html
2012-06-19 17:47:11 +00:00
Christian Grothoff 0ef1eadb3f adding support for status code 451 2012-06-12 19:35:38 +00:00
Christian Grothoff f8147ac899 -releasing 0.9.20 2012-05-31 11:36:24 +00:00
Christian Grothoff 6842307f20 -fixing bugs with missing shutdown callbacks 2012-05-29 11:55:38 +00:00
Christian Grothoff bdcf885cb3 -removing 0.8.x-branch, only confuses users at this time 2012-04-22 06:38:47 +00:00
Christian Grothoff 7cb018fd33 changing order in which headers are returned to match the order in which we received them from the network 2012-03-02 23:00:11 +00:00
Christian Grothoff 912620e3f9 BS: fixing compilation problem on MinGW 2012-02-01 08:40:41 +00:00
Christian Grothoff 0dbf57ab97 releasing 0.9.19 2012-01-31 16:53:57 +00:00
Christian Grothoff f7982784f7 fixing #2126 2012-01-30 19:03:16 +00:00
Christian Grothoff 29ad274096 -fixing #2120 2012-01-27 10:01:51 +00:00
Christian Grothoff 25e0d42621 add check for sin_len 2012-01-24 15:08:41 +00:00
Christian Grothoff 3f285017e0 releasing 0.9.18 2012-01-23 13:08:11 +00:00
Christian Grothoff ced72bc239 hopefully fixing #1967 2012-01-19 21:17:29 +00:00
Christian Grothoff 19c33f8618 tclaveirole: fixing #2085 with patch from the bugreport 2012-01-19 16:47:20 +00:00
Christian Grothoff b54d68ff21 properly fixing #2059, keeping the check that the uri from the nonce generation is exactly the same as the primary uri we got from the HTTP request 2012-01-19 16:40:57 +00:00
Christian Grothoff cee75ea2bf fix nonce counter base - #2061 2012-01-07 16:32:50 +00:00
Christian Grothoff 20e37fdb3d partial fix for #2059 2012-01-05 21:02:21 +00:00
Christian Grothoff de35faa11a Hi there,
am I right in the assumption, that the documentation at
http://www.gnu.org/s/libmicrohttpd/tutorial.html#Supporting-basic-authentication
is newer than authorization_example.c in the src/examples/ subdirectory?

If so here is a patch to make authorization_example.c use the functions from
the tutorial instead of raw base64 strings.

Regards

Sven
-
2011-12-01 14:24:24 +00:00
Christian Grothoff 6cf74917a7 added flag for 'Date:' suppression 2011-11-21 17:52:44 +00:00
Christian Grothoff 46e0cc9954 releasing 0.9.17 2011-11-19 19:09:10 +00:00
Christian Grothoff 7c75a906a6 fixing 1914 2011-11-18 19:18:24 +00:00
Christian Grothoff 7c88233a64 trying to fix issue with 'connectin: close' header duplicated in footer reported by Dirk on mailinglist 2011-11-13 12:36:59 +00:00
Christian Grothoff 98d2c01bcf docu 2011-11-04 09:03:24 +00:00
Christian Grothoff 7333727189 fixing shutdown issue on OS X -- 1760 2011-11-03 09:29:31 +00:00
Christian Grothoff 4eb568c37c send connection:close always if we shutdown socket for reading, see mantis #1760 2011-11-01 17:52:48 +00:00
Christian Grothoff fcf8127533 LRN: treat EAGAIN as EINTR 2011-10-27 12:17:14 +00:00
Christian Grothoff da7e8ad76d fixing #1824 2011-10-12 08:41:49 +00:00
Christian Grothoff 2160c66589 LRN: w32 test case fixes 2011-10-07 17:51:10 +00:00
Christian Grothoff 65f549493a fixing 1811 2011-09-30 15:57:34 +00:00
Christian Grothoff b6f6b9a5cc release0.9.15 2011-09-28 06:41:03 +00:00