]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
http_recv: Fix reading of the HTTP OK message pattern.
authorAndre Noll <maan@systemlinux.org>
Sat, 22 Nov 2008 16:49:39 +0000 (17:49 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 22 Nov 2008 16:49:39 +0000 (17:49 +0100)
This bug leads to sound artefacts at the beginning of the
stream caused by calling recv_pattern() with a buffer size
larger than the HTTP OK message.

It may thus happen that the buffer used by recv_pattern() contains
not only the HTTP OK message but also the beginning of the stream.
Since that buffer is discarded by recv_pattern(), the first few
bytes of the stream are lost if this happens.

Fix it by passing the exact length of the HTTP OK message to
recv_pattern().

http_recv.c

index 2e518b2063a8c81946b27d971ad80f5fca3c070e..c7eb485a7797f282917c8c4d4b4d34889cba603b 100644 (file)
@@ -119,7 +119,7 @@ static void http_recv_post_select(struct sched *s, struct task *t)
        if (!FD_ISSET(phd->fd, &s->rfds))
                return;
        if (phd->status == HTTP_SENT_GET_REQUEST) {
        if (!FD_ISSET(phd->fd, &s->rfds))
                return;
        if (phd->status == HTTP_SENT_GET_REQUEST) {
-               t->error = recv_pattern(phd->fd, HTTP_OK_MSG, MAXLINE);
+               t->error = recv_pattern(phd->fd, HTTP_OK_MSG, strlen(HTTP_OK_MSG));
                if (t->error >= 0) {
                        PARA_INFO_LOG("received ok msg, streaming\n");
                        phd->status = HTTP_STREAMING;
                if (t->error >= 0) {
                        PARA_INFO_LOG("received ok msg, streaming\n");
                        phd->status = HTTP_STREAMING;