Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atmosphere generates nonstandard HTTP headers #1900

Closed
winstonleedev opened this issue Mar 16, 2015 · 1 comment
Closed

Atmosphere generates nonstandard HTTP headers #1900

winstonleedev opened this issue Mar 16, 2015 · 1 comment

Comments

@winstonleedev
Copy link

According to RFC 2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html), HTTP status line and header lines must be separated with CRLF line ending. For example a response from Google (lines end with "0d 0a", or "\r\n")

00000000  48 54 54 50 2f 31 2e 31  20 33 30 32 20 46 6f 75 HTTP/1.1  302 Fou
00000010  6e 64 0d 0a 43 61 63 68  65 2d 43 6f 6e 74 72 6f nd..Cach e-Contro
00000020  6c 3a 20 70 72 69 76 61  74 65 0d 0a 43 6f 6e 74 l: priva te..Cont
00000030  65 6e 74 2d 54 79 70 65  3a 20 74 65 78 74 2f 68 ent-Type : text/h
00000040  74 6d 6c 3b 20 63 68 61  72 73 65 74 3d 55 54 46 tml; cha rset=UTF
00000050  2d 38 0d 0a 4c 6f 63 61  74 69 6f 6e 3a 20 68 74 -8..Loca tion: ht
00000060  74 70 3a 2f 2f 77 77 77  2e 67 6f 6f 67 6c 65 2e tp://www .google.
00000070  63 6f 2e 6b 72 2f 3f 67  66 65 5f 72 64 3d 63 72 co.kr/?g fe_rd=cr

But currently, atmosphere separate header lines with line with "\n" only.

00000000  48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0a HTTP/1.1  200 OK.
00000010  43 6f 6e 74 65 6e 74 2d  54 79 70 65 3a 61 70 70 Content- Type:app
00000020  6c 69 63 61 74 69 6f 6e  2f 6a 73 6f 6e 0a 58 2d lication /json.X-
00000030  xx xx xx xx xx xx xx xx  2d 54 69 6d 65 73 74 61 XXXXXXXX -Timesta
00000040  6d 70 3a 31 34 32 36 32  32 34 35 34 38 32 36 36 mp:14262 24548266
00000050  0a 54 72 61 6e 73 66 65  72 2d 45 6e 63 6f 64 69 .Transfe r-Encodi
00000060  6e 67 3a 63 68 75 6e 6b  65 64 0a 58 2d 41 74 6d ng:chunk ed.X-Atm
00000070  6f 73 70 68 65 72 65 2d  66 69 72 73 74 2d 72 65 osphere- first-re

Java-based application would happily ignore this, but it will became a problem when used with a .net client, since Microsoft's HTTP parser implementation will throw an exception if the header doesn't match the mentioned RFC's specification.

I think we should follow the standard and save the .net developers from some googling. Since the fix for this problem is trivial (modify several lines in AtmosphereResource.java) and there's no drawback, I went ahead and created pull request #1901 . Please review when you have time :)

@jfarcand
Copy link
Member

Fixed by #1901

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants