Bug 139298 - [websocket] Invalid UTF-8 sequence in header value after offline/online sequence
Summary: [websocket] Invalid UTF-8 sequence in header value after offline/online sequence
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad iOS 8.1
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-05 07:38 PST by jfarcand
Modified: 2016-03-18 19:31 PDT (History)
3 users (show)

See Also:


Attachments
Dev Tool Ouput (443.11 KB, image/png)
2014-12-05 07:38 PST, jfarcand
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jfarcand 2014-12-05 07:38:36 PST
Created attachment 242630 [details]
Dev Tool Ouput

Opening a websocket connection using IOS (tested with 8.1, but I suspect the issue is there for all version) after going offline (Plane mode off/on) cause Safari to crash with

WebSocket connection to 'ws://10.0.1.12:8080/chat?X-Atmosphere-tracking-id=c884a896-1944-4793-b2ed-6563e218f407&X-Atmosphere-Framework=2.2.6-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json&X-atmo-protocol=true' failed: Invalid UTF-8 sequence in header value

Before going offline, the same URL just works:

Using URL: ws://10.0.1.12:8080/chat?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.2.6-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json&X-atmo-protocol=true
atmosphere.js:3171

The issue seems to be with the length of the query String. For example, doing 

ws://10.0.1.12:8080/chat?X-Atmosphere-tracking-id=0

will works. But doing

ws://10.0.1.12:8080/chat?X-Atmosphere-tracking-id=0dsdasdasdasdsa

won't.

Attached is the Safari Dev Console output. This can be easily tested using the console.
Comment 1 Benjamin Poulain 2014-12-05 11:03:07 PST
I *think* Alexey fixed that
Comment 2 Alexey Proskuryakov 2014-12-05 11:48:15 PST
The only related thing that I recently fixed would be bug 137009, which is not obviously the same thing.

Please test with iOS 8.1.1 though.
Comment 3 jfarcand 2014-12-05 12:55:28 PST
Same issue with 8.1.1
Comment 4 ookke1 2015-02-19 02:15:14 PST
Seems that the Blink guys fixed a similar issue that was triggered by empty response headers: https://code.google.com/p/chromium/issues/detail?id=380075

We managed to reproduce this on iOS also with an empty response header and work around it by ensuring that the header value is never empty.
Comment 5 Chris 2016-03-18 19:31:43 PDT
BTW, This has never been solved. 
If you try https://speech-to-text-demo.mybluemix.net/ on Safari 9, you receive a  "Invalid UTF-8 sequence in header value" In this case I think the problem is the Content-type being empty.
Another example is here: 
http://stackoverflow.com/questions/34679134/websocket-safari-9-invalid-utf-8-sequence-in-header-value . The `Set-Cookie` is empty