[MPlayer-dev-eng] [PATCH] add -referrer option to allow HTTP referrer to be set
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun May 30 13:37:02 CEST 2010
On Sun, May 30, 2010 at 11:55:36AM +0100, chocolateboy wrote:
> The attached patch adds support for a new -referrer option, which
> allows a HTTP referrer header to be set. The rationale is the same
> as for the existing -user-agent and cookie-related options.
I'm tempted to say that at some point people should just pipe the
data through wget :-)
> @@ -226,6 +227,13 @@
> else
> http_set_field( http_hdr, "User-Agent: MPlayer/"VERSION);
>
> + if (network_referrer)
> + {
> + char referrer[2048]; /* http://www.boutell.com/newfaq/misc/urllength.html */
> + snprintf(referrer, 2048, "Referer: %s", network_referrer);
use sizeof(referrer)
Also URLs aren't really good as comments, particularly since that page says 2048 is the
limit for the URL length, but here you put in the URL _and_ the string "Referer: ".
Since speed does not matter you could just malloc the space (just make sure that an integer
overflow does not make it exploitable).
In principle the patch is fine though.
More information about the MPlayer-dev-eng
mailing list