git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] instaweb: fix ip binding for the python http.server

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 10, 2025, 23:32 UTC
Message-ID
<xmqq5xmm5joc.fsf@gitster.g>
In-Reply-To
<20250110101346.30416-1-alecsk@gmail.com>
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.
Show 22 quoted lines
>
> 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
Previous: Alecs KingNext: Arti Zirk
Message 2 of 3 in “instaweb: fix ip binding for the python http.server”
  1. instaweb: fix ip binding for the python http.serverAlecs King, Jan 10, 2025
  2. Junio C HamanoJan 10, 2025
  3. Arti ZirkJan 15, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.