0

I'm using python 2.7 and I want to implement the do_TRACE function for my HTTP server and I'm using the BaseHTTPServer library. I want to get the request header. How can I get it? How can I get the length of it? Please help me...

    def do_TRACE(self):
        self.send_response(200)
        self.send_header('Server', socket.gethostname())
        self.send_header('Connection', 'close')
        self.send_header('Content-Type', )
        self.send_header('Content-Length')
        self.end_headers()
Ramin Gharib
  • 45
  • 10
  • share what you have tried till now – Panther Dec 10 '14 at 19:32
  • According to the docs, there is a public dict called `headers`, so you should be able to do something like `print(server.headers)` -- https://docs.python.org/2/library/basehttpserver.html – Gillespie Dec 10 '14 at 19:33

0 Answers0