0

I am reading an early version of goagent, I don't know where is the do_CONNECT method being called.

class GaeProxyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
    ...
    def do_CONNECT(self):
        ...

The same method in the following page does not being called, either. click here

Yes, if you search "do_CONNECT", you will get almost nothing, but to search "http method CONNECT"

Community
  • 1
  • 1
thinker3
  • 12,771
  • 5
  • 30
  • 36

2 Answers2

1

GaeProxyHandler's base class is BaseHTTPRequestHandler, so the code may be written in BaseHTTPRequestHandler

If you want to run the proxy, you should run the following code:

server = LocalProxyServer((common.LISTEN_IP, common.LISTEN_PORT), GAEProxyHandler)
server.serve_forever()

So you know the server itself may write code about calling the method do_CONNECT now.

And let's see the backtrace, it actually does.

  File "E:\Python33\lib\threading.py", line 616, in _bootstrap
    self._bootstrap_inner()
  File "E:\Python33\lib\threading.py", line 639, in _bootstrap_inner
    self.run()
  File "E:\Python33\lib\threading.py", line 596, in run
    self._target(*self._args, **self._kwargs)
  File "E:\Python33\lib\socketserver.py", line 610, in process_request_thread
    self.finish_request(request, client_address)
  File "E:\Python33\lib\socketserver.py", line 345, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "E:\Python33\lib\socketserver.py", line 666, in __init__
    self.handle()
  File "E:\Python33\lib\http\server.py", line 400, in handle
    self.handle_one_request()
  File "E:\Python33\lib\http\server.py", line 388, in handle_one_request
    method()
  File "E:\eclipse\workspace\GoAgent\src\goagent-local\proxy.py", line 1758, in **do_CONNECT**

see the last do_CONNECT?

damn_c
  • 2,442
  • 2
  • 15
  • 17
  • I asked this question before I know CONNECT is just a method like GET or POST, one of the 7 http methods. – thinker3 Sep 02 '13 at 01:20
1

CONNECT is a method like GET or POST, for the client to tell the PROXY server they need to finish the ssl handshake before sending request to the REAL server.

Thus, do_CONNECT would be called when there is an https request need to be forward.

check this

Community
  • 1
  • 1
lichon
  • 141
  • 1
  • 5