-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Johan,

On 1/11/17 12:25 PM, Johan Basson wrote:
> I have a C++ client posting a json payload to Tomcat. The payload
> is GZIP encoded and the request is send in chunks. I have added a
> GZIP Filter to my application which wrappes the ServletInputStream
> into a GZIPInputStream.
> 
> The request spans multiple packets, so I'm getting only partial
> content. Do I need to buffer the request content until all the
> content has been received or does Tomcat do It for you?
> 
> The compressed payload is 42K spread over 3 requests.
> 
> Technical Details:
> 
> Tomcat: 8.5.5 Server OS: Linux
> 
> Client Request Headers:
> 
> Content-Type:application/json Transfer-Encoding: identity 
> Content-Encoding: gzip Content-Length: 41608 Accept:
> application/json Expect: 100-continue

Okay, so you are non-chunked-encoding (there is a Content-Length) with
a gzip Content-Encoding. You shouldn't have to unwrap this request at
all. If you do this:

byte[] buffer = new byte[4096];
InputStream in = request.getInputStream();
int count = in.read(buffer);

Then the bytes in the buffer should be your actual JSON. There
shouldn't be any reason to gunzip the data a second time.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYd7ZvAAoJEBzwKT+lPKRYhk8P+wSZN2C0IiY/j7abKRsM3ydi
ZgVBOCeGSK0gliAux2kxtmI7G0mcsS4yLjgQcAJszgNzBMDzBG9rlLLCMMeFx3J9
fb5Z3O5W0t1vBCE2Tax9y4vCvJhn3u9pcpvKdVGHHjqVWw+unK6UEDaJl1/JrERH
tsdAcoKqVSOiiVFiCqxv1Ok3KcMNe78G3jOGGzZSXFRSK7tYfy+qYfRfmWRgOuTJ
s1mTTw3XtLubQnP2kjl6/mA/5M+GxzKzgWL+RQVp0S95ptNbl0fukytAf5b6yaU7
VRMz6FBGuYZCelqhArpWCLpqgwveLk9cjdmwyYu+UtpKaWi4Y8qbUuZFXWCkdgnQ
Je70/NNjWDZuds/W6lN/cDKoSUQPXy+x1HQuqFnPwuEePltn3yMFK+/FifQx209L
Pc9AnhKX8L5n1pAV27TNXDB9LUBDV4eTdl3zEi795fAuUdBL4H7bqEoFvup64nkP
JnBUyFelJAbytzo41hiwEDsRvuJE0lE8AaCQ68bgrI6olYjxUY8nJToPGjzMzAsO
hylNZxX/sx/INPUWD0G7GafdLjOVLln5CkRP00lUB7qkp1p3p2DXPAOkuxfAtRBM
jJnQSpMpOkBmSR6X2LwapI/wdDSpVRu1lPct57PQc4OcX6gMhZKdFOl8/3TOSnsR
DATV35IuYhVDBZngoDyN
=lPh8
-----END PGP SIGNATURE-----

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

Reply via email to