When my application running on chrome browser sends a pre-flight OPTIONS request before sending the POST to start the BOSH session, the server response to OPTIONS does not contain a Content-Length header. Although the response does not have any body and the Content length is 0, but despite this the response should contain the header Content-Length: 0
Because of the missing header the chrome's pre-flight request many a times remains in pending state.
Irrespective of this I think that every Http response should contain Content-Length.
When my application running on chrome browser sends a pre-flight OPTIONS request before sending the POST to start the BOSH session, the server response to OPTIONS does not contain a Content-Length header. Although the response does not have any body and the Content length is 0, but despite this the response should contain the header Content-Length: 0
Because of the missing header the chrome's pre-flight request many a times remains in pending state.
Irrespective of this I think that every Http response should contain Content-Length.
A sample request response is as following:
OPTIONS / HTTP/1.1
Host: sample.im:5280
Connection: keep-alive
Access-Control-Request-Method: POST
Origin: http://stanzapper.appspot.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Access-Control-Request-Headers: origin, content-type
Accept: /
Referer: http://stanzapper.appspot.com/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type
Access-Control-Max-Age: 86400
Server: Tigase Bosh/3.3.0.0
The response should contain the Content-Length header, along with the headers copied from bosh-extra-headers.txt
I tried to correct this in my local source code of tigase by changing the method prepareHeaders in BoshIOService.java as such:
@
public StringBuilder prepareHeaders(String data) {
@
the else is added by me, this seems to have taken care of the issue and BOSH works fine on chrome now.
Please fix this issue in the trunk of tigase as well.