summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2013-09-02 19:33:31 +0200
committermakefu <github@syntax-fehler.de>2013-09-02 19:33:31 +0200
commita3675799d1d9a0e7879071b23f1cc066c709efd0 (patch)
treed3b75ee5c3af9a29cc335d3038fbfc39bd35c7d8
parentd8b0cd79e8e007dac950974c1bdbfe58ad1a5fbf (diff)
urlparse: add scheme, only print user/pass if set
-rwxr-xr-xutil/bin/urlparse11
1 files changed, 8 insertions, 3 deletions
diff --git a/util/bin/urlparse b/util/bin/urlparse
index 3767b929..685b1ab1 100755
--- a/util/bin/urlparse
+++ b/util/bin/urlparse
@@ -17,7 +17,12 @@ if __name__ == "__main__":
print('usage: %s URI')
exit(1)
u = uri_parser(uri)
- print('USERNAME="%s"' % u.username)
- print('PASSWORD="%s"' % u.password)
+
+ print('SCHEME="%s"' % u.scheme)
+ if u.username:
+ print('USERNAME="%s"' % u.username)
+ if u.password:
+ print('PASSWORD="%s"' % u.password)
+ if u.path:
+ print('URIPATH="%s"' % u.path)
print('HOSTNAME="%s"' % u.hostname)
- print('URIPATH="%s"' % u.path)