[xiph-commits] r3048 - liboggplay/trunk/src/liboggplay
shans at svn.annodex.net
shans at svn.annodex.net
Mon Jun 25 06:52:29 PDT 2007
Author: shans
Date: 2007-06-25 06:52:29 -0700 (Mon, 25 Jun 2007)
New Revision: 3048
Modified:
liboggplay/trunk/src/liboggplay/oggplay.c
liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
Log:
Find port numbers when included in media urls
Modified: liboggplay/trunk/src/liboggplay/oggplay.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay.c 2007-06-25 13:10:49 UTC (rev 3047)
+++ liboggplay/trunk/src/liboggplay/oggplay.c 2007-06-25 13:52:29 UTC (rev 3048)
@@ -68,6 +68,7 @@
me->buffer = NULL;
me->shutdown = 0;
me->trash = NULL;
+ me->oggz = NULL;
return me;
Modified: liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c 2007-06-25 13:10:49 UTC (rev 3047)
+++ liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c 2007-06-25 13:52:29 UTC (rev 3048)
@@ -113,7 +113,9 @@
char * _location;
char * host;
char * path;
+ char * colon;
char * pos;
+ int port;
int len;
int nbytes;
int has_http;
@@ -185,12 +187,30 @@
if (strncmp(_location, "http://", 7) == 0) {
path = strchr(_location + 7, '/');
+ colon = strchr(_location + 7, ':');
has_http = 1;
} else {
path = strchr(_location, '/');
+ colon = strchr(_location, ':');
has_http = 0;
}
+ port = 80;
+ if (colon != NULL) {
+ if (path == NULL || colon < path) {
+ port = (int)strtol(colon+1, NULL, 10);
+ if (path != NULL) {
+ strcpy(colon, me->location + (path - _location));
+ path = colon;
+ }
+ else {
+ *colon = '\0';
+ path = NULL;
+ }
+ }
+ }
+
+
if (path == NULL) {
_location[len] = '/';
_location[len + 1] = '\0';
@@ -227,7 +247,7 @@
}
memcpy(&addr.sin_addr.s_addr, he->h_addr, he->h_length);
addr.sin_family = AF_INET;
- addr.sin_port = htons(80);
+ addr.sin_port = htons(port);
/*
* Connect to the host.
More information about the commits
mailing list