Skip to content

Firefox websocket upgrade request #12

Closed

Description

@smfgh

Thank for your websocket-implementation. :-)

In WebSocketHandler.isWebsocketRequest there is a check for the connection upgrade, which is working well for Chrome and Opera, but my Firefox (version 133.0 snap) fails to connect due to sending keep-alive, Upgrade instead of the expected Upgrade.

Changing the first if-clause in isWebsocketRequest from

  if (connection == null ||
    !connection.equalsIgnoreCase(Util.HEADER_CONNECTION_VALUE)) {

to something like

if (connection == null ||
    !connection.toLowerCase()
       .contains(Util.HEADER_CONNECTION_VALUE.toLowerCase())) {

fixes this issue for me.

Activity

  1. robaho commented on Dec 11, 2024

    @robaho
    Owner

    Thanks for reporting.

    The code does look wrong, but there is a test case that verifies this here so I must have altered the code when integrating nanohttp code.

    More importantly, it brings up an issue, because according to the spec, it should be a comma delimited list, but I believe this syntax is also correct:

    Connection: keep-alive
    Connection: Upgrade
    

    so using getFirst() is not appropriate either.

  2. robaho commented on Dec 11, 2024

    @robaho
    Owner

    Ah, the test is broken, it isn't verifying the results!

  3. changed the title [-]Firefox websocket upgrade test[/-] [+]Firefox websocket upgrade request[/+] on Dec 11, 2024
  4. robaho commented on Dec 11, 2024

    @robaho
    Owner

    This has been fixed in version 1.0.11

  5. smfgh commented on Dec 12, 2024

    @smfgh
    Author

    thank you so much! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions