aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2010-06-02 18:55:18 +0300
committerGravatar Uoti Urpala <uau@glyph.nonexistent.invalid>2010-06-02 18:55:18 +0300
commit497c32cdadb9da9bc20a3650b3056e2657358136 (patch)
treeed3d48e5f9631d2951d8569b48a00d025c20ab08 /stream
parent626373af3840220d40217b7bbe81f5fb452882bb (diff)
parentdef243261a0b8e3ab0d043cd89b97f8c9826e573 (diff)
Merge svn changes up to r31291
Diffstat (limited to 'stream')
-rw-r--r--stream/network.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/stream/network.c b/stream/network.c
index a7528af4ad..11c8a2d460 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -61,6 +61,7 @@ char *network_password=NULL;
int network_bandwidth=0;
int network_cookies_enabled = 0;
char *network_useragent=NULL;
+char *network_referrer=NULL;
/* IPv6 options */
int network_ipv4_only_proxy = 0;
@@ -225,6 +226,23 @@ http_send_request( URL_t *url, off_t pos ) {
else
http_set_field( http_hdr, "User-Agent: MPlayer/"VERSION);
+ if (network_referrer) {
+ char *referrer = NULL;
+ size_t len = strlen(network_referrer) + 10;
+
+ // Check len to ensure we don't do something really bad in case of an overflow
+ if (len > 10)
+ referrer = malloc(len);
+
+ if (referrer == NULL) {
+ mp_tmsg(MSGT_NETWORK, MSGL_FATAL, "Memory allocation failed.\n");
+ } else {
+ snprintf(referrer, len, "Referer: %s", network_referrer);
+ http_set_field(http_hdr, referrer);
+ free(referrer);
+ }
+ }
+
if( strcasecmp(url->protocol, "noicyx") )
http_set_field(http_hdr, "Icy-MetaData: 1");