Commits

Maciej Fijalkowski committed 9f578e8

a bit more standard

Comments (0)

Files changed (1)

asynchammer/asynchammer.py

 from twisted.internet.endpoints import TCP4ClientEndpoint
 from twisted.internet.error import ConnectionDone
 
+HTTP_REQ = """GET / HTTP/1.1
+Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
+Accept-Encoding:sdch
+Accept-Language:en-US,en;q=0.8
+Connection:keep-alive
+Cookie:MMMM=%(cookie)s; EEEE=%(cookie)s, ZZZZ=%(cookie)s, XXXX=%(cookie)s
+Host:www.google.com
+User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.58 Safari/537.22
+X-Chrome-UMA-Enabled:1
+X-Chrome-Variations:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==
+
+""" % {'cookie': 'a' * 100}
+
 class Hammer(Protocol):
     def __init__(self, factory):
         self.factory = factory
     
     def writeRequest(self):
-        self.transport.write("GET /\r\n")
+        self.transport.write(HTTP_REQ)
 
     def dataReceived(self, data):
-        pass
+        print data
 
     def connectionLost(self, fail):
         if not fail.type == ConnectionDone: