4

UPDATED I've made simple proxy based on SimpleHTTPServer but i've got problem with POST method when someone is requesting with POST method it show Error so i've made do_POST() function,but when i requesting with POST (works fine with most site except vbulletin script !) i just get page says:The connection was reset

so now the problem is when i try to login at vbulletin site it said The connection was reset i have no idea why !

class Proxy(SimpleHTTPServer.SimpleHTTPRequestHandler):
    def do_GET(self):
      print self.address_string()
      print "User ip:",self.client_address[0]
      print self.date_time_string()#return time
      print self.path
      print self.headers
      self.copyfile(urllib.urlopen(self.path), self.wfile)
      print "--------------------------------------------\n"
    #this is the function where is the problem 
    def do_POST(self):
      print "=====================\n"
      print self.raw_requestline
      print self.headers.getheaders("Content-Length")
      length = int(self.headers.getheaders("Content-Length")[0])
      post_data = urlparse.parse_qs(self.rfile.read(length))
      self.copyfile(urllib.urlopen(self.path,urllib.urlencode(post_data)),self.wfile)
      print "=====================\n"

hopefully i can get hint about it

0 Answers0