summaryrefslogtreecommitdiff
path: root/src/input/input_http.c
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2009-10-10 14:50:31 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2009-10-10 14:50:31 +0100
commitac4a311c81c5d01cfbc332d248907bb833ecfed3 (patch)
tree1019df995b3db215778237b5d7cc4cace176eb99 /src/input/input_http.c
parentc579d6f6fb0fd0075faf02a80be1a24f7f75071a (diff)
parent556f8d0d0799bd05f38cfb454fdb80de85dd2f7c (diff)
downloadxine-lib-ac4a311c81c5d01cfbc332d248907bb833ecfed3.tar.gz
xine-lib-ac4a311c81c5d01cfbc332d248907bb833ecfed3.tar.bz2
Merge from 1.1.
Diffstat (limited to 'src/input/input_http.c')
-rw-r--r--src/input/input_http.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c
index a4a37c501..fdd7d74f8 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -88,7 +88,7 @@ typedef struct {
off_t preview_size;
char *mime_type;
-
+ const char *user_agent;
char *proto;
char *user;
char *password;
@@ -644,7 +644,8 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
use_proxy = this_class->proxyhost && strlen(this_class->proxyhost);
if (!_x_parse_url(this->mrl, &this->proto, &this->host, &this->port,
- &this->user, &this->password, &this->uri)) {
+ &this->user, &this->password, &this->uri,
+ &this->user_agent)) {
_x_message(this->stream, XINE_MSG_GENERAL_WARNING, "malformed url", NULL);
return 0;
}
@@ -749,10 +750,12 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
}
snprintf(this->buf + buflen, BUFSIZE - buflen,
- "User-Agent: xine/%s\015\012"
+ "User-Agent: %s%sxine/%s\015\012"
"Accept: */*\015\012"
"Icy-MetaData: 1\015\012"
"\015\012",
+ this->user_agent ? this->user_agent : "",
+ this->user_agent ? " " : "",
VERSION);
buflen = strlen(this->buf);
if (_x_io_tcp_write (this->stream, this->fh, this->buf, buflen) != buflen) {
@@ -1003,7 +1006,8 @@ static input_plugin_t *http_class_get_instance (input_class_t *cls_gen, xine_str
if (strncasecmp (mrl, "http://", 7) &&
strncasecmp (mrl, "unsv://", 7) &&
- strncasecmp (mrl, "peercast://pls/", 15)) {
+ strncasecmp (mrl, "peercast://pls/", 15) &&
+ !_x_url_user_agent (mrl) /* user agent hacks */) {
return NULL;
}
this = calloc(1, sizeof(http_input_plugin_t));