diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2012-05-21 11:27:10 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-05-22 23:16:46 +0300 |
commit | e5773d8bc372a88b28452efa5fc87711f673bd28 (patch) | |
tree | a8c242aa8ca824d41a9614ed41bcbac898163ccb | |
parent | ba354a8cc091039662e50f1a5a194f5b589056f6 (diff) | |
download | ffmpeg-e5773d8bc372a88b28452efa5fc87711f673bd28.tar.gz |
http: Add support for reading http POST reply headers
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r-- | libavformat/http.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/libavformat/http.c b/libavformat/http.c index 124f533a1f..f978dc17af 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -52,6 +52,7 @@ typedef struct { int willclose; /**< Set if the server correctly handles Connection: close and will close the connection after feeding us the content. */ int chunked_post; int end_chunked_post; /**< A flag which indicates if the end of chunked encoding has been sent. */ + int end_header; /**< A flag which indicates we have finished to read POST reply. */ } HTTPContext; #define OFFSET(x) offsetof(HTTPContext, x) @@ -249,8 +250,10 @@ static int process_line(URLContext *h, char *line, int line_count, char *tag, *p, *end; /* end of header */ - if (line[0] == '\0') + if (line[0] == '\0') { + s->end_header = 1; return 0; + } p = line; if (line_count == 0) { @@ -462,6 +465,17 @@ static int http_buf_read(URLContext *h, uint8_t *buf, int size) static int http_read(URLContext *h, uint8_t *buf, int size) { HTTPContext *s = h->priv_data; + int err, new_location; + + if (s->end_chunked_post) { + if (!s->end_header) { + err = http_read_header(h, &new_location); + if (err < 0) + return err; + } + + return http_buf_read(h, buf, size); + } if (s->chunksize >= 0) { if (!s->chunksize) { |