sockjs-tornado icon indicating copy to clipboard operation
sockjs-tornado copied to clipboard

Wrong content length header

Open herzaso opened this issue 9 years ago • 1 comments

Server: Tornado 4.2.1 and sockjs 1.0.2 Client: Javascript, Firefox

I'm trying to establish a realtime connection from a local file (file:///) to a remote server. The response headers I get from a call to "http://://info?t=1444720615830" are:

Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Cache-Control: no-store, no-cache, must-revalidate, max-age=0 Content-Length: 87 Content-Type: application/json; charset=UTF-8 Date: Tue, 13 Oct 2015 07:17:08 GMT Etag: "eef3578f083ee9ef36b811fe004fbd996ac00192" Server: TornadoServer/4.2.1

while in the response body I get "SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data"

I Firefox developer tools, there is a button to "Edit and Resend" a request and when I do it (resend without editing" I get a different response headers:

Access-Control-Allow-Credentials: true Access-Control-Allow-Origin: * Cache-Control: no-store, no-cache, must-revalidate, max-age=0 Content-Length: 85 Content-Type: application/json; charset=UTF-8 Date: Tue, 13 Oct 2015 07:21:52 GMT Etag: "529027274ad34b6e2600bbfb60e10e7322506ea0" Server: TornadoServer/4.2.1

(I marked the differences in bold)

The response body of the resent request is now a valid JSON object {origins: [':'], websocket: true, cookie_needed: true, entropy: 16239493526095616}

Am I missing something or is there a problem with the content length?

herzaso avatar Oct 13 '15 07:10 herzaso

It appears that this issue is that same as issue #177 After overriding the preflight with Access-Control-Allow-Origin=null, it works (no relation to the content length)...

herzaso avatar Oct 13 '15 12:10 herzaso