unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8931: 24.0.50; url-http.el terminating HTTP packets with extra carriage return and newline
@ 2011-06-24 19:45 Nicolas Avrutin
  2011-07-03 16:04 ` Lars Magne Ingebrigtsen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Nicolas Avrutin @ 2011-06-24 19:45 UTC (permalink / raw)
  To: 8931


[-- 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))

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-24 22:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-24 19:45 bug#8931: 24.0.50; url-http.el terminating HTTP packets with extra carriage return and newline Nicolas Avrutin
2011-07-03 16:04 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).