Hello,

I am  using Tomcat 6.0.20 on Ubuntu 10.04 and have written a simple 
TomcatWeatherServlet as presented in 
http://www.ibm.com/developerworks/web/library/wa-cometjava/ I modified the 
servlet to stream weather feed to multiple curl clients. I am using curl 7.21.6 
as my client.

When I run curl -i -k -v -trace 
https://<IP_Addr>:8443/Weather<https://%3cIP_Addr%3e:8443/Weather> from the 
command-line I get the following response for the first few times:

<code>
$ curl -i -k -v -trace https://<IP_Addr>:8443/Weather
* About to connect() to <IP_Addr> port 8443 (#0)
*   Trying <IP_Addr>... connected
* Connected to <IP_Addr> (<IP_Addr>) port 8443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*              subject: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*              start date: 2009-02-23 23:07:18 GMT
*              expire date: 2019-02-21 23:07:18 GMT
*              common name: XXXXXXXXXX (does not match '<IP_Addr>')
*              issuer: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*              SSL certificate verify result: self signed certificate (18), 
continuing anyway.
> GET /Weather HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k 
> zlib/1.2.3.3 libidn/1.15
> Host: <IP_Addr>:8443
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
Server: Apache-Coyote/1.1
< Content-Length: 0
Content-Length: 0
< Date: Wed, 29 Jun 2011 23:40:17 GMT
Date: Wed, 29 Jun 2011 23:40:17 GMT

<
* Connection #0 to host <IP_Addr> left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
</code>

Observe that Content-Length is 0 in the response. Also when I do get the 
expected response which is,

<code>
> GET /Weather HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k 
> zlib/1.2.3.3 libidn/1.15
> Host: <IP_Addr>:8443
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
Server: Apache-Coyote/1.1
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Wed, 29 Jun 2011 23:46:18 GMT
Date: Wed, 29 Jun 2011 23:46:18 GMT

<
<h2>Conditions for San Jose, CA at 3:52 pm PDT</h2>
<img src="http://l.yimg.com/a/i/us/we/52/30.gif"/><br />
<b>Current Conditions:</b><br />
Partly Cloudy, 68 F<BR />
<BR /><b>Forecast:</b><BR />
Wed - Mostly Clear. High: 70 Low: 55<br />
Thu - Partly Cloudy. High: 77 Low: 57<br />
<br />
<a 
href="http://us.rd.yahoo.com/dailynews/rss/weather/San_Jose__CA/*http://weather.yahoo.com/forecast/USCA0993_f.html";>Full
 Forecast at Yahoo! Weather</a><BR/><BR/>
(provided by <a href="http://www.weather.com"; >The Weather Channel</a>)<br/>
<br>

</code>
I get Transfer-Encoding as chunked and no Content-Length.

On Server logs I get for the error are:
16:40:16.916  INFO http-8443-exec-3 TomcatWeatherServlet:41 - Begin for 
session: BDD6B1808161F1DA99D5D3207F1A719B
16:40:16.959  INFO http-8443-exec-4 TomcatWeatherServlet:48 - End for session: 
BDD6B1808161F1DA99D5D3207F1A719B
16:40:17.033  INFO http-8443-exec-4 TomcatWeatherServlet:48 - End for session: 
BDD6B1808161F1DA99D5D3207F1A719B

This was working when I was on HTTP. I have tried to debug this for a lot of 
time w/o success. Also I get two END events instead of one as seen in the Logs. 
 Any insights will be helpful.

Thanks,
Sudeep

Reply via email to