NetBSD-Bugs archive

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

Re: bin/58880: bozohttpd(8): set custom header field in responses



Martin Husemann <martin%duskware.de@localhost> writes:

> Just a tangential node:
>
>  - if we always want to send all headers verbatim, it would be simpler to
>    create a single malloc() for the whole header file and make sure it has
>    no empty lines in it when reading, then just write it out in one
>    call. Gets rid of the simpleque and the iterations.

It's a nice idea except that the line delimiter mismatch ("\n" vs "\r\n")
between the file and HTTP headers will require fragmenting it anyway.

>
>  - if we consider doing value replacements later (not sure if that could
>    be usefull and what values to offer in that context) it would be easier
>    if we would parse the file into header and value pairs, unwrap continuation
>    lines and have them in a struct with header/value pointer on the simpleque.
>
> Do other servers offer some kind of right-hand-side (value) string 
> substitutions for this?

Checked nginx[0], apache[1] and they do allow value substitutions.

On Jan 3, 2016, elric introduced the concept of reply headers[2] but I
couldn't see any code populating them. If we intend to support value
substitutions, I guess it's a good idea to tokenize the custom headers
from .bzcustomheaders file and use hr_replheaders.

[0] http://nginx.org/en/docs/http/ngx_http_headers_module.html
[1] https://httpd.apache.org/docs/2.4/mod/mod_headers.html
[2] http://cvsweb.netbsd.org/bsdweb.cgi/src/libexec/httpd/bozohttpd.c.diff?r1=1.77;r2=1.78


Home | Main Index | Thread Index | Old Index