emacs-devel
[Top][All Lists]
Advanced

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

Re: help with URL module needed


From: Paul Pogonyshev
Subject: Re: help with URL module needed
Date: Fri, 26 Nov 2004 18:58:20 +0200
User-agent: KMail/1.4.3

> > I'm trying to login to Wikipedia from within Emacs using the URL
> > module (to be able to edit and save articles in Emacs.)  However,
> > I'm having problems with sending POST requests (to transmit login
> > information.)  Here is what I get:
> >
> > [in *URL-DEBUG* buffer]:
>
> Which version of emacs do you use?
> If you use the source code in the CVS repository, could you tell me
> the date?

CVS of November 14.

> How can I reproduce the error?

I made more experiments and narrowed down conditions that lead to error.
You need an account in the English Wikipedia domain (en.wikipedia.org).

First enter valid "wpName" and "wpPassword" for your account in the code
below and try to login.  Here it fails with "411 Length Required" HTTP
code.  Now replace your password with _any_ invalid password (i.e. change
one single symbol.) and try to login again.  Here, it succeeds with
"200 OK" (though the login itself fails, of course.)

So, to summarize: if you try to login with valid name/password, HTTP
request fails for a reason I don't understand.  If you try to login with
invalid password, HTTP request succeeds, but login fails (as it should.)
This looks so weird to me that I'm not sure you can reproduce it.

Does this all make any sense?

Paul

P.S. Thi, I tried to remove "\r\n" (in `url-http.el'), but it didn't
     make any difference.


(require 'url)

(defun wikipedia-login ()
  (interactive)
  (let ((domain                    "en")
        (url-request-method        "POST")
        (url-request-extra-headers '(("Content-Type" . 
"application/x-www-form-urlencoded")))
        (url-request-data
         (wikipedia-build-post-data '(("wpName"         . "")
                                      ("wpLoginattempt" . "Login")
                                      ("wpPassword"     . "")
                                      ("wpRetype"       . "")
                                      ("wpEmail"        . ""))))
        (url-debug           t))
    (url-retrieve (concat "http://"; domain 
".wikipedia.org/w/wiki.phtml?title=Special:Userlogin&action=submit")
                  (lambda () (pop-to-buffer (current-buffer))))))

(defun wikipedia-build-post-data (post-data-alist)
  (mapconcat (lambda (association)
               (concat (car association) "="
                       (url-hexify-string (cdr association))))
             post-data-alist "&"))





reply via email to

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