From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nicolas Avrutin Newsgroups: gmane.emacs.bugs Subject: bug#8931: 24.0.50; url-http.el terminating HTTP packets with extra carriage return and newline Date: Fri, 24 Jun 2011 15:45:36 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=20cf3071cc626983ed04a67a74c6 X-Trace: dough.gmane.org 1308949718 20533 80.91.229.12 (24 Jun 2011 21:08:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 24 Jun 2011 21:08:38 +0000 (UTC) To: 8931@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 24 23:08:33 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QaDc8-0007ix-U9 for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2011 23:08:33 +0200 Original-Received: from localhost ([::1]:40621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaDc8-0000Vo-0i for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jun 2011 17:08:32 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaDLD-0005j3-P6 for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 16:51:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaDLC-00086K-8R for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 16:51:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:52452) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaDLC-00086A-0k for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 16:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QaDLB-0003ev-NM; Fri, 24 Jun 2011 16:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas Avrutin Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jun 2011 20:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8931 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.130894862214020 (code B ref -1); Fri, 24 Jun 2011 20:51:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Jun 2011 20:50:22 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QaDKX-0003e4-5Z for submit@debbugs.gnu.org; Fri, 24 Jun 2011 16:50:21 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QaCKk-0007Zs-4X for submit@debbugs.gnu.org; Fri, 24 Jun 2011 15:46:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaCKc-0005fo-MH for submit@debbugs.gnu.org; Fri, 24 Jun 2011 15:46:24 -0400 Original-Received: from lists.gnu.org ([140.186.70.17]:55772) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaCKc-0005fZ-Bg for submit@debbugs.gnu.org; Fri, 24 Jun 2011 15:46:22 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:34730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaCKa-0005D1-FE for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 15:46:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QaCKX-0005ep-TD for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 15:46:19 -0400 Original-Received: from mail-vx0-f169.google.com ([209.85.220.169]:44433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QaCKX-0005ed-KV for bug-gnu-emacs@gnu.org; Fri, 24 Jun 2011 15:46:17 -0400 Original-Received: by vxg38 with SMTP id 38so2888838vxg.0 for ; Fri, 24 Jun 2011 12:46:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=oV3pLFaeFg4Atl/vlq7gaqerNc8Mf3yOKZ9hRw0tFws=; b=lZKD4KXnyyq8jn1PMx6O8t3uUdJWGc6VL1XOIDclFuAl0uLB3eDKZSFUdM6Z/xWwUo 6CBX2gGOjpyRumi2vQoYtD+k3lsVsak2T83mjIhGPmKgYlf8A+1GFNwYAu91YDwF7enH s4a/6CNeQo/2/ZjBJZ1prHwYuAbN8n9su4VnM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=XrStSd9XQLmGBnxdbvMJC1rgBAoLjhXFs8BlFc39i4hYrM8M9KXHGWDCuOro4wiYs/ iEKaCamLjIGgjW4uWCOC9JTtywV969zI+zJ36bmdMMtOfjN645mk6Bvu7JM2ZUz450zJ jqCm4ppQAPjLSzn3qoIWhIce84RNrMMFChQZ4= Original-Received: by 10.52.178.74 with SMTP id cw10mr5208011vdc.141.1308944776135; Fri, 24 Jun 2011 12:46:16 -0700 (PDT) Original-Received: by 10.52.160.161 with HTTP; Fri, 24 Jun 2011 12:45:36 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Fri, 24 Jun 2011 16:50:20 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 24 Jun 2011 16:51:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-Mailman-Approved-At: Fri, 24 Jun 2011 17:00:30 -0400 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:47446 Archived-At: --20cf3071cc626983ed04a67a74c6 Content-Type: multipart/alternative; boundary=20cf3071cc626983ea04a67a74c4 --20cf3071cc626983ea04a67a74c4 Content-Type: text/plain; charset=UTF-8 `browse-url-emacs' and `url-retrieve-synchronously' (and probably other functions) appear to be generating malformed HTTP packets by appending an extra \r\n to the packet, resulting in them being terminated with "\r\n\r\n" instead of "\r\n". Some pages (such as http://www.google.com) to still return properly and just send back a packet saying that the sent packet was malformed. Other pages, in my case last.fm's client API (access via emms-lastfm-client) return 400 Bad Request. In addition, this causes Wireshark to report the packet as "HEAD / HTTP/1.1 Continuation or non-HTTP traffic". Removing the "\r\n" on line 341 of url-http.el (see attached patch) removes the duplicate "'\r\n" and appears to fix the issue. Calls to last.fm's client API return 200 OK as expected and Wireshark properly reports the packet as "HEAD / HTTP/1.1". Google, however, still reports a malformed packet. This bug is preset in Emacs 23.1, but is not in 23.2. My patch restores the line to what it was in 23.2, but I do not know if it was changed for a reason or in error. -- Nicolas Avrutin --20cf3071cc626983ea04a67a74c4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
`browse-url-emacs' and `url-retrieve-synchronously' (and proba= bly other functions) appear to be generating malformed HTTP packets by appe= nding an extra \r\n to the packet, resulting in them being terminated with = "\r\n\r\n" instead of "\r\n". Some pages (such as http://www.google.com) to still return pro= perly and just send back a packet saying that the sent packet was malformed= . Other pages, in my case last.fm's clie= nt API (access via emms-lastfm-client) return 400 Bad Request.=C2=A0In addi= tion, this causes Wireshark to report the packet as "HEAD / HTTP/1.1 C= ontinuation or non-HTTP traffic".

Removing the "\r\n" on line 341 of url-http.e= l (see attached patch) removes the duplicate "'\r\n" and=C2= =A0appears to fix the issue. Calls to last.fm's client API return 200 OK as expected and Wireshark properly reports= the packet as "HEAD / HTTP/1.1". Google, however, still reports = a malformed packet.

This bug is preset in Emacs 23.1, but is not in 23.2. M= y patch restores the line to what it was in 23.2, but I do not know if it w= as changed for a reason or in error.

--
Nicolas Avrutin

--20cf3071cc626983ea04a67a74c4-- --20cf3071cc626983ed04a67a74c6 Content-Type: text/x-patch; charset=US-ASCII; name="url-http.patch" Content-Disposition: attachment; filename="url-http.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gpbjpawq0 KioqIHVybC1odHRwLmVsCTIwMTEtMDYtMjQgMTU6MTE6NTMuMTg2MjM4ODkzIC0wNDAwCi0tLSB1 cmwtaHR0cC5lbC5wYXRjaGVkCTIwMTEtMDYtMjQgMTU6MTE6MDAuMjMyOTA3NjE5IC0wNDAwCioq KioqKioqKioqKioqKgoqKiogMzM4LDM0NCAqKioqCiAgICAgICAgICAgICAgIDs7IEVuZCByZXF1 ZXN0CiAgICAgICAgICAgICAgICJcclxuIgogICAgICAgICAgICAgICA7OyBBbnkgZGF0YQohICAg ICAgICAgICAgICB1cmwtaHR0cC1kYXRhICJcclxuIikpCiAgICAgICAgICAgICAiIikpCiAgICAg ICh1cmwtaHR0cC1kZWJ1ZyAiUmVxdWVzdCBpczogXG4lcyIgcmVxdWVzdCkKICAgICAgcmVxdWVz dCkpCi0tLSAzMzgsMzQ0IC0tLS0KICAgICAgICAgICAgICAgOzsgRW5kIHJlcXVlc3QKICAgICAg ICAgICAgICAgIlxyXG4iCiAgICAgICAgICAgICAgIDs7IEFueSBkYXRhCiEgICAgICAgICAgICAg IHVybC1odHRwLWRhdGEpKQogICAgICAgICAgICAgIiIpKQogICAgICAodXJsLWh0dHAtZGVidWcg IlJlcXVlc3QgaXM6IFxuJXMiIHJlcXVlc3QpCiAgICAgIHJlcXVlc3QpKQo= --20cf3071cc626983ed04a67a74c6--