[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12893: 24.2.50; url-retrieve fails for localhost
From: |
Dmitry Gutov |
Subject: |
bug#12893: 24.2.50; url-retrieve fails for localhost |
Date: |
Sun, 23 Dec 2012 04:24:55 +0400 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
On 22.12.2012 17:52, Andreas Schwab wrote:
You need to look at the url-proxy-services variable.
It has the default value of nil.
So, here's the small example of a web server in Ruby:
```
require 'webrick'
class Server < WEBrick::HTTPServer
def initialize(port)
super(Port: port)
mount("/", Handler)
end
class Handler < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
res["Content-Type"] = "text/html"
res.status = 200
res.body = "Hello!\n"
raise WEBrick::HTTPStatus::OK
end
end
end
server = Server.new(54321)
%w(INT TERM).each { |s| trap(s) { server.stop } }
server.start
```
When I run it (ruby server.rb), I see the following output:
[2012-12-23 04:12:53] INFO WEBrick 1.3.1
[2012-12-23 04:12:53] INFO ruby 1.9.3 (2012-11-10) [x86_64-linux]
[2012-12-23 04:12:53] WARN TCPServer Error: Address already in use -
bind(2)
[2012-12-23 04:12:53] INFO Server#start: pid=4838 port=54321
The third line probably hints at problem with the system, but
curl http://localhost:54321/
outputs the expected "Hello!", and running
lsof -i TCP:54321
doesn't show anything when the server isn't running.
Now, when the server is running, evaluating
(switch-to-buffer (url-retrieve-synchronously "http://localhost:54321/"))
shows an empty buffer, whereas
(switch-to-buffer (url-retrieve-synchronously "http://127.0.0.1:54321/"))
shows the expected contents.
Now, I couldn't reproduce the problem on my Windows machine, so the test
case is probably not very useful.
If you tell me where to poke to solve the "address already in use"
warning, I'll be sure to do that.