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: Fri, 26 Nov 2004 18:58:20 +0200	[thread overview]
Message-ID: <200411261858.20645.pogonyshev@gmx.net> (raw)
In-Reply-To: <20041127.010441.112625752.jet@gyve.org>


> > 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	other threads:[~2004-11-26 16:58 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 [this message]
2004-11-28 14:38     ` Paul Pogonyshev
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=200411261858.20645.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).