On Tue, 11 Mar 2014, Luca Barbato wrote:

---
libavformat/http.c | 136 +++++++++++++++++++++++++++++++++--------------------
1 file changed, 85 insertions(+), 51 deletions(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index ba0cf57..161bb6b 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -303,11 +303,89 @@ static int http_get_line(HTTPContext *s, char *line, int 
line_size)
    }
}

+static int check_http_code(URLContext *h, int http_code, const char *end)
+{
+    HTTPContext *s = h->priv_data;
+    /* error codes are 4xx and 5xx, but regard 401 as a success, so we
+     * don't abort until all headers have been parsed. */
+    if (http_code >= 400 && http_code < 600 &&
+        (http_code != 401 || s->auth_state.auth_type != HTTP_AUTH_NONE) &&
+        (http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) 
{
+        end += strspn(end, SPACE_CHARS);
+        av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n", http_code, end);
+        return AVERROR(EIO);
+    }
+    return 0;
+}
+
+static int parse_location(HTTPContext *s, const char *p)
+{
+    char redirected_location[MAX_URL_SIZE], *new_loc;
+    ff_make_absolute_url(redirected_location, sizeof(redirected_location),
+                         s->location, p);
+    new_loc = av_strdup(redirected_location);
+    if (!new_loc)
+        return AVERROR(ENOMEM);
+    av_free(s->location);
+    s->location = new_loc;
+    return 0;
+}
+
+/* "bytes $from-$to/$document_size" */
+static void parse_content_range(URLContext *h, char *p)

const here too?

+{
+    HTTPContext *s = h->priv_data;
+    const char *slash;
+
+    if (!strncmp(p, "bytes ", 6)) {
+        p += 6;
+        s->off = strtoll(p, NULL, 10);
+        if ((slash = strchr(p, '/')) && strlen(slash) > 0)
+            s->filesize = strtoll(slash+1, NULL, 10);
+    }
+    h->is_streamed = 0; /* we _can_ in fact seek */
+}
+
+static int parse_content_encoding(URLContext *h, char *p)

.. and here

The patch itself looks ok though with const added at those places.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to