[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Re: url-http.el breaks Emacs/W3]




note that this patch appears corrupt. I'm waiting to hear from
the author for a true fix 

>>>>> "tvr" == T V Raman <raman@users.sf.net> writes:
    tvr> If running w3 under emacs 22 you'll need this patch.
    tvr> Mime-Version: 1.0 Content-Type: multipart/mixed;
    tvr> boundary="=-=-=" Received: from mail.comcast.net
    tvr> [216.148.227.80] by localhost with POP3
    tvr> (fetchmail-6.3.2) for <raman@localhost> (single-drop);
    tvr> Tue, 19 Sep 2006 10:08:57 -0700 (PDT) Received: from
    tvr> lists.gnu.org ([199.232.76.165]) by
    tvr> sccrmxc17.comcast.net (sccrmxc17) with ESMTP id
    tvr> <20060919163109s1700at1i8e>; Tue, 19 Sep 2006 16:31:09
    tvr> +0000 X-Originating-IP: [199.232.76.165] Received: from
    tvr> localhost ([127.0.0.1] helo=lists.gnu.org) by
    tvr> lists.gnu.org with esmtp (Exim 4.43) id 1GPiV3-0002zM-1u
    tvr> for tvraman@comcast.net; Tue, 19 Sep 2006 12:31:09 -0400
    tvr> Received: from mailman by lists.gnu.org with
    tvr> tmda-scanned (Exim 4.43) id 1GPiUo-0002yx-Gn for
    tvr> emacs-devel@gnu.org; Tue, 19 Sep 2006 12:30:54 -0400
    tvr> Received: from exim by lists.gnu.org with spam-scanned
    tvr> (Exim 4.43) id 1GPiUl-0002yd-UG for emacs-devel@gnu.org;
    tvr> Tue, 19 Sep 2006 12:30:54 -0400 Received: from
    tvr> [199.232.76.173] (helo=monty-python.gnu.org) by
    tvr> lists.gnu.org with esmtp (Exim 4.43) id 1GPiUl-0002ya-RU
    tvr> for emacs-devel@gnu.org; Tue, 19 Sep 2006 12:30:51 -0400
    tvr> Received: from [80.91.229.2] (helo=ciao.gmane.org) by
    tvr> monty-python.gnu.org with esmtps
    tvr> (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id
    tvr> 1GPiXr-0006gZ-PW for emacs-devel@gnu.org; Tue, 19 Sep
    tvr> 2006 12:34:04 -0400 Received: from list by
    tvr> ciao.gmane.org with local (Exim 4.43) id
    tvr> 1GPiUW-0007rQ-HK for emacs-devel@gnu.org; Tue, 19 Sep
    tvr> 2006 18:30:36 +0200 Received: from tr.sevcable.net
    tvr> ([193.58.251.1]) by main.gmane.org with esmtp (Gmexim
    tvr> 0.1 (Debian)) id 1AlnuQ-0007hv-00 for
    tvr> <emacs-devel@gnu.org>; Tue, 19 Sep 2006 18:30:36 +0200
    tvr> Received: from mange by tr.sevcable.net with local
    tvr> (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for
    tvr> <emacs-devel@gnu.org>; Tue, 19 Sep 2006 18:30:36 +0200
    tvr> X-Injected-Via-Gmane: http://gmane.org/
    tvr> Mail-Followup-To: emacs-devel@gnu.org Lines: 214
    tvr> Message-ID: <87hcz4jp3v.fsf@freemail.hu> References:
    tvr> <17672.54193.91556.204057@gargle.gargle.HOWL>
    tvr> X-Complaints-To: usenet@sea.gmane.org
    tvr> X-Gmane-NNTP-Posting-Host: tr.sevcable.net User-Agent:
    tvr> Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50
    tvr> (berkeley-unix) Mail-Copies-To: never Jabber-Id:
    tvr> legoscia@jabber.cd.chalmers.se Cancel-Lock:
    tvr> sha1:kVoSyvCQK2Jp9977qJYvNFtoGAY= X-BeenThere:
    tvr> emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence:
    tvr> list List-Id: "Emacs development discussions."
    tvr> <emacs-devel.gnu.org> List-Unsubscribe:
    tvr> <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
    tvr> <mailto:emacs-devel-request@gnu.org?subject=unsubscribe>
    tvr> List-Archive:
    tvr> <http://lists.gnu.org/pipermail/emacs-devel> List-Post:
    tvr> <mailto:emacs-devel@gnu.org> List-Help:
    tvr> <mailto:emacs-devel-request@gnu.org?subject=help>
    tvr> List-Subscribe:
    tvr> <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
    tvr> <mailto:emacs-devel-request@gnu.org?subject=subscribe>
    tvr> Sender: emacs-devel-bounces+tvraman=comcast.net@gnu.org
    tvr> Errors-To:
    tvr> emacs-devel-bounces+tvraman=comcast.net@gnu.org From:
    tvr> Magnus Henoch <mange@freemail.hu> To:
    tvr> emacs-devel@gnu.org Subject: Re: url-http.el breaks
    tvr> Emacs/W3 Date: Tue, 19 Sep 2006 10:24:20 +0300 Cc:
    tvr> w3-dev@gnu.org
    tvr> 
    tvr> --=-=-=
    tvr> 
    tvr> "T. V. Raman" <raman@users.sf.net> writes:
    tvr> 
    >> I finally got a little more detail on where this breakage
    >> is occuring.
    >> 
    >> Symptoms:
    >> 
    >> If you use Emacs/w3 and use the URL package out of Emacs
    >> CVS you hit an error on sites that do a redirect
    >> e.g. http://sf.net
    >> 
    >> The error is very difficult to track down because it's
    >> being thrown from the w3 site in w3-fetch-callback.
    >> 
    >> But I have verified that the problem appears to be
    >> isolated in url-http.el, i.e. if you use package url out
    >> of Emacs 22 CVS, and load url-http.el by hand from William
    >> Perry's original CVS snapshot on savannah, then everything
    >> works correctly.
    tvr> 
    tvr> As far as I can see, the problem is that the interface
    tvr> of `url-retrieve' changed, but W3 wasn't adapted.  I
    tvr> have been seeing the same problem, and have been using
    tvr> the patch below with good results.
    tvr> 
    tvr> The patch is less complicated than it looks; most of it
    tvr> is changed indentation.  I have sent this to w3-devel as
    tvr> well.
    tvr> 
    tvr> Magnus
    tvr> 
    tvr> 
    tvr> --=-=-= Content-Type: text/x-patch Content-Disposition:
    tvr> attachment; filename=w3.el.patch
    tvr> 
    tvr> *** w3.el 03 Mar 2006 05:13:41 +0200 1.32 --- w3.el 01
    tvr> Sep 2006 03:30:17 +0300 *************** *** 293,375 ****
    tvr> (w3-setup-reload-timer uri (url-view-url t)
    tvr> (string-to-int (or reload "5"))))))
    tvr>   
    tvr> ! (defun w3-fetch-callback (url) !
    tvr> (w3-nasty-disgusting-http-equiv-handling
    tvr> (current-buffer) url) !  ;; Process any cookie and
    tvr> refresh headers.  !  (let (headers) !  (ignore-errors !
    tvr> (save-restriction !  (mail-narrow-to-head) !  (goto-char
    tvr> (point-min)) !  (unless (save-excursion !
    tvr> (search-forward ":" (line-end-position) t)) !
    tvr> (forward-line)) !  (setq headers (mail-header-extract))
    tvr> !  (let (refreshed) !  (dolist (header headers) !  ;;
    tvr> Act on multiple cookies if necessary, but only on a !
    tvr> ;; single refresh request in case there's more than one.
    tvr> !  (case (car header) !  (refresh (unless refreshed !
    tvr> (w3-handle-refresh-header (cdr header)) !  (setq
    tvr> refreshed t)))))))) !  (let ((handle (mm-dissect-buffer
    tvr> t)) !  (w3-explicit-coding-system !  (or
    tvr> w3-explicit-coding-system !
    tvr> (w3-recall-explicit-coding-system url))) !  (buff nil))
    tvr> !  (message "Downloading of `%s' complete." url) !
    tvr> (url-mark-buffer-as-dead (current-buffer)) !  (unless
    tvr> headers !  (setq headers (list (cons 'content-type !
    tvr> (mm-handle-media-type handle))))) !  ;; Fixme: can
    tvr> handle be null?  !  (cond !  ((equal
    tvr> (mm-handle-media-type handle) "text/html") !  ;; Special
    tvr> case text/html if it comes through w3-fetch !
    tvr> (set-buffer (generate-new-buffer " *w3-html*")) !
    tvr> (mm-disable-multibyte) !  (mm-insert-part handle) !
    tvr> (w3-decode-charset handle) !  (setq url-current-object
    tvr> (url-generic-parse-url url)) !  (w3-prepare-buffer) !
    tvr> (setq url-current-mime-headers headers) !
    tvr> (w3-notify-when-ready (current-buffer)) !
    tvr> (mm-destroy-parts handle)) !  ;; ((equal
    tvr> (mm-handle-media-type handle) "text/xml") !  ;; ;;
    tvr> Special case text/xml if it comes through w3-fetch !  ;;
    tvr> (set-buffer (generate-new-buffer " *w3-xml*")) !  ;;
    tvr> (mm-disable-multibyte) !  ;; (mm-insert-part handle) !
    tvr> ;; (w3-decode-charset handle) !  ;; !!! Need some
    tvr> function to view XML nicely... maybe the !  ;; !!!
    tvr> customize tree control?  !  ;; (setq url-current-object
    tvr> (url-generic-parse-url url) !  ;;
    tvr> url-current-mime-headers headers) !  ;;
    tvr> (mm-destroy-parts handle) !  ;; (w3-notify-when-ready
    tvr> (current-buffer))) !  ((equal (car-safe (mm-handle-type
    tvr> handle)) !  "application/x-elisp-parsed-html") !  ;;
    tvr> Also need to special-case pre-parsed representations of
    tvr> HTML.  !  ;; Fixme: will this need decoding?  !
    tvr> (w3-prepare-tree (read (set-marker (make-marker) 1 !
    tvr> (mm-handle-buffer handle))))) !  ((mm-inlinable-p
    tvr> handle) !  ;; We can view it inline!  !  (set-buffer
    tvr> (generate-new-buffer url)) !  (require 'mm-view) ; make
    tvr> sure methods are defined !  (mm-display-part handle) !
    tvr> (set-buffer-modified-p nil) !  (w3-mode) !  (if (equal
    tvr> "image" (mm-handle-media-supertype handle)) !  (setq
    tvr> cursor-type nil)) !  (setq url-current-mime-headers
    tvr> headers) !  (w3-notify-when-ready (current-buffer))) !
    tvr> (t !  ;; Must be an external viewer !  (mm-display-part
    tvr> handle) !  ;;(mm-destroy-parts handle) !  )))))
    tvr>   
    tvr>   ;;;###autoload (defun w3-fetch (&optional url target)
    tvr> --- 293,382 ---- (w3-setup-reload-timer uri
    tvr> (url-view-url t) (string-to-int (or reload "5"))))))
    tvr>   
    tvr> ! (defun w3-fetch-callback (&rest args) !  (let ((url
    tvr> (cond !  ;; see callback argument conventions in
    tvr> docstring of !  ;; `url-retrieve' !  ((eq (car args)
    tvr> :redirect) !  (caddr args)) !  (t !  (car args))))) !
    tvr> (w3-nasty-disgusting-http-equiv-handling
    tvr> (current-buffer) url) !  ;; Process any cookie and
    tvr> refresh headers.  !  (let (headers) !  (ignore-errors !
    tvr> (save-restriction !  (mail-narrow-to-head) !  (goto-char
    tvr> (point-min)) !  (unless (save-excursion !
    tvr> (search-forward ":" (line-end-position) t)) !
    tvr> (forward-line)) !  (setq headers (mail-header-extract))
    tvr> !  (let (refreshed) !  (dolist (header headers) !  ;;
    tvr> Act on multiple cookies if necessary, but only on a !
    tvr> ;; single refresh request in case there's more than one.
    tvr> !  (case (car header) !  (refresh (unless refreshed !
    tvr> (w3-handle-refresh-header (cdr header)) !  (setq
    tvr> refreshed t)))))))) !  (let ((handle (mm-dissect-buffer
    tvr> t)) !  (w3-explicit-coding-system !  (or
    tvr> w3-explicit-coding-system !
    tvr> (w3-recall-explicit-coding-system url))) !  (buff nil))
    tvr> !  (message "Downloading of `%s' complete." url) !
    tvr> (url-mark-buffer-as-dead (current-buffer)) !  (unless
    tvr> headers !  (setq headers (list (cons 'content-type !
    tvr> (mm-handle-media-type handle))))) !  ;; Fixme: can
    tvr> handle be null?  !  (cond !  ((equal
    tvr> (mm-handle-media-type handle) "text/html") !  ;; Special
    tvr> case text/html if it comes through w3-fetch !
    tvr> (set-buffer (generate-new-buffer " *w3-html*")) !
    tvr> (mm-disable-multibyte) !  (mm-insert-part handle) !
    tvr> (w3-decode-charset handle) !  (setq url-current-object
    tvr> (url-generic-parse-url url)) !  (w3-prepare-buffer) !
    tvr> (setq url-current-mime-headers headers) !
    tvr> (w3-notify-when-ready (current-buffer)) !
    tvr> (mm-destroy-parts handle)) !  ;; ((equal
    tvr> (mm-handle-media-type handle) "text/xml") !  ;; ;;
    tvr> Special case text/xml if it comes through w3-fetch !  ;;
    tvr> (set-buffer (generate-new-buffer " *w3-xml*")) !  ;;
    tvr> (mm-disable-multibyte) !  ;; (mm-insert-part handle) !
    tvr> ;; (w3-decode-charset handle) !  ;; !!! Need some
    tvr> function to view XML nicely... maybe the !  ;; !!!
    tvr> customize tree control?  !  ;; (setq url-current-object
    tvr> (url-generic-parse-url url) !  ;;
    tvr> url-current-mime-headers headers) !  ;;
    tvr> (mm-destroy-parts handle) !  ;; (w3-notify-when-ready
    tvr> (current-buffer))) !  ((equal (car-safe (mm-handle-type
    tvr> handle)) !  "application/x-elisp-parsed-html") !  ;;
    tvr> Also need to special-case pre-parsed representations of
    tvr> HTML.  !  ;; Fixme: will this need decoding?  !
    tvr> (w3-prepare-tree (read (set-marker (make-marker) 1 !
    tvr> (mm-handle-buffer handle))))) !  ((mm-inlinable-p
    tvr> handle) !  ;; We can view it inline!  !  (set-buffer
    tvr> (generate-new-buffer url)) !  (require 'mm-view) ; make
    tvr> sure methods are defined !  (mm-display-part handle) !
    tvr> (set-buffer-modified-p nil) !  (w3-mode) !  (if (equal
    tvr> "image" (mm-handle-media-supertype handle)) !  (setq
    tvr> cursor-type nil)) !  (setq url-current-mime-headers
    tvr> headers) !  (w3-notify-when-ready (current-buffer))) !
    tvr> (t !  ;; Must be an external viewer !  (mm-display-part
    tvr> handle) !  ;;(mm-destroy-parts handle) !  ))))))
    tvr>   
    tvr>   ;;;###autoload (defun w3-fetch (&optional url target)
    tvr> 
    tvr> --=-=-= Content-Type: text/plain; charset="us-ascii"
    tvr> MIME-Version: 1.0 Content-Disposition: inline
    tvr> 
    tvr> _______________________________________________
    tvr> Emacs-devel mailing list Emacs-devel@gnu.org
    tvr> http://lists.gnu.org/mailman/listinfo/emacs-devel
    tvr> --=-=-=--
    tvr> 
    tvr> 

-- 
Best Regards,
--raman

      
Email:  raman@users.sf.net
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: tv.raman.tv@gmail.com
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman 
IRC:    irc://irc.freenode.net/#emacs

-----------------------------------------------------------------------------
To unsubscribe from the emacspeak list or change your address on the
emacspeak list send mail to "emacspeak-request@cs.vassar.edu" with a
subject of "unsubscribe" or "help"


Emacspeak Files | Subscribe | Unsubscribe | Search