Change the content-length header for other filters

2016-12-21 Thread André Rothe
Hi,

I have a filter, which changes the content length of a POST request.
There are some key-value-pairs of the request, which the filter removes
before other filters process the request.

But after my filter completes the request processing, I'll get:

Sending error response: The request contained fewer content data than
specified by the content-length header

I have tried to change the header key "Content-Length" and set the
new value like:

apr_table_set(f->r->headers_in, "Content-Length",
apr_psprintf(f->r->pool, "%ld", len));

but it has no effect outside of my filter. The incoming request has a
content length of 1107 bytes. I modify the bucket brigade and it
contains at the end of my filter code only 1074 bytes (which is also
stored into "len").

What can I do to send the new content length along the filter chain?

Thank you
André



Chunked request

2016-09-23 Thread André Rothe
Hi,

I try to understand an request filter (input). Maybe you can help me to
understand the processes:

The POST size of a request is larger than 8192 bytes, so the request
will be split up into two pieces. I need both parts to process the
request within the filter. There are further filters, which process the
request too.

My filter calls ap_get_brigade() and tries to get the bytes. The brigade
will be stored within a context structure of the ap_filter_t.

On the first call of my filter it gets only 8192 bytes and no EOS. As
the next, I'm looking for EOS, if there isn't one, I try to store the
buckets with

apr_bucket_setaside(b, f->r->pool);

and return from the filter with APR_SUCCESS. I think, there should be a
further call of my filter hook with the second chunk. There I would
concat the stored brigade with the new one. If there isn't an EOS too,
store the whole brigade again. But is there an EOS, I can process the
request.

What I have to send on the first call to the next filter (nothing,
flush)? At the moment I get an

Sending error response: The request contained fewer content data than
specified by the content-length header

within the error_log and the client gets a 404. So it seems, that a
filter should be informed, that my filter waits for further chunks and
passes the chunks together to the next filter after the second call.

Any ideas?

Thank you.
Andre