[FFmpeg-devel] [PATCH] lavf/http: Export headers as AVDictionary
Nicolas George
george at nsup.org
Sat Aug 22 11:00:37 CEST 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150822/53e9bf7a/attachment.sig>
More information about the ffmpeg-devel
mailing list