unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18007: 24.3.92: eww-download-callback, patch included
@ 2014-07-12 21:30 Charles Rendleman
  2014-07-13  8:09 ` Andreas Schwab
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Charles Rendleman @ 2014-07-12 21:30 UTC (permalink / raw)
  To: 18007

Originally filed incorrectly under Emacs 23; this bug is with the
24.3.92 pretest

eww-download-callback should remove the HTTP header before saving the file
after a download.

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 02fc575..cff85a5 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1075,7 +1075,9 @@ Differences in #targets are ignored."
            (path (car (url-path-and-query obj)))
            (file (eww-make-unique-file-name (file-name-nondirectory path)
                                            eww-download-directory)))
-      (write-file file)
+      (goto-char 0)
+      (re-search-forward "\r?\n\r?\n")
+      (write-region (point) (point-max) file)
       (message "Saved %s" file))))

 (defun eww-make-unique-file-name (file directory)





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#18007: 24.3.92: eww-download-callback, patch included
  2014-07-12 21:30 bug#18007: 24.3.92: eww-download-callback, patch included Charles Rendleman
@ 2014-07-13  8:09 ` Andreas Schwab
  2014-11-04 16:39 ` Ted Zlatanov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2014-07-13  8:09 UTC (permalink / raw)
  To: Charles Rendleman; +Cc: 18007

Charles Rendleman <carendle@gmail.com> writes:

> +      (goto-char 0)

That should use (point-min).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18007: 24.3.92: eww-download-callback, patch included
  2014-07-12 21:30 bug#18007: 24.3.92: eww-download-callback, patch included Charles Rendleman
  2014-07-13  8:09 ` Andreas Schwab
@ 2014-11-04 16:39 ` Ted Zlatanov
  2014-11-10 20:56   ` Lars Magne Ingebrigtsen
  2014-11-05 16:55 ` bug#18007: 24.3.92: eww-download-callback, better " Kentaro NAKAZAWA
  2014-11-10 20:56 ` bug#18007: 24.3.92: eww-download-callback, " Lars Magne Ingebrigtsen
  3 siblings, 1 reply; 6+ messages in thread
From: Ted Zlatanov @ 2014-11-04 16:39 UTC (permalink / raw)
  To: Charles Rendleman; +Cc: 18007

On Sat, 12 Jul 2014 17:30:43 -0400 Charles Rendleman <carendle@gmail.com> wrote: 

CR> Originally filed incorrectly under Emacs 23; this bug is with the
CR> 24.3.92 pretest

CR> eww-download-callback should remove the HTTP header before saving the file
CR> after a download.

CR> diff --git a/lisp/net/eww.el b/lisp/net/eww.el
CR> index 02fc575..cff85a5 100644
CR> --- a/lisp/net/eww.el
CR> +++ b/lisp/net/eww.el
CR> @@ -1075,7 +1075,9 @@ Differences in #targets are ignored."
CR>             (path (car (url-path-and-query obj)))
CR>             (file (eww-make-unique-file-name (file-name-nondirectory path)
CR>                                             eww-download-directory)))
CR> -      (write-file file)
CR> +      (goto-char 0)
CR> +      (re-search-forward "\r?\n\r?\n")
CR> +      (write-region (point) (point-max) file)
CR>        (message "Saved %s" file))))

CR>  (defun eww-make-unique-file-name (file directory)

Would that work correctly with all encodings?  Multipart?  Binary data?

Is there a better way to extract the data in the url library?

Thanks
Ted





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18007: 24.3.92: eww-download-callback, better patch included
  2014-07-12 21:30 bug#18007: 24.3.92: eww-download-callback, patch included Charles Rendleman
  2014-07-13  8:09 ` Andreas Schwab
  2014-11-04 16:39 ` Ted Zlatanov
@ 2014-11-05 16:55 ` Kentaro NAKAZAWA
  2014-11-10 20:56 ` bug#18007: 24.3.92: eww-download-callback, " Lars Magne Ingebrigtsen
  3 siblings, 0 replies; 6+ messages in thread
From: Kentaro NAKAZAWA @ 2014-11-05 16:55 UTC (permalink / raw)
  To: 18007

The following patch use the url library.

*** eww.el.orig	2014-06-27 11:14:40.000000000 +0900
--- eww.el	2014-11-06 01:12:35.620431852 +0900
***************
*** 1075,1081 ****
             (path (car (url-path-and-query obj)))
             (file (eww-make-unique-file-name (file-name-nondirectory path)
  					    eww-download-directory)))
!       (write-file file)
        (message "Saved %s" file))))
  
  (defun eww-make-unique-file-name (file directory)
--- 1075,1081 ----
             (path (car (url-path-and-query obj)))
             (file (eww-make-unique-file-name (file-name-nondirectory path)
  					    eww-download-directory)))
!       (write-region (1+ (marker-position url-http-end-of-headers)) (point-max) file)
        (message "Saved %s" file))))
  
  (defun eww-make-unique-file-name (file directory)

-- 
Kentaro NAKAZAWA





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18007: 24.3.92: eww-download-callback, patch included
  2014-07-12 21:30 bug#18007: 24.3.92: eww-download-callback, patch included Charles Rendleman
                   ` (2 preceding siblings ...)
  2014-11-05 16:55 ` bug#18007: 24.3.92: eww-download-callback, better " Kentaro NAKAZAWA
@ 2014-11-10 20:56 ` Lars Magne Ingebrigtsen
  3 siblings, 0 replies; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-10 20:56 UTC (permalink / raw)
  To: Charles Rendleman; +Cc: 18007

Charles Rendleman <carendle@gmail.com> writes:

> Originally filed incorrectly under Emacs 23; this bug is with the
> 24.3.92 pretest
>
> eww-download-callback should remove the HTTP header before saving the file
> after a download.

Thanks; applied after tweaking slightly.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18007: 24.3.92: eww-download-callback, patch included
  2014-11-04 16:39 ` Ted Zlatanov
@ 2014-11-10 20:56   ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-10 20:56 UTC (permalink / raw)
  To: Charles Rendleman; +Cc: 18007

Ted Zlatanov <tzz@lifelogs.com> writes:

> Would that work correctly with all encodings?  Multipart?  Binary data?

Yes, it's all binary in the URL buffer, so it always works.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-11-10 20:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-12 21:30 bug#18007: 24.3.92: eww-download-callback, patch included Charles Rendleman
2014-07-13  8:09 ` Andreas Schwab
2014-11-04 16:39 ` Ted Zlatanov
2014-11-10 20:56   ` Lars Magne Ingebrigtsen
2014-11-05 16:55 ` bug#18007: 24.3.92: eww-download-callback, better " Kentaro NAKAZAWA
2014-11-10 20:56 ` bug#18007: 24.3.92: eww-download-callback, " Lars Magne Ingebrigtsen

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).