From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 31 13:10:27 2013 Received: (at submit) by debbugs.gnu.org; 31 Jan 2013 18:10:28 +0000 Received: from localhost ([127.0.0.1]:57902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0yah-0004y8-44 for submit@debbugs.gnu.org; Thu, 31 Jan 2013 13:10:27 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52394) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U0xvZ-0003ww-OF for submit@debbugs.gnu.org; Thu, 31 Jan 2013 12:27:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0xuo-0007Wp-3H for submit@debbugs.gnu.org; Thu, 31 Jan 2013 12:27:14 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID,WEIRD_PORT autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:57687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0xuo-0007Wk-0n for submit@debbugs.gnu.org; Thu, 31 Jan 2013 12:27:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0xui-0002yA-EN for bug-gnu-emacs@gnu.org; Thu, 31 Jan 2013 12:27:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U0xud-0007US-Ff for bug-gnu-emacs@gnu.org; Thu, 31 Jan 2013 12:27:04 -0500 Received: from mail-bk0-f49.google.com ([209.85.214.49]:42384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U0xud-0007U3-9l for bug-gnu-emacs@gnu.org; Thu, 31 Jan 2013 12:26:59 -0500 Received: by mail-bk0-f49.google.com with SMTP id w11so1465955bku.8 for ; Thu, 31 Jan 2013 09:26:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:subject:date:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=VcU/0EK8T9yhdIMy+bcaMJar6zv1RklAZODPvP/J954=; b=YYa+iJ7PjwYaJFdXCC1COZnmjjX8jZqklpFugmCtQMRMMClRvTRsxKwoYx3KCJwMOS 1GGfv/rsVX4zoNnZdRxZs7cOnKfak+oDtxFjzelCQGJPti7IpBkPUjq7NefG5kbTr3bh u6HVvMuj96L+fsSxRT2wVG+RtuOAH1CzRYWNX0iYyYeoCGAN1uDhR21aGQwwyEkU3zUj wTmPgbo7CG8JaV6Iq1oap5HdpCNpdDRdg5jXU9QwRkjHWr+RGL0M7h2h19cSkgKuLL/Q +5t+vKFrciUPkkcpzYKtnKGH5ObGAu43N9ejCYGOMOCz9nLl1Gj8ss90ZysTC6Td4/V4 Dfow== X-Received: by 10.204.127.6 with SMTP id e6mr2439845bks.13.1359653217792; Thu, 31 Jan 2013 09:26:57 -0800 (PST) Received: from kafka (dslb-178-000-019-197.pools.arcor-ip.net. [178.0.19.197]) by mx.google.com with ESMTPS id b21sm913222bkw.12.2013.01.31.09.26.56 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 31 Jan 2013 09:26:56 -0800 (PST) From: coroa@online.de (Jonas Hoersch) To: bug-gnu-emacs@gnu.org Subject: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line Date: Thu, 31 Jan 2013 18:26:54 +0100 Message-ID: <87d2wluuu9.fsf@online.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Thu, 31 Jan 2013 13:10:25 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) hej, everyone, i just finished hunting down an improbable bug in url-http.el, which appears when a url is retrieved from a server which sends the headers line-by-line instead of in one junk, like it is the case for the BaseHTTPServer classes coming along in python 2. A simple test-case looks like the following (sorry for the long non-emacs setup stuff, but it's the minimalist example i could come up with) cd into a directory containing only a single minimal text file and start python's SimpleHTTPServer so it serves it. $ cd $(mktemp -d) $ echo "hello world" > textfile $ python -m SimpleHTTPServer 8000 # works only for python 2.x (switch-to-buffer (url-retrieve-synchronously "http://127.0.0.1:8000/textfile")) now correctly will retrieve the "hello world" but the buffer-local-variables url-http-content-type and url-http-content-length are nil in the returned buffer, although one sees that they have been transmitted by python. adding an extra debug line to url-http's url-http-wait-for-headers-change-function around line 1043, ------ (when (re-search-forward "^\r*$" nil t) ;; Saw the end of the headers (url-http-debug "Saw end of headers... (%s)" (buffer-name))=20=20=20=20= =20=20=20=20=20=20 + (url-http-debug "when the buffer contained...\n%s" (buffer-substr= ing (point-min) (point-max))) (setq url-http-end-of-headers (set-marker (make-marker) (point)) end-of-headers t) ------- will show you in *URL-DEBUG* (url-debug being t) ------- http -> Saw end of headers... ( *http 127.0.0.1:8000*-273882) http -> when the buffer contained... HTTP/1.0 200 OK Server: SimpleHTTP/0.6 Python/2.7.3 http -> url-http-parse-response called in ( *http 127.0.0.1:8000*-273882) http -> No content-length, being dumb. ------- that the headers haven't completely arrived yet, when url-http decides it has seen the end of them. changing the regex in (re-search-forward "^\r*$" nil t) to "^\r*\n" solves the problem for me, but i'm unsure about what i might possibly be breaking that way. thanks for looking into it, jonas h=C3=B6rsch In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll b= ars) of 2013-01-29 on kafka Bzr revision: michael.albinus@gmx.de-20130129081211-mmthn9p4bh75h5pr Windowing system distributor `The X.Org Foundation', version 11.0.11302000 Configured using: `configure --prefix=3D/usr --sysconfdir=3D/etc --localstatedir=3D/var --libexecdir=3D/usr/lib --mandir=3D/usr/share/man --without-sound --with-xft --with-x-toolkit=3Dlucid' Important settings: value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 07 13:31:17 2013 Received: (at submit) by debbugs.gnu.org; 7 Feb 2013 18:31:17 +0000 Received: from localhost ([127.0.0.1]:42306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U3WFh-0006Ji-7a for submit@debbugs.gnu.org; Thu, 07 Feb 2013 13:31:17 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41207) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U3WFe-0006Jb-8Z for submit@debbugs.gnu.org; Thu, 07 Feb 2013 13:31:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3WEH-0000II-TU for submit@debbugs.gnu.org; Thu, 07 Feb 2013 13:29:50 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD,USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:33386) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3WEH-0000ID-Qx for submit@debbugs.gnu.org; Thu, 07 Feb 2013 13:29:49 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3WEH-0002l7-1I for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2013 13:29:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U3WEF-0000Hq-RC for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2013 13:29:48 -0500 Received: from plane.gmane.org ([80.91.229.3]:36040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U3WEF-0000Gl-M2 for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2013 13:29:47 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1U3WEV-0006LC-RX for bug-gnu-emacs@gnu.org; Thu, 07 Feb 2013 19:30:03 +0100 Received: from e178209186.adsl.alicedsl.de ([85.178.209.186]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Feb 2013 19:30:03 +0100 Received: from coroa by e178209186.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 07 Feb 2013 19:30:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: coroa@online.de (Jonas =?utf-8?Q?H=C3=B6rsch?=) Subject: Re: bug#13598: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line Date: Thu, 07 Feb 2013 19:13:40 +0100 Lines: 21 Message-ID: <87wquk3sbv.fsf@online.de> References: <87d2wluuu9.fsf@online.de> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178209186.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:HewRqEk5XBPUA8yP3xjhMA8pCLY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) On Thu, Jan 31 2013, Jonas Hoersch wrote: > changing the regex in (re-search-forward "^\r*$" nil t) to "^\r*\n" > solves the problem for me, but i'm unsure about what i might possibly be > breaking that way. i'm positive now, that changing the regex to "^\r+$" is the way to go. i would be happy to supply a patch, but i understand it is probably to trivial a matter to justify going through the legal requirements first. the following advice can serve as a hotfix: (defadvice url-http-wait-for-headers-change-function (around url-http-properly-wait-for-headers-advice activate) (save-excursion (goto-char (point-min)) (if (re-search-forward "^\r+$" nil t) ad-do-it (url-http-debug "Incomplete headers...: %d" (point-max))))) From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 13 12:19:55 2013 Received: (at 13598) by debbugs.gnu.org; 13 Feb 2013 17:19:56 +0000 Received: from localhost ([127.0.0.1]:54420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5fzv-0004y9-EN for submit@debbugs.gnu.org; Wed, 13 Feb 2013 12:19:55 -0500 Received: from mail-wi0-f173.google.com ([209.85.212.173]:42864) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5fzt-0004y2-ET for 13598@debbugs.gnu.org; Wed, 13 Feb 2013 12:19:54 -0500 Received: by mail-wi0-f173.google.com with SMTP id hq4so6014199wib.12 for <13598@debbugs.gnu.org>; Wed, 13 Feb 2013 09:19:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type :content-transfer-encoding; bh=gMNcYE0Ei9K8u+STGM41cquHXNzFjnioiNK+7ap9GBg=; b=T8rjJVBoAWfx/cZIRoIQCuKkfaNvmkSlxCPi7x5PTmcoG72SgXz9pdPfDmcqC5i6fT r7c2hmtQkETZ5Hmq2Dt6ytZhaFSvUFje8P28u/uMOHAv8hq+gQHrha9jVIJwuJV/cjb4 Se/CRE0sofA0vRsxsyKH/OKnY+CHeBa0WzE/onxrb25g023fLL5oLvrTWDuiJSjB7O+C 2DgF7FceEtjLAAV7fi1+Wx055cSYtqXAEVsIe33PU/79sUilq5TErK9jQo/LKoNn8HqB hV6BD7ys7jvqfHEUqg8q2DMKYtxBxG7cB+1slyF+5bfOb7ye8b1Z1Aw8O9SQ+PCyM4ht n94g== X-Received: by 10.194.92.65 with SMTP id ck1mr39794625wjb.54.1360775959915; Wed, 13 Feb 2013 09:19:19 -0800 (PST) Received: from bzg.localdomain (mar75-2-81-56-68-112.fbx.proxad.net. [81.56.68.112]) by mx.google.com with ESMTPS id ec3sm43747156wib.1.2013.02.13.09.19.17 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Feb 2013 09:19:18 -0800 (PST) Received: by bzg.localdomain (Postfix, from userid 1000) id 3A7081C20D18; Wed, 13 Feb 2013 18:19:15 +0100 (CET) From: Bastien To: coroa@online.de (Jonas =?iso-8859-1?Q?H=F6rsch?=) Subject: Re: bug#13598: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line In-Reply-To: <87wquk3sbv.fsf@online.de> ("Jonas =?iso-8859-1?Q?H=F6rsch=22?= =?iso-8859-1?Q?'s?= message of "Thu, 07 Feb 2013 19:13:40 +0100") References: <87d2wluuu9.fsf@online.de> <87wquk3sbv.fsf@online.de> User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) Date: Wed, 13 Feb 2013 18:19:15 +0100 Message-ID: <878v6st9m4.fsf@bzg.ath.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 13598 Cc: 13598@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Jonas, coroa@online.de (Jonas Hörsch) writes: > On Thu, Jan 31 2013, Jonas Hoersch wrote: > >> changing the regex in (re-search-forward "^\r*$" nil t) to "^\r*\n" >> solves the problem for me, but i'm unsure about what i might possibly be >> breaking that way. > > i'm positive now, that changing the regex to "^\r+$" is the way to go. > > i would be happy to supply a patch, but i understand it is probably to > trivial a matter to justify going through the legal requirements first. > > the following advice can serve as a hotfix: > > (defadvice url-http-wait-for-headers-change-function (around > url-http-properly-wait-for-headers-advice > activate) > (save-excursion > (goto-char (point-min)) > (if (re-search-forward "^\r+$" nil t) > ad-do-it > (url-http-debug "Incomplete headers...: %d" (point-max))))) I confirm both the problem and the fix. It does not look critical though. Stefan, Glenn, should I commit the patch into trunk (or emacs-24)? -- Bastien From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 13 14:31:15 2013 Received: (at 13598) by debbugs.gnu.org; 13 Feb 2013 19:31:15 +0000 Received: from localhost ([127.0.0.1]:54547 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5i31-00082W-Ji for submit@debbugs.gnu.org; Wed, 13 Feb 2013 14:31:15 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:38517) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5i2x-00082F-5o for 13598@debbugs.gnu.org; Wed, 13 Feb 2013 14:31:12 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFxKjI/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFxKjI/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="1182977" Received: from 69-196-168-200.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.200]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Feb 2013 14:30:37 -0500 Received: by pastel.home (Postfix, from userid 20848) id 5A66B59267; Wed, 13 Feb 2013 14:30:37 -0500 (EST) From: Stefan Monnier To: Bastien Subject: Re: bug#13598: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line Message-ID: References: <87d2wluuu9.fsf@online.de> <87wquk3sbv.fsf@online.de> <878v6st9m4.fsf@bzg.ath.cx> Date: Wed, 13 Feb 2013 14:30:37 -0500 In-Reply-To: <878v6st9m4.fsf@bzg.ath.cx> (Bastien's message of "Wed, 13 Feb 2013 18:19:15 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 13598 Cc: 13598@debbugs.gnu.org, Jonas =?iso-8859-1?Q?H=F6rsch?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > It does not look critical though. Stefan, Glenn, should I > commit the patch into trunk (or emacs-24)? AFAIK this is not a regression, so => trunk And thanks for taking care of it, Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 13 14:43:11 2013 Received: (at 13598) by debbugs.gnu.org; 13 Feb 2013 19:43:11 +0000 Received: from localhost ([127.0.0.1]:54562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5iEY-0008LD-Vt for submit@debbugs.gnu.org; Wed, 13 Feb 2013 14:43:11 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:32803) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5iEX-0008L7-QT for 13598@debbugs.gnu.org; Wed, 13 Feb 2013 14:43:10 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1U5iDz-0002o4-PX; Wed, 13 Feb 2013 14:42:35 -0500 From: Glenn Morris To: Bastien Subject: Re: bug#13598: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line References: <87d2wluuu9.fsf@online.de> <87wquk3sbv.fsf@online.de> <878v6st9m4.fsf@bzg.ath.cx> X-Spook: SHA Glock Exon Shell Uzi ASIO George W. Bush ANDVT SSL X-Ran: [0jY1s+>Wai1&s2+auwcAL)W}O].>G'>l5cmPQ%:CkIc{8^ii1vS:!.B%Q(5B'#Ko:[/r5 X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Wed, 13 Feb 2013 14:42:35 -0500 In-Reply-To: <878v6st9m4.fsf@bzg.ath.cx> (Bastien's message of "Wed, 13 Feb 2013 18:19:15 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13598 Cc: 13598@debbugs.gnu.org, Jonas =?utf-8?Q?H=C3=B6rsch?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Bastien wrote: >> i'm positive now, that changing the regex to "^\r+$" is the way to go. I don't understand how this can be correct. What is this supposed to be matching? http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.3 The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 13 16:39:13 2013 Received: (at 13598) by debbugs.gnu.org; 13 Feb 2013 21:39:13 +0000 Received: from localhost ([127.0.0.1]:54626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5k2q-0002ch-RB for submit@debbugs.gnu.org; Wed, 13 Feb 2013 16:39:13 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:34861) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5k2k-0002cV-MD for 13598@debbugs.gnu.org; Wed, 13 Feb 2013 16:39:10 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1U5k2A-0007Ku-EH; Wed, 13 Feb 2013 16:38:30 -0500 From: Glenn Morris To: Bastien Subject: Re: bug#13598: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line References: <87d2wluuu9.fsf@online.de> <87wquk3sbv.fsf@online.de> <878v6st9m4.fsf@bzg.ath.cx> X-Spook: BLU-97 A/B Putin Saddam Hussein STARLAN crypto anarchy X-Ran: PQRa+15m^^%"$NZh)RD;^;|#t^Q4\\8C_y)R`[u:@eXE\MH5e,DWLbp/u#ndK@${dXg.CV X-Hue: black X-Debbugs-No-Ack: yes X-Attribution: GM Date: Wed, 13 Feb 2013 16:38:29 -0500 In-Reply-To: (Glenn Morris's message of "Wed, 13 Feb 2013 14:42:35 -0500") Message-ID: <68ip5v99nu.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13598 Cc: 13598@debbugs.gnu.org, Jonas =?utf-8?Q?H=C3=B6rsch?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) >>> i'm positive now, that changing the regex to "^\r+$" is the way to go. Would "^\r?\n" be better? From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 14 01:09:23 2013 Received: (at 13598) by debbugs.gnu.org; 14 Feb 2013 06:09:23 +0000 Received: from localhost ([127.0.0.1]:54932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5s0Z-0001sN-1A for submit@debbugs.gnu.org; Thu, 14 Feb 2013 01:09:23 -0500 Received: from mail-wi0-f182.google.com ([209.85.212.182]:43173) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5s0W-0001sD-Je for 13598@debbugs.gnu.org; Thu, 14 Feb 2013 01:09:21 -0500 Received: by mail-wi0-f182.google.com with SMTP id hi18so2292793wib.3 for <13598@debbugs.gnu.org>; Wed, 13 Feb 2013 22:08:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=wzJ2F8YKxlKw97jhPu4DWj9vtsUbaqYkyg2kRp/Co9s=; b=wbPIZl3VmzsXDXtYBi0HAkjbgtlsrvdJtn0lWlutoyH+6U5ir5OVDBPXIUsWVgftyP o/Gs/QlEycAm1pGJtiLP4NNufBw+yn/ATfuAWgv1gd0kDouB4HINwe5WOduZPG/h72Tw G9IX8grhdeLJzcohdcTAdHCXBPQ+Sm8iNq4kyKwk1Y2LvkW0RE8Ek6wsuCJShZrGIWdr j7TrTDmEq+3N7goclgFYPf2oZsNlUWnccKygBvSmAf7xeS0TPLahrQvkpXSOrCcflcMK GM9OZNo64+VmIkT4bGkSuOGE/Ejzs3lUdyz27tY09tA2xcbfHLmgUH64ciGx8NvLPYSL 3l7A== X-Received: by 10.180.84.162 with SMTP id a2mr14411276wiz.14.1360822124431; Wed, 13 Feb 2013 22:08:44 -0800 (PST) Received: from bzg.localdomain (mar75-2-81-56-68-112.fbx.proxad.net. [81.56.68.112]) by mx.google.com with ESMTPS id e12sm50109909wiw.5.2013.02.13.22.08.41 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 13 Feb 2013 22:08:43 -0800 (PST) Received: by bzg.localdomain (Postfix, from userid 1000) id B08641C20D5B; Thu, 14 Feb 2013 07:08:40 +0100 (CET) From: Bastien To: Glenn Morris Subject: Re: bug#13598: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line In-Reply-To: <68ip5v99nu.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 13 Feb 2013 16:38:29 -0500") References: <87d2wluuu9.fsf@online.de> <87wquk3sbv.fsf@online.de> <878v6st9m4.fsf@bzg.ath.cx> <68ip5v99nu.fsf@fencepost.gnu.org> User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) Date: Thu, 14 Feb 2013 07:08:40 +0100 Message-ID: <87obfno2af.fsf@bzg.ath.cx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.2 (-) X-Debbugs-Envelope-To: 13598 Cc: 13598@debbugs.gnu.org, Jonas =?iso-8859-1?Q?H=F6rsch?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Glenn, Glenn Morris writes: >>>> i'm positive now, that changing the regex to "^\r+$" is the way to go. > > Would "^\r?\n" be better? The quote of the OP is misleading -- he proposed to change the regexp in (re-search-forward "^\r*$" nil t) to "^\r*\n", which is the fix I'm talking about. But yes, "^\r?\n" is slightly better than "^\r*\n" because AFAIK there can be only one CR in the line separating the headers from the body. Let me know if you want to fix this yourself or if I should do it. Thanks, -- Bastien From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 15 21:07:41 2013 Received: (at 13598-done) by debbugs.gnu.org; 16 Feb 2013 02:07:42 +0000 Received: from localhost ([127.0.0.1]:58340 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6XBk-00055t-DR for submit@debbugs.gnu.org; Fri, 15 Feb 2013 21:07:41 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:37149) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6XBi-00055l-RQ for 13598-done@debbugs.gnu.org; Fri, 15 Feb 2013 21:07:39 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1U6XAy-0005em-52; Fri, 15 Feb 2013 21:06:52 -0500 From: Glenn Morris To: 13598-done@debbugs.gnu.org Subject: Re: bug#13598: 24.3.50; url-http.el doesn't correctly parse headers when they are sent line-by-line References: <87d2wluuu9.fsf@online.de> <87wquk3sbv.fsf@online.de> <878v6st9m4.fsf@bzg.ath.cx> <68ip5v99nu.fsf@fencepost.gnu.org> X-Spook: Abu Ghraib Plame radar lock picking NSA pipeline X-Ran: H:8;E47}9?eK"Po82*r7?5C (Glenn Morris's message of "Wed, 13 Feb 2013 16:38:29 -0500") Message-ID: <3qwqu92ero.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 13598-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.5 (-----) Version: 24.4 Glenn Morris wrote: > Would "^\r?\n" be better? Applied. From unknown Sat Jun 14 19:10:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 16 Mar 2013 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Wed May 08 19:09:01 2013 Received: (at control) by debbugs.gnu.org; 8 May 2013 23:09:01 +0000 Received: from localhost ([127.0.0.1]:34251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UaDTo-0007qh-PB for submit@debbugs.gnu.org; Wed, 08 May 2013 19:09:01 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:50245) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UaDTn-0007qa-NQ for control@debbugs.gnu.org; Wed, 08 May 2013 19:08:59 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1UaDTm-00019h-DJ for control@debbugs.gnu.org; Wed, 08 May 2013 19:08:58 -0400 Date: Wed, 08 May 2013 19:08:58 -0400 Message-Id: Subject: control message for bug 14372 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.6 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) unarchive 13598 forcemerge 13598 14372 From unknown Sat Jun 14 19:10:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 06 Jun 2013 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 11:44:40 2014 Received: (at control) by debbugs.gnu.org; 26 Feb 2014 16:44:40 +0000 Received: from localhost ([127.0.0.1]:41489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIhb4-0002Om-AZ for submit@debbugs.gnu.org; Wed, 26 Feb 2014 11:44:39 -0500 Received: from mail-ea0-f180.google.com ([209.85.215.180]:42213) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIagn-0005ap-02 for control@debbugs.gnu.org; Wed, 26 Feb 2014 04:22:05 -0500 Received: by mail-ea0-f180.google.com with SMTP id m10so717880eaj.25 for ; Wed, 26 Feb 2014 01:22:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=XUvuw61U9Oq1ItSLWwjl+J1T1v9Gco1jCrrd3QwNy/4=; b=yqQChhUmdm/zFvT0e2nm8EiaSc/3Y3o5V7IQIEjb87Ut43RGlJFgRguGark3yVw+N0 bej05+q2CDpbaMshpEI1zYNTIlA8UZqumth5WXhMdjflXPp+KQFU/d4tQ2LWJnu9mBYh IX4lyAxFfE/Q6Jz+bRt6TSXnZIkx9qcX7p8XDFTMRk4LDqECXrFApqjjGeJkJ7gpnYKX hJiWqtS8JQfWHtPWmWS34bgwDlrANijHIvp1hyNUq2WMAnCDUa9SzPWZKNGpeVbeM3/W h7YJg8mIA7GMyjJuxDxtIpxkomiWXus36UIcaymOVHbXl8CxFixL2a7eybMAbZknmCz5 QDpg== X-Received: by 10.14.175.2 with SMTP id y2mr5158065eel.75.1393406523845; Wed, 26 Feb 2014 01:22:03 -0800 (PST) Received: from [192.168.1.100] ([87.204.33.177]) by mx.google.com with ESMTPSA id 46sm1360477ees.4.2014.02.26.01.22.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 01:22:03 -0800 (PST) From: Blazej Adamczyk Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: unarchive 13598 Message-Id: <6072B4B0-FE7D-4D3A-A633-B71351806125@gmail.com> Date: Wed, 26 Feb 2014 10:22:00 +0100 To: control@debbugs.gnu.org Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) X-Mailer: Apple Mail (2.1827) X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: control X-Mailman-Approved-At: Wed, 26 Feb 2014 11:44:35 -0500 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: -0.4 (/) unarchive 13598 From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 11:45:23 2014 Received: (at 13598) by debbugs.gnu.org; 26 Feb 2014 16:45:23 +0000 Received: from localhost ([127.0.0.1]:41500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIhbm-0002RH-NE for submit@debbugs.gnu.org; Wed, 26 Feb 2014 11:45:23 -0500 Received: from mail-ea0-f170.google.com ([209.85.215.170]:49609) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIarA-0005uC-QP for 13598@debbugs.gnu.org; Wed, 26 Feb 2014 04:32:49 -0500 Received: by mail-ea0-f170.google.com with SMTP id g15so753238eak.29 for <13598@debbugs.gnu.org>; Wed, 26 Feb 2014 01:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=zhkGyvTXuz/gUac5LHVKIvBk6/ptDb9lKsyz97rjr04=; b=JFa8pDwL0FDvk9va7Fn0k0dzY/Wd7R/QsAOcRMHGGE65wKYFYWUXtrbhzWWnxQLwBA sHC69qcZED7iuRd3qqvbbKQ/kt3UDc99I8PKxp0IWcwUTMSd5L3jri8N/bNYYyhDU4ix dE1VG0nPiciXypSWCENB60l/Z04Jl0TnkbrU2eIobDCas55E8fgUBxcoZNIP5x4zC5On sncawD1rEZ3hEeWk6JZUvtorxEdtuSO/ViwU3M+BNQcM2Maln5OziZ3ADUrJu6tp330n j61DHWZOhv3Cx45OO57wg73NTImAbb8Vj8mVl4qpTsxXMh1wKkJcuQC6L2pp+xd2GgL+ MZqg== X-Received: by 10.14.241.140 with SMTP id g12mr5370380eer.45.1393407167942; Wed, 26 Feb 2014 01:32:47 -0800 (PST) Received: from [192.168.1.100] ([87.204.33.177]) by mx.google.com with ESMTPSA id a2sm1428201eem.18.2014.02.26.01.32.47 for <13598@debbugs.gnu.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 01:32:47 -0800 (PST) From: Blazej Adamczyk Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Re: bug#13598: 24.3.50; Message-Id: <5007F097-0E1C-42DE-BD66-56BED0D9C28B@gmail.com> Date: Wed, 26 Feb 2014 10:32:45 +0100 To: 13598@debbugs.gnu.org Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) X-Mailer: Apple Mail (2.1827) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 13598 X-Mailman-Approved-At: Wed, 26 Feb 2014 11:45:20 -0500 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: -0.7 (/) Hello,=20 I had to reopen the bug because I faced the same problem as OP. His = didn't make himself clear: By example: When parsing response we may get in state when we will receive only the = following: "HTTP/1.0 200 OK^M " without double quotes (I added them to show the newline character). In case of current implementation the regexp "^\r?$" and the previous = regexp "^\r*$" both are matching the end of string. That is wrong = because there will be something in the new line after a while.=20 RFC 2616 states clear: generic-message =3D start-line *(message-header CRLF) CRLF [ message-body ] start-line =3D Request-Line | Status-Line there has to be one (exactly one) CR in a single line between headers = and body. Thus I propose a simple regexp "^\r$". -- Blazej= From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 26 11:54:16 2014 Received: (at 13598) by debbugs.gnu.org; 26 Feb 2014 16:54:16 +0000 Received: from localhost ([127.0.0.1]:41529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIhkN-0002i9-CP for submit@debbugs.gnu.org; Wed, 26 Feb 2014 11:54:15 -0500 Received: from mail-ea0-f170.google.com ([209.85.215.170]:50888) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WIhkJ-0002hu-Ke for 13598@debbugs.gnu.org; Wed, 26 Feb 2014 11:54:12 -0500 Received: by mail-ea0-f170.google.com with SMTP id g15so1116282eak.1 for <13598@debbugs.gnu.org>; Wed, 26 Feb 2014 08:54:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:message-id:date:to:mime-version; bh=NwNAjtH1YyRf2oTLvVxyTJOhKZRS/0yXmG8rFNddyjk=; b=NsXg0SF9jK0KsBvy3RXSSYIpzjCXxrcPQ1kRz9Gq82gVCL9z+NTvxeA6YC+ZsjgUkj +/njvTq4+LOXnFEArpz5FX3dKQh4H6eXyWA68huY/yVDWhhH9i9Njuxh0J0UuGFqBeV0 FthwZEBTR3td2QUQkaBx43qucgIVYmTmsOAyQcQAHtZLyaL4MEINJftqq8prHg1bcHpu b98X9PhYbWLDlv3JG5/DHLSzF3HVWkXtu/v5sB4U5mpDvyvO4hPpSYe7I0w+snqOdvX2 eUoDVsFWucEF+TYlGdzL6zoWzEuIaaSAhd7l2axORG+aurUp8bvx0SHZX2Xd8DNgszx5 9Wyg== X-Received: by 10.14.111.5 with SMTP id v5mr7871269eeg.11.1393433650521; Wed, 26 Feb 2014 08:54:10 -0800 (PST) Received: from [192.168.1.100] ([87.204.33.177]) by mx.google.com with ESMTPSA id 43sm5813518eeh.13.2014.02.26.08.54.08 for <13598@debbugs.gnu.org> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Feb 2014 08:54:09 -0800 (PST) From: Blazej Adamczyk Content-Type: multipart/signed; boundary="Apple-Mail=_66A2BAA1-A246-4EA4-884A-E43B1733702E"; protocol="application/pgp-signature"; micalg=pgp-sha256 Subject: Re: bug#13598: 24.3.50 Message-Id: <2DC22385-AACB-4B7D-9918-3EB835B8526C@gmail.com> Date: Wed, 26 Feb 2014 17:54:06 +0100 To: 13598@debbugs.gnu.org Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) X-Mailer: Apple Mail (2.1827) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 13598 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: -0.7 (/) --Apple-Mail=_66A2BAA1-A246-4EA4-884A-E43B1733702E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hello,=20 I had to reopen the bug because I faced the same problem as OP. His = didn't make himself clear: By example: When parsing response we may get in state when we will receive only the = following: "HTTP/1.0 200 OK^M " without double quotes (I added them to show the newline character). In case of current implementation the regexp "^\r?$" and the previous = regexp "^\r*$" both are matching the end of string. That is wrong = because there will be something in the new line after a while.=20 RFC 2616 states clear: generic-message =3D start-line *(message-header CRLF) CRLF [ message-body ] start-line =3D Request-Line | Status-Line there has to be one (exactly one) CR in a single line between headers = and body. Thus I propose a simple regexp "^\r$". -- Blazej --Apple-Mail=_66A2BAA1-A246-4EA4-884A-E43B1733702E Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQEcBAEBCAAGBQJTDhwuAAoJELcOb3l0I/e32v4IAK9z9WCre9qiiKiNbrJUaTHR /QIrxyk0mDmTHkyYjFEgWRTjbk4gDF4ljQz6sMinv1JH9Zv5hwdk+diijNkvsCyE oq8lbJuQcsIjmKQrM+VT+OS2fFqcthHRsjtdHIeJT6GjkKxoqK8X9epCw9D5mf4F uQvr+/TfQWG18eRiXFVqX6FQj/ndo9StIpfRnvJhBh7XRieQ5Rqai+DeDVI6Nhfx 0JZNeJuRvDPXkPjjG3g51Y4FS93H5mxuQPU84FwcYmpULYSO2c2YxQ/v2AFBWFxg qMD2bljGnoyp7bNUULSPh6hZFIxuxisH02/RXT4pou77lVikAfhRTss4ibhSJs0= =MsbQ -----END PGP SIGNATURE----- --Apple-Mail=_66A2BAA1-A246-4EA4-884A-E43B1733702E-- From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 27 17:43:12 2014 Received: (at 13598) by debbugs.gnu.org; 27 Feb 2014 22:43:12 +0000 Received: from localhost ([127.0.0.1]:43212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ9fb-0000iR-G3 for submit@debbugs.gnu.org; Thu, 27 Feb 2014 17:43:12 -0500 Received: from fencepost.gnu.org ([208.118.235.10]:47074) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WJ9fZ-0000iJ-8Y for 13598@debbugs.gnu.org; Thu, 27 Feb 2014 17:43:09 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1WJ9fY-0005Qv-FM; Thu, 27 Feb 2014 17:43:08 -0500 From: Glenn Morris To: Blazej Adamczyk Subject: Re: bug#13598: 24.3.50 References: <87d2wluuu9.fsf@online.de> <2DC22385-AACB-4B7D-9918-3EB835B8526C@gmail.com> X-Spook: Montenegro president offensive information warfare Steve X-Ran: S(tl+:6>C&s'}6kHc$AgBa4}cJ8;XGvc@4W-}RmiT*e#ub9I.:Y`5jcTi$%mOhvAok""_: X-Hue: red X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 27 Feb 2014 17:43:08 -0500 In-Reply-To: <2DC22385-AACB-4B7D-9918-3EB835B8526C@gmail.com> (Blazej Adamczyk's message of "Wed, 26 Feb 2014 17:54:06 +0100") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 13598 Cc: 13598@debbugs.gnu.org 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.0 (-----) Blazej Adamczyk wrote: > By example: > When parsing response we may get in state when we will receive only > the following: > > "HTTP/1.0 200 OK^M > " > > without double quotes (I added them to show the newline character). > > In case of current implementation the regexp "^\r?$" and the previous > regexp "^\r*$" both are matching the end of string. That is wrong > because there will be something in the new line after a while. The current implementation uses "^\r?\n", not "^\r?$". Where did you get "^\r?$" from? As such I do not see that it will match your example. > RFC 2616 states clear: > generic-message = start-line > *(message-header CRLF) > CRLF > [ message-body ] > start-line = Request-Line | Status-Line > > there has to be one (exactly one) CR in a single line between headers > and body. Thus I propose a simple regexp "^\r$". Yes, but as I already quoted in http://debbugs.gnu.org/13598#17 it also recommends tolerance: The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 03 01:10:30 2014 Received: (at 13598) by debbugs.gnu.org; 3 Mar 2014 06:10:31 +0000 Received: from localhost ([127.0.0.1]:48429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WKM58-0003ch-2L for submit@debbugs.gnu.org; Mon, 03 Mar 2014 01:10:30 -0500 Received: from mail-ea0-f169.google.com ([209.85.215.169]:34341) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WKM53-0003cT-Jj for 13598@debbugs.gnu.org; Mon, 03 Mar 2014 01:10:26 -0500 Received: by mail-ea0-f169.google.com with SMTP id h14so1321135eaj.0 for <13598@debbugs.gnu.org>; Sun, 02 Mar 2014 22:10:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=o1rvftSyaiD9Mrk5+C2GAc75oPfLliK0vYVwQdoi8gY=; b=hwubS4r8nAO6dnhS12DAyOXIRDYQUru+vmQr4bGtTNGboXMmHw6vvO+4rb0dQSWPJ3 b62DtWWZzBPeNuLK7JCCHW8lAGC/2JgZKGPhW5ehfz0H2RwL0a6UXiVcORTt2sDSKJ3R rr6ocX669848SY+zO7orxpx3v0Tkca4su0R7+/AsM8rFaPHLcAHZxKRa05wJw9BZ3DPK sP2VWkB8z9imVDulbdJ/lbEd2cVSDzdNiLf5Kw39muU1OAIWEZADbLInltF7HnPFgIat vllt9pxtxdBjIFP0ZTy0hrtZKi/aRKzcsaUFtQH5NombTjCKeU08Dd5kCrT6cB742DHe yW0A== X-Received: by 10.14.208.195 with SMTP id q43mr1091922eeo.102.1393827024677; Sun, 02 Mar 2014 22:10:24 -0800 (PST) Received: from [192.168.1.100] ([87.204.33.177]) by mx.google.com with ESMTPSA id x6sm45705710eew.20.2014.03.02.22.10.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 02 Mar 2014 22:10:23 -0800 (PST) Content-Type: multipart/signed; boundary="Apple-Mail=_76496F82-F466-4CA6-A62A-B36A07025DDB"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: bug#13598: 24.3.50 From: Blazej Adamczyk In-Reply-To: Date: Mon, 3 Mar 2014 07:10:21 +0100 Message-Id: <481D100B-FD57-41C1-9F26-83EFB1C0CF25@gmail.com> References: <87d2wluuu9.fsf@online.de> <2DC22385-AACB-4B7D-9918-3EB835B8526C@gmail.com> To: Glenn Morris X-Mailer: Apple Mail (2.1827) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 13598 Cc: 13598@debbugs.gnu.org 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: -0.7 (/) --Apple-Mail=_76496F82-F466-4CA6-A62A-B36A07025DDB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Ahh yes my mistake! I was looking at some wrong sources. Obviously the = current "^\r?\n" is correct.=20 Sorry and thanks! Blazej =46rom Glenn Morris w dniu 27 lut 2014, o godz. 23:43: Blazej Adamczyk wrote: By example: When parsing response we may get in state when we will receive only the following: "HTTP/1.0 200 OK^M " without double quotes (I added them to show the newline character). In case of current implementation the regexp "^\r?$" and the previous regexp "^\r*$" both are matching the end of string. That is wrong because there will be something in the new line after a while. The current implementation uses "^\r?\n", not "^\r?$". Where did you get "^\r?$" from? As such I do not see that it will match your example. RFC 2616 states clear: generic-message =3D start-line *(message-header CRLF) CRLF [ message-body ] start-line =3D Request-Line | Status-Line there has to be one (exactly one) CR in a single line between headers and body. Thus I propose a simple regexp "^\r$". Yes, but as I already quoted in http://debbugs.gnu.org/13598#17 it also recommends tolerance: The line terminator for message-header fields is the sequence CRLF. However, we recommend that applications, when parsing such headers, recognize a single LF as a line terminator and ignore the leading CR. --Apple-Mail=_76496F82-F466-4CA6-A62A-B36A07025DDB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQEcBAEBCAAGBQJTFBzNAAoJELcOb3l0I/e3dvMH/i6OYRVOoepzLFYN1aFTeZfm 52tFNu5ZN4X66hgLIcPsWhlGbJNfiCg+dDRDXMCyVUAq4EgmXL6Mm+WYGabaW+18 NxmYYucGmYUEsvysRCB/2wghqyxMt36Bc4NhG+3oaOYkwXgriZ7sADKPQeHF1MvJ DADH3xU8B9cK/tpIYlS3KDd5AGKaleGZ8kP5oWqrAbx0QcgYJMhqauio/vg6QkUh Ha7gWWZXi+dlHhUYwZmNExX4KYL/4EUNwHGHl4DQgR9TZdpA2E1jAznMFmKFXMD0 AnrPPSbmH6HHnViMBSzwJC59jmLctqU+pUVVuRoXQTwQY7bhEdBF1NFvu+Ekhk0= =f5Fn -----END PGP SIGNATURE----- --Apple-Mail=_76496F82-F466-4CA6-A62A-B36A07025DDB-- From unknown Sat Jun 14 19:10:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 31 Mar 2014 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator