[FFmpeg-soc] http header dictionary

Josh Allmann joshua.allmann at gmail.com
Sun Jun 6 03:00:50 CEST 2010


On 5 June 2010 16:58, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sat, Jun 05, 2010 at 10:46:56AM -0700, Josh Allmann wrote:
>> On 5 June 2010 03:26, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Sat, Jun 05, 2010 at 01:44:56AM -0700, Josh Allmann wrote:
>> >> Hi guys,
>> >>
>> >> So I caved and made HTTP headers settable by a dictionary. Let me know
>> >> what you think.
>> >
>> > overkill for http headers (not saying its neccessarily useless for
>> > other code ...), would belong to libavutil,
>> > we have a avl tree in avutil alraedy if you need hundreads of headers.
>>
>> D'oh... if I had known, I would not have done this :)
>>
>> > and which headers do you want to override anyway?
>> > if its just 1 or 2 where overriding makes sense there is a much
>> > simpler solution, namely 1 or 2 int in a struct
>>
>> I need to add some, replace some, and remove some. But not hundreds.
>
> could you elaborate which exactly you need to add, remove and modify?
> understanding this may help in coming up with a clean way to do it
> (or maybe not of course ;)
>

Sure. Note that I implemented Ronald's suggestion of using string search:
http://github.com/j0sh/ffmpeg-soc/commit/ec6ad739addcd33d829cd1bac3ea63d2f11d2936

It will add and replace headers, won't remove. Also, lavf's default
headers are preserved if they aren't explicitly specified. Here are
the headers I'm working with:

Add:
x-sessioncookie (randomly generated session id). This is the only one
that is really mandatory.

The spec also suggests including these to mitigate proxy caching:
Content-Length, Cache-Control, Pragma, Expires.
These are all static and do not change after the request.

Remove:
Transfer-Encoding

I made a separate patch earlier for disabling transfer-encoding.
http://github.com/j0sh/ffmpeg-soc/commit/53b7a7846b583e20929ebf11de8f8f1feacac7c7
However, I reckon that a more general ff_http_ignore_header function
would require less munging of the ff_http* api in the future.

I also wanted to remove others (Range, Connection, Host), but feng and
dss work fine with those. Note that the spec mandates HTTP/1.0, while
these are 1.1-specific features. Servers don't seem picky, though.

Modify:
Accept (x-rtsp-tunnelled)

MMS-HTTP also might have its own requirements, but I don't know those. Zhentan?

Josh

> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> No human being will ever know the Truth, for even if they happen to say it
> by chance, they would not even known they had done so. -- Xenophanes
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFMCuSkYR7HhwQLD6sRAlUSAJ9OqDb0aRIJpH6Rru6ypnrp0n2jOQCfaMvq
> sCy/c+dz7IWdAUAgBp5Smn8=
> =KuAB
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> FFmpeg-soc mailing list
> FFmpeg-soc at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc
>
>


More information about the FFmpeg-soc mailing list