HttpClient and Grizzly Comet Server
"이희승 (Trustin Lee)"
trustin at gmail.com
Mon Jun 1 00:58:26 EDT 2009
Hi César,
On 01-Jun-2009 09:16, César Fernando Henriques wrote:
> Hi,
>
> I'm working with the HttpClient example connecting to a Grizzly Comet
> Server that send data back to the client in a persistent connection
> every a specified amount of time or when a specific event is
> dispatched.
>
> I'm testing with IExplorer and Firefox and the server works pretty
> well. Now I'm trying connecting with the Netty HttpClient and I just
> can receive the first message (Http Header) without content.
>
> I'm using the HttpClient from the netty examples packages untouched
> (just added SSL support).
>
> Doing a telnet to port 80 I can start receiving data.
>
> If you want to see what I need to replicate open these url in the browser:
>
> https://proxy.alttab.com.ar/login/daemon
>
> and in a separate window
>
> https://proxy.alttab.com.ar/mobile/access
>
> I'm very new to Netty, so probably I'm missing something.
I think it's a bug in Grizzly Comet Server. If I send the request in
HTTP/1.1, then it works fine. Just replace the version string in the
HttpClient.java with HTTP_1_1, then it will work as you expect:
---- LOG BEGINS ----
$ telnet proxy.alttab.com.ar 80
Trying 190.19.106.99...
Connected to proxy.alttab.com.ar.
Escape character is '^]'.
GET /mobile/access HTTP/1.1
Host: proxy.alttab.com.ar
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=3951342630233082416; Path=/
Content-Type: text/plain; charset=iso-8859-1
Transfer-Encoding: chunked
Date: Mon, 01 Jun 2009 04:36:41 GMT
1b
Data:data desde el daemon
---- LOG ENDS ----
However, if the client sends HTTP/1.0, the server neither closes the
connection nor sends the chunked content nor sends the content-length in
the header. That was why you were not receiving data with Netty.
---- LOG BEGINS ----
$ telnet proxy.alttab.com.ar 80
Trying 190.19.106.99...
Connected to proxy.alttab.com.ar.
Escape character is '^]'.
GET /mobile/access HTTP/1.0
Host: proxy.alttab.com.ar
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=3806627106805071482; Path=/
Content-Type: text/plain; charset=iso-8859-1
Date: Mon, 01 Jun 2009 04:53:29 GMT
Connection: close
Data:data desde el daemon
---- LOG ENDS ----
I've just updated the HttpClient example so that it sends HTTP/1.1
instead of HTTP/1.0 at HttpClient.java:91, and it works just fine.
HTH,
Trustin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20090601/732fd0f8/attachment.bin
More information about the netty-users
mailing list