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)
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) {
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) {