From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniele Nicolodi Newsgroups: gmane.emacs.devel Subject: Re: Bug in url-retrieve-synchronously from url.el on redirect Date: Fri, 10 Jul 2020 13:43:16 -0600 Message-ID: <8d25cbf6-5cc8-25d5-89bc-5a7a74d477c4@grinta.net> References: <08fad79e-9b6b-6ff4-66fd-c32fdf5b7189@grinta.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31003"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jul 10 21:44:03 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jtywF-0007xE-K8 for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Jul 2020 21:44:03 +0200 Original-Received: from localhost ([::1]:53260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtywE-00075s-NA for ged-emacs-devel@m.gmane-mx.org; Fri, 10 Jul 2020 15:44:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jtyvh-0006YX-R8 for emacs-devel@gnu.org; Fri, 10 Jul 2020 15:43:30 -0400 Original-Received: from grinta.net ([109.74.203.128]:55620) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jtyvf-0006nk-Is for emacs-devel@gnu.org; Fri, 10 Jul 2020 15:43:29 -0400 Original-Received: from black.local (c-73-229-170-236.hsd1.co.comcast.net [73.229.170.236]) (Authenticated sender: daniele) by grinta.net (Postfix) with ESMTPSA id D66E8E0F85 for ; Fri, 10 Jul 2020 19:43:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=grinta.net; s=2020; t=1594410206; bh=fIWnOSTRYJB9JW+GtCmjN9lWAvYVDX4YN9nxULD9Qtg=; h=Subject:To:References:From:Date:In-Reply-To:From; b=P7j+lLd0O8UphzUkei0+fgwQrySPLE9wwfVPXNpJgEmL3lb35CANXzvahaq2eSNxv Zdqcn4r0gqU43n09HI2bVuIs2nTINOBZNNkkucUMy0uBLTBbwFkRMphnH2ImFDTYY2 7cGbnx8B8fNQmt1MusPLrMqAGiHlDzRmldvJYbmgt2LEQuV00IwMIEg6+n9wpLX7sP gvLyGIHvy5VO7L5n3dZ2DOmUac2ezk8/INE+TJbVN67ma1Ub9N5knWnP48+yho+f+F TPIzVhY52u/yaqGPneXvhX3OGB8nMZ9vmXfeHjBNqNFSboCUyDmxSrbqdnx2kASdHj me5zNGSBSypkA== In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=109.74.203.128; envelope-from=daniele@grinta.net; helo=grinta.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/10 14:18:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252836 Archived-At: On 10/07/2020 12:49, Yuri Khan wrote: > On Sat, 11 Jul 2020 at 01:18, Daniele Nicolodi wrote: > >> url-retrieve-synchronously fails to obey redirect responses if the >> returned "Location" header contains spaces: it redirects to the URL >> truncated to the first space. It seems that spaces in the Location >> header value are allowed (at least ngnix produces headers like that). > > They are not, and you should report it as a bug against nginx. It > should be percent-encoding the space. It should also be > percent-encoding any non-ASCII characters. > > The Location header is defined in RFC 7231, section 7.1.2, with a > value of URI-reference as defined in RFC 3986. The complete BNF > grammar is listed in Appendix A, and none of the productions there > contain the raw space character, nor raw non-ASCII characters. Thanks for the explanation. As far as I understand the RFCs (and being wrong before, I may be wrong again) do not allow for < > quoting either. Why does url-http.el strip them? Why does it break the URI at the first space if spaces are not allowed? I would apply the old "be liberal in what you accent and strict in what you emit" wisdom here. Indeed, all the HTTP implementations I tested, except Emacs, interpret the Location header with spaces as most likely intended. Cheers, Dan