View Issue Details

IDProjectCategoryView StatusLast Update
0004967libmicrohttpdcompliancepublic2021-09-02 17:54
Reportermarianobarrios Assigned ToChristian Grothoff  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.52 
Target Version0.9.53Fixed in Version0.9.53 
Summary0004967: Failure to accept chucks bigger than 16MB
DescriptionThe HTTP specification does not limit the size of each "chunk" used in chucked transfer encoding. Even though it is clear that there should be some practical limit, libmicrohttpd sets it at 16 MB (6 hexadecimal digits), which happens to be quite small in practice.

In particular, it is smaller than what Amazon load balancer can use when the body is big enough.
Additional InformationIn case of sending requests with big bodies through Amazon ELB, there is not possible workaround from the client perspective (transfer encoding is a hop-by-hop aspect of the HTTP protocol, completely in control of the intermediary).

Below is a patch for increasing the value one hexadecimal digit (to 256 MB). This happens to be enough for Amazon ELB:

--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1817,7 +1817,7 @@ process_request_body (struct MHD_Connection *connection)
                        ('\n' == buffer_head[i]) )
                     break;
                   i++;
- if (i >= 6)
+ if (i >= 7)
                     break;
                 }
               /* take '\n' into account; if '\n'
@@ -1829,7 +1829,7 @@ process_request_body (struct MHD_Connection *connection)
                        (2 == available) &&
                        ('0' == buffer_head[0]) ) )
                 break; /* need more data... */
- malformed = (i >= 6);
+ malformed = (i >= 7);
               if (! malformed)
                 {
                   size_t num_dig = MHD_strx_to_sizet_n_ (buffer_head,
--
TagsNo tags attached.

Activities

Christian Grothoff

2017-03-25 21:00

manager   ~0011975

Fixed, but by allowing chunks up to 2^64-1 instead. I think that "limit" will really suffice for everyone for a while... Commit is bf7418b3d9288e9e0175651a9e3cf3297e197942

Christian Grothoff

2021-09-02 17:54

manager   ~0018183

Fix committed to master branch.

Related Changesets

libmicrohttpd: master bf7418b3

2017-03-25 21:41

Christian Grothoff


Details Diff
fix 0004967 Affected Issues
0004967
mod - ChangeLog Diff File
mod - src/microhttpd/connection.c Diff File
mod - src/microhttpd/internal.h Diff File

Issue History

Date Modified Username Field Change
2017-03-21 11:08 marianobarrios New Issue
2017-03-25 20:21 Christian Grothoff Assigned To => Christian Grothoff
2017-03-25 20:21 Christian Grothoff Status new => assigned
2017-03-25 21:00 Christian Grothoff Status assigned => resolved
2017-03-25 21:00 Christian Grothoff Resolution open => fixed
2017-03-25 21:00 Christian Grothoff Fixed in Version => 0.9.53
2017-03-25 21:00 Christian Grothoff Note Added: 0011975
2017-03-25 21:01 Christian Grothoff Target Version => 0.9.53
2017-04-12 00:00 Christian Grothoff Status resolved => closed
2021-09-02 17:54 Christian Grothoff Changeset attached => libmicrohttpd master bf7418b3
2021-09-02 17:54 Christian Grothoff Note Added: 0018183