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

Behind Proxies that make headers lowercase fails #88

Open
philjones88 opened this issue Jun 13, 2024 · 0 comments
Open

Behind Proxies that make headers lowercase fails #88

philjones88 opened this issue Jun 13, 2024 · 0 comments

Comments

@philjones88
Copy link

Behind Istio that makes all HTTP headers it proxies to applications lowercase, this code here fails, it is using a HashMap and as a result is case sensitive.

https://github.com/usnistgov/jsip/blob/master/src/gov/nist/javax/sip/stack/WebSocketHttpHandshake.java#L114

Fails as it's looking for Sec-WebSocket-Key but the headers HashMap would have sec-websocket-key.

For example:

var test = new HashMap<String, String>();
test.put("sec-lower", "foo");
test.put("Sec-Upper", "bar");
System.out.println("Test: " + test.get("sec-upper"));
System.out.println("Test: " + test.get("sec-lower"));

Outputs:

Test: null
Test: foo

Interestingly other parts of the code seem to be case insensitively written, e.g.

https://github.com/usnistgov/jsip/blob/master/src/gov/nist/javax/sip/stack/WebSocketHttpHandshake.java#L85

So behind Istio or other proxies that lowercase headers the response Sec-WebSocket-Accept header is always of the value of the string null

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

No branches or pull requests

1 participant