WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
63262
REGRESSION: EventSource fails to connect if Content-Type header has a charset attribute
https://bugs.webkit.org/show_bug.cgi?id=63262
Summary
REGRESSION: EventSource fails to connect if Content-Type header has a charset...
goberman
Reported
2011-06-23 10:01:24 PDT
This is regression of
https://bugs.webkit.org/show_bug.cgi?id=45372
that was fixed for a while, but now broken again in the nightly build 89520. Used to work in Chrome for months, but broken in the latest Chrome...
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2011-06-23 10:05:23 PDT
Do you have a test case that you could share with us? It can't be all broken, since we have regression tests for this behavior. Or if you can't share a test, maybe you could attach a packet trace (from tcpdump or Wireshark)?
goberman
Comment 2
2011-06-23 10:21:21 PDT
SERVER: package test; import java.io.IOException; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class WebFrameworkServletEventSource extends HttpServlet { private SimpleDateFormat formatter = new SimpleDateFormat("hh:mm:ss"); public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Begin for session: " + request.getSession(true).getId() + " " + response.getWriter()); response.setHeader("pragma", "no-cache,no-store"); response.setHeader("cache-control", "no-cache,no-store,max-age=0,max-stale=0"); response.setHeader("Connection", "close"); response.setContentType("text/event-stream"); PrintWriter out = response.getWriter(); int messagesSent = 0; while (true) { out.print("data: "); out.print("{\"m\":8448,\"r\":0,\"e\":1,\"s\":[\"BAC.\",0],\"f\":[[0,6,3993,2],[55,6,1185,2],[54,6,3218,2],[5,6,6617,2],[52,4,15],[12,6,1700,2]]}"); out.print("\n\n"); out.flush(); messagesSent++; try { Thread.sleep(2000); } catch (InterruptedException e1) { } } } } CLIENT: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd
"> <html> <head> <title>test</title> </head> <body> <input type="button" value="TEST" onclick="test(); return false;" /> <script type="text/javascript"> var domElement; var messagesProcessed = 0; var eventSrc; function test() { domElement = document.getElementsByTagName('body')[0]; debug('connect'); try { eventSrc = new EventSource('
http://{ADDRESS}/Test/Controller
'); } catch (e) { debug('exception'); } eventSrc.onopen = function (event) { debug('open ' + event.type); }; eventSrc.onerror = function (event) { debug('error ' + event.type); }; eventSrc.onmessage = function (event) { var data = event.data; debug(event.type + ' ' + data); }; } function debug(message) { var oText = document.createTextNode(message); var oDiv = document.createElement('div'); oDiv.appendChild(oText); domElement.insertBefore(oDiv, domElement.hasChildNodes() ? domElement.childNodes[0] : null); } </script> </body> </html> WEB.XML <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "
http://java.sun.com/dtd/web-app_2_3.dtd
"> <web-app> <servlet> <servlet-name>Controller</servlet-name> <servlet-class>test.WebFrameworkServletEventSource</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Controller</servlet-name> <url-pattern>/Controller</url-pattern> </servlet-mapping> </web-app> WIRESHARK TRACE: GET /Test/Controller HTTP/1.1 Host: 172.16.16.250 Connection: keep-alive Referer:
http://172.16.16.250/Test/web/StreamingEventSourceTest.html
Cache-Control: no-cache User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.100 Safari/534.30 Accept: text/event-stream Accept-Encoding: gzip,deflate,sdch Accept-Language: en-US,en;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Set-Cookie: JSESSIONID=BB8BAD8227976D3032225DEB90FE99BB; Path=/Test; HttpOnly pragma: no-cache,no-store cache-control: no-cache,no-store,max-age=0,max-stale=0 Connection: close Content-Type: text/event-stream;charset=ISO-8859-1 Transfer-Encoding: chunked Date: Thu, 23 Jun 2011 17:15:34 GMT 81 data: {"m":8448,"r":0,"e":1,"s":["BAC.",0],"f":[[0,6,3993,2],[55,6,1185,2],[54,6,3218,2],[5,6,6617,2],[52,4,15],[12,6,1700,2]]} 81 data: {"m":8448,"r":0,"e":1,"s":["BAC.",0],"f":[[0,6,3993,2],[55,6,1185,2],[54,6,3218,2],[5,6,6617,2],[52,4,15],[12,6,1700,2]]}
Alexey Proskuryakov
Comment 3
2011-06-23 10:35:57 PDT
Thank you!
> Content-Type: text/event-stream;charset=ISO-8859-1
That's correct behavior per HTML5 - only "UTF-8" (case insensitive) is allowed as charset value. Please re-open if this is unacceptable for you, and you would like to try and get the spec changed.
goberman
Comment 4
2011-06-23 12:32:59 PDT
This must have been implemented after
https://bugs.webkit.org/show_bug.cgi?id=45372
was fixed...
Alexey Proskuryakov
Comment 5
2011-06-23 12:42:54 PDT
Yes, that was
bug 56942
.
goberman
Comment 6
2011-06-23 14:32:52 PDT
Well, Tomcat sends ISO-8859-1 by default, to it broke our server app. We are not in prod, so it is not a huge deal, at least for us. Can someone explain what WebKit version a bug fix (
https://bugs.webkit.org/show_bug.cgi?id=56942
for example) landed on? I asked this question multiple times, but nobody seems to know. I know what WebKit version is is used by Chrome and Safari:
http://en.wikipedia.org/wiki/Safari_version_history
http://en.wikipedia.org/wiki/Google_Chrome
, but just cannot figure out how to match a bug to a WebKit version. Thanks
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug