فهرست منبع

unix:// urls didn't work in tail -f.

Chris McDonough 19 سال پیش
والد
کامیت
36dc67d48d
2فایلهای تغییر یافته به همراه7 افزوده شده و 8 حذف شده
  1. 5 6
      src/supervisor/http_client.py
  2. 2 2
      src/supervisor/supervisorctl.py

+ 5 - 6
src/supervisor/http_client.py

@@ -52,10 +52,10 @@ class HTTPHandler(object, asynchat.async_chat):
         self.url = None
         self.error_handled = False
 
-    def get(self, url):
+    def get(self, serverurl, path):
         assert(self.url==None, "Already doing a get") #@@
-        self.url = url
-        scheme, host, path, params, query, fragment = urlparse(url)
+        self.url = serverurl + path
+        scheme, host, path_ignored, params, query, fragment = urlparse(self.url)
         if not scheme in ("http", "unix"):
             raise NotImplementedError
         self.host = host
@@ -66,7 +66,7 @@ class HTTPHandler(object, asynchat.async_chat):
             hostname = host
             port = 80
 
-        self.path = "?".join([path, query])
+        self.path = path
         self.port = port
 
         if scheme == "http":
@@ -74,8 +74,7 @@ class HTTPHandler(object, asynchat.async_chat):
             self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
             self.connect((ip, self.port))
         elif scheme == "unix":
-            socketname, path = url[7:].split('/', 1)
-            self.path = '/' + path
+            socketname = serverurl[7:]
             self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
             self.connect(socketname)
     

+ 2 - 2
src/supervisor/supervisorctl.py

@@ -146,7 +146,7 @@ class Controller(cmd.Cmd):
 
         self._output('==> Press Ctrl-C to exit <==')
 
-        url = self.options.serverurl + '/logtail/' + arg
+        path = '/logtail/' + arg
         username = self.options.username
         password = self.options.password
         try:
@@ -159,7 +159,7 @@ class Controller(cmd.Cmd):
             import http_client
             listener = http_client.Listener()
             handler = http_client.HTTPHandler(listener, username, password)
-            handler.get(url)
+            handler.get(self.options.serverurl, path)
             asyncore.loop()
         except KeyboardInterrupt:
             handler.close()