Re: Quick question regarding recent SOUP_ENCODING_EOF code



W. Michael Petullo wrote:
> I think I figured this out. I was sending a Content-Length in the header,
> despite using EOF/chunked encoding. I did this in order to support a
> broken client. I used the generic soup_message_headers_append() function,
> so I had thought it would sneak by libsoup. Would it be appropriate to
> have libsoup ignore this header when in EOF encoding mode?

The problem is, if you include a Content-Length header, then you're
*not* in EOF mode. Even if you could get libsoup to close the connection
at the point you wanted, the client is still going to expect to see
exactly as many bytes as you indicated in the Content-Length header. If
you keep writing after that point, the client won't see the extra bytes
(and might consider them to be the response to its next request) and if
 you close the connection before that point, the client will consider
that to be an error (and will probably pop up some sort of "connection
unexpectedly disconnected" error dialog rather than considering the song
to have finished playing successfully).

If you want to play around with this anyway, it looks like you can trick
libsoup by adding whitespace to the end of the Content-Length value that
you're setting via soup_message_headers_append. This will cause it to
send the Content-Length header (and hopefully iTunes won't care about
the extra whitespace?) but internally it will still think it's in EOF
mode...

-- Dan


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