[Inteproxy-commits] r109 - in trunk: . inteproxy

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Feb 14 12:29:04 CET 2008


Author: bh
Date: 2008-02-14 12:29:03 +0100 (Thu, 14 Feb 2008)
New Revision: 109

Modified:
   trunk/ChangeLog
   trunk/inteproxy/proxycore.py
Log:
* inteproxy/proxycore.py
(InteProxyHTTPRequestHandler.handle_proxy_request): Remove the
method parameter.  Its value is always the same as self.command
and handle_proxy_request takes all other information about the
request from instance variables anyway.  Update the doc-string
(InteProxyHTTPRequestHandler.do_GET)
(InteProxyHTTPRequestHandler.do_POST): Adapt to
handle_proxy_request changes


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-02-05 17:06:31 UTC (rev 108)
+++ trunk/ChangeLog	2008-02-14 11:29:03 UTC (rev 109)
@@ -1,3 +1,14 @@
+2008-02-14  Bernhard Herzog  <bh at intevation.de>
+
+	* inteproxy/proxycore.py
+	(InteProxyHTTPRequestHandler.handle_proxy_request): Remove the
+	method parameter.  Its value is always the same as self.command
+	and handle_proxy_request takes all other information about the
+	request from instance variables anyway.  Update the doc-string
+	(InteProxyHTTPRequestHandler.do_GET)
+	(InteProxyHTTPRequestHandler.do_POST): Adapt to
+	handle_proxy_request changes
+
 2008-02-05  Bernhard Herzog  <bh at intevation.de>
 
 	* inteproxy/feesdialog.py (handle_fees_and_access_constraints):

Modified: trunk/inteproxy/proxycore.py
===================================================================
--- trunk/inteproxy/proxycore.py	2008-02-05 17:06:31 UTC (rev 108)
+++ trunk/inteproxy/proxycore.py	2008-02-14 11:29:03 UTC (rev 109)
@@ -1,5 +1,5 @@
 #! /usr/bin/python
-# Copyright (C) 2006, 2007 by Intevation GmbH
+# Copyright (C) 2006, 2007, 2008 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 #
@@ -65,27 +65,16 @@
 
     def do_GET(self):
         """Handle a GET request"""
-        self.handle_proxy_request("GET")
+        self.handle_proxy_request()
 
     def do_POST(self):
         """Handle a POST request"""
-        self.handle_proxy_request("POST")
+        self.handle_proxy_request()
 
-    def handle_proxy_request(self, method):
-        """Handle a request that needs to be 'proxied'
-
-        Method should be either 'POST' or 'GET'.  Both methods are
-        handled in the same way.  The real host to connect to is
-        determined from the url: The path component starts with the real
-        hostname.  The method strips that hostname from the path and
-        connects to the new host.  All headers from the HTTP request and
-        any extra data are passed through to the remote host and the
-        reponse is likewise simply copied through.  The only exception
-        is the Host: header from the original request.  It would be
-        wrong, so it is removed and a new one is generated pointing to
-        the real remote host.
+    def handle_proxy_request(self):
+        """Handle a request that needs to be 'proxied'.
         """
-        self.log_debug("Got %s request for %s", method, self.path)
+        self.log_debug("Got %s request for %s", self.command, self.path)
         for header, value in self.headers.items():
             self.log_debug("header from client: %s:%r", header, value)
 
@@ -93,7 +82,7 @@
         # Create a http request for the real location
         #
         transcoder_map = inteproxy.transcoder.transcoder_map
-        transcoder = transcoder_map.get_transcoder(method, self.path)
+        transcoder = transcoder_map.get_transcoder(self.command, self.path)
         remote_url = transcoder.get_url()
         self.log_debug("Converted url: %r", remote_url)
 



More information about the Inteproxy-commits mailing list