unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmx.net>
Cc: emacs-devel@gnu.org
Subject: Re: help with URL module needed
Date: Sun, 28 Nov 2004 16:38:02 +0200	[thread overview]
Message-ID: <200411281638.02083.pogonyshev@gmx.net> (raw)
In-Reply-To: <200411261858.20645.pogonyshev@gmx.net>

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 ()
  (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"         . "Testy Test")
				      ("wpLoginattempt" . "Login")
				      ("wpPassword"     . "test")
				      ("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 "&"))

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?

Paul

  reply	other threads:[~2004-11-28 14:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-26 15:32 help with URL module needed Paul Pogonyshev
2004-11-26 16:04 ` Masatake YAMATO
2004-11-26 16:58   ` Paul Pogonyshev
2004-11-28 14:38     ` Paul Pogonyshev [this message]
2004-11-28 19:12       ` Andreas Schwab
2004-11-28 22:37         ` Paul Pogonyshev
2004-11-28 22:59           ` Andreas Schwab
2004-11-28 23:12             ` Paul Pogonyshev
2004-11-28 23:43               ` Alex Schroeder
2004-11-29  0:10               ` Andreas Schwab
2004-11-29 14:01                 ` Paul Pogonyshev
2004-11-30 19:49                   ` Paul Pogonyshev
2004-11-30 21:29                     ` Andreas Schwab
2004-11-29 21:42             ` Thien-Thi Nguyen
2004-11-30  0:35               ` Andreas Schwab
2004-11-30  9:22                 ` Thien-Thi Nguyen
2004-11-30 17:18         ` Mark A. Hershberger
2004-11-26 16:27 ` Thien-Thi Nguyen

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=200411281638.02083.pogonyshev@gmx.net \
    --to=pogonyshev@gmx.net \
    --cc=emacs-devel@gnu.org \
    /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.
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).