Re: adding a header to request_rec in an input filter of type AP_FTYPE_RESOURCE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The filter saves the file in the requesty body given in a
multipart/form-data format, hence an input filter. I found using a
filter more suitable for this purpose.

> What's reading it back specifically?
Once the file is saved, the control is passed on to a handler attached
to the called URI (something like /handle/upload/file) which is
another process. That process operates independently on the uploaded
file but relies on the custom header to obtain the name of the
uploaded file.

> Yes, but it is after most other processing that would be reading r->headers_in
Does that imply I need to hook the filter to run first or reallly
first? Right now it's hooked a APR_HOOK_MIDDLE.


On Mon, Apr 6, 2020 at 8:00 PM Eric Covener <covener@xxxxxxxxx> wrote:
>
> On Mon, Apr 6, 2020 at 7:54 PM Akhil Jaggarwal
> <akhil.jaggarwal@xxxxxxxxx> wrote:
> >
> > hi,
> >
> > I've an input filter of type AP_FTYPE_RESOURCE.
> >
> > I'm trying to add a custom header to request_rec->headers_in. Here's
> > how i do it when I see an EOS:
> >
> > apr_table_set(f->r->headers_in, "MY_CUSTOM_HDR", "CUSTOM_VAL");
> >
> > But for some reason the header doesn't persist when i read the request
> > object back on the receiving side.
>
> What's reading it back specifically?
>
> The input filter won't be called until the "handler" is reading the
> body to consume it which will happen after almost everything else in
> the server.
>
> > Is this the correct way to add a custom header to request_rec in a filter?
>
> it is unusually late during request processing.  You should use
> something like post_read_request or fixups both of which are much
> simpler as they are not even filters.
>
> > Does an input filter of type AP_FTYPE_RESOURCE allow to modify
> > request_rec->headers_in?
>
> Yes, but it is after most other processing that would be reading r->headers_in.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux