Yes - that's it. Thank you very much. I didn't read the chapter about message 
headers in the spec careful enough.

Kind regards,

Michael 

-----Ursprüngliche Nachricht-----
Von: Alexey Panchenko [mailto:[email protected]] 
Gesendet: Dienstag, 24. April 2012 11:56
An: HttpClient User Discussion
Betreff: Re: How to test compressed response

Just don't add spaces in the beginning of the lines.

On Tue, Apr 24, 2012 at 16:52,  <[email protected]> wrote:
> No - doesn't work (just forgot to mention it in my post).
> I did it after my last header field "Content-Length:".
>
> Kind regards,
>
> Michael
>
> -----Ursprüngliche Nachricht-----
> Von: Sam Crawford [mailto:[email protected]]
> Gesendet: Dienstag, 24. April 2012 11:20
> An: HttpClient User Discussion
> Betreff: Re: How to test compressed response
>
> You need two CRLF after your final HTTP header. So try using:
>
> +" Content-Encoding: gzip\r\n\r\n";
>
> Thanks,
>
> Sam
>
>
> On 24 April 2012 10:14,  <[email protected]> wrote:
>> My fault. After adding the necessary CRLF it works.
>> String sHeader = "HTTP/1.1 200 OK\r\n"
>>                           +" Server: Apache\r\n"
>>                           +" Content-Type: text/html\r\n"
>>                           +" Content-Encoding: gzip\r\n";
>>
>> But when I receive the response I have only one header containing all header 
>> fields together [Server: Apache Content-Type: text/html Content-Encoding: 
>> gzip] and I can't iterate nor pick a special header out. I guess in my 
>> example above I should have at least three headers. Something else what I 
>> did wrong?
>>
>> Kind regards,
>>
>> Michael
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Fankanowsky, Michael
>> Gesendet: Montag, 23. April 2012 10:33
>> An: [email protected]
>> Betreff: How to test compressed response
>>
>> Hi all,
>>
>> I just want to test the handling of compressed responses. I have some java 
>> code which can do the compression of content and which listens to http get 
>> requests. But I actually have no idea how to send the response respectively 
>> which streams/writers to use and how to combine the message header and the 
>> compressed content.
>> My last try was building a byteArray:
>>
>> int contentLength = 0;
>> v
>>
>> // parameter String message comes with call of method byte[] content 
>> = message.getBytes("ISO-8859-1"); byte[] compressedContent = new 
>> byte[1000]; byte[] bHeader; byte[] response; int numOfBytes;
>>
>> Deflater def = new Deflater(Deflater.BEST_COMPRESSION);
>> def.setInput(content);
>> def.finish();
>> contentLength = def.deflate(compressedContent); sHeader += "
>> Content-Length: "+contentLength; bHeader = 
>> sHeader.getBytes("ISO-8859-1"); numOfBytes = bHeader.length + 
>> compressedContent.length; response = new byte[numOfBytes]; 
>> System.arraycopy(bHeader, 0, response, 0, bHeader.length); 
>> System.arraycopy(compressedContent, 0, response,
>>                 bHeader.length, compressedContent.length);
>>
>> But on client side I receive a ClientProtocolException: Invalid header.
>>
>> Any hints?
>>
>> Kind regards,
>>
>> Michael
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to