#11227: use Host header in asyncore example.

This commit is contained in:
Georg Brandl 2011-03-06 11:05:03 +01:00
parent 12a6153aee
commit 45ec333c72
1 changed files with 2 additions and 1 deletions

View File

@ -263,7 +263,8 @@ implement its socket handling::
asyncore.dispatcher.__init__(self)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
self.connect( (host, 80) )
self.buffer = bytes('GET %s HTTP/1.0\r\n\r\n' % path, 'ascii')
self.buffer = bytes('GET %s HTTP/1.0\r\nHost: %s\r\n\r\n' %
(path, host), 'ascii')
def handle_connect(self):
pass