From: "Mark A. Hershberger" <mah@everybody.org>
Cc: Kenichi Handa <handa@m17n.org>, Emacs Development <emacs-devel@gnu.org>
Subject: Re: encoding and content-length for url-http.el
Date: Thu, 16 Jun 2005 00:21:44 -0400 [thread overview]
Message-ID: <1118895704.7936.19.camel@localhost.localdomain> (raw)
In-Reply-To: <87is0lap4t.fsf-monnier+emacs@gnu.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 3427 bytes --]
On Fri, 2005-06-10 at 17:22 -0400, Stefan Monnier wrote:
> Could you describe much more precisely what you're doing (especially
> how
> you use the URL package: which functions of it you call, etc...).
> Are you using WebDAV (i.e. url-dav.el)?
I'm not using url-dav.el -- I'm using xml-rpc.el which I maintain.
However, to eliminate the reliance on external code, I've pulled the bit
from xml-rpc.el that makes the call to post to a weblog hosted on
Blogger.com:
(let ((url-debug t)) (setq url-request-data "<?xml version=\"1.0\" encoding=\"UTF-8\"?><methodCall><methodName>blogger.newPost</methodName><params><param><value><string>0123456789ABCDEF</string></value></param><param><value><string>9380140</string></value></param><param><value><string>usrname</string></value></param><param><value><string>passwrd</string></value></param><param><value><string>Iñtërnâtiônàlizætiøn from emacs with patch</string></value></param><param><value><boolean>1</boolean></value></param></params></methodCall>")
(setq my-resp (unwind-protect
(save-excursion
(let ((url-working-buffer (get-buffer-create
(xml-rpc-get-temp-buffer-name)))
(url-request-method "POST")
(url-request-coding-system 'utf-8)
(url-http-attempt-keepalives nil)
(url-request-extra-headers (list
(cons "Content-Type" "text/xml; charset=utf-8"))))
(set-buffer url-working-buffer)
(let ((buffer (url-retrieve-synchronously "http://plant.blogger.com/api/RPC2"))
result)
(set-buffer buffer)
(url-http-parse-headers)
(if (> url-http-response-status 299)
(error "Error during request: %s"
url-http-response-status))
(url-extract-mime-headers)
(setq result (xml-rpc-request-process-buffer buffer))
result))))))
Without the patch that I supplied, this results in a server error:
"unexpected end of file found"
With the patch, it works perfectly. The result can be seen at
http://emacs-weblogger.blogspot.com/
(I originally used the LiveJournal platform, but decided it wasn't good
enough for this demonstration since it uses Perl's SOAP::Lite which is
very liberal in what it accepts. Blogger.com runs on Java and Java's
static typing makes it stricter in what it will accept when it comes to
XML-RPC types.)
For purposes of this report, I've attached a .zip file with my a elisp
snippets, a perl snippet and some packet traces of the working and
non-working code. I've elided my username and password, but you'll be
able to see that the server fails when I submit without the patch and
succeeds when I submit with the patch.
Further, the only differences in the packet traces are the way
"Iñtërnâtiônàlizætiøn" is encoded and the Content-Length header.
I'm fully prepared to admit that my patch only works in this case
because of some fluke, but the fact is that url-http.el works with the
patch and fails without it. I humbly ask your assistance in fixing
url-http.el.
--
http://mah.everybody.org/weblog/
GPG Fingerprint: 7E15 362D A32C DFAB E4D2 B37A 735E F10A 2DFC BFF5
More people are killed every year by pigs than by sharks, which shows
you how good we are at evaluating risk. -- Bruce Schneier
[-- Attachment #1.1.2: emacs-xml-url.zip --]
[-- Type: application/zip, Size: 6968 bytes --]
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2005-06-16 4:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-10 15:41 encoding and content-length for url-http.el Mark A. Hershberger
2005-06-10 15:53 ` Mark A. Hershberger
2005-06-10 19:47 ` Stefan Monnier
2005-06-10 17:14 ` Mark A. Hershberger
2005-06-10 21:22 ` Stefan Monnier
2005-06-16 4:21 ` Mark A. Hershberger [this message]
2005-06-16 7:05 ` Kenichi Handa
2005-06-16 16:05 ` Mark A. Hershberger
2005-06-11 11:06 ` Kenichi Handa
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1118895704.7936.19.camel@localhost.localdomain \
--to=mah@everybody.org \
--cc=emacs-devel@gnu.org \
--cc=handa@m17n.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 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).