Re: Query about the content-length value while content-encoding is set to gZip..



On 11/22/2011 05:32 AM, sukanya c wrote:
> The issue is When the response is received in the form of chunks, it is
> difficult to predict the response content size much before all the
> chunks received. This requires the application to allocate & reallocate
> memory to copy each response chunk .

You don't need to gather the response body yourself; you can just read
it out of msg->response_body.data after the message has completed.
got-chunk is generally intended for if you are processing each chunk as
it arrives, and don't care about having the data all in one place at the
end.

> Why not Libsoup set the Content-length with the resulting size of
> decompressed content?

In the general case, there is no way for it to know that, although for
gzip coding in particular, the uncompressed length is stored in the gzip
header, so it would be possible to expose that information after it has
read the first chunk... we could add new API for that if you needed it.
If so, file a bug at bugzilla.gnome.org requesting that please.

-- Dan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]