{"thread":{"id":"62780","subject":"[PATCH] instaweb: fix ip binding for the python http.server","startedAt":"2025-01-10T10:13:54Z","lastAt":"2025-01-15T09:24:50Z","messageCount":3,"participants":["Alecs King","Junio C Hamano","Arti Zirk"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"510286","messageId":"20250110101346.30416-1-alecsk@gmail.com","threadId":"62780","inReplyTo":null,"subject":"[PATCH] instaweb: fix ip binding for the python http.server","fromName":"Alecs King","fromEmail":"alecsk@gmail.com","sentAt":"2025-01-10T10:13:46Z","receivedAt":"2025-01-10T10:13:54Z","isPatch":true,"sender":{"key":"alecsk@gmail.com","avatar":"https://avatars.githubusercontent.com/u/84553?v=4"},"body":"`git instaweb -d python` should bind the server to 0.0.0.0\n`git instaweb -d python -l` should bind the server to 127.0.0.1\n\nSigned-off-by: Alecs King <alecsk@gmail.com>\n---\n git-instaweb.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-instaweb.sh b/git-instaweb.sh\nindex 5ad50160bb..7b44f70789 100755\n--- a/git-instaweb.sh\n+++ b/git-instaweb.sh\n@@ -694,9 +694,9 @@ class GitWebRequestHandler(CGIHTTPRequestHandler):\n \t\treturn result\n \n \n-bind = \"127.0.0.1\"\n+bind = \"0.0.0.0\"\n if \"$local\" == \"true\":\n-\tbind = \"0.0.0.0\"\n+\tbind = \"127.0.0.1\"\n \n # Set our http root directory\n # This is a work around for a missing directory argument in older Python versions\n-- \n2.47.1\n\n"},{"id":"510355","messageId":"xmqq5xmm5joc.fsf@gitster.g","threadId":"62780","inReplyTo":"20250110101346.30416-1-alecsk@gmail.com","subject":"Re: [PATCH] instaweb: fix ip binding for the python http.server","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-01-10T23:32:51Z","receivedAt":"2025-01-10T23:32:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alecs King <alecsk@gmail.com> writes:\n\n> `git instaweb -d python` should bind the server to 0.0.0.0\n> `git instaweb -d python -l` should bind the server to 127.0.0.1\n\nThat is a correct statement of the fact.  What makes this patch\nworthwhile is that the current code gets it the other way around\nsince its inception at 2eb14bb2 (git-instaweb: add Python builtin\nhttp.server support, 2019-01-28).\n\nWell spotted.\n\nThere seem to be some backends that simply ignore the \"--local\"\noption.  Should they be somehow \"fixed\" (or at least making it a\ndocumented bug)?  It is not within the scope of this patch, but\nsince the script has our attention...\n\nThanks, will queue.\n\n>\n> Signed-off-by: Alecs King <alecsk@gmail.com>\n> ---\n>  git-instaweb.sh | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-instaweb.sh b/git-instaweb.sh\n> index 5ad50160bb..7b44f70789 100755\n> --- a/git-instaweb.sh\n> +++ b/git-instaweb.sh\n> @@ -694,9 +694,9 @@ class GitWebRequestHandler(CGIHTTPRequestHandler):\n>  \t\treturn result\n>  \n>  \n> -bind = \"127.0.0.1\"\n> +bind = \"0.0.0.0\"\n>  if \"$local\" == \"true\":\n> -\tbind = \"0.0.0.0\"\n> +\tbind = \"127.0.0.1\"\n>  \n>  # Set our http root directory\n>  # This is a work around for a missing directory argument in older Python versions\n"},{"id":"510561","messageId":"6deb9ea67b2dafb12d02146a29a35ddd970f7c06.camel@gmail.com","threadId":"62780","inReplyTo":"20250110101346.30416-1-alecsk@gmail.com","subject":"Re: [PATCH] instaweb: fix ip binding for the python http.server","fromName":"Arti Zirk","fromEmail":"arti.zirk@gmail.com","sentAt":"2025-01-15T09:24:46Z","receivedAt":"2025-01-15T09:24:50Z","isPatch":true,"sender":{"key":"arti.zirk@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1923870?v=4"},"body":"On R, 2025-01-10 at 18:13 +0800, Alecs King wrote:\n> `git instaweb -d python` should bind the server to 0.0.0.0\n> `git instaweb -d python -l` should bind the server to 127.0.0.1\n\nThanks for noticing that bug and sending a patch!\n\n\n>  GitWebRequestHandler(CGIHTTPRequestHandler):\n\nNB: Looks like CGI support will be removed some time in the future and\nthe Python backend for instaweb will stop working afterwards.\n\nhttps://docs.python.org/3.13/library/http.server.html#http.server.CGIHTTPRequestHandler\n\nWhen I get the time I should look into cleaning up the instaweb script.\n"}]}