GNU bug report logs - #12893
24.2.50; url-retrieve fails for localhost

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Thu, 15 Nov 2012 09:00:02 UTC

Severity: normal

Found in version 24.2.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Chong Yidong <cyd <at> gnu.org>, 12893 <at> debbugs.gnu.org
Subject: bug#12893: 24.2.50; url-retrieve fails for localhost
Date: Sun, 23 Dec 2012 04:24:55 +0400
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.




This bug report was last modified 10 years and 164 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.