Re: How to receive mp3 stream in UPNP media renderer using libsoup?



Thank you for the feedback.

So, I ll start with soup_session_send_async(), inspect the received HTTP headers there, and then use soup_session_send_finish() to process the stream, and this should not block any other work being done in my current GMainLoop, right?

On 08.08.2016 15:29, Jens Georg wrote:
> the canonical way to do that is to do a HEAD request with all required request headers first.

I recently stumbled upon a Stackoverflow question saying that, according to Section 14.13 of the HTTP/1.1 spec, it is allowed to omit Content-Length header, and I'm afraid that there might be "lazy" UPNP servers which do not return Content-Length for HEAD requests (or do not return it at all in some specific cases, like live streaming etc.).

Therefore I am preparing myself for a workaround to do GET request and then drop the connection, in case I can't find any way to proceed at all.

In case if I don't want to receive the message body, can I just call g_input_stream_close() on the soup_session_send_finish() stream to make libsoup properly terminate the underlying HTTP connection?

And two more questions:

- what will happen if the connection gets interrupted while my program is processing the soup_session_send_finish() stream and how to clean up the GInputStream and SoupSession state after such failures, so I could retry to connect again?

- does the stream returned by soup_session_send_finish() also deal with `transfer-encoding chunked` transparently?

Martin


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