[MPlayer-cvslog] r33082 - in trunk: DOCS/man/en/mplayer.1 cfg-common.h stream/network.c stream/network.h

cehoyos subversion at mplayerhq.hu
Thu Mar 17 09:58:50 CET 2011


Author: cehoyos
Date: Thu Mar 17 09:58:49 2011
New Revision: 33082

Log:
Allow setting custom http header.

Patch by Nikolay Nikolaev, nicknickolaev yahoo com

Modified:
   trunk/cfg-common.h
   trunk/stream/network.c
   trunk/stream/network.h

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/en/mplayer.1

Modified: trunk/cfg-common.h
==============================================================================
--- trunk/cfg-common.h	Mon Mar 14 01:07:11 2011	(r33081)
+++ trunk/cfg-common.h	Thu Mar 17 09:58:49 2011	(r33082)
@@ -354,6 +354,7 @@ const m_option_t common_opts[] = {
     {"user", &network_username, CONF_TYPE_STRING, 0, 0, 0, NULL},
     {"passwd", &network_password, CONF_TYPE_STRING, 0, 0, 0, NULL},
     {"bandwidth", &network_bandwidth, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
+    {"http-header-fields", &network_http_header_fields, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
     {"user-agent", &network_useragent, CONF_TYPE_STRING, 0, 0, 0, NULL},
     {"referrer", &network_referrer, CONF_TYPE_STRING, 0, 0, 0, NULL},
     {"cookies", &network_cookies_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL},

Modified: trunk/stream/network.c
==============================================================================
--- trunk/stream/network.c	Mon Mar 14 01:07:11 2011	(r33081)
+++ trunk/stream/network.c	Thu Mar 17 09:58:49 2011	(r33082)
@@ -57,6 +57,7 @@ int   network_bandwidth=0;
 int   network_cookies_enabled = 0;
 char *network_useragent=NULL;
 char *network_referrer=NULL;
+char **network_http_header_fields=NULL;
 
 /* IPv6 options */
 int   network_ipv4_only_proxy = 0;
@@ -246,6 +247,12 @@ http_send_request( URL_t *url, off_t pos
 
 	if (network_cookies_enabled) cookies_set( http_hdr, server_url->hostname, server_url->url );
 
+	if (network_http_header_fields) {
+		int i=0;
+		while (network_http_header_fields[i])
+			http_set_field(http_hdr, network_http_header_fields[i++]);
+	}
+
 	http_set_field( http_hdr, "Connection: close");
 	if (proxy)
 		http_add_basic_proxy_authentication(http_hdr, url->username, url->password);

Modified: trunk/stream/network.h
==============================================================================
--- trunk/stream/network.h	Mon Mar 14 01:07:11 2011	(r33081)
+++ trunk/stream/network.h	Thu Mar 17 09:58:49 2011	(r33082)
@@ -66,6 +66,7 @@ extern char *network_password;
 extern char *network_referrer;
 extern char *network_useragent;
 extern char *network_username;
+extern char **network_http_header_fields;
 
 extern int   network_bandwidth;
 extern int   network_cookies_enabled;


More information about the MPlayer-cvslog mailing list