On Mon, May 21, 2012 at 12:22 PM, Martin Storsjö <[email protected]> wrote:

> On Mon, 21 May 2012, Samuel Pitoiset wrote:
>
>  ---
>> libavformat/http.c |   16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/http.c b/libavformat/http.c
>> index 97da9bf..37f73c9 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;
>>    char end_chunked_post;   /**< A flag which indicates if the end of
>> chunked encoding has been sent. */
>> +    char 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) {
>> --
>> 1.7.10.2
>>
>
> Did you test doing this as part of http_shutdown, if that makes the code
> clearer or not?


It makes the code a bit uglier... So, I decided to keep this version.


>
>
> // Martin
> ______________________________**_________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/**mailman/listinfo/libav-devel<https://lists.libav.org/mailman/listinfo/libav-devel>
>



-- 
Best regards,
Samuel Pitoiset.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to