httpserve
  • Overview
  • Repository
  • Tickets
  • Statistics

Repository

Fix handling url containing only a hostname

Parent commits : 0ef11618ded58abf470eca9af2ed53cb201d6a49,
Children commits : c3f93bf15a6c7de736f9151faa52d5798408319b,

By Laurent Defert on 2013-05-28 22:42:55
Fix handling url containing only a hostname

Browse content
Difference with parent commit 0ef11618ded58abf470eca9af2ed53cb201d6a49
Files modified:
httpget.py
--- 
+++ 
@@ -247,10 +247,9 @@
         self.raw_url = raw_url
         self.url = urlparse.urlparse(raw_url)
         self.hosts = args.hosts_list.split(',')
-        if self.url.path != '':
+        self.filename = 'index.html'
+        if '/' in self.url.path:
             self.filename = unquote(self.url.path).rsplit('/', 1)[1]
-        if self.filename == '':
-            self.filename = 'index.html'
     
     def get_connection(self):
         if self.url.scheme == 'http':
@@ -258,7 +257,7 @@
         elif self.url.scheme == 'https':
             return httplib.HTTPSConnection(self.url.hostname, self.url.port)
         else:
-             raise Exception('Unknown protocol:%s' % self.proto)
+             raise Exception('Unknown protocol:%s' % self.url.scheme)
 
     def download(self):
         progress_bar = ProgressBar(threading.Lock())