Hi. First thanks for the great library, I really like it :) .
When running examples/webapp.c I noticed it doesn't work with firefox 74. The assert on ws_attach_server() (line 101) fails. The problem lies in the ws.c file on line 254.
libdill checks if the "Connection" header equals "Upgrade", but firefox sends "keep-alive, Upgrade" not only "Upgrade" as chrome and others do. The websockets standard (https://tools.ietf.org/html/rfc6455#section-4.2) specifies that the Connection must include a case-insensitive Upgrade value. So firefox correctly follows the standard, but libdill in this case doesn't.
If you are interested I'm happy to create a PR to fix this.
For the PR I see 2 options:
1) follow the standard and check for substring and not equality
2) don't check at all. There seem to be some proxy servers in the wild that don't correctly forward hop by hop headers. So the server only receives Connection: keep-alive, and not the whole Connection: keep-alive, Upgrade. See https://stackoverflow.com/questions/50192812/firefox-combining-connection-keep-alive-upgrade-conflicts-with-mobile-operat . So to support a wider audience of clients this is also an interesting option in my opinion.
If you are interested in a PR please specify which of the above 2 options you would like me to implement. Thanks.
Thank you for debugging this issue and making notes.
I just spent the weekend re-writing a crummy Python monitoring system with libdill and ran into the Firefox issue well into the project.
Hi. First thanks for the great library, I really like it :) .
When running
examples/webapp.c
I noticed it doesn't work with firefox 74. The assert onws_attach_server()
(line 101) fails. The problem lies in thews.c
file on line 254.libdill checks if the "Connection" header equals "Upgrade", but firefox sends "keep-alive, Upgrade" not only "Upgrade" as chrome and others do. The websockets standard (https://tools.ietf.org/html/rfc6455#section-4.2) specifies that the Connection must include a case-insensitive Upgrade value. So firefox correctly follows the standard, but libdill in this case doesn't.
If you are interested I'm happy to create a PR to fix this.
For the PR I see 2 options: 1) follow the standard and check for substring and not equality 2) don't check at all. There seem to be some proxy servers in the wild that don't correctly forward hop by hop headers. So the server only receives Connection: keep-alive, and not the whole Connection: keep-alive, Upgrade. See https://stackoverflow.com/questions/50192812/firefox-combining-connection-keep-alive-upgrade-conflicts-with-mobile-operat . So to support a wider audience of clients this is also an interesting option in my opinion.
If you are interested in a PR please specify which of the above 2 options you would like me to implement. Thanks.