GNU bug report logs - #54171
[PATCH] web: default to INADDR_ANY instead of INADDR_LOOPBACK

Previous Next

Package: guile;

Reported by: Aleix Conchillo Flaqué <aconchillo <at> gmail.com>

Date: Sat, 26 Feb 2022 18:12:02 UTC

Severity: normal

Tags: patch, wontfix

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54171 in the body.
You can then email your comments to 54171 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#54171; Package guile. (Sat, 26 Feb 2022 18:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Aleix Conchillo Flaqué <aconchillo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 26 Feb 2022 18:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Aleix Conchillo Flaqué <aconchillo <at> gmail.com>
To: bug-guile <at> gnu.org
Cc: Aleix Conchillo Flaqué <aconchillo <at> gmail.com>
Subject: [PATCH] web: default to INADDR_ANY instead of INADDR_LOOPBACK
Date: Sat, 26 Feb 2022 10:11:32 -0800
Using INADDR_ANY instead of INADDR_LOOPBACK makes it convenient when
starting the web server inside containers without the need to having to
specify INADDR_ANY all the time. This is the default in most libraries
and languages.

This doesn't break backwards compatibility since INADDR_LOOPBACK is also
included in INADDR_ANY.

* doc/ref/web.texi (Web Server): update INADDR_LOOPBACK to INADDR_ANY
and related text.

* module/web/server/http.scm (http-open): default to INADDR_ANY for the
web server.
---
 doc/ref/web.texi           | 10 +++++-----
 module/web/server/http.scm |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/doc/ref/web.texi b/doc/ref/web.texi
index 93cd0214f..6b42b8ff6 100644
--- a/doc/ref/web.texi
+++ b/doc/ref/web.texi
@@ -1807,7 +1807,7 @@ socket, listening for request on that port.
 
 @deffn {HTTP Implementation} http [#:host=#f] @
                              [#:family=AF_INET] @
-                             [#:addr=INADDR_LOOPBACK] @
+                             [#:addr=INADDR_ANY] @
                              [#:port 8080] [#:socket]
 The default HTTP implementation.  We document it as a function with
 keyword arguments, because that is precisely the way that it is -- all
@@ -1815,7 +1815,7 @@ of the @var{open-params} to @code{run-server} get passed to the
 implementation's open function.
 
 @example
-;; The defaults: localhost:8080
+;; The defaults: any local IP on port 8080
 (run-server handler)
 ;; Same thing
 (run-server handler 'http '())
@@ -1866,9 +1866,9 @@ handler:
 (run-server hello-world-handler)
 @end example
 
-By default, the web server listens for requests on
-@code{localhost:8080}.  Visit that address in your web browser to
-test.  If you see the string, @code{Hello World!}, sweet!
+By default, the web server listens for requests on port @code{8080}.
+Visit @code{http://localhost:8080} in your web browser to test.  If you
+see the string, @code{Hello World!}, sweet!
 
 @subsubsection Inspecting the Request
 
diff --git a/module/web/server/http.scm b/module/web/server/http.scm
index 05bf46bf0..91354021c 100644
--- a/module/web/server/http.scm
+++ b/module/web/server/http.scm
@@ -1,6 +1,6 @@
 ;;; Web I/O: HTTP
 
-;; Copyright (C)  2010, 2011, 2012, 2015 Free Software Foundation, Inc.
+;; Copyright (C)  2010, 2011, 2012, 2015, 2022 Free Software Foundation, Inc.
 
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -61,7 +61,7 @@
                     (family AF_INET)
                     (addr (if host
                               (inet-pton family host)
-                              INADDR_LOOPBACK))
+                              INADDR_ANY))
                     (port 8080)
                     (socket (make-default-socket family addr port)))
   (listen socket 128)
-- 
2.35.1





Information forwarded to bug-guile <at> gnu.org:
bug#54171; Package guile. (Tue, 01 Mar 2022 08:50:02 GMT) Full text and rfc822 format available.

Message #8 received at 54171 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Aleix Conchillo Flaqué <aconchillo <at> gmail.com>
Cc: 54171 <at> debbugs.gnu.org
Subject: Re: bug#54171: [PATCH] web: default to INADDR_ANY instead of
 INADDR_LOOPBACK
Date: Tue, 01 Mar 2022 09:49:15 +0100
Bon dia!

Aleix Conchillo Flaqué <aconchillo <at> gmail.com> skribis:

> Using INADDR_ANY instead of INADDR_LOOPBACK makes it convenient when
> starting the web server inside containers without the need to having to
> specify INADDR_ANY all the time. This is the default in most libraries
> and languages.
>
> This doesn't break backwards compatibility since INADDR_LOOPBACK is also
> included in INADDR_ANY.

A potential problem with changing the default is that people using the
defaults would all of a sudden have their servers accessible from the
outside, which could be a real problem.

Also, defaulting to INADDR_LOOPBACK is a conservative choice, with the
understanding that you have to explicitly say so if you want your server
to be directly accessible from the outside.  (In most cases, one would
run Guile web servers behind a proxy such as nginx.)

So I have a preference for the status quo.

WDYT?

Ludo’.




Added tag(s) wontfix. Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 13 Jan 2023 15:39:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 54171 <at> debbugs.gnu.org and Aleix Conchillo Flaqué <aconchillo <at> gmail.com> Request was from Ludovic Courtès <ludo <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 13 Jan 2023 15:39:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 11 Feb 2023 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 68 days ago.

Previous Next


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