From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#42382: 26.3; url-http handling of Location redirection headers containing whitespace Date: Thu, 16 Jul 2020 18:08:37 +0200 Message-ID: References: <875e714c-28f3-7a4e-7a9e-0f4ce640e336@grinta.net> 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="31077"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42382@debbugs.gnu.org To: Daniele Nicolodi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 16 18:10:14 2020 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 1jw6Sb-0007zw-VP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Jul 2020 18:10:13 +0200 Original-Received: from localhost ([::1]:52110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jw6Sa-0008Fx-V2 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 16 Jul 2020 12:10:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45402) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jw6RS-0007Of-QP for bug-gnu-emacs@gnu.org; Thu, 16 Jul 2020 12:09:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44252) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jw6RS-0006pP-HD for bug-gnu-emacs@gnu.org; Thu, 16 Jul 2020 12:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jw6RS-00012g-BH for bug-gnu-emacs@gnu.org; Thu, 16 Jul 2020 12:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 16 Jul 2020 16:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42382 X-GNU-PR-Package: emacs Original-Received: via spool by 42382-submit@debbugs.gnu.org id=B42382.15949157293977 (code B ref 42382); Thu, 16 Jul 2020 16:09:02 +0000 Original-Received: (at 42382) by debbugs.gnu.org; 16 Jul 2020 16:08:49 +0000 Original-Received: from localhost ([127.0.0.1]:55797 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jw6RE-000125-RX for submit@debbugs.gnu.org; Thu, 16 Jul 2020 12:08:49 -0400 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:34833) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jw6RB-00011r-CF for 42382@debbugs.gnu.org; Thu, 16 Jul 2020 12:08:47 -0400 Original-Received: by mail-wm1-f43.google.com with SMTP id l2so12163668wmf.0 for <42382@debbugs.gnu.org>; Thu, 16 Jul 2020 09:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=m+7iQpZgTrT8mGXB42quPaLLTNF6u4UjqV2HZ07wqro=; b=V2dMiF+qgKm0duSOKDqyeKT+FGJRM6aBJZCpC7xEr4ZpcCpyQsmuZFb5ZX4emsWNPF 2yvF43AXQ9JlRd5Ysm5u1LqzJGsc7WVKrQRqmH6Ua79JFdgP8DQVhTznvjYII06HcuVv mY5SFWu1NkLATPsfrKAPwXoMNsRF2xGQGNW200wJ9hlw2Gb+ylkHqOPpaYWINmZemvnV UtwHUeAi6GzuezczeqxmN1VMd9H57+Hj3YDnMbVZmpsvFqXc1G/T4H+Evl17VBNpMuZI H8FvNjoGjfry71yrgoggXUmLx34vYDXDUzKG7yIIzGMLYx4MQH01sBmvoBNUly4LmuE6 +cMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version:content-transfer-encoding; bh=m+7iQpZgTrT8mGXB42quPaLLTNF6u4UjqV2HZ07wqro=; b=dunjB/g55l6EzhHIaMOp7XOpqQgrO9OMV8GSIHXGYowJCPPRykP5JCvStEjvXAH90u yuCpCVD0PmsuWRbo6REUfMhZc90bkVfA4GeQ7QUK5WzX/7/gfdzbZ0JGLRpEliOxDlcJ oqkOt2pw/Ktpbh0dgOSMX7pfU4hqk0lVItgcY5QF7I2/DCejzM7q1dyaM+Aoyh+mMPTW c9SEg+OM4nS946Bz+YtbeVsgRwTVdibBOHFkow0FCLSCZvR7JQ6/mCPhLaidxCqJrLG1 2+jZFZAXda2747ixQR4nUdumLTB4ASfcqVcYqsfRGACuVnb071qdsmWvI34+Svs+wmEk RvyA== X-Gm-Message-State: AOAM530bbXk7lYxBx7UliKWK6zt6v8c4sx5H/zNnoKBV4XlraMDFhQ8e bdPFsK4ydbDm7DlMSPCIe2eQkFwkUrw= X-Google-Smtp-Source: ABdhPJwiCx4pzrbzA0cFWQotGdr/GZJZFzD9yyoZxRhzEhdsTA0B7vKlyP/L/N+vKRCtKB8nc6XBbA== X-Received: by 2002:a1c:cc0c:: with SMTP id h12mr5267916wmb.140.1594915719345; Thu, 16 Jul 2020 09:08:39 -0700 (PDT) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:6c9b:b312:5489:40ad]) by smtp.gmail.com with ESMTPSA id o9sm9775572wrs.1.2020.07.16.09.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 09:08:38 -0700 (PDT) In-Reply-To: <875e714c-28f3-7a4e-7a9e-0f4ce640e336@grinta.net> (Daniele Nicolodi's message of "Wed, 15 Jul 2020 14:40:36 -0600") 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:183080 Archived-At: >>>>> On Wed, 15 Jul 2020 14:40:36 -0600, Daniele Nicolodi said: Daniele> In RFC 7231 the Location header is defined to carry a URI-refe= rence. Daniele> According to RFC 3986 it should be percent-encoded and thus sh= ould not Daniele> contain spaces. However, there are HTTP server implementation = (notably Daniele> nginx) that do not do that. While this is a bug in those HTTP = server Daniele> implementations, I think Emacs should follow what most other H= TTP client Daniele> implementatios (all the ones I tested) and use the content of = the Daniele> Location header unmodified. Stripping of angle bracket quotes = is Daniele> unnecessary as they are not valid according to the RFCs. Nor is embedded whitespace in the URI :-) Are you sure this won't break anything? ie are you sure there are 0 server implementations out there that send angle brackets? I=CA=BCd be conservative, and just replace the truncation on whitespace with percent-encoding of said whitespace. Daniele> Also, accordingly to the RFCs, the location header may contain= a Daniele> relative location. Thus the comment that suggest that such a r= esponse is Daniele> a bug in the server should be reworded. Daniele> The attached patches implement the proposed changes. The second patch is small enough that I think you can combine the two. Robert