[FFmpeg-devel] [PATCH] lavf/http: Export headers as AVDictionary

Stephan Holljes klaxa1337 at googlemail.com
Sat Aug 22 17:10:28 CEST 2015

On Sat, Aug 22, 2015 at 11:00 AM, Nicolas George <george at nsup.org> wrote:
> Le tridi 3 fructidor, an CCXXIII, Stephan Holljes a écrit :
>> Actually I just noticed that Pragma-headers may appear multiple times.
>> What would be a good way to handle that? I thought about expanding the
>> header tag from "Pragma" to "Pragma-%02d" with either an incrementing
>> number or just using s->nb_headers. Is there a better solution?
> Well, this is annoying, I had hoped we could disregard duplicated headers as
> a badly-formed request warranting sending nasal demons to the client.
> Suffixing a number would be very impractical for the application, and would
> cause strange behaviours if the client were to send a header with a number.
> Another option would be to allow duplicated key entries in AVDictionary, but
> that would require specifying the order of the entries.
> Fortunately, the RFC saves us here:
>    Multiple message-header fields with the same field-name MAY be
>    present in a message if and only if the entire field-value for that
>    header field is defined as a comma-separated list [i.e., #(values)].
>    It MUST be possible to combine the multiple header fields into one
>    "field-name: field-value" pair, without changing the semantics of the
>    message, by appending each subsequent field-value to the first, each
>    separated by a comma.
> Therefore, when dealing with any header already present in the dictionary:
> append a comma and the new value to it.
> Note that FFserver's behaviour with regard to duplicated Pragma entries is
> currently broken:
>                 if (av_strncasecmp(p, "Pragma: log-line=", 17) == 0) {
>                     logline = p;
>                     break;
>                 }
>                 if (av_strncasecmp(p, "Pragma: client-id=", 18) == 0)
>                     client_id = strtol(p + 18, 0, 10);
> That code recognizes:
>         Pragma: log-line=foobar
>         Pragma: client-id=bazqux
> but not:
>         Pragma: log-line=foobar,client-id=bazqux
> Hopefully, fixing it would be a side effect of using the new HTTP server
> API.
> Regards,
> --
>   Nicolas George
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

I implemented putting all multiple headers into a comma-separated
list. Updated patch will come as a reply to this email.

I pushed an updated version of FFServer to my repo. I tested it
against a custom HTTP request with multiple Pragma-headers and it
parsed them correctly.


More information about the ffmpeg-devel mailing list