emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HTTP POST requests with url.el broken


From: Tassilo Horn
Subject: HTTP POST requests with url.el broken
Date: Wed, 01 Nov 2006 00:56:01 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.90 (gnu/linux)

Hi all,

since some days the `url-retrieve' with HTTP POST in my emms-lastfm.el
stopped working. It seems the POST data is not sent and GET is used
instead of POST.

,----[ *URL-DEBUG* ]
| http -> Contacting host: 62.216.251.205:80
| http -> Marking connection as busy: 62.216.251.205:80 #<process 
62.216.251.205>
| http -> Request is: 
| GET /protocol_1.1 HTTP/1.1

| MIME-Version: 1.0

| Connection: keep-alive

| Extension: Security/Digest Security/SSL

| Host: 62.216.251.205

| Accept-charset: utf-8;q=1, iso-8859-1;q=0.5, iso-8859-15;q=0.5, 
windows-1252;q=0.5, big5;q=0.5, iso-2022-jp;q=0.5, shift_jis;q=0.5, 
iso-8859-2;q=0.5, iso-8859-3;q=0.5, iso-8859-4;q=0.5, iso-8859-5;q=0.5, 
iso-8859-7;q=0.5, iso-8859-8;q=0.5, iso-8859-9;q=0.5, gb2312;q=0.5, 
euc-jp;q=0.5, euc-kr;q=0.5, tis-620;q=0.5, iso-8859-14;q=0.5, 
windows-1251;q=0.5, koi8-r;q=0.5, koi8-u;q=0.5, viscii;q=0.5, hz-gb-2312;q=0.5, 
iso-2022-cn-ext;q=0.5, iso-2022-cn;q=0.5, iso-2022-jp-2;q=0.5, 
iso-2022-kr;q=0.5, utf-16;q=0.5, utf-16be;q=0.5, utf-16le;q=0.5

| Accept: */*

| User-Agent: URL/Emacs (i686-pc-linux-gnu; X11)

| 

| 
| http -> Calling after change function 
`url-http-wait-for-headers-change-function' for `#<process 62.216.251.205>'
| http -> url-http-wait-for-headers-change-function ( *http 
62.216.251.205:80*<10>)
| http -> Saw end of headers... ( *http 62.216.251.205:80*<10>)
| http -> url-http-parse-response called in ( *http 62.216.251.205:80*<10>)
| http -> No content-length, being dumb.
| http -> Marking connection as free: 62.216.251.205:80 #<process 
62.216.251.205>
| http -> Activating callback in buffer ( *http 62.216.251.205:80*<10>)
`----

That's my code:

--8<---------------cut here---------------start------------->8---
(defun emms-lastfm-submit-track ()
  "Submits the current track (`emms-lastfm-current-track') to
last.fm."
  (let* ((artist (emms-track-get emms-lastfm-current-track 'info-artist))
         (title  (emms-track-get emms-lastfm-current-track 'info-title))
         (album  (emms-track-get emms-lastfm-current-track 'info-album))
         (musicbrainz-id "")
         (track-length (number-to-string
                        (emms-track-get emms-lastfm-current-track
                                        'info-playing-time)))
         (date (format-time-string "%Y-%m-%d %H:%M:%S" (current-time) t))
         (url-http-attempt-keepalives nil)
         (url-request-method "POST")
         (url-request-extra-headers
          '(("Content-type" . "application/x-www-form-urlencoded; 
charset=utf-8")))
         (url-request-data (encode-coding-string
                            (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)
                            'utf-8)))
    (setq emms-lastfm-buffer
          (url-retrieve emms-lastfm-submit-url
                        'emms-lastfm-submission-sentinel))))
--8<---------------cut here---------------end--------------->8---

If I edebug the function the step pointer jumps over the

         (url-http-attempt-keepalives nil)
         (url-request-method "POST")
         (url-request-extra-headers
          '(("Content-type" . "application/x-www-form-urlencoded; 
charset=utf-8")))

part. This would explain my problems but is totally weird.

Any clue?

Bye and thanks,
Tassilo
-- 
          "Emacs is not a development tool but a way of life."
                - David Kastrup in alt.religion.emacs -





reply via email to

[Prev in Thread] Current Thread [Next in Thread]