ESPAsyncWebServer icon indicating copy to clipboard operation
ESPAsyncWebServer copied to clipboard

Websocket doesn't work with any Internet Explorer version

Open drony opened this issue 9 years ago • 13 comments

Websocket doesn't work with any Internet Explorer version.

drony avatar May 21 '17 11:05 drony

I'm sadly having the same issue. Could this have something to do with the security configuration for the intranet of the IE?

stephanmoe avatar May 28 '17 21:05 stephanmoe

nope. It has to do with the fact the MS does not follow the rules for constructing requests. The server expects the "Host" header to be the first header and that is not the case with IE, so it breaks the parser

me-no-dev avatar May 29 '17 07:05 me-no-dev

Ok.. that's exactly the problem.. I've tried to log the request..

Google Chrome and Firefox send the request as a whole (inclusive HEADER), what fits perfectly in your parser..

NOT_FOUND: GET http://192.168.1.1/ws _HEADER[Connection]: Upgrade _HEADER[Upgrade]: websocket _HEADER[Origin]: http://www.websocket.org _HEADER[Sec-WebSocket-Version]: 13 _HEADER[Sec-WebSocket-Key]: cbm715DQGb5Qd9eyI2nZiw== _GET[encoding]: text

In IE it looks more like following: (All Header files were transmitted seperatly)

NOT_FOUND: GET http://192.168.1.1/ws _GET[encoding]: text

Did you already see the parser implementation of Links2004 ? https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSocketsServer.cpp#L676

This parser works perfectly with the newest version of IE..

stephanmoe avatar May 29 '17 12:05 stephanmoe

it's one thing to be a WebSocket server with the sole purpose of parsing WebSocket requests and a whole other thing to be an actual web server parsing all kinds of requests and supporting all kinds of things.

me-no-dev avatar May 29 '17 12:05 me-no-dev

I see.. Sorry I didn't wanted to be disparging.. You did a great job with your async webServer. I'm excited day by day of your great work!

I will try to merge the idea of Links2004 into yours and come back in the next few days..

stephanmoe avatar May 29 '17 13:05 stephanmoe

It needs a different approach to get this resolved. But that will mean even more memory usage as you need to collect all headers before actin on them. The Host header in question splits the logic to virtual hosts and together with the request can make a decision if a given request can be handled or not.

me-no-dev avatar May 29 '17 13:05 me-no-dev

Could we for the time being introduce a IE compatible directive for the ones desperately needing it?

universam1 avatar Jun 30 '17 21:06 universam1

I am working on a solution for this. It is caused by 2 separate small bugs. I will post the solution next week. I don't have a good Internet connection at hand this week... Bug 1: websocket needs Host in header and this implementation assumes this header is the first to be transmitted by the browser. IE and Edge send it as one of the last. Bug 2: if a handler exists that results in a file or folder that has the same name as the folder in the socket request, it will reply with result code 200 and transmit the file. While the browser expects code 101.

pdfelen avatar Jul 31 '17 10:07 pdfelen

On implementation I had 2 choices: 1- Parse headers twice (first to determine request type and Host, attach correct handler, second to store needed headers) 2- Parse headers first, attach correct handler, remove not needed headers I have chosen to implement the second one, it temporary uses more memory, but not needed part will be freed fast

pdfelen avatar Aug 06 '17 21:08 pdfelen

The uploaded fix contains my proposed fixes to issues 172 and 198 fixed issues 172 + 198.zip

pdfelen avatar Aug 07 '17 00:08 pdfelen

Merged into master :)

me-no-dev avatar Aug 18 '17 17:08 me-no-dev

great job!

pdfelen avatar Aug 18 '17 17:08 pdfelen

thanks @pdfelen and @me-no-dev

universam1 avatar Aug 18 '17 17:08 universam1