Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cache] Don't store hop-by-hop headers #409

Closed
krizhanovsky opened this issue Jan 30, 2016 · 4 comments
Closed

[Cache] Don't store hop-by-hop headers #409

krizhanovsky opened this issue Jan 30, 2016 · 4 comments
Assignees
Labels
Milestone

Comments

@krizhanovsky
Copy link
Contributor

Keep-Alive and Server are hop-by-hop headers and should not be cached. hbh_hdrs must be adjusted and the headers must be made special to be analyzed quickly in tfw_cache_copy_resp().

Relates to #407.

@krizhanovsky krizhanovsky added this to the 0.5.0 Web Server milestone Jan 30, 2016
@krizhanovsky krizhanovsky changed the title [Cache] Don't store Keep-Alive header [Cache] Don't store hop-by-hop headers Jan 30, 2016
@krizhanovsky
Copy link
Contributor Author

See also What Proxies Must Do and particularly the referenced spec

@vankoven
Copy link
Contributor

Actual problem differs from mentioned above: hop-by-hop headers are forwarded as end-to-end headers

In spec mentioned above 8 headers are marked as a hop-by-hop. But the final document RFC7230 is more strict than a draft and close to article What Proxies Must Do:

   A proxy or gateway MUST parse a received Connection header field before
   a message is forwarded and, for each connection-option in this field,
   remove any header field(s) from the message with the same name as the
   connection-option, and then remove the Connection header field itself
   (or replace it with the intermediary's own connection options for the
   forwarded message).

So, for request:

    GET /foo HTTP/1.1
    Host: example.net
    Connection: Keep-Alive, Foo, Bar
    Foo: abc
    Foo: def
    Keep-Alive: timeout=30

The Connection, Keep-Alive and both Foo headers must be removed before forwarding it.
Co-Advisor HTTP 1.1 compatibility tests follows obsoleted RFC2616, but also checks hop-by-hop headers removing from messages.

'tfw_http_set_hdr_connection()` seems to return without updating Connection header. Also other hop-by hop headers are not removed from test messages.

Used tempesta (af32a834) configuration:

server <test-server-ip>
cache_methods GET HEAD;
cache_fulfill * *;

@krizhanovsky
Copy link
Contributor Author

Please also store correct Server and Via headers in cache as described in #634

@vankoven
Copy link
Contributor

fixed in 72a24ae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants