From d81e824732c33e2d5ce31fbc58571561a8d9b21f Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 9 Apr 2019 13:39:57 -0700 Subject: Url parser sucks. It sucks a little less now. I need to redo it completely, it's stupid. --- src/unstable/url.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/unstable') diff --git a/src/unstable/url.cpp b/src/unstable/url.cpp index f51f381..8106ce7 100644 --- a/src/unstable/url.cpp +++ b/src/unstable/url.cpp @@ -123,12 +123,14 @@ void Bu::Url::setProtocol( const Bu::String &sNewProto, bool bAutoSetPort ) void Bu::Url::parseUserPass( Bu::String::const_iterator &i ) { - Bu::String::const_iterator s = i.find('@'); - if( !s ) + Bu::String::const_iterator s; + for( s = i; s && *s != '/' && *s != '@'; s++ ) { } + if( !s || *s == '/') return; - Bu::String::const_iterator p = i.find(':'); - if( p ) + Bu::String::const_iterator p; + for( p = i.find(':'); p && *p != '/' && *p != ':'; p++ ) { } + if( p && *p == ':' ) { sUser.set( i, p ); sPass.set( p+1, s ); -- cgit v1.2.3