Re: [Twisted-Python] Can browse, but getPage() fails on localhost address

Steve> t.w.c.getPage("http://localhost/w3c-validator/check") <-- 404 Steve> wget http://localhost/w3c-validator/check <-- 404 Steve> So what the heck is the difference in how these things resolve that Steve> address!? When you say 404, do you really mean that you get a 404? Or are you just saying that to informally tell us that it doesn't work? If the former, then it seems this has nothing to do with DNS and host names. The connection is being made in all cases. It looks like there's something different about the HTTP requests that causes the server to react differently. You're writing the server, correct? Can you log output? If the latter, then I guess you really mean that the connection fails. Terry

On Oct 29, 2009, at 2:01 PM, Terry Jones wrote:
No, I mean this, exactly: # wget http://localhost/w3c-validator/check --2009-10-29 13:31:40-- http://localhost/w3c-validator/check Resolving localhost... 127.0.0.1, ::1, fe80::1 Connecting to localhost|127.0.0.1|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2009-10-29 13:31:40 ERROR 404: Not Found. # python foo.py Error: 404 Not Found *--- Failure #6 --- Failure: twisted.web.error.Error: 404 Not Found *--- End of Failure #6 --- That last is from failure.printDetailedTraceback(). S

On Oct 29, 2009, at 3:29 PM, Steve Steiner (listsin) wrote:
The only difference between the requests, as far as I can see (via tcpdump et al.), is that both `curl` and my browsers send HTTP/1.1 requests and both `wget` and t.w.c.getPage() send HTTP/1.0. This code also works: import httplib headers = { "Accept":"*/*"} h1 = httplib.HTTPConnection("localhost") h1.connect() h1.request("GET", url="/w3c-validator/check", headers=headers) rsp = h1.getresponse() print rsp.read() Does this make any sense, that an HTTP/1.1 request would succeed where a simple HTTP/1.0 request returns a 404? Maybe it's time to whip out that /twisted-branch-high-level-web- client-3987 I checked out a while ago... S

On Oct 29, 2009, at 2:01 PM, Terry Jones wrote:
No, I mean this, exactly: # wget http://localhost/w3c-validator/check --2009-10-29 13:31:40-- http://localhost/w3c-validator/check Resolving localhost... 127.0.0.1, ::1, fe80::1 Connecting to localhost|127.0.0.1|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2009-10-29 13:31:40 ERROR 404: Not Found. # python foo.py Error: 404 Not Found *--- Failure #6 --- Failure: twisted.web.error.Error: 404 Not Found *--- End of Failure #6 --- That last is from failure.printDetailedTraceback(). S

On Oct 29, 2009, at 3:29 PM, Steve Steiner (listsin) wrote:
The only difference between the requests, as far as I can see (via tcpdump et al.), is that both `curl` and my browsers send HTTP/1.1 requests and both `wget` and t.w.c.getPage() send HTTP/1.0. This code also works: import httplib headers = { "Accept":"*/*"} h1 = httplib.HTTPConnection("localhost") h1.connect() h1.request("GET", url="/w3c-validator/check", headers=headers) rsp = h1.getresponse() print rsp.read() Does this make any sense, that an HTTP/1.1 request would succeed where a simple HTTP/1.0 request returns a 404? Maybe it's time to whip out that /twisted-branch-high-level-web- client-3987 I checked out a while ago... S
participants (2)
-
Steve Steiner (listsin)
-
Terry Jones