diff options
Diffstat (limited to 'src/tests/url.cpp')
-rw-r--r-- | src/tests/url.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/tests/url.cpp b/src/tests/url.cpp index c9af676..4dc8c46 100644 --- a/src/tests/url.cpp +++ b/src/tests/url.cpp | |||
@@ -4,28 +4,31 @@ | |||
4 | 4 | ||
5 | int main( int argc, char *argv[] ) | 5 | int main( int argc, char *argv[] ) |
6 | { | 6 | { |
7 | printf("encodede: %s\n", Bu::Url::encode( argv[1] ).getStr() ); | 7 | for( argc--, argv++; argc >= 0; argc--, argv++ ) |
8 | printf("decodede: %s\n", Bu::Url::decode( argv[1] ).getStr() ); | ||
9 | Bu::Url u( argv[1] ); | ||
10 | |||
11 | printf("Protocol: %s\n", u.getProtocol().getStr() ); | ||
12 | printf("User: %s\n", u.getUser().getStr() ); | ||
13 | printf("Pass: %s\n", u.getPass().getStr() ); | ||
14 | printf("Host: %s\n", u.getHost().getStr() ); | ||
15 | printf("Path: %s\n", u.getPath().getStr() ); | ||
16 | try | ||
17 | { | ||
18 | printf("Port: %d\n", u.getPort() ); | ||
19 | } catch( Bu::ExceptionBase &e ) | ||
20 | { | 8 | { |
21 | printf("Port: not set.\n"); | 9 | printf("encodede: %s\n", Bu::Url::encode( *argv ).getStr() ); |
22 | } | 10 | printf("decodede: %s\n", Bu::Url::decode( *argv ).getStr() ); |
23 | printf("Parameters:\n"); | 11 | Bu::Url u( *argv ); |
24 | for( Bu::Url::ParamList::const_iterator i = u.getParamBegin(); i; i++ ) | 12 | |
25 | { | 13 | printf("Protocol: %s\n", u.getProtocol().getStr() ); |
26 | printf(" \"%s\" = \"%s\"\n", | 14 | printf("User: %s\n", u.getUser().getStr() ); |
27 | (*i).sName.getStr(), (*i).sValue.getStr() | 15 | printf("Pass: %s\n", u.getPass().getStr() ); |
28 | ); | 16 | printf("Host: %s\n", u.getHost().getStr() ); |
17 | printf("Path: %s\n", u.getPath().getStr() ); | ||
18 | try | ||
19 | { | ||
20 | printf("Port: %d\n", u.getPort() ); | ||
21 | } catch( Bu::ExceptionBase &e ) | ||
22 | { | ||
23 | printf("Port: not set.\n"); | ||
24 | } | ||
25 | printf("Parameters:\n"); | ||
26 | for( Bu::Url::ParamList::const_iterator i = u.getParamBegin(); i; i++ ) | ||
27 | { | ||
28 | printf(" \"%s\" = \"%s\"\n", | ||
29 | (*i).sName.getStr(), (*i).sValue.getStr() | ||
30 | ); | ||
31 | } | ||
29 | } | 32 | } |
30 | 33 | ||
31 | return 0; | 34 | return 0; |