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

AbstractProxyServlet.onServerResponseHeaders does not support headers with empty values #8750

Closed
danrohrer opened this issue Oct 20, 2022 · 8 comments · Fixed by #8904
Closed

Comments

@danrohrer
Copy link

https://github.com/eclipse/jetty.project/blob/8404eb0db1a362b20d4dc35a7d48ac2fe41ddfce/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java#L666

There were changes made some time ago to support setting headers with empty values (see: #1116) however the change did not carry through to onServerResponseHeaders().

Wondering if this was an oversight or intentional.

@joakime
Copy link
Contributor

joakime commented Oct 20, 2022

Wait, I thought a null headerValue means it doesn't exist, and an empty header value "" means it exists, but has no value?
@gregw @sbordet thoughts?

@danrohrer
Copy link
Author

In this particular code, a null could be returned if the header name was being explicitly filtered out, hence the check for null in line 666 above. I'm referring to the case where a header (with an actual name) is assigned a value that is empty (as in myheader: \r\n). In such a case, the value's length will be 0, and the code will skip adding the response header.

@danrohrer
Copy link
Author

Any further thoughts on this? RFC 9110 Section 5.5 seems to allow for an empty header field value. Same was true of earlier RFCs. Section 5.1 also states "A proxy MUST forward unrecognized header fields unless ... the proxy is specifically configured to block, or
otherwise transform, such fields." Just wondering if this will be addressed or if I'll need to override the behavior in my own code.

@gregw
Copy link
Contributor

gregw commented Nov 2, 2022

@danrohrer what version of Jetty? We are not making any changes like this to Jetty-9.4, which is end of life for community support. But sounds like something we should address in >= 10

@danrohrer
Copy link
Author

danrohrer commented Nov 2, 2022

>= 10 will work for me

sbordet added a commit that referenced this issue Nov 16, 2022
…upport headers with empty values

Fixed support for empty headers.
Added test case.

Signed-off-by: Simone Bordet <[email protected]>
@sbordet
Copy link
Contributor

sbordet commented Nov 16, 2022

@danrohrer can you check whether #8904 works for you?

@danrohrer
Copy link
Author

danrohrer commented Nov 16, 2022 via email

@sbordet
Copy link
Contributor

sbordet commented Nov 16, 2022

Yes, we'll merge the PR to Jetty 10 and then merge forward to Jetty 11 and Jetty 12.

sbordet added a commit that referenced this issue Nov 16, 2022
…upport headers with empty values (#8904)

Fixed support for empty headers.
Added test case.

Signed-off-by: Simone Bordet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants