Il 28/01/2013 16:07, Oleg Kalnichevski ha scritto:
On Mon, 2013-01-28 at 12:34 +0100, Zanelli Franco wrote:
> hi to all,
> my device for each http request, returns a response that provides
more bytes than specified with Content-Length header. I can know the amount of
additional bytes, but I don't know how to tell to httpclient.
> Can you please help me?
> Should I change the content length strategy implementing a new
ContentLengthStratecy class? is it possible?
>
> thank you
> greetings
>
>
I would very strongly to recommend you to not misuse HTTP protocol and
do not create HTTP services that grossly violate the specification.
Please consider making your code generate properly delineated message
and pass whatever additional custom information your particular
application requires in a custom header such as 'X-My-Content-Length: 20
bytes shorter or whatever'.
Oleg
PS: yes, it is definitely possible to plug-in a custom
ContentLengthStrategy implementation. It is somewhat easier with 4.3
APIs and slightly more difficult with 4.2 APIs.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Thanks for your fast reply.
Honestly I didn't understand how to force httpclient to consider my custom
content length and not the one specified in device response.
By the way, can you suggest me where can i find a sample code to change
ContentLengthStrategy or resolve my issue, please?
Thank you very much