[Top][All Lists]

[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: Sun, 28 Nov 2004 16:38:02 +0200
User-agent: KMail/1.4.3

I wrote:
> > > 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).

I'll assume the lack of response is due to nobody's having an account at
Wikipedia ;)

So, I'll ease it.  Evaluate these two functions and type
`M-x wikipedia-login RET':

(defun wikipedia-login ()
  (let ((domain                    "en")
        (url-request-method        "POST")
        (url-request-extra-headers '(("Content-Type" . 
         (wikipedia-build-post-data '(("wpName"         . "Testy Test")
                                      ("wpLoginattempt" . "Login")
                                      ("wpPassword"     . "test")
                                      ("wpRetype"       . "")
                                      ("wpEmail"        . ""))))
        (url-debug           t))
    (url-retrieve (concat "http://"; domain 
                  (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 "&"))

You should get a ``411 Length Required''.

Now go back and change the (valid) password to anything else, evaluate
the new function and type `M-x wikipedia-login RET' again.  You should
get ``200 OK''.

Now, I agree that this doesn't really look like an URL module problem.
But can anyone confirm this weird behaviour and explain me (or at least
guess) what's going wrong?


reply via email to

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