unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* HTTP POST requests with url.el broken
@ 2006-10-31 23:56 Tassilo Horn
  2006-11-01 15:17 ` Magnus Henoch
  2006-11-03 22:48 ` Tassilo Horn
  0 siblings, 2 replies; 3+ messages in thread
From: Tassilo Horn @ 2006-10-31 23:56 UTC (permalink / raw)


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 -

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

* Re: HTTP POST requests with url.el broken
  2006-10-31 23:56 HTTP POST requests with url.el broken Tassilo Horn
@ 2006-11-01 15:17 ` Magnus Henoch
  2006-11-03 22:48 ` Tassilo Horn
  1 sibling, 0 replies; 3+ messages in thread
From: Magnus Henoch @ 2006-11-01 15:17 UTC (permalink / raw)


Tassilo Horn <tassilo@member.fsf.org> writes:

> 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.

I just committed a fix.  Does it work with the new url-http.el?

Magnus

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

* Re: HTTP POST requests with url.el broken
  2006-10-31 23:56 HTTP POST requests with url.el broken Tassilo Horn
  2006-11-01 15:17 ` Magnus Henoch
@ 2006-11-03 22:48 ` Tassilo Horn
  1 sibling, 0 replies; 3+ messages in thread
From: Tassilo Horn @ 2006-11-03 22:48 UTC (permalink / raw)


Hello,

it seems one of the latest changes to url-http.el fixed my problems.

Regards,
Tassilo
-- 
* delYsid has mortgage, opportunity and penis in his score file.
<delYsid> thats pretty effective against spam
<Luke> aren't you worried about missing opportunities to mortgage
       your penis?

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

end of thread, other threads:[~2006-11-03 22:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-31 23:56 HTTP POST requests with url.el broken Tassilo Horn
2006-11-01 15:17 ` Magnus Henoch
2006-11-03 22:48 ` Tassilo Horn

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