View Issue Details

IDProjectCategoryView StatusLast Update
0004967libmicrohttpdcompliancepublic2021-09-02 15:54
Reportermarianobarrios Assigned ToChristian Grothoff Due Date
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 20: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 15:54

manager   ~0018183

Fix committed to master branch.

Issue History

Date ModifiedUsernameFieldChange
2017-03-21 10:08marianobarriosNew Issue
2017-03-25 19:21Christian GrothoffAssigned To => Christian Grothoff
2017-03-25 19:21Christian GrothoffStatusnew => assigned
2017-03-25 20:00Christian GrothoffStatusassigned => resolved
2017-03-25 20:00Christian GrothoffResolutionopen => fixed
2017-03-25 20:00Christian GrothoffFixed in Version => 0.9.53
2017-03-25 20:00Christian GrothoffNote Added: 0011975
2017-03-25 20:01Christian GrothoffTarget Version => 0.9.53
2017-04-11 22:00Christian GrothoffStatusresolved => closed
2021-09-02 15:54Christian Grothoff
2021-09-02 15:54Christian GrothoffNote Added: 0018183