From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Aleix Conchillo =?UTF-8?Q?Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#54171: [PATCH] web: default to INADDR_ANY instead of INADDR_LOOPBACK Date: Sat, 26 Feb 2022 10:11:32 -0800 Message-ID: <20220226181132.64743-1-aconchillo@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30486"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Aleix Conchillo =?UTF-8?Q?Flaqu=C3=A9?= To: 54171@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Feb 26 19:14:16 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nO1aC-0007mq-GA for guile-bugs@m.gmane-mx.org; Sat, 26 Feb 2022 19:14:16 +0100 Original-Received: from localhost ([::1]:46674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nO1aB-0001BW-7j for guile-bugs@m.gmane-mx.org; Sat, 26 Feb 2022 13:14:15 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO1Y3-0006YQ-1I for bug-guile@gnu.org; Sat, 26 Feb 2022 13:12:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34190) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO1Y2-00059s-NY for bug-guile@gnu.org; Sat, 26 Feb 2022 13:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nO1Y2-0004MU-IB for bug-guile@gnu.org; Sat, 26 Feb 2022 13:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Aleix Conchillo =?UTF-8?Q?Flaqu=C3=A9?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 26 Feb 2022 18:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54171 X-GNU-PR-Package: guile X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164589910716734 (code B ref -1); Sat, 26 Feb 2022 18:12:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Feb 2022 18:11:47 +0000 Original-Received: from localhost ([127.0.0.1]:56320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nO1Xn-0004Lp-04 for submit@debbugs.gnu.org; Sat, 26 Feb 2022 13:11:47 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:60320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nO1Xl-0004Lg-6G for submit@debbugs.gnu.org; Sat, 26 Feb 2022 13:11:45 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:43910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nO1Xk-0006Eq-RI for bug-guile@gnu.org; Sat, 26 Feb 2022 13:11:45 -0500 Original-Received: from [2607:f8b0:4864:20::636] (port=35762 helo=mail-pl1-x636.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nO1Xg-00055h-Jh for bug-guile@gnu.org; Sat, 26 Feb 2022 13:11:42 -0500 Original-Received: by mail-pl1-x636.google.com with SMTP id i1so7416124plr.2 for ; Sat, 26 Feb 2022 10:11:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zsc7MzeUpS5LhA0przTdO0ucWDeWozvnDer/riJiHOU=; b=HyioVMQ5inw8LAhtlsbTVaFExX50KvrTECMId4J8gdOI5kPn7n6Ht7fJaTkiIEnQOd r1+BZ2U9bpWy7Z2t0SegzdJ3ISP7BWh+3Qk71jBPfj+RR4FLetPjO78CM3+RETiPuyCG 1RVJ9sWFDbNV9WSZxbVhsojYXMz6MiUTI766yXqSIGPd9/C9kzojUQu5iz1FTz0Ct1A1 aORLjDhzj+uyS7pz2/iNvUS5Jl3zEbVL1UrmqlrxwS9jxhHMuqXInqdGLg9+HZOHfnHU 07ZkkDNyXgGyJDgBlM0I5Ur0Rvv0s19TAfRNpV/hRcA6zHChigjcyNSkEyt51Av5SnFy ookQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zsc7MzeUpS5LhA0przTdO0ucWDeWozvnDer/riJiHOU=; b=H8T/BsiBrFzqz8GX7Y3OPJBWN+gMO2i5LrmwXDhR4Fcyo38EIH0nOuJVbIqS0pUXsk GtUJvzsYhqLt/JYnmav3/QShrFMc89hb/0T+xOVfxSbIYUxLAPvkCkqIGbkthu81XQSW ag0W0LSmkDolDxAHLJpx/vqThsIEmnZU6s1jDHliPdpswTFE0BWtl8jJQJ44w0GNVcKP 6pqlYDzRzMD+l3Z60tquYw1qeMn5uKCHC1jk+yTVmUIHfvOlgkxGEDOqhyhmE+pnC95f +13sUfp7mJ+X2zA8/zGbSdiKrtK1POr/VDdthUDR+8U46v7XnOoMc2rligTSVtQYIk2o fHNQ== X-Gm-Message-State: AOAM53319hIJ/BVTbWU4PL36rh1jEe+xRqMwGR+jSz5KtmoPoDZQxlzP 1UVjXq/TGahP59K7ekb07Me9xNVLgjM= X-Google-Smtp-Source: ABdhPJwhuk1vLx29AbzTU7FrUCH2Fv7Yf+tHEG8Q0TQNqreN6Jl+ViLKisSk74ZCPos18CB7MCmg7g== X-Received: by 2002:a17:90a:f185:b0:1bc:806f:5cfc with SMTP id bv5-20020a17090af18500b001bc806f5cfcmr8885226pjb.136.1645899098333; Sat, 26 Feb 2022 10:11:38 -0800 (PST) Original-Received: from localhost (cpe-198-72-134-0.socal.res.rr.com. [198.72.134.0]) by smtp.gmail.com with UTF8SMTPSA id l10-20020a056a00140a00b004c55d0dcbd1sm7298625pfu.120.2022.02.26.10.11.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Feb 2022 10:11:38 -0800 (PST) X-Mailer: git-send-email 2.35.1 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::636 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=aconchillo@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10255 Archived-At: 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