From unknown Fri Jun 13 11:00:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16960: 24.3.50; Infinite loop in url-retrieve-synchronously if method is POST and response status is 301/302 Resent-From: Alex Kost Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Mar 2014 15:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16960 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 16960@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13942059585553 (code B ref -1); Fri, 07 Mar 2014 15:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Mar 2014 15:25:58 +0000 Received: from localhost ([127.0.0.1]:55029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WLwes-0001RU-0Y for submit@debbugs.gnu.org; Fri, 07 Mar 2014 10:25:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47642) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WLwep-0001RM-8y for submit@debbugs.gnu.org; Fri, 07 Mar 2014 10:25:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLwek-0008Mg-LN for submit@debbugs.gnu.org; Fri, 07 Mar 2014 10:25:54 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:58335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLwek-0008MM-J8 for submit@debbugs.gnu.org; Fri, 07 Mar 2014 10:25:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLweg-0006EE-89 for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 10:25:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLweb-0008LH-V1 for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 10:25:46 -0500 Received: from mail-la0-x22a.google.com ([2a00:1450:4010:c03::22a]:62162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLweb-0008L2-L6 for bug-gnu-emacs@gnu.org; Fri, 07 Mar 2014 10:25:41 -0500 Received: by mail-la0-f42.google.com with SMTP id ec20so2934786lab.1 for ; Fri, 07 Mar 2014 07:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=3wwozrUPyyhRdJQVtD+FGLOUWNxkthn7RkV20YHPySA=; b=CEHt7aG85ToEQwJybL3C2m7t4ZP7rqL24eDFYX0laz/w1mMfVowufXZx4vMclh0cei Cpw5fqnN1asAlQCiadx6yfCcJ9A9AUKlHtfPMsgACiK8s5X4ZUmRA2DmpLSrKM/3G3HY O3lyleMHzmQA+mNswaaihIyF4J5TnW4glXKlka3HBe0uxI1lcSk9R0xMy1jmAj555FjA ovOL7MGGUQmLSvxv4AeOH+eEE3AcOTcO7MJPC0p6lB66V6YgEJTggwf/w2Y2i5kkOwog kyg7XpLblQk4T+BzfL7vTMtU4q/ztH+xivfPDXc+dUpx7jXDYoYc5chH+ucLCyipHCtr McxQ== X-Received: by 10.112.136.71 with SMTP id py7mr8256512lbb.26.1394205939623; Fri, 07 Mar 2014 07:25:39 -0800 (PST) Received: from leviafan (128-70-206-28.broadband.corbina.ru. [128.70.206.28]) by mx.google.com with ESMTPSA id wv4sm1297441lbb.10.2014.03.07.07.25.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Mar 2014 07:25:37 -0800 (PST) From: Alex Kost Date: Fri, 07 Mar 2014 19:25:30 +0400 Message-ID: <878usmni8l.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain The problem is the following: when I try to login to https://aur.archlinux.org with `url-retrieve-synchronously' (see the code below), Emacs freezes (C-g helps) because callback passed to `url-retrieve' is never called. AFAIU this happens because `url-http-parse-headers' returns nil if response status is 301/302/307 and method is not "HEAD" or "GET" (see ). At least the problem goes away when I add: (setq success t) after (or `moved-permanently `found `temporary-redirect) in `url-http-parse-headers'. Would it be OK to allow such requests? Recipe is simple but you need to have an account on for that: 1. emacs -Q 2. Evaluate (setq url-debug t) 3. Evaluate the following code: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (defun url-post (url args &optional inhibit-cookies) "Send ARGS to URL as a POST request. ARGS is alist of field names and values to send. Return the buffer with the received data. If INHIBIT-COOKIES is non-nil, do not use saved cookies." (let ((url-request-method "POST") (url-request-extra-headers '(("Content-Type" . "application/x-www-form-urlencoded"))) (url-request-data (mapconcat (lambda (arg) (concat (url-hexify-string (car arg)) "=3D" (url-hexify-string (cdr arg)))) args "&"))) (url-retrieve-synchronously url inhibit-cookies))) (url-post "https://aur.archlinux.org/login" (list (cons "user" "") (cons "passwd" "") (cons "remember_me" "off")) t) --=-=-= Content-Type: text/plain 3. Emacs hangs; press C-g 4. In "*URL-DEBUG*" buffer you can see the line: http -> Finished parsing HTTP headers: nil In GNU Emacs 24.3.50.2 (i686-pc-linux-gnu, GTK+ Version 3.10.6) of 2014-02-02 on leviafan Windowing system distributor `The X.Org Foundation', version 11.0.11500000 Configured using: `configure --prefix=/home/alexx/usr' --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 09 11:37:11 2015 Received: (at control) by debbugs.gnu.org; 9 Jul 2015 15:37:11 +0000 Received: from localhost ([127.0.0.1]:45342 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDDst-0004Pn-Bj for submit@debbugs.gnu.org; Thu, 09 Jul 2015 11:37:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44240) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZDDsr-0004Pb-Sa for control@debbugs.gnu.org; Thu, 09 Jul 2015 11:37:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZDDsl-0006or-Rc for control@debbugs.gnu.org; Thu, 09 Jul 2015 11:37:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZDDsl-0006oj-Gn for control@debbugs.gnu.org; Thu, 09 Jul 2015 11:37:03 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ZDDsl-00037n-7X for control@debbugs.gnu.org; Thu, 09 Jul 2015 11:37:03 -0400 Subject: control message for bug 21017 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Thu, 09 Jul 2015 11:37:03 -0400 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.3 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.3 (-----) merge 16960 21017 From unknown Fri Jun 13 11:00:59 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16960: 24.3.50; Infinite loop in url-retrieve-synchronously if method is POST and response status is 301/302 Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 25 Dec 2015 20:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16960 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Alex Kost Cc: 16960@debbugs.gnu.org Received: via spool by 16960-submit@debbugs.gnu.org id=B16960.145107581616834 (code B ref 16960); Fri, 25 Dec 2015 20:37:01 +0000 Received: (at 16960) by debbugs.gnu.org; 25 Dec 2015 20:36:56 +0000 Received: from localhost ([127.0.0.1]:35462 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCZ6e-0004NS-D6 for submit@debbugs.gnu.org; Fri, 25 Dec 2015 15:36:56 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:48836) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aCZ6c-0004NJ-Cs for 16960@debbugs.gnu.org; Fri, 25 Dec 2015 15:36:54 -0500 Received: from 2.150.58.24.tmi.telenormobil.no ([2.150.58.24] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aCZ6H-00044d-5d; Fri, 25 Dec 2015 21:36:33 +0100 From: Lars Ingebrigtsen References: <878usmni8l.fsf@gmail.com> Date: Fri, 25 Dec 2015 21:36:32 +0100 In-Reply-To: <878usmni8l.fsf@gmail.com> (Alex Kost's message of "Fri, 07 Mar 2014 19:25:30 +0400") Message-ID: <87k2o22rlb.fsf@gnus.org> User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1aCZ6H-00044d-5d X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1451680593.43088@qAKKjM3SRwwfOjXXgRuoMA X-Spam-Status: No X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Alex Kost writes: > The problem is the following: when I try to login to > https://aur.archlinux.org with `url-retrieve-synchronously' (see the > code below), Emacs freezes (C-g helps) because callback passed to > `url-retrieve' is never called. > > AFAIU this happens because `url-http-parse-headers' returns nil if > response status is 301/302/307 and method is not "HEAD" or "GET" (see > ). > At least the problem goes away when I add: > > (setq success t) > > after > > (or `moved-permanently `found `temporary-redirect) > > in `url-http-parse-headers'. > > Would it be OK to allow such requests? > > Recipe is simple but you need to have an account on > for that: I don't have an account there, so I can't reproduce this bug. But could you create a patch that fixes this problem? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no