tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Schumacher <felix.schumac...@internetallee.de>
Subject Re: Transfer-Encoding: chunked not working
Date Fri, 06 Dec 2013 06:57:00 GMT




"C. Benson Manica" <cbmanica@gmail.com> schrieb:
>On Thu, Dec 5, 2013 at 10:58 AM, Christopher Schultz <
>chris@christopherschultz.net> wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>> C.,
>>
>> On 12/5/13, 12:53 PM, C. Benson Manica wrote:
>> > The content I expect is in the neighborhood of 30K. What I get back
>> > is
>> >
>> > $ curl -i http://localhost:8080/
>> >
>> > HTTP/1.1 200 OK^M Server: Apache-Coyote/1.1^M Set-Cookie:
>> > JSESSIONID=6ED488F581B8D3317261ADA2AD97CC20; Path=/; HttpOnly^M
>> > Content-Type: text/html;charset=UTF-8^M Transfer-Encoding:
>> > chunked^M Date: Thu, 05 Dec 2013 17:47:22 GMT^M ^M
>> >
>> >
>> > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
>> > http://www.w3.org/TR/html4/loose.dtd"> <!-- intervening content
>> > elided --> var s
>>
>> Unfortunately, curl appears to be "handling" the content for you. I
>> think you want to look at the raw bytes coming back.
>>
>> I can't remember if I installed it myself or what, but you might have
>> tcpdump on your machine already. Try this:
>>
>> $ sudo tcpdump -Xi lo0 src port 8080
>>
>
>I got this back: (apologies if the fixed-width formatting doesn't come
>through)
>
>16:34:44.954734 IP6 localhost.http-alt > localhost.61592: Flags [P.],
>seq
>1:9001, ack 146, win 9166, options [nop,nop,TS val 266717589 ecr
>266717588], length 9000
>  0x0000:  600e be82 2348 0640 0000 0000 0000 0000  `...#H.@........
>  0x0010:  0000 0000 0000 0001 0000 0000 0000 0000  ................
>  0x0020:  0000 0000 0000 0001 1f90 f098 239d 52e7  ............#.R.
>  0x0030:  95db ddf9 8018 23ce 2350 0000 0101 080a  ......#.#P......
>  0x0040:  0fe5 c995 0fe5 c994 4854 5450 2f31 2e31  ........HTTP/1.1
>  0x0050:  2032 3030 204f 4b0d 0a53 6572 7665 723a  .200.OK..Server:
>  0x0060:  2041 7061 6368 652d 436f 796f 7465 2f31  .Apache-Coyote/1
>  0x0070:  2e31 0d0a 5365 742d 436f 6f6b 6965 3a20  .1..Set-Cookie:.
>  0x0080:  4a53 4553 5349 4f4e 4944 3d38 4533 4637  JSESSIONID=8E3F7
>  0x0090:  4631 4131 4542 4537 3733 3341 3943 3146  F1A1EBE7733A9C1F
>  0x00a0:  3846 4142 4436 3630 3333 453b 2050 6174  8FABD66033E;.Pat
>  0x00b0:  683d 2f3b 2048 7474 704f 6e6c 790d 0a43  h=/;.HttpOnly..C
>  0x00c0:  6f6e 7465 6e74 2d54 7970 653a 2074 6578  ontent-Type:.tex
>  0x00d0:  742f 6874 6d6c 3b63 6861 7273 6574 3d55  t/html;charset=U
>  0x00e0:  5446 2d38 0d0a 5472 616e 7366 6572 2d45  TF-8..Transfer-E
>  0x00f0:  6e63 6f64 696e 673a 2063 6875 6e6b 6564  ncoding:.chunked
>  0x0100:  0d0a 4461 7465 3a20 4672 692c 2030 3620  ..Date:.Fri,.06.
>
>... much redaction ...
>
>  0x1df0:  426f 6f6c 6561 6e28 7363 7269 7074 2e64  Boolean(script.d
>  0x1e00:  6f6e 6529 3b0a 2020 2020 7661 7220 730d  one);.....var.s.
>  0x1e10:  0a30 0d0a 0d0a                           .0....
>
>So it looks like Tomcat is, for some reason, only sending one chunk,
>which
>is truncated at an arbitrary point in the output.

Could this arbitrary point be an buffer boundary?  Maybe your servlet is causing tomcat to
throw an exception an since the response is committed it will not be able to show a proper
error page nor can it revoke the sent bytes.

Have you looked for errors or exceptions in all log files? 

Regards
 Felix
>
>>
>> This will dump everything. You'll need to read a bit to see all the
>> headers. You might also want to read-up on chunked transfer-encoding.
>>
>
>Based on my rudimentary understanding, Tomcat should be sending
>multiple
>chunk-encoded chunks here, right?
>
>>
>> > I'm not using a tool to inspect traffic, because if it becomes
>> > that troublesome to debug a default install, I'm probably just
>> > going to use jetty. (full disclosure: I *am* now using jetty, with
>> > the same web application, and not running into any issues, so
>> > whatever's going on is in Tomcat world.)
>>
>> Can you perhaps reduce the problem to something you could share with
>> us? Maybe someone on the list would be willing to do all that work so
>> that Tomcat can get fixed, assuming there is a problem.
>>
>
>Possibly, but I'm not sure I'd succeed in reproducing the issue, given
>that
>another gentleman has already made the attempt. I'm hypothesizing at
>this
>point that there might be some obscure interaction between the default
>Tomcat installation and the settings and environment that my IDE is
>using
>to launch Tomcat and the web application. If I get a chance, I'll try
>to
>put together a simple web app and post it here if I can reproduce the
>problem. Thanks for the assistance - in the meantime, however, given
>that
>I've gotten this to work with Jetty, I need to get back to wrangling
>with
>the app itself.
>
>
>>
>> > In answer to your meta-question, brew seemed to do a reasonable job
>> > with Tomcat, modulo this issue. I don't know that
>> > /usr/local/Cellar/tomcat/7.0.47/libexec makes 100% sense for
>> > $TOMCAT_HOME, but at least everything's in the same place.
>>
>> Good to know.
>>
>> - -chris
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.15 (Darwin)
>> Comment: GPGTools - http://gpgtools.org
>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>
>> iQIcBAEBCAAGBQJSoMzHAAoJEBzwKT+lPKRYV+AQAL2IEEnamhh8TsEes0BChuPl
>> uIkhrHM5i8f3OKQ6Gx4QP2aYJcjPcWg+1aGf/O7TdJsYTiWn9lQVunBfivZxtDYg
>> ABBlu3oqiOPjv/gZWbDy6adwwpCnWG8JPV4eiLtI1K3jHiu/XDABPQH1asw0uYXV
>> 6NsY9cLfJsMe0WKa2IJoYDabrE0LXOo7v4jLdz3TLARQ50W8RWwqhxxJrme8hSe/
>> elCI7u2bLF93WTtWEjS6XZYDA///N54IvR1wjBDwjWAw/z5Zy+/25/RS+w3QGVDe
>> tW51wxE0xI0Rqk44U+Kt3vi3iYp6+2CNmrT3ZnT9UzSVWmBRjM13E+tvdjiv7VLA
>> gj+vGvRgEEtJecA3Di4+NlDsocxj865m3jEZqXDOKU1avoWDLWiIew1Ihb9qXpjU
>> pFUZNFy+kgYnP8QBXnjW3DcJHhU43Jhb5UP1QazVDml1ZQlbX4KUwgiPOLiCr6mz
>> VI58FUb3HZKSfyqB4xzt60TDJ7IexWq9PkjcF6wh9wkZtTMO4jV3Est7JAXcuz2w
>> EmKp9l1/hmqKF487PHiQodIQuiK3Yis+W8cjGvubVV/vjsQ/rlFCSrt1uIbUfhoO
>> aZ8QsBVL7UlpS3X1yqAnKPPUb84VtLteRK/DVzI13Nvxs9+KepOc68qlMZCJaXQv
>> UNZgZmunwk6o6hiBHKe2
>> =bQW3
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message