Bug 80172

Summary: [Chromium] KURL behaves differently
Product: WebKit Reporter: Takashi Toyoshima <toyoshim>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED WONTFIX    
Severity: Normal CC: ap, bashi, brettw, ian, schenney, yutak
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 76198    

Description Takashi Toyoshima 2012-03-02 10:38:37 PST
WebSocket uses KURL to validate URL.
But, KURL in Chromium using googleurl behaves differently from Safari.

http://samples.msdn.microsoft.com/ietestcenter/#websockets

The white space (%20) is handled as is in Safari, and escaped like '%20' in Chrome.

[Safari]
> ws = new WebSocket('ws://foo bar/')
x Invalid url for WebSocket ws://foo bar
x |> DOMException

[Chrome]
> ws = new WebSocket('ws://foo bar/')
  |> WebSocket
> ws.url
  "ws://foo%20bar/"

We just verity the url as

m_url = KURL(KURL(), url);
if (!m_url.isValid()) {
  ...
Comment 1 Takashi Toyoshima 2012-03-08 11:19:12 PST
I chat about this issue with Brett.

>Brett,
Sorry, I said that I tried url containing space in path, but actually i tried space in host.

Anyway, this escape is intended in Chromium port.
So, if WebSocket requires additional error check, we should implement own checker.

I filed another bug to introduce WebSocket own URL validator.
https://bugs.webkit.org/show_bug.cgi?id=80616