summaryrefslogtreecommitdiff
path: root/src/input/http_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input/http_helper.c')
-rw-r--r--src/input/http_helper.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/input/http_helper.c b/src/input/http_helper.c
index 279d3ff05..db93b9b45 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, '@');
@@ -185,6 +198,7 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
} else
*it = start[i];
}
+ *it = '\0';
}
}
} else {
@@ -257,7 +271,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);