[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: HTTP POST requests with url.el
From: |
Tassilo Horn |
Subject: |
Re: HTTP POST requests with url.el |
Date: |
Fri, 20 Oct 2006 21:34:20 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
Hi Stefan,
>> (url-request-data (concat "u=" emms-lastfm-username
>> "&s=" (md5 (concat
>> (md5 emms-lastfm-password)
>> emms-lastfm-md5-challenge))
>> "&a[0]=" artist
>> "&t[0]=" title
>> "&b[0]=" album
>> "&m[0]=" musicbrainz-id
>> "&l[0]=" track-length
>> "&i[0]=" date "\r\n")))
>
>> Does anyone know what I'm doing wrong, or how I can find the bug?
>
> Could it be that the data needs to be be url-encoded (SPC -> %20)?
I stole the url-encoding function from http-get.el:
--8<---------------cut here---------------start------------->8---
(defun http-url-encode (str content-type)
"URL encode STR using CONTENT-TYPE as the coding system."
(apply 'concat
(mapcar (lambda (c)
(if (or (and (>= c ?a) (<= c ?z))
(and (>= c ?A) (<= c ?Z))
(and (>= c ?0) (<= c ?9)))
(string c)
(format "%%%02x" c)))
(encode-coding-string str content-type))))
--8<---------------cut here---------------end--------------->8---
So I tried sending this:
u%3dheimdall80%26s%3d75e64782c62944cf3a0bf850a2c45d7c%26a%5b0%5d%3dLeonard%20Cohen%26t%5b0%5d%3dThe%20Future%20%28Edited%29%26b%5b0%5d%3dNatural%20Born%20Killers%26m%5b0%5d%3d%26l%5b0%5d%3d229%26i%5b0%5d%3d2006%2d10%2d20%2019%3a29%3a33
But it fails with the same error.
Another idea?
Bye and thanks,
Tassilo
--
A child of five could understand this! Fetch me a child of five!