http: Properly handle chunked transfer-encoding for replies to post data
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
eb564b23a3
commit
35127bf156
@ -353,6 +353,8 @@ static int http_read_header(URLContext *h, int *new_location)
|
|||||||
char line[1024];
|
char line[1024];
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
s->chunksize = -1;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ((err = http_get_line(s, line, sizeof(line))) < 0)
|
if ((err = http_get_line(s, line, sizeof(line))) < 0)
|
||||||
return err;
|
return err;
|
||||||
@ -470,7 +472,6 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
|
|||||||
s->http_code = 200;
|
s->http_code = 200;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
s->chunksize = -1;
|
|
||||||
|
|
||||||
/* wait for header */
|
/* wait for header */
|
||||||
err = http_read_header(h, new_location);
|
err = http_read_header(h, new_location);
|
||||||
@ -513,14 +514,10 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
|
|||||||
if (!s->hd)
|
if (!s->hd)
|
||||||
return AVERROR_EOF;
|
return AVERROR_EOF;
|
||||||
|
|
||||||
if (s->end_chunked_post) {
|
if (s->end_chunked_post && !s->end_header) {
|
||||||
if (!s->end_header) {
|
err = http_read_header(h, &new_location);
|
||||||
err = http_read_header(h, &new_location);
|
if (err < 0)
|
||||||
if (err < 0)
|
return err;
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
return http_buf_read(h, buf, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->chunksize >= 0) {
|
if (s->chunksize >= 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user