libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] MHD_add_connection multiple requests


From: Wolfgang Haupt
Subject: Re: [libmicrohttpd] MHD_add_connection multiple requests
Date: Thu, 02 Jan 2014 19:56:44 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130219 Thunderbird/17.0.3

Dear Christian,

thank you very much for your fast reply.

I guess my problem is that the connection where I get the first GET request is still sending data, while the Mediaplayer is requesting another range of data. This is usually OK if the client can establish the connections, because it just uses a new connection for the second (and all following) GETs.

   your solution (HTTP with connection reversal is usually
   a pretty insane thing to try as a solution for NAT in my
   book).
Sounds bad for me, this is exactly what I wanted to do...

I know that MHD does not handle range-requests itself, I already managed to parse the range request add the right accept-ranges and send the correct data when there's no NAT between my server and the client.

Do you know of any alternativ approaches to solve such a problem?



Kind Regards,
Wolfgang
On 01/02/2014 07:43 PM, Christian Grothoff wrote:
Dear Wolfgang,

You might be confusing a few issues here.

1) if you get the first request, the problem is unlikely to
   be NAT-related.  Similarly, MHD_add_connection is most
   likely not the answer to your problem.  Unless, of course,
   you are already using that function to deal with NAT in
   the first place, in which case you should elaborate on
   your solution (HTTP with connection reversal is usually
   a pretty insane thing to try as a solution for NAT in my
   book).
2) I'm not sure why you do not get the 2nd 'GET' request,
   short of having crashed / misbehaved during the first one.
   You only say what your client generates, but what would
   be interesting to know is what you get behind the NAT
   (in terms of traffic) and what exactly you see at the API
   side.

Furthermore, from what you quote, you _may_ have a completely different
issue, which is that MHD itself does _not_ handle range requests.
That doesn't mean you cannot support range requests, but it is
the responsibility of the application to
1) set the 'Accept-Ranges' header in the response, and to
2) parse the range request and adjust the generated responses
   accordingly.

So unless your application does both, it is conceivable that
you're actually receiving the 2nd request, but are treating it just
like the 1st request (ignoring the range) and then the media player
is unlikely to like what it gets.



Happy hacking!

Christian


On 01/02/2014 07:08 PM, Wolfgang Haupt wrote:
Hi,

I face following situation:

I wrote a very simple implementation of a webserver for handling
streaming of videos and music.
This works very well, now I need to handle the situation that this
server is behind a NAT firewall.
So I came up with the MHD_add_connection function.

I managed to get the first GET response from the media player, but I my
response-callback isn't called when the media player requests another
part of the current media item.

I imagine in "normal" daemon mode the player uses a new connection for
sending further GET-Requests, but in case of using MHD_add_connection
how can I do this?

Eg.:

Player:
HTTP GET
bytes=0-*

Server:
HTTP Partial Content
Range-Bytes=0-745125/745126

(following GET never comes across)
Player:
HTTP GET
bytes=245458-*

I did not find any hints for MHD_add_connection in the docs.
Can anyone help me here?

Thx and kind regards,
Wolfgang



reply via email to

[Prev in Thread] Current Thread [Next in Thread]