all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Avrutin <nicolasavru@gmail.com>
To: 8931@debbugs.gnu.org
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	[thread overview]
Message-ID: <BANLkTinV6P26jU4Q_9+ApOxNFn15ScmkACeEx0+ME-MBTkyGyA@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1081 bytes --]

`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

[-- Attachment #1.2: Type: text/html, Size: 1367 bytes --]

[-- Attachment #2: url-http.patch --]
[-- Type: text/x-patch, Size: 557 bytes --]

*** url-http.el	2011-06-24 15:11:53.186238893 -0400
--- url-http.el.patched	2011-06-24 15:11:00.232907619 -0400
***************
*** 338,344 ****
               ;; End request
               "\r\n"
               ;; Any data
!              url-http-data "\r\n"))
             ""))
      (url-http-debug "Request is: \n%s" request)
      request))
--- 338,344 ----
               ;; End request
               "\r\n"
               ;; Any data
!              url-http-data))
             ""))
      (url-http-debug "Request is: \n%s" request)
      request))

             reply	other threads:[~2011-06-24 19:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24 19:45 Nicolas Avrutin [this message]
2011-07-03 16:04 ` bug#8931: 24.0.50; url-http.el terminating HTTP packets with extra carriage return and newline Lars Magne Ingebrigtsen
2011-09-24  4:04 ` bug#8931: url-http-create-request needs extra CRLF for https Christopher J. White
2011-09-24 22:58   ` Chong Yidong
2011-09-24 18:30 ` bug#8931: May be related to 9592 Christopher J. White

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTinV6P26jU4Q_9+ApOxNFn15ScmkACeEx0+ME-MBTkyGyA@mail.gmail.com \
    --to=nicolasavru@gmail.com \
    --cc=8931@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.