Re: Pushing a large file to HTTP 1.0 clients without chunked transfer encoding
- From: "W. Michael Petullo" <mike flyn org>
- To: "Dan Winship" <danw gnome org>
- Cc: libsoup-list gnome org
- Subject: Re: Pushing a large file to HTTP 1.0 clients without chunked transfer encoding
- Date: Wed, 18 Feb 2009 22:06:11 -0500 (EST)
>> The solution I'd like to use is to set "Connection: Close" in the HTTP
>> header and then just skip the "Content-Length" header. Then, I should be
>> able to write to the connection byte by byte. This seems compliant with
>> HTTP 1.0 as RFC 1945 seems to state that the Content-Length is optional
>> for HTTP responses.
>>
>> Does the libsoup API allow me to do something like this?
>
> Hm... you ought to be able to do this, but looking at the code, it seems
> like the HTTP I/O code doesn't actually deal correctly with the
> "response body ends with connection close" case. (Now filed as
> http://bugzilla.gnome.org/show_bug.cgi?id=572153.)
>
> Do you know in advance how large the response is going to be? If so, you
> can use Content-Length, but provide the response a little bit at a time
> instead of all at once. Do this from your SoupServer handler:
>
> soup_message_headers_set_content_length (msg->response_headers,
> total_length);
> soup_message_body_set_accumulate (msg->response_body, FALSE);
I only know the final stream size when I don't have to transcode the
stream. Right now I'd like to get the easy case working (i.e., when I do
know the stream size).
This is what I am trying. I already had the chunked encoding working
previously. I tried removing "soup_message_headers_set_encoding (...,
SOUP_ENCODING_CHUNKED)" and adding
"soup_message_headers_set_content_length (...)." Something is not working
right, though. Once I made this change, the file provided by the server
was received corrupted.
I tested a few variations using curl as my HTTP client with the following
results (the last is the only one that worked):
Normal (not chunked) transfer encoding
Call of soup_message_headers_set_content_length ()
Set Content-Length using soup_message_headers_append ()
CORRUPT RECEPTION
Normal (not chunked) transfer encoding
NO call of soup_message_headers_set_content_length ()
Set Content-Length using soup_message_headers_append ()
CORRUPT RECEPTION
Normal (not chunked) transfer encoding
NO call of soup_message_headers_set_content_length ()
DO NOT set Content-Length using soup_message_headers_append ()
CORRUPT RECEPTION
Chunked transfer encoding
Call of soup_message_headers_set_content_length ()
Set Content-Length using soup_message_headers_append ()
CORRUPT RECEPTION
Chunked transfer encoding
NO Call of soup_message_headers_set_content_length ()
Set Content-Length using soup_message_headers_append ()
RECEPTION NOT CORRUPT
Could this be a bug in libsoup? Is anyone else using
soup_message_body_append () without using chunked transfer encoding?
Mike
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]