From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "J.P." Newsgroups: gmane.emacs.bugs Subject: bug#46342: 28.0.50; socks-send-command munges IP address bytes to UTF-8 Date: Fri, 12 Feb 2021 06:30:32 -0800 Message-ID: <87h7mh73zr.fsf@neverwas.me> References: <875z355sh9.fsf@neverwas.me> <83pn1do008.fsf@gnu.org> <87r1lt2s8k.fsf@neverwas.me> <83czxdns61.fsf@gnu.org> <874kils22e.fsf@neverwas.me> <831rdpkyl6.fsf@gnu.org> <87ft24njud.fsf@neverwas.me> <83o8grj4d3.fsf@gnu.org> <87eehmlkhz.fsf@neverwas.me> <83o8gqhbeh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17714"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) Cc: 46342@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 12 15:31:27 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lAZTj-0004Ud-CR for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Feb 2021 15:31:27 +0100 Original-Received: from localhost ([::1]:46786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lAZTi-0003MI-BM for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 12 Feb 2021 09:31:26 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lAZTM-0003M5-KM for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 09:31:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lAZTJ-00061I-P3 for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 09:31:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lAZTJ-0002Cc-Km for bug-gnu-emacs@gnu.org; Fri, 12 Feb 2021 09:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "J.P." Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Feb 2021 14:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46342 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46342-submit@debbugs.gnu.org id=B46342.16131402428429 (code B ref 46342); Fri, 12 Feb 2021 14:31:01 +0000 Original-Received: (at 46342) by debbugs.gnu.org; 12 Feb 2021 14:30:42 +0000 Original-Received: from localhost ([127.0.0.1]:60171 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAZSz-0002Bt-Q5 for submit@debbugs.gnu.org; Fri, 12 Feb 2021 09:30:42 -0500 Original-Received: from mail-108-mta72.mxroute.com ([136.175.108.72]:34927) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lAZSx-0002Bk-3K for 46342@debbugs.gnu.org; Fri, 12 Feb 2021 09:30:40 -0500 Original-Received: from filter004.mxroute.com ([149.28.56.236] 149.28.56.236.vultr.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta72.mxroute.com (ZoneMTA) with ESMTPSA id 17796a699470006238.001 for <46342@debbugs.gnu.org> (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Fri, 12 Feb 2021 14:30:36 +0000 X-Zone-Loop: 862d7d1d17f9dc90a2a0d0257a58eb8b2e768df6a9a0 X-Originating-IP: [149.28.56.236] In-Reply-To: <83o8gqhbeh.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 11 Feb 2021 17:28:06 +0200") X-AuthUser: masked@neverwas.me X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199858 Archived-At: Eli Zaretskii writes: > Then they are what we call "raw bytes", and encoding them with > raw-text-unix should suffice. Thanks. Unfortunately, this produces the same utf-8 encoded bytes. (encode-coding-char 192 'raw-text-unix) =E2=87=92 "\303\200" =20=20 It looks like raw-text-unix is an alias for binary [1], the coding system already used by the network process sending the erroneous request. I suppose it's always possible to strong arm it like (encode-coding-char (or (decode-char 'eight-bit c) c) 'raw-text-unix) =E2=87=92 "^@" ... "\377" But what about your original latin-1 suggestion? Is that no longer in contention? (encode-coding-char 192 'latin-1) =E2=87=92 "\300" > How does the code which calls socks.el create these raw bytes? This library has an entry-point function that's part of the url-gateway dispatch mechanism. I can't say for certain, but it looks like url-http is the only library directly using this facility. Regardless, the function gets called with a (possibly multibyte) host name, which in rare cases may be an ASCII IP address created by url-gateway. With SOCKS4, that's kind of moot, since all names are looked up through socks-nslookup-host, which returns an IPv4 address as a list of fixnums. Its caller is an internal helper that converts this list into a multibyte string for socks-send-command to emit onto the wire (where it's then rejected by the service). Currently, IP addresses aren't used at all for v5 connect-command requests. And raw-byte IP addresses do not yet appear anywhere [2]. This patch would introduce them, either as an argument to socks-send-command or as something ephemeral produced by it (the current idea). [1] (elisp) Coding System Basics [2] Of course, these are generalities that don't apply to users who wire everything up manually.