unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tassilo Horn <heimdall@uni-koblenz.de>
Subject: Re: HTTP POST requests with url.el
Date: Fri, 20 Oct 2006 21:34:20 +0200	[thread overview]
Message-ID: <87u01yu6gz.fsf@baldur.nicundtas.de> (raw)
In-Reply-To: jwvejt2izkt.fsf-monnier+gnu.emacs.help@gnu.org

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!

  reply	other threads:[~2006-10-20 19:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-20 17:19 HTTP POST requests with url.el Tassilo Horn
2006-10-20 18:59 ` Stefan Monnier
2006-10-20 19:34   ` Tassilo Horn [this message]
2006-10-20 20:03     ` Tassilo Horn
2006-10-20 22:04   ` Andreas Seltenreich
     [not found]   ` <mailman.48.1161381893.27805.help-gnu-emacs@gnu.org>
2006-10-24 15:44     ` Stefan Monnier

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=87u01yu6gz.fsf@baldur.nicundtas.de \
    --to=heimdall@uni-koblenz.de \
    /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.
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).