From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.devel Subject: Re: help with URL module needed Date: Fri, 26 Nov 2004 18:58:20 +0200 Message-ID: <200411261858.20645.pogonyshev@gmx.net> References: <200411261732.12616.pogonyshev@gmx.net> <20041127.010441.112625752.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1251" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1101488252 3566 80.91.229.6 (26 Nov 2004 16:57:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 26 Nov 2004 16:57:32 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 26 17:57:27 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CXjPT-0000UK-00 for ; Fri, 26 Nov 2004 17:57:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CXjYj-0004Qi-5F for ged-emacs-devel@m.gmane.org; Fri, 26 Nov 2004 12:07:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CXjXT-0003Q0-3K for emacs-devel@gnu.org; Fri, 26 Nov 2004 12:05:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CXjXR-0003PL-U8 for emacs-devel@gnu.org; Fri, 26 Nov 2004 12:05:42 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CXjXR-0003P9-Ks for emacs-devel@gnu.org; Fri, 26 Nov 2004 12:05:41 -0500 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1CXjO6-0004Ml-S9 for emacs-devel@gnu.org; Fri, 26 Nov 2004 11:56:03 -0500 Original-Received: (qmail 19888 invoked by uid 65534); 26 Nov 2004 16:55:57 -0000 Original-Received: from unknown (EHLO localhost.localdomain) (195.50.12.117) by mail.gmx.net (mp003) with SMTP; 26 Nov 2004 17:55:57 +0100 X-Authenticated: #16844820 Original-To: Masatake YAMATO , Thien-Thi Nguyen User-Agent: KMail/1.4.3 In-Reply-To: <20041127.010441.112625752.jet@gyve.org> X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30398 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30398 > > 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") =09(url-request-method "POST") =09(url-request-extra-headers '(("Content-Type" . "application/x-www-form= -urlencoded"))) =09(url-request-data =09 (wikipedia-build-post-data '(("wpName" . "") =09=09=09=09 ("wpLoginattempt" . "Login") =09=09=09=09 ("wpPassword" . "") =09=09=09=09 ("wpRetype" . "") =09=09=09=09 ("wpEmail" . "")))) =09(url-debug=09 t)) (url-retrieve (concat "http://" domain ".wikipedia.org/w/wiki.phtml?t= itle=3DSpecial:Userlogin&action=3Dsubmit") =09=09 (lambda () (pop-to-buffer (current-buffer)))))) (defun wikipedia-build-post-data (post-data-alist) (mapconcat (lambda (association) =09 (concat (car association) "=3D" =09=09 (url-hexify-string (cdr association)))) =09 post-data-alist "&"))