git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] instaweb: fix ip binding for the python http.server
@ 2025-01-10 10:13 Alecs King
  2025-01-10 23:32 ` Junio C Hamano
  2025-01-15  9:24 ` Arti Zirk
  0 siblings, 2 replies; 3+ messages in thread
From: Alecs King @ 2025-01-10 10:13 UTC (permalink / raw)
  To: git; +Cc: Arti Zirk

`git instaweb -d python` should bind the server to 0.0.0.0
`git instaweb -d python -l` should bind the server to 127.0.0.1

Signed-off-by: Alecs King <alecsk@gmail.com>
---
 git-instaweb.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-instaweb.sh b/git-instaweb.sh
index 5ad50160bb..7b44f70789 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -694,9 +694,9 @@ class GitWebRequestHandler(CGIHTTPRequestHandler):
 		return result
 
 
-bind = "127.0.0.1"
+bind = "0.0.0.0"
 if "$local" == "true":
-	bind = "0.0.0.0"
+	bind = "127.0.0.1"
 
 # Set our http root directory
 # This is a work around for a missing directory argument in older Python versions
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] instaweb: fix ip binding for the python http.server
  2025-01-10 10:13 [PATCH] instaweb: fix ip binding for the python http.server Alecs King
@ 2025-01-10 23:32 ` Junio C Hamano
  2025-01-15  9:24 ` Arti Zirk
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2025-01-10 23:32 UTC (permalink / raw)
  To: Alecs King; +Cc: git, Arti Zirk

Alecs King <alecsk@gmail.com> writes:

> `git instaweb -d python` should bind the server to 0.0.0.0
> `git instaweb -d python -l` should bind the server to 127.0.0.1

That is a correct statement of the fact.  What makes this patch
worthwhile is that the current code gets it the other way around
since its inception at 2eb14bb2 (git-instaweb: add Python builtin
http.server support, 2019-01-28).

Well spotted.

There seem to be some backends that simply ignore the "--local"
option.  Should they be somehow "fixed" (or at least making it a
documented bug)?  It is not within the scope of this patch, but
since the script has our attention...

Thanks, will queue.

>
> Signed-off-by: Alecs King <alecsk@gmail.com>
> ---
>  git-instaweb.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/git-instaweb.sh b/git-instaweb.sh
> index 5ad50160bb..7b44f70789 100755
> --- a/git-instaweb.sh
> +++ b/git-instaweb.sh
> @@ -694,9 +694,9 @@ class GitWebRequestHandler(CGIHTTPRequestHandler):
>  		return result
>  
>  
> -bind = "127.0.0.1"
> +bind = "0.0.0.0"
>  if "$local" == "true":
> -	bind = "0.0.0.0"
> +	bind = "127.0.0.1"
>  
>  # Set our http root directory
>  # This is a work around for a missing directory argument in older Python versions

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] instaweb: fix ip binding for the python http.server
  2025-01-10 10:13 [PATCH] instaweb: fix ip binding for the python http.server Alecs King
  2025-01-10 23:32 ` Junio C Hamano
@ 2025-01-15  9:24 ` Arti Zirk
  1 sibling, 0 replies; 3+ messages in thread
From: Arti Zirk @ 2025-01-15  9:24 UTC (permalink / raw)
  To: Alecs King, git

On R, 2025-01-10 at 18:13 +0800, Alecs King wrote:
> `git instaweb -d python` should bind the server to 0.0.0.0
> `git instaweb -d python -l` should bind the server to 127.0.0.1

Thanks for noticing that bug and sending a patch!


>  GitWebRequestHandler(CGIHTTPRequestHandler):

NB: Looks like CGI support will be removed some time in the future and
the Python backend for instaweb will stop working afterwards.

https://docs.python.org/3.13/library/http.server.html#http.server.CGIHTTPRequestHandler

When I get the time I should look into cleaning up the instaweb script.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-15  9:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10 10:13 [PATCH] instaweb: fix ip binding for the python http.server Alecs King
2025-01-10 23:32 ` Junio C Hamano
2025-01-15  9:24 ` Arti Zirk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).