Skip to content

Behind Proxies that make headers lowercase fails #88

@philjones88

Description

@philjones88

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions