iisnode
iisnode copied to clipboard
Switch to checking if the conenction header contains 'upgrade' rather than equals 'upgrade'
A potential solution to the issue firefox has where it sends both 'keep-alive' and 'upgrade' in the connection header (see https://github.com/tjanczuk/iisnode/issues/497)
I don't have much experience with C++ or the project so if there's any other changes required or tests that need to be updated/created I'm happy to look into that with some direction
The fix seems to only affect passing through the keep-alive
value. I think the underlying problem is that when FireFox sends Connection: keep-alive, Upgrade
, IISNode only relays Connection: keep-alive
to Node.
I haven't used C++ in quite a while but from what I gathered the reason IISNode is only relaying the keep-alive
connection header is because of this line. I believe the check was saying if the connection doesn't exactly equal upgrade
then send just keep-alive
so if it's changed to the check of just the connection header including upgrade
it should pass along both keep-alive
and upgrade
from firefox.
There is one problem with this commit: the original checked for upgrade
ignoring case (by using stricmp), and with strstr, you lose the ignore case capability, and there is no stristr in the standard library.
Because I didn't want to introduce a stristr function in my patch, I did this instead.
The reason for it not working for Firefox is not that IISNode relays only "keep-alive", the reason is that firefox sends Upgrade with an uppercase U.
Cheers @Fer22f for the comments. Totally didn't twig about the case insensitive stuff.
Updated based on your idea about splitting the header on the comma and checking each one.
Obviously it's not perfect yet and doesn't seem to follow the styling/conventions of the rest of the project but maybe we can build upon this.
Hey guys. Is this pull request going to be merged?