[vlc-devel] commit: shout: default to port 8000, try to improve URL parsing (untested) ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu Nov 26 16:24:50 CET 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 26 17:23:41 2009 +0200| [a68b3396daae00230d977910ce914cf88cdc05a5] | committer: Rémi Denis-Courmont
shout: default to port 8000, try to improve URL parsing (untested)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a68b3396daae00230d977910ce914cf88cdc05a5
---
modules/access_output/shout.c | 52 +++++++++++++++++++++++++++++-----------
1 files changed, 37 insertions(+), 15 deletions(-)
diff --git a/modules/access_output/shout.c b/modules/access_output/shout.c
index 8ba8ff0..f81c802 100644
--- a/modules/access_output/shout.c
+++ b/modules/access_output/shout.c
@@ -196,21 +196,43 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
/* Parse connection data user:pwd at host:port/mountpoint */
- psz_user = psz_parser;
- while( psz_parser[0] && psz_parser[0] != ':' ) psz_parser++;
- if( psz_parser[0] ) { psz_parser[0] = 0; psz_parser++; }
- psz_pass = psz_parser;
- while( psz_parser[0] && psz_parser[0] != '@' ) psz_parser++;
- if( psz_parser[0] ) { psz_parser[0] = 0; psz_parser++; }
- psz_host = psz_parser;
- while( psz_parser[0] && psz_parser[0] != ':' ) psz_parser++;
- if( psz_parser[0] ) { psz_parser[0] = 0; psz_parser++; }
- psz_port = psz_parser;
- while( psz_parser[0] && psz_parser[0] != '/' ) psz_parser++;
- if( psz_parser[0] ) { psz_parser[0] = 0; psz_parser++; }
- psz_mount = psz_parser;
-
- i_port = atoi( psz_port );
+ psz_host = strchr( psz_parser, '@' );
+ if( psz_host )
+ {
+ psz_user = psz_parser;
+ *(psz_host++) = '\0';
+ }
+ else
+ psz_user = "";
+
+ psz_pass = strchr( psz_user, ':' );
+ if( psz_pass )
+ *(psz_pass++) = '\0';
+ else
+ psz_pass = "";
+
+ psz_mount = strchr( psz_host, '/' );
+ if( psz_mount )
+ *(psz_mount++) = '\0';
+ else
+ psz_mount = "";
+
+ if( psz_host[0] == '[' )
+ {
+ psz_port = strstr( psz_host, "]:" );
+ if( psz_port )
+ {
+ *psz_port = '\0';
+ psz_port += 2;
+ }
+ }
+ else
+ {
+ psz_port = strchr( psz_host, ':' );
+ if( psz_port )
+ *(psz_port++) = '\0';
+ }
+ i_port = psz_port ? atoi( psz_port ) : 8000;
p_sys = p_access->p_sys = malloc( sizeof( sout_access_out_sys_t ) );
if( !p_sys )
More information about the vlc-devel
mailing list