Diamond Necklace song lyrics are updated here. Lyrics for all Diamond Necklace songs are added here. Diamond Necklace song list is given here.Q:
DNS not resolved from python
I have an server with DNS entry (they are not really an DNS server) and I'm trying to resolve the DNS entry from a python script.
This is the request I'm making to the DNS server:
#!/usr/bin/env python
from socket import *
sock = socket(AF_INET, SOCK_STREAM)
sock.connect(('10.1.1.6', 80))
sock.sendall(('GET /toto HTTP/1.0
Host: www.example.com
'))
sock.sendall(('
response, addr = sock.recvfrom(1024)
print 'Response:', response
And I have got the following error:
Response:
From the logs I see this:
Request: GET /toto HTTP/1.0
Host: www.example.com
So it looks like python is making the request but it is not sending the Host header.
Is there something I'm doing wrong? Or do I have to send the Host header with the request?
A:
you are not sending the Host header. Since you are using sockets you have to use
sock.sendall(('Host: www.example.com
instead of just
sock.sendall('Host: www.example.com
')
Remember that this is a request not a response and you don't want to receive the HTTP response (i.e. the body of the response) but the HTTP headers which contain the Host header.
For years, Yellowstone National Park’s name has evoked images of lakes of boiling, bubbling mud, erupting with fiery steam and fierce geysers — a reminder of the might of nature and of the threats we face from it.
But Yellowstone’s most famous natural phenomenon has, for the past decade,
Related links:
Comments