Add support for chunked input encoding in nginx

Hi.

How hard is to add support for chunked input encoding in Nginx?
I’m not talking about generic support, but only support for a very
specialized module I’m planning to write.

Reading the sources I see this:

if (r->method & (NGX_HTTP_POST|NGX_HTTP_PUT)
&& r->headers_in.content_length_n == -1)
{
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
“client sent POST method without “Content-Length”
header”);
ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
return NGX_ERROR;
}

This code can be relaxed, but is it safe?

Thanks Manlio P.

Hi Manlio

Were you able to find a work-around for this ?
I’m facing the exact same issue where a client is posting a largish body
using chunked transfer-encoding without content-length, and so NGINX
croaks at this same point.

Any help will be appreciated.

Regards,
Mansoor

----- “Manlio P.” [email protected] wrote:
| From: “Manlio P.” [email protected]
| To: [email protected]
| Sent: Tuesday, April 1, 2008 6:44:10 PM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi
| Subject: [dev] add support for chunked input encoding in nginx
|
| Hi.
|
| How hard is to add support for chunked input encoding in Nginx?
| I’m not talking about generic support, but only support for a very
| specialized module I’m planning to write.
|
|
| Reading the sources I see this:
|
| if (r->method & (NGX_HTTP_POST|NGX_HTTP_PUT)
| && r->headers_in.content_length_n == -1)
| {
| ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
| “client sent POST method without "Content-Length" header”);
| ngx_http_finalize_request(r, NGX_HTTP_LENGTH_REQUIRED);
| return NGX_ERROR;
| }
|
|
| This code can be relaxed, but is it safe?
|
|
|
| Thanks Manlio P.
|
|

Mansoor P. ha scritto:

Hi Manlio

Were you able to find a work-around for this ?

No.

I’m facing the exact same issue where a client is posting a largish body
using chunked transfer-encoding without content-length, and so NGINX
croaks at this same point.

Any help will be appreciated.

You should wait until Igor will implement support for input filters.

Regards,
Mansoor

Manlio P.

Manlio P. wrote:

Mansoor P. ha scritto:

Hi Manlio

Were you able to find a work-around for this ?

A quick workaround:

Best regards,
Vsevolod

Vsevolod Dyomkin wrote:

Manlio P. wrote:

Mansoor P. ha scritto:

Hi Manlio

Were you able to find a work-around for this ?

A quick workaround:
Lisp, the Universe and Everything: correcting Transfer-encoding:chunked problem in nginx

Best regards,
Vsevolod

An updated version:
https://www.blogger.com/comment.g?blogID=6031647961506005424&postID=3915986647933648395