summaryrefslogtreecommitdiff
path: root/src/input/http_helper.c
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2009-08-26 15:45:59 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2009-08-26 15:45:59 +0100
commit556f8d0d0799bd05f38cfb454fdb80de85dd2f7c (patch)
treef36b5415d765427ead674dae5d4d61c077b3a638 /src/input/http_helper.c
parent8e334af88b6ac33adc19f6f274595b7e239684f5 (diff)
downloadxine-lib-556f8d0d0799bd05f38cfb454fdb80de85dd2f7c.tar.gz
xine-lib-556f8d0d0799bd05f38cfb454fdb80de85dd2f7c.tar.bz2
Add a user agent & protocol hack to allow viewing of Apple film trailers.
Diffstat (limited to 'src/input/http_helper.c')
-rw-r--r--src/input/http_helper.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/input/http_helper.c b/src/input/http_helper.c
index 279d3ff05..d7f9a93ff 100644
--- a/src/input/http_helper.c
+++ b/src/input/http_helper.c
@@ -29,8 +29,18 @@
#include "xine_internal.h"
#include "http_helper.h"
+
+const char *_x_url_user_agent (const char *url)
+{
+ if (!strncasecmp (url, "qthttp://", 9))
+ return "QuickTime"; /* needed for Apple trailers */
+ return NULL;
+}
+
int _x_parse_url (char *url, char **proto, char** host, int *port,
- char **user, char **password, char **uri) {
+ char **user, char **password, char **uri,
+ const char **user_agent)
+{
char *start = NULL;
char *authcolon = NULL;
char *at = NULL;
@@ -63,6 +73,9 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
end = start + strlen(start) - 1;
*proto = strndup(url, start - url);
+ if (user_agent)
+ *user_agent = _x_url_user_agent (url);
+
/* user:password */
start += 3;
at = strchr(start, '@');
@@ -257,7 +270,7 @@ static int check_url(char *url, int ok) {
printf("--------------------------------\n");
printf("url=%s\n", url);
res = _x_parse_url (url,
- &proto, &host, &port, &user, &password, &uri);
+ &proto, &host, &port, &user, &password, &uri, NULL);
if (res) {
printf("proto=%s, host=%s, port=%d, user=%s, password=%s, uri=%s\n",
proto, host, port, user, password, uri);