GNU bug report logs - #6407
URL: error when handling redirects

Previous Next

Package: emacs;

Reported by: David Reitter <david.reitter <at> gmail.com>

Date: Fri, 11 Jun 2010 19:40:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6407 in the body.
You can then email your comments to 6407 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6407; Package emacs. (Fri, 11 Jun 2010 19:40:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Reitter <david.reitter <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 11 Jun 2010 19:40:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Reitter <david.reitter <at> gmail.com>
To: Bug-Gnu-Emacs <bug-gnu-emacs <at> gnu.org>
Subject: URL: error when handling redirects
Date: Fri, 11 Jun 2010 15:38:53 -0400
A simple call to `url-http' results in an error when handling a certain kind of redirect.  
The call would be

  (url-http url  'foo-function  (list t )))

and the trace, the HTTP buffer and a partial explanation of the problem follow below:

 ===========
Debugger entered--Lisp error: (wrong-type-argument listp t)
  car(t)
  (eq (car events) :redirect)
  (if (eq (car events) :redirect) (setq old-redirects (1+ old-redirects)))
  (while events (if (eq ... :redirect) (setq old-redirects ...)) (and (setq events ...) (setq events ...)))
  (let ((events ...) (old-redirects 0)) (while events (if ... ...) (and ... ...)) (< old-redirects url-max-redirections))
  (and (> url-max-redirections 0) (let (... ...) (while events ... ...) (< old-redirects url-max-redirections)))
  (or (< url-max-redirections 0) (and (> url-max-redirections 0) (let ... ... ...)))
  (if (or (< url-max-redirections 0) (and ... ...)) (progn (setf ... ...) (set ... ...) (url-mark-buffer-as-dead buffer)) (url-http-debug "Maximum redirections reached") (setf (car url-callback-arguments) (nconc ... ...)) (setq success t))
  (let ((url-request-method url-http-method) (url-request-data url-http-data) (url-request-extra-headers url-http-extra-headers)) (if (or ... ...) (progn ... ... ...) (url-http-debug "Maximum redirections reached") (setf ... ...) (setq success t)))
  (progn (if (string-match "\\([^ 	]+\\)[ 	]" redirect-uri) (setq redirect-uri ...)) (if (string-match "^<\\(.*\\)>$" redirect-uri) (setq redirect-uri ...)) (if (not ...) (setq redirect-uri ...)) (let (... ... ...) (if ... ... ... ... ...)))
  (if redirect-uri (progn (if ... ...) (if ... ...) (if ... ...) (let ... ...)))
  (when redirect-uri (if (string-match "\\([^ 	]+\\)[ 	]" redirect-uri) (setq redirect-uri ...)) (if (string-match "^<\\(.*\\)>$" redirect-uri) (setq redirect-uri ...)) (if (not ...) (setq redirect-uri ...)) (let (... ... ...) (if ... ... ... ... ...)))
  (let ((redirect-uri ...)) (case url-http-response-status (300 nil) (... ...) (303 ...) (304 ... ... ...) (305 ...) (otherwise nil)) (when redirect-uri (if ... ...) (if ... ...) (if ... ...) (let ... ...)))
  (cond ((eql class ...) (url-mark-buffer-as-dead buffer) (error "HTTP responses in class 1xx not supported (%d)" url-http-response-status)) ((eql class ...) (case url-http-response-status ... ...)) ((eql class ...) (let ... ... ...)) ((eql class ...) (case url-http-response-status ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (when success ...)) ((eql class ...) (setq success t) (case url-http-response-status ... ... ... ... ... ...) (when success ...)) (t (error "Unknown class of HTTP response code: %d (%d)" class url-http-response-status)))
  (case class (1 (url-mark-buffer-as-dead buffer) (error "HTTP responses in class 1xx not supported (%d)" url-http-response-status)) (2 (case url-http-response-status ... ...)) (3 (let ... ... ...)) (4 (case url-http-response-status ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (when success ...)) (5 (setq success t) (case url-http-response-status ... ... ... ... ... ...) (when success ...)) (otherwise (error "Unknown class of HTTP response code: %d (%d)" class url-http-response-status)))
  (let ((buffer ...) (class nil) (success nil)) (setq class (/ url-http-response-status 100)) (url-http-debug "Parsed HTTP headers: class=%d status=%d" class url-http-response-status) (url-http-handle-cookies) (case class (1 ... ...) (2 ...) (3 ...) (4 ... ...) (5 ... ... ...) (otherwise ...)) (if (not success) (url-mark-buffer-as-dead buffer)) (url-http-debug "Finished parsing HTTP headers: %S" success) (widen) success)
  url-http-parse-headers()
  url-http-content-length-after-change-function(434 1327 893)
  url-http-wait-for-headers-change-function(1 1327 1326)
  url-http-generic-filter(#<process aquamacs.org> "HTTP/1.0 302 RD
\nLocation: http://utility.loganwifi.com/port-redirectDAZ7.asp?UI=01f981&NI=0050e801f981&UIP=192.168.1.10&MA=58B0357F2DA0&RN=898&PORT=898&RAD=yes&TUN=no&CC=no&PMS=no&OS=http://aquamacs.org%2Fcgi-bin%2Fcurrentversion.cgi%3Fsess%3D237567792%26seq%3D3138%26beta%3D1%26ver%3D2.0a%26vbt%3D2010-06-10%26obof%3D0%26tab%3D1%26gssm%3D0%26tgssm%3D1%26ssm%3D0%26mm%3Demacs-lisp-mode%26os%3D10.3.1%26cpu%3Di386
\nContent-Length: 888
\n
\n<HTML>\n<!--access procedure=nx.1-->\n<!--ndxid=01f981-->\n<!--protocol=https-->\n<!--ndxhost=nomadprime.subscribe.loganwifi.com-->\n<!--ndxport=1112-->\n<!--<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<WISPAccessGatewayParam\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:noNamespaceSchemaLocation=\"http://www.acmewisp.com/WISPAccessGatewayParam.xsd\">\n<Proxy>\n<MessageType>110</MessageType>\n<ResponseCode>200</ResponseCode>\n<NextURL><![CDATA[http://utility.loganwifi.com/port-redirectDAZ7.asp?UI=01f981&NI=0050e801f981&UIP=192.168.1.10&MA=58B0357F2DA0&RN=898&PORT=898&RAD=yes&TUN=no&CC=no&PMS=no&OS=http://aquamacs.org%2Fcgi-bin%2Fcurrentversion.cgi%3Fsess%3D237567792%26seq%3D3138%26beta%3D1%26ver%3D2.0a%26vbt%3D2010-06-10%26obof%3D0%26tab%3D1%26gssm%3D0%26tgssm%3D1%26ssm%3D0%26mm%3Demacs-lisp-mode%26os%3D10.3.1%26cpu%3Di386]]></NextURL>\n</Proxy>\n</WISPAccessGatewayParam>-->\n</HTML>")
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)


==================

The " *url...*" buffer looks like this:

HTTP/1.0 302 RD
Location: http://utility.loganwifi.com/port-redirectDAZ7.asp?UI=01f981&NI=0050e801f981&UIP=192.168.1.10&MA=58B0357F2DA0&RN=898&PORT=898&RAD=yes&TUN=no&CC=no&PMS=no&OS=http://aquamacs.org%2Fcgi-bin%2Ftruncated.cgi
Content-Length: 888

=====
In parse-http-headers, redirect-uri is set (an correct), but code like the following seems to expect something special in url-callback-arguments:

	     ;; Check existing number of redirects
	     (if (or (< url-max-redirections 0)
		     (and (> url-max-redirections 0)
			  (let ((events (car url-callback-arguments))
				(old-redirects 0))
			    (while events
			      (if (eq (car events) :redirect)
				  (setq old-redirects (1+ old-redirects)))
			      (and (setq events (cdr events))
				   (setq events (cdr events))))
			    (< old-redirects url-max-redirections))))


My `url-callback-arguments' here is just the callback args list that was originally used for the url-http request as above.

I am unable to replicate due to a lack of redirecting Wifi network.  This happened at Logan airport, before signing in for the Wifi, and I reproduced the error many times (didn't get it to work at all).  I ran it in Aquamacs 2.0, i.e., Emacs 23.



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#6407; Package emacs. (Sat, 13 Oct 2012 09:40:01 GMT) Full text and rfc822 format available.

Message #8 received at 6407 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: David Reitter <david.reitter <at> gmail.com>
Cc: 6407 <at> debbugs.gnu.org
Subject: Re: bug#6407: URL: error when handling redirects
Date: Sat, 13 Oct 2012 17:38:39 +0800
David Reitter <david.reitter <at> gmail.com> writes:

> My `url-callback-arguments' here is just the callback args list that
> was originally used for the url-http request as above.

`url-http' does require the callback arguments to have a certain form
(the first element must be a plist specifying the retrieval status).
I've committed a doc fix to trunk.






bug closed, send any further explanations to 6407 <at> debbugs.gnu.org and David Reitter <david.reitter <at> gmail.com> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 13 Oct 2012 09:40:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 10 Nov 2012 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 195 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.