We use udpxy to convert multicast stream into HTTP and play it with Motorola KreaTV set-top-box.
The problem is that the STB first make a HEAD request, then if the response is ok, a GET request.
And udpxy doesn't work properly.
Here is the problem:
The function get_request in rparse.c returns error code 1 when the request doesn't start with "GET /".
const char HEAD[] = "GET /";
/* ... */
p = strstr( src, HEAD );
if( NULL == p ) return 1; /* no header */
In our case the request starts with "HEAD /" and the get_request returns 1.
But in read_command (udpxy.c) only an error code -1 is expected.
rc = get_request( httpbuf, (size_t)hlen, request, &rlen );
if( rc == -1 ) return rc;
So udpxy assumes that there is no error and proceed streaming.
Which request does it use? Since the request variable is static and get_request doesn't update it
(it returns early) udpxy streams from the last multicast address used.
I made a quick fix that works in my situation, but a more general approach is needed.
Current HTTP request handling is overly simplistic and will be revised. Thank you for your input.