<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>31659</bug_id>
          
          <creation_ts>2009-11-18 20:53:36 -0800</creation_ts>
          <short_desc>Connection must be closed in case of Web Socket handshake error</short_desc>
          <delta_ts>2009-11-30 15:49:43 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yuzo Fujishima">yuzo</reporter>
          <assigned_to name="Alexey Proskuryakov">ap</assigned_to>
          <cc>ap</cc>
    
    <cc>eric</cc>
    
    <cc>ukai</cc>
    
    <cc>yuzo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>164889</commentid>
    <comment_count>0</comment_count>
    <who name="Yuzo Fujishima">yuzo</who>
    <bug_when>2009-11-18 20:53:36 -0800</bug_when>
    <thetext>Currently, WebKit times out in case of Web Socket handshake error (as caught by LayoutTests/websocket/tests/handshake-error.html)

It must close the connection instead.

http://www.w3.org/TR/2009/WD-websockets-20091029/
4 The WebSocket interface
...
If the &quot;establish a Web Socket connection&quot; algorithm fails, it triggers the &quot;fail the Web Socket connection&quot; algorithm, which then invokes the &quot;close the Web Socket connection&quot; algorithm, which then establishes that the &quot;Web Socket connection is closed&quot;, which fires the close event as described below.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>164896</commentid>
    <comment_count>1</comment_count>
    <who name="Yuzo Fujishima">yuzo</who>
    <bug_when>2009-11-18 21:29:09 -0800</bug_when>
    <thetext>Note: this bug was found while examining:
https://bugs.webkit.org/show_bug.cgi?id=31465

Yuzo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>166781</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-11-26 13:03:34 -0800</bug_when>
    <thetext>I don&apos;t understand what exactly fails here. According to &lt;http://build.webkit.org/waterfall&gt;, all tests currently pass. Does this particular test have identical output in success and failure cases? Or does it only fail with a patch from bug 31465 applied?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>166797</commentid>
    <comment_count>3</comment_count>
    <who name="Yuzo Fujishima">yuzo</who>
    <bug_when>2009-11-26 16:43:55 -0800</bug_when>
    <thetext>Without 31465, the server calls a non-existent method, raises exception, and closes the socket.

With 31645, the server writes an invalid handshake response to the socket.

It seems that the client side can handle the socket closure case properly but not
the invalid response case -- the client times out for the latter.

Yuzo</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>166798</commentid>
    <comment_count>4</comment_count>
    <who name="Yuzo Fujishima">yuzo</who>
    <bug_when>2009-11-26 16:45:44 -0800</bug_when>
    <thetext>Sorry, s/31645/31465/g in #3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>167444</commentid>
    <comment_count>5</comment_count>
      <attachid>44045</attachid>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-11-30 15:44:49 -0800</bug_when>
    <thetext>Created attachment 44045
proposed fix</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>167445</commentid>
    <comment_count>6</comment_count>
      <attachid>44045</attachid>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2009-11-30 15:45:58 -0800</bug_when>
    <thetext>Comment on attachment 44045
proposed fix

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>167449</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2009-11-30 15:49:43 -0800</bug_when>
    <thetext>Committed &lt;http://trac.webkit.org/changeset/51516&gt;.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>44045</attachid>
            <date>2009-11-30 15:44:49 -0800</date>
            <delta_ts>2009-11-30 15:45:58 -0800</delta_ts>
            <desc>proposed fix</desc>
            <filename>didClose.txt</filename>
            <type>text/plain</type>
            <size>2543</size>
            <attacher name="Alexey Proskuryakov">ap</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA1MTUxNSkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTcgQEAKKzIwMDktMTEtMzAgIEFsZXhleSBQcm9za3VyeWFrb3YgIDxhcEBhcHBs
ZS5jb20+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAg
aHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTMxNjU5CisgICAgICAgIENv
bm5lY3Rpb24gbXVzdCBiZSBjbG9zZWQgaW4gY2FzZSBvZiBXZWIgU29ja2V0IGhhbmRzaGFrZSBl
cnJvcgorCisgICAgICAgIFRoZSBuZXR3b3JrIGNvbm5lY3Rpb24gd2FzIGNsb3NlZCwgYnV0IHRo
ZSBjbG9zZSBldmVudCB3YXNuJ3QgZGlzcGF0Y2hlZC4KKworICAgICAgICAqIHBsYXRmb3JtL25l
dHdvcmsvY2YvU29ja2V0U3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XBwZWQKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gTGF5b3V0VGVzdHMvcGxhdGZv
cm0vbWFjL1NraXBwZWQJKHJldmlzaW9uIDUxNTEwKQorKysgTGF5b3V0VGVzdHMvcGxhdGZvcm0v
bWFjL1NraXBwZWQJKHdvcmtpbmcgY29weSkKQEAgLTEwOCw2ICsxMDgsMyBAQCBwbHVnaW5zL3Jl
bG9hZHBsdWdpbnMtbm8tcGFnZXMuaHRtbAogCiAjIFRoZXNlIHRlc3QgcmVxdWlyZSBRdCBXaWRn
ZXRzCiBwbHVnaW5zL3F0LXF3aWRnZXQtcGx1Z2luLmh0bWwKLQotIyBTa2lwcGVkIHVudGlsIGh0
dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0zMTY1OSBpcyBmaXhlZC4KLXdl
YnNvY2tldC90ZXN0cy9oYW5kc2hha2UtZXJyb3IuaHRtbAo=
</data>
<flag name="review"
          id="25817"
          type_id="1"
          status="+"
          setter="oliver"
    />
          </attachment>
      

    </bug>

</bugzilla>