diff --git a/src/client.c b/src/client.c index 409be33e..70059eac 100644 --- a/src/client.c +++ b/src/client.c @@ -115,6 +115,16 @@ void client_complete(client_t *client) long long unsigned int scannumber; int have = 0; + if (!have) { + header = httpp_getvar(client->parser, "content-length"); + if (header) { + if (sscanf(header, "%llu", &scannumber) == 1) { + client->request_body_length = scannumber; + have = 1; + } + } + } + if (!have) { if (client->parser->req_type == httpp_req_source) { client->request_body_length = -1; /* streaming */ @@ -132,16 +142,6 @@ void client_complete(client_t *client) } } - if (!have) { - header = httpp_getvar(client->parser, "content-length"); - if (header) { - if (sscanf(header, "%llu", &scannumber) == 1) { - client->request_body_length = scannumber; - have = 1; - } - } - } - if (!have) { if (client->parser->req_type == httpp_req_put) { /* As we don't know yet, we asume this PUT is in streaming mode */