1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-01 02:05:33 +00:00
Commit Graph

261 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
38d7bffced Bug 770: Document session.download_uri 2009-07-19 04:06:25 +03:00
Kalle Olavi Niemitalo
266d4df2d2 Fix file descriptor leaks if init_file_download fails
If init_file_download() succeeds (returning non-NULL), it saves the
file descriptor to file_download->handle, whence abort_download() will
close it.  However, if init_file_download() fails, the caller is
responsible of closing the file, something common_download_do() and
continue_download_do() failed to do.  There was no problem with
bittorrent_download() because that uses -1 as the fd.
2009-07-19 04:04:02 +03:00
Kalle Olavi Niemitalo
c7b4d5de97 Fix file name leaks if init_file_download fails
If init_file_download() succeeds (returning non-NULL), it saves the
file-name pointer to file_download->file, whence abort_download() will
free it.  However, if init_file_download() fails, the caller is
responsible of freeing the name.  bittorrent_download() already did so
but common_download_do() and continue_download_do() didn't.
2009-07-19 04:03:49 +03:00
Kalle Olavi Niemitalo
62316163f3 Comment fixes 2009-07-18 23:31:10 +03:00
Kalle Olavi Niemitalo
519284654b Typo fix 2009-07-18 18:09:36 +03:00
Kalle Olavi Niemitalo
34bb3c4d95 More comments about type-query callbacks 2009-07-18 02:00:44 +03:00
Kalle Olavi Niemitalo
9f217ba897 Add typedefs for type_query-related callbacks
Doxygen isn't too good at documenting the parameters of a callback
within the documentation of a parameter that points to the callback.
A typedef provides a better place to document the parameters.
2009-07-18 00:09:08 +03:00
Kalle Olavi Niemitalo
b427a4f159 Small Doxygen fixes 2009-07-17 23:58:38 +03:00
Kalle Olavi Niemitalo
dfe6d81683 Add @relates markup for Doxygen 2009-07-17 17:07:12 +03:00
Kalle Olavi Niemitalo
d41fd043c6 Add comments about struct type_query and related 2009-07-17 14:10:36 +03:00
Kalle Olavi Niemitalo
6032bc730a Disable resuming download of formatted document
If the user chose File -> Save formatted document and typed the name
of an existing file, ELinks offered to resume downloading the file.
There are a few problems with that:

* save_formatted_finish does not actually support resuming.  It would
  instead overwrite the beginning of the file and not truncate it.

* When save_formatted calls create_download_file, cdf_hop->data
  ends up pointing to struct document.  If the user then chooses to
  resume, lun_resume would read *(int *)cdf_hop->data, hoping to
  get cmdw_hop.magic or codw_hop.magic.  struct document does not
  begin with any such magic value.

* Because ELinks already has the formatted document in memory,
  resuming saves neither time nor I/O.

So don't show the "Resume download of the original file" button in
this situation.
2009-07-14 10:27:09 +03:00
Kalle Olavi Niemitalo
683cfe4c86 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	NEWS: merged
	configure.in: VERSION changed in elinks-0.12; kept 0.13.GIT
	doc/man/man1/elinks.1.in: regenerated
	doc/man/man5/elinks.conf.5: regenerated
	doc/man/man5/elinkskeys.5: regenerated
	po/fr.po: kept 0.13.GIT
	po/pl.po: kept 0.13.GIT
2009-05-31 16:18:23 +03:00
Miciah Dashiel Butler Masters
1eebbb9ede Bug 765: use ses_load to load old tab's document
Yet another valiant wack at the beast.  This one violates abstractions
a little less deeply, so maybe it will work better.

The last attempt caused a crash when a tab was cloned after the tab's
loading had been aborted.
(cherry picked from commit 76377d9714)
2009-05-27 22:15:23 +03:00
Miciah Dashiel Butler Masters
f5103d0cc0 Bug 765: use load_uri to load old tab's document
Kalle reported that after commit 5c96d430c9,
ELinks would crash if the document in the old tab was still loading when a
new tab was opened.  The problem was that the new session's download.data
pointer was not updated to point to the session as doc_loading_callback
expects.

Instead of just calling render_document_frames, set up the download and
call load_uri.
(cherry picked from commit d6116ca83a)
2009-05-27 22:14:19 +03:00
Miciah Dashiel Butler Masters
f4a231cb9a Bug 765: Bypass checks on base tab's view state when copying to a new tab
In setup_session, use copy_location, add_to_history, and
render_document_frames instead of goto_uri and copy_vs to copy the base
tab's view state.  By avoiding goto_uri, setup_session now bypasses MIME
checks, form post confirmations, malicious URL checks, and so on when
copying the base tab's current location and view state to the new tab,
so the new tab should get exactly what was loaded in the base tab.

This fixes bug 765: Opening a new tab can ask about the document of the
previous tab.

(cherry picked from commit 5c96d430c9)

Conflicts:

	src/session/session.c:
		Both elinks-0.12 and master had the ses->doc_view->vs
		= vs assignment, but only elinks-0.12 had vs->doc_view
		= ses->doc_view as well.  Also, struct connection_state
		had been added after the original patch.
2009-05-27 22:05:22 +03:00
Witold Filipczyk
68ccb4513d bug 765: If set download->callback set also download->data.
In the task.c line 517 there is:
	if (is_in_progress_state((*download_p)->state)) {
		if (have_location(ses))
			*download_p = &cur_loc(ses)->download;
			^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Here the download was changed. download->data and download->callback
were NULL after the assignment, but later in loading_callback
only download->callback had new value. download->data was still NULL.
2009-05-27 01:11:02 +03:00
Miciah Dashiel Butler Masters
76377d9714 Bug 765: use ses_load to load old tab's document
Yet another valiant wack at the beast.  This one violates abstractions
a little less deeply, so maybe it will work better.

The last attempt caused a crash when a tab was cloned after the tab's
loading had been aborted.
2009-05-22 23:10:54 +00:00
Miciah Dashiel Butler Masters
d6116ca83a Bug 765: use load_uri to load old tab's document
Kalle reported that after commit 5c96d430c9,
ELinks would crash if the document in the old tab was still loading when a
new tab was opened.  The problem was that the new session's download.data
pointer was not updated to point to the session as doc_loading_callback
expects.

Instead of just calling render_document_frames, set up the download and
call load_uri.
2009-05-22 19:47:07 +00:00
Witold Filipczyk
387aeac953 No segfault
At the end of the destroy_vs there two assignments vs->doc_view->vs = NULL and
vs->doc_view = NULL. In the setup_session the copy_vs left the vs "unbound"
with any variable. At least one of these two is wrong.
2009-05-05 20:44:07 +03:00
Kalle Olavi Niemitalo
34f8f6a58f Merge branch 'elinks-0.12' into master
Conflicts:
	NEWS (merged)
	configure.in (merged)
	doc/man/man1/elinks.1.in (regenerated)
	doc/man/man5/elinks.conf.5 (regenerated)
	doc/man/man5/elinkskeys.5 (regenerated)
	po/af.po (used elinks-0.12)
	po/be.po (used elinks-0.12)
	po/bg.po (used elinks-0.12)
	po/ca.po (used elinks-0.12)
	po/cs.po (used elinks-0.12)
	po/da.po (used elinks-0.12)
	po/de.po (used elinks-0.12)
	po/el.po (used elinks-0.12)
	po/es.po (used elinks-0.12)
	po/et.po (used elinks-0.12)
	po/fi.po (used elinks-0.12)
	po/fr.po (used master)
	po/gl.po (used elinks-0.12)
	po/hr.po (used elinks-0.12)
	po/hu.po (used elinks-0.12)
	po/id.po (used elinks-0.12)
	po/is.po (used elinks-0.12)
	po/it.po (used elinks-0.12)
	po/lt.po (used elinks-0.12)
	po/nb.po (used elinks-0.12)
	po/nl.po (used elinks-0.12)
	po/pl.po (used master)
	po/pt.po (used elinks-0.12)
	po/pt_BR.po (used elinks-0.12)
	po/ro.po (used elinks-0.12)
	po/ru.po (used elinks-0.12)
	po/sk.po (used elinks-0.12)
	po/sr.po (used elinks-0.12)
	po/sv.po (used elinks-0.12)
	po/tr.po (used elinks-0.12)
	po/uk.po (used elinks-0.12)
2009-03-29 18:26:20 +03:00
Kalle Olavi Niemitalo
d7d18e4e43 bug 1047: inline functions C99 conformance
C99 6.7.4p3 and 6.7.4p6 set some constraints on what can be done in
inline functions and how they can be declared.  In particular, any
function declared inline must also be defined in the same translation
unit.  To comply with that, remove inline specifiers from function
declarations in header files when the functions are not also defined
in those header files.

Sun Studio 11 on Solaris 9 is stricter than C99 and does not allow
references to static identifiers in extern inline functions.  Make the
configure script detect this and define NONSTATIC_INLINE accordingly
in config.h.  Then use that in the definitions of all non-static
inline functions.

Document the restrictions and this scheme in doc/hacking.txt.
2009-03-28 20:15:08 +02:00
Kalle Olavi Niemitalo
d89cebc0b3 bug 762: Fix memory leak in ses_goto.
In src/session/task.c, if ses_goto() was going to ask the user to
confirm, it did:

    task->session_task.target.frame = null_or_stracpy(target_frame);

It added the struct task to a memory_list, so the structure was freed
when the message box was closed.  The target frame string was however
never freed.  To fix this leak, add the target frame string to the
memory_list too.

Alternatively, this could have been fixed by making post_yes() and
post_no() free the string.  It is however a bit better to use the
memory_list because msg_box() frees that even if it is unable to
display the message box.
2009-02-17 09:11:22 +01:00
Kalle Olavi Niemitalo
d2854dca8d Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/bookmarks/backend/default.c
	src/bookmarks/bookmarks.c
	src/session/session.c
	src/terminal/event.c
	src/viewer/text/search.c
2009-02-08 22:02:57 +02:00
Kalle Olavi Niemitalo
b432b735e4 bug 1066: Attempt to convert -remote addBookmark(URL) to UTF-8.
Currently, it is not clear which codepage is used in struri().
Assume it is the system codepage.
2009-02-08 18:26:19 +02:00
Kalle Olavi Niemitalo
99d1269bc5 bug 153, 1066: Convert session-snapshot bookmarks to/from UTF-8.
These functions now expect or return strings in UTF-8:
delete_folder_by_name (sneak in a const, too), bookmark_terminal_tabs,
open_bookmark_folder, and get_auto_save_bookmark_foldername_utf8 (new
function).
2009-02-08 18:26:19 +02:00
Kalle Olavi Niemitalo
d1f2f8df80 bug 153, 1066: init_bookmark() and add_bookmark() expect UTF-8.
Comment changes only.
2009-01-24 12:17:48 +02:00
Witold Filipczyk
ba70d61051 762: Instead of setting a bare pointer for task.target.frame always
use the dynamically allocated value. null_or_stracpy and mem_free_set
macros are used. Slower, but safer.
2009-01-01 22:06:59 +01:00
Kalle Olavi Niemitalo
687f19dbde Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/bfu/dialog.c
	src/bfu/hotkey.c
	src/bfu/inpfield.c
	src/dialogs/options.c
	src/document/renderer.c
	src/intl/gettext/libintl.h
	src/protocol/http/codes.c
	src/session/task.c
	src/terminal/event.c
	src/terminal/terminal.h
	src/viewer/text/form.c
	src/viewer/text/link.c

And a semantic conflict in src/terminal/terminal.c.
2009-01-01 19:14:01 +00:00
Kalle Olavi Niemitalo
29c34df62e Fix assertion failure if IMG/@usemap refers to a different file.
Change test/imgmap2.html so it can be used for testing this too.

Debian Iceweasel 3.0.4 does not appear to support such external
client-side image maps.  Well, that's one place where ELinks is
superior, I guess.  There might be a security problem though if ELinks
were to let scripts of the referring page examine the links in the
image map.
2009-01-01 19:12:41 +00:00
Kalle Olavi Niemitalo
ad45176dde Add get_terminal_codepage().
This simplifies the callers a little and may help implement
simultaneous support for different charsets on different terminals
of the same type (bug 1064).
2009-01-01 16:16:17 +00:00
Kalle Olavi Niemitalo
5c2fada371 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/session/download.c
2008-11-01 22:39:17 +02:00
M. Vefa Bicakci
96b3093519 Patch 2: Modifications to the remaining parts of ELinks
[Forward ported to 0.12 from bug 1004 attachment 499.  --KON]
2008-11-01 22:20:25 +02:00
Kalle Olavi Niemitalo
84e19d0e4e bug 1054: Don't abort downloads when closing a terminal.
Except if they have external handlers.

When ELinks receives an event from a terminal, move that terminal to
the beginning of the global "terminals" list, so that the terminals
are always sorted according to the time of the most recent use.  Note,
this affects the numbering of bookmark folders in session snapshots.

Add get_default_terminal(), which returns the most recently used
terminal that is still open.  Use that in various places that
previously used terminals.prev or terminals.next.  Four functions
fetch the size of the terminal for User-Agent headers, and
get_default_terminal() is not really right, but neither was the
original code; add TODO comments in those functions.

When the user chooses "Background and Notify", associate the download
with the terminal where the dialog box is.  So any later messages will
then appear in that terminal, if it is still open.  However, don't
change the terminal if the download has an external handler.

When a download gets some data, don't immediately check the associated
terminal.  Instead, wait for the download to end.  Then, if the
terminal of the download has been closed, use get_default_terminal()
instead.  If there is no default terminal either, just skip any
message boxes.
2008-10-15 23:29:25 +03:00
Kalle Olavi Niemitalo
75302f8e62 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	NEWS
2008-10-03 10:55:11 +03:00
Kalle Olavi Niemitalo
4c2ddac289 Bug 1053: Fix crash when download ends.
ELinks attempted to display a message box on file_download.term, but
it had already closed that terminal and freed the struct terminal.  To
fix this, reset file_download.term pointers to NULL when the terminal
is about to be destroyed.  Also, assert in download_data_store() that
file_download.term is either NULL or in the global "terminals" list.

Reported by أحمد المحمودي.
(cherry picked from commit 6e2476ea4d)
2008-10-03 00:18:41 +03:00
Kalle Olavi Niemitalo
a73fe73cd2 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	src/document/document.h
	src/encoding/encoding.c
	src/network/connection.c
	src/protocol/bittorrent/bittorrent.c
	src/protocol/bittorrent/bittorrent.h
	src/protocol/bittorrent/common.h
	src/protocol/bittorrent/connection.c
	src/protocol/bittorrent/dialogs.c
	src/protocol/bittorrent/tracker.c
	src/protocol/file/cgi.c
	src/protocol/http/http.c
2008-08-03 22:18:53 +03:00
Kalle Olavi Niemitalo
6c2e8cd7b2 Bug 1013: Don't assume errno is between 0 and 100000
Replace almost all uses of enum connection_state with struct
connection_status.  This removes the assumption that errno values used
by the system are between 0 and 100000.  The GNU Hurd uses values like
ENOENT = 0x40000002 and EMIG_SERVER_DIED = -308.

This commit is derived from my attachments 450 and 467 to bug 1013.
2008-08-03 17:56:41 +03:00
Kalle Olavi Niemitalo
988cec481b Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	NEWS
	configure.in

The following files also conflicted, but they had not been manually
edited in the elinks-0.12 branch after the previous merge, so I just
kept the 0.13.GIT versions:

	doc/man/man1/elinks.1.in
	doc/man/man5/elinks.conf.5
	doc/man/man5/elinkskeys.5
	po/fr.po
	po/pl.po
2008-07-11 22:28:45 +03:00
Kalle Olavi Niemitalo
06c39a8ac4 Bug 951: Lock the cache entry while the hook runs. 2008-07-08 15:20:38 +03:00
Kalle Olavi Niemitalo
5b6c913c6a Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	src/network/connection.h
	src/session/download.c
	src/session/download.h
2008-06-15 21:43:08 +03:00
Kalle Olavi Niemitalo
eb8bbc9286 Revert "Copiousoutput part II. To be continued ..."
I am reverting all copiousoutput support because of bug 917.
This reverts commit f6115e65ec.

Conflicts:

	src/session/download.h: type_query.cgi, and Doxygen comments.
2008-06-15 14:38:48 +03:00
Kalle Olavi Niemitalo
196c3a8134 Revert "int_min instead of int_max. Valgrind said: invalid read"
I am reverting all copiousoutput support because of bug 917.
This reverts commit a2c12d7653.

Conflicts:

	src/session/download.c: The int_min vs. int_max change had
	  already been obsoleted by using safe_strncpy instead,
	  in commit efcd6c9758 for bug 896 on 2007-07-24.
	  Also, TERM_EXEC_FG and TERM_EXEC_BG had been added.
2008-06-15 14:31:17 +03:00
Kalle Olavi Niemitalo
6e0d4cf4bf Revert "Copiousoutput final stage. I doubt that /dev/fd/%d is portable. It works"
I am reverting all copiousoutput support because of bug 917.
This reverts commit 6ead4e9c65.

Conflicts:

	src/session/download.c: TERM_EXEC_FG and TERM_EXEC_BG had been
	  added after the original commit.
2008-06-15 14:21:55 +03:00
Kalle Olavi Niemitalo
bfb034c953 Revert "copiousoutput: cleanup after copiousoutput handling. Temporary files should"
I am reverting all copiousoutput support because of bug 917.
This reverts commit 4dc4ea47f2.

Conflicts:

	src/network/connection.h: After the original commit, the declaration
	  of copiousoutput_data had been changed to use the LIST_OF macro.
	  Also, connection.cgi had been added next to the connection.popen
	  member added by the original commit.
	src/session/download.c: After the original commit, the definition of
	  copiousoutput_data had been changed to use the INIT_LIST_OF macro.
2008-06-15 14:17:44 +03:00
Kalle Olavi Niemitalo
01dd1b3b65 Revert "When prompting a program for copiousoutput don't show the block checkbox"
I am reverting all copiousoutput support because of bug 917.
This reverts commit 0c2ce62459.
2008-06-15 14:05:55 +03:00
Witold Filipczyk
1544b5f4b9 bug 991: fix crash when the file is already cached
If the user opens the same file again after it is in the cache, then
ELinks does not always open a new connection, so download->conn can be
NULL in init_type_query(), and download->conn->cgi would crash.
Don't read that, then; instead add a new flag cache_entry.cgi, which
http_got_header() sets or clears as soon as possible after the cache
entry has been created.
(cherry picked from commit 81f8ee1fa2)
2008-06-15 13:53:34 +03:00
Witold Filipczyk
d15439edff bug 991: Added the bit field cgi to the structs connection and type_query.
CGI scripts are distinguishable from normal files. I hope that this
fixes the bug 991. This commit also reverts the previous revert.
(cherry picked from commit 7ceba1e461)
2008-06-15 13:07:02 +03:00
Miciah Dashiel Butler Masters
5c96d430c9 Bug 765: Bypass checks on base tab's view state when copying to a new tab
In setup_session, use copy_location, add_to_history, and
render_document_frames instead of goto_uri and copy_vs to copy the base
tab's view state.  By avoiding goto_uri, setup_session now bypasses MIME
checks, form post confirmations, malicious URL checks, and so on when
copying the base tab's current location and view state to the new tab,
so the new tab should get exactly what was loaded in the base tab.

This fixes bug 765: Opening a new tab can ask about the document of the
previous tab.
2008-06-11 10:32:02 +00:00
Miciah Dashiel Butler Masters
9e04b0ec8c Fix bug 944: avoid duplicate type-query handlers
Previously, init_type_query would check to make sure that it doesn't create a
duplicate type query and would return NULL if it otherwise would create a
duplicate.  Then setup_download_handler would return 0 to do_move.

This patch changes setup_download_handler to return 1 to do_move in this
situation so that do_move stops trying to load the document.

This avoid a crash when loading twice the same file in the same tab when
loading the file opens a type query.
2008-05-11 15:42:21 +00:00
Witold Filipczyk
81f8ee1fa2 bug 991: fix crash when the file is already cached
If the user opens the same file again after it is in the cache, then
ELinks does not always open a new connection, so download->conn can be
NULL in init_type_query(), and download->conn->cgi would crash.
Don't read that, then; instead add a new flag cache_entry.cgi, which
http_got_header() sets or clears as soon as possible after the cache
entry has been created.
2008-03-15 20:49:15 +02:00
Witold Filipczyk
2aa70f77bc bug 991: Added the bit field cgi to the structs connection and type_query.
CGI scripts are distinguishable from normal files. I hope that this
fixes the bug 991. This commit also reverts the previous revert.
(cherry picked from commit 7ceba1e461)
2008-03-15 19:25:01 +02:00
Kalle Olavi Niemitalo
fb966b87a3 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	doc/Doxyfile.in
2008-03-15 19:24:51 +02:00
Kalle Olavi Niemitalo
cd4a9d77b9 Revert "bug 991: Added the bit field cgi to the structs connection and type_query."
This reverts commit 7ceba1e461,
which is causing an assertion to fail if I open the same PDF
twice in a row, even if I cancel the dialog box when ELinks
first asks which program to run:

INTERNAL ERROR at /home/Kalle/src/elinks-0.12/src/session/download.c:980: assertion download && download->conn failed!

Forcing core dump! Man the Lifeboats! Women and children first!

But please DO NOT report this as a segfault!!! It is an internal error, not a
normal segfault, there is a huge difference in these for us the developers.
Also, noting the EXACT error you got above is crucial for hunting the problem
down. Thanks, and please get in touch with us.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1216698688 (LWP 17877)]
0xb7a02d76 in raise () from /lib/libc.so.6
(gdb) backtrace 6
    at /home/Kalle/src/elinks-0.12/src/util/error.c:179
    fmt=0x816984c "assertion download && download->conn failed!")
    at /home/Kalle/src/elinks-0.12/src/util/error.c:122
    cached=0x8253ca8) at /home/Kalle/src/elinks-0.12/src/session/download.c:980
    cached=0x8253ca8, frame=0)
    at /home/Kalle/src/elinks-0.12/src/session/download.c:1339
    at /home/Kalle/src/elinks-0.12/src/session/task.c:493
(More stack frames follow...)

There is a fix available but I don't trust it yet.
2008-03-11 10:51:20 +02:00
Witold Filipczyk
7ceba1e461 bug 991: Added the bit field cgi to the structs connection and type_query.
CGI scripts are distinguishable from normal files. I hope that this
fixes the bug 991. This commit also reverts the previous revert.
2008-03-09 15:47:35 +02:00
Kalle Olavi Niemitalo
13a04b8fbc Bug 991: Revert "When requested to open local files with a handler use the file in place"
This reverts commit d0be89a16c, and thus
restores the ELinks 0.11 behaviour: always copy the data to a
temporary file before passing it to a MIME handler, even if the
"file:" URI scheme is being used.  Previously, ELinks 0.12.GIT passed
the name of the original file directly to the handler.  That was more
efficient but unfortunately gave the wrong result with local CGI.

The commit being reverted also claims to partially fix bug 238
(caching of local files).  That bug is still open.
2008-03-08 21:20:58 +02:00
Witold Filipczyk
19079733df Bug 991: URI-decode and shell-quote file name for MIME handler
Currently, when ELinks passes the name of a local file to an external
MIME handler program, it encodes the name as a URI.  Programs
typically do not expect this, and they then fail to open the file.
This patch makes ELinks instead quote the file name for the shell.

(The patch was attachment 425 of bug 991, by Witold Filipczyk.
 This commit message was written by Kalle Olavi Niemitalo.)
2008-03-08 21:20:58 +02:00
Miciah Dashiel Butler Masters
3a0286e447 Strings corrections from Malcolm Parsons
Fix the spelling and grammar in various comments, variable names, comment
descriptions, and documentation.
2008-01-27 04:19:23 +00:00
Miciah Dashiel Butler Masters
643a34e6af Strings corrections from Malcolm Parsons
Fix the spelling and grammar in various comments, variable names, comment
descriptions, and documentation.
2008-01-27 04:09:18 +00:00
Miciah Dashiel Butler Masters
12dce0d1c0 setup_session: Restore ses->doc_view->vs pointer after copying base's vs
After copying the base session's viewstate, restore the ses->doc_view->vs
pointer.

This follows up on commit 65321923b90da94a9bbe326349a7716be5106eba:

    In setup_session, copy the viewstate for the new session from the base
    session.

This fixes bug 977:  When opening a javascript: link in a new tab, an
assertion on ses->doc_view->vs in ecmascript_protocol_handler would fail.
2007-12-27 21:36:46 +00:00
Miciah Dashiel Butler Masters
f598226be4 Don't copy current tab when using -remote
In init_remote_session, pass open_uri_in_new_tab a false argument for the based parameter so that the new tab does not get the old tabs current location in its history.
2007-12-23 13:56:34 +00:00
Laurent MONIN
9297853d20 Fix download led among different sessions, just use are_there_downloads().
It is a partial revert of commit d14f79eb2c.
Most introduced stuff was useless.
2007-11-07 14:01:10 +01:00
Laurent MONIN
b3cfede1c1 Drop @safe parameter of create_download_file().
Use new flag DOWNLOAD_EXTERNAL instead.
2007-11-07 13:33:04 +01:00
Laurent MONIN
71ccbe0f8d Replace resume parameter by more generic flags.
Type download_flags_T and enum download_flag were introduced.
2007-11-07 12:57:13 +01:00
Laurent MONIN
cfdbe749e8 Use sizeof() instead hardcoded value in read_from_popen(). 2007-11-07 12:12:31 +01:00
Laurent MONIN
cdda2f5acd Factor out redundant code in download_data_store(). 2007-11-07 12:08:36 +01:00
Laurent MONIN
2a59f0f5bd Simplify code. 2007-11-07 12:06:24 +01:00
Laurent MONIN
d14f79eb2c Indicate backgrounded downloads using an unused led.
The sixth position (the last led from the left) is used.
2007-11-07 11:24:52 +01:00
Miciah Dashiel Butler Masters
7033247905 Introduce start_document_refreshes()
start_document_refreshes() performs the NULL-pointer checks that
previously all callers to start_document_refresh() must perform
and then calls start_document_refresh().
2007-09-14 16:44:04 +02:00
Miciah Dashiel Butler Masters
dbacc9ead2 Support document refresh in frames
Introduce reload_frame, which takes a frame @name argument in addition to the arguments that reload takes.
2007-09-06 20:47:17 +00:00
Miciah Dashiel Butler Masters
a1a8696cce Introduce start_document_refreshes
start_document_refreshes performs the NULL-pointer checks that previously all callers to start_document_refresh must perform and then calls start_document_refresh.
2007-09-06 18:52:23 +00:00
Jonas Fonseca
8489f04cc9 renderer: Fix unnecessary inclusions of document/html/renderer 2007-08-31 15:43:56 +02:00
Miciah Dashiel Butler Masters
0e0bacf0d3 Merge branch 'master' of ssh://pasky.or.cz/srv/git/elinks
Conflicts:

	src/document/options.c
2007-08-30 21:13:43 +00:00
Miciah Dashiel Butler Masters
91947860f2 Check session- and domain-specific settings for many options
Pass the session with some get_opt_* calls.  These are the low-hanging fruit.  Some places will be difficult because we don't have the session or for other reasons.
2007-08-30 21:11:51 +00:00
Petr Baudis
6b05ddb762 Remove unnecessary document/html/parser.h includes 2007-08-29 00:08:05 +02:00
Miciah Dashiel Butler Masters
fa12b10e26 Introduce session- (tab-)specific options
Introduce session-specific options for those options that have toggle-... actions.
2007-08-28 17:29:41 +00:00
Miciah Dashiel Butler Masters
ea372bd0cd get_opt_*: Add ses parameter
Add a session parameter to get_opt_ and its wrappers in preparation for session-specific and domain-specific options.
2007-08-28 17:24:59 +00:00
Kalle Olavi Niemitalo
870df797cf Doxygen: Escape some HTML tags. 2007-07-31 13:48:20 +03:00
Kalle Olavi Niemitalo
54dfa64c04 Doxygen: @relates 2007-07-27 14:14:00 +03:00
Kalle Olavi Niemitalo
d5f2d90611 Doxygenate src/session/ 2007-07-27 09:55:40 +03:00
Kalle Olavi Niemitalo
96176a8c77 Declare element types of lists. 2007-07-26 22:47:23 +03:00
Kalle Olavi Niemitalo
d3d2bb26c5 New macro LIST_OF for better Doxygen support. 2007-07-26 22:45:51 +03:00
Jonas Fonseca
a721f62be3 Bug 723: Always get the current frame when loading frame files
This cleans up and changes the calling convention of
load_additional_file(), so that it now grab its own doc_view using
current_frame() and the struct session pointer in the file_to_load
object. By always looking up the current frame, corruption of doc_view
due to rerendering of the upper frame document is avoided.

The fix extends commit 6afdbf608f by
Witold, which moved the getting of doc_view in the other caller of
load_additional_file(). The additional clean up ensures that any future
users of load_additional_file() will not reintroduce a similar bug.

A possible future optimization would be to change load_additional_file()
to take the referrer as an argument.
2007-07-24 15:27:21 +02:00
Jonas Fonseca
efcd6c9758 Bug 896: use safe_strncpy when initializing the program field
This cleans up the previous fix and also fixes the problem mentioned
regarding ELinks still crashing when the first character is removed.
2007-07-24 12:47:35 +02:00
Kalle Olavi Niemitalo
6117f8a164 Name the exec_on_terminal() fg values. 2007-07-15 23:46:18 +03:00
Kalle Olavi Niemitalo
45d1750d03 Bug 914: Don't let UTF-8 I/O affect internal representations.
Use it for the actual I/O only.  Previously, defining CONFIG_UTF8 and
enabling UTF-8 used to force many strings to the UTF-8 charset
regardless of the terminal charset option.  Now, those strings always
follow the terminal charset.  This fixes bug 914 which was caused
because _() returned strings in the terminal charset and functions
then assumed they were in UTF-8.  This reduction in the effects of
UTF-8 I/O may also simplify future testing.
2007-05-20 15:31:02 +03:00
Witold Filipczyk
026e56d539 Used add_shell_quoted_to_string instead of enclosing the text with '"'.
The code works both with copiousoutput and without it.

[ Part 1/2 of commit c25c41bd18 on the
  witekfl branch.  I'm leaving out the part that depends on commit
  469481b272, which is not yet safe to
  apply.  --KON ]
2007-03-12 19:22:41 +02:00
Witold Filipczyk
b3fa9a7019 MIME: When there is no % in the handler string (no %s in the mailcap entry)
the handler reads data from stdin. I think it only works with copiousoutput.

[ Part 1/2 of commit 4a7b9415e1 on the
  witekfl branch, fixes bug 916.  I'm leaving out delayed_goto_uri()
  for now because I don't understand its purpose.  --KON ]
2007-03-12 19:19:57 +02:00
Kalle Olavi Niemitalo
a05f7203cd Cast variadic arguments of getml to void *.
getml reads the args with va_arg(ap, void *), and the NULL macro in
particular may have the wrong type.
2007-03-11 12:41:17 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Kalle Olavi Niemitalo
2b7788614f Type-check button arguments of msg_box.
Don't cast function pointers; calling functions via pointers of
incorrect types is not guaranteed to work.  Instead, define the
functions with the desired types, and make them cast the incoming
parameters.  Or define wrapper functions if the return types don't
match.

really_exit_prog wasn't being used outside src/dialogs/menu.c,
and I had to change its parameter type, so it's now static.
2007-03-10 23:50:56 +02:00
Laurent MONIN
e4256e0e6a Refresh status bar when key prefix is eaten. It fixes bug 930. 2007-03-05 22:15:50 +01:00
Witold Filipczyk
2bf5372a29 stpcpy was not used in this file. 2007-02-25 11:02:28 +02:00
Kalle Olavi Niemitalo
a565365a8d do_type_query: Make known_types[] const. 2007-02-04 15:32:35 +02:00
Kalle Olavi Niemitalo
2e5488ba3d option_changed: Merge the 2nd and 3rd parameter.
All callers were passing the same value for both.
2007-01-27 19:52:49 +02:00
Kalle Olavi Niemitalo
bddafe5f7e Document how timer callbacks erase timer IDs; add some assertions.
Tangential to bug 868.
2006-12-02 18:35:03 +02:00
Jonas Fonseca
58c83a9f48 Never show empty filename in the what-to-do dialog
This fixes the last comment of bug 396.
2006-11-06 04:55:26 +01:00
Witold Filipczyk
f4e66f1fc6 ECMAScript: added writeonly property window.status 2006-10-24 20:41:25 +02:00
Laurent MONIN
3e5b4b7adf Fix whitespace goof reported by Miciah on IRC, introduced in
947c1730a6.
2006-10-13 15:08:52 +02:00
Laurent MONIN
947c1730a6 Fix crash due to untested null pointer occuring when doing
HTTP_PROXY=8080:proxy.ucv.cl elinks http://wwww.google.cl. Thanks to
Karel Zak.
2006-10-11 14:44:39 +02:00
Laurent MONIN
0b58b99d30 Use @current_tab for current tab. 2006-09-28 23:58:26 +02:00
Kalle Olavi Niemitalo
92cb452a9e Rename CONFIG_UTF_8 to CONFIG_UTF8.
The configure script no longer recognizes "CONFIG_UTF_8=yes" lines
in custom features.conf files.  They will have to be changed to
"CONFIG_UTF8=yes".  This incompatibility was deemed acceptable
because no released version of ELinks supports CONFIG_UTF_8.

The --enable-utf-8 option was not renamed.
2006-09-17 16:12:47 +03:00
Witold Filipczyk
2a6125e3d0 Merge with utf8. src/document/plain/renderer.c replaced by utf8 version 2006-07-21 13:12:06 +02:00
Witold Filipczyk
ff136e5116 Bugfix for bug 770 (Download resuming simply restarts the download)
using magic ;)

Now in resume mode connection is always interrupted
and resumed. Even when all file is downloaded from beginning
conection will be resumed from old end of file. Feel free to fix it.
2006-07-16 14:46:46 +02:00
Jonas Fonseca
0c2ce62459 When prompting a program for copiousoutput don't show the block checkbox
Since (I hope) it has no effect. Instead, inform the user that the output will
be displayed in the current tab.
2006-06-06 01:32:03 +02:00
Witold Filipczyk
4dc4ea47f2 copiousoutput: cleanup after copiousoutput handling. Temporary files should
be deleted
2006-05-09 09:36:16 +02:00
Witold Filipczyk
6ead4e9c65 Copiousoutput final stage. I doubt that /dev/fd/%d is portable. It works
at least under Linux. I didn't test network part of external handlers.
Files in tmpdir must be delete somehow. Maybe make a list of files
to unlink and delete them while quitting ELinks.
2006-05-04 21:19:30 +02:00
Witold Filipczyk
a2c12d7653 int_min instead of int_max. Valgrind said: invalid read
copiousoutput III. It works only for local files, but you must remove
| /usr/bin/less
yourself and allow reading special files, and set default mime type
as text/plain for convenience.
2006-05-04 20:44:27 +02:00
Witold Filipczyk
f6115e65ec Copiousoutput part II. To be continued ... 2006-05-04 18:02:45 +02:00
Pavol Babincak
8b9d06c977 Convert link titles to correct codepage before displaying it on screen.
Don't replace UTF-8 bytes with '*'. Probably there is need to do better
check what will be displayed.

Also get_current_link_title is no longer pretty and trivial. (o:
2006-03-13 01:54:34 +01:00
witekfl
e50581faf3 Menu bar moved at the end of windows queue. bfu_technology activated at the
right place.
2006-03-04 11:42:57 +01:00
witekfl
3f01c3d2fe Display optionally tabs bar at top like other browser do.
TODO: input_line_layouter, ACT_MAIN_TAB_MENU
2006-03-04 10:24:37 +01:00
Kalle Olavi Niemitalo
a1f26c1f25 Merge with http://elinks.cz/elinks.git 2006-02-12 17:54:22 +02:00
Miciah Dashiel Butler Masters
daad05c055 Don't check is_in_progress_state before calling cancel_download
With commit 637f1e82e6 ('NET: Merge
change_connection into cancel_download'), cancel_download returns
immediately if the connection is not in a result state, so save some
code by not checking is_in_progress_state before calling cancel_download.
2006-02-12 15:41:21 +00:00
Kalle Olavi Niemitalo
0066214b47 Merge with http://elinks.cz/elinks.git 2006-02-10 09:15:12 +02:00
Jonas Fonseca
03299d6c2e Add documents displayed via "What to do" dialog to globhist
First the patch makes sure doc_loading_callback is always called from
tp_display even if the download is in result state. This is often the
case for local files that the user decides to display via the WTD dialog.

Furthermore, improve the adding to globhist part of doc_loading_callback,
so that it works also for downloads in result state where the
download->conn member is NULL. In addition to grabbing the URI from the
connection try also the cache entry if it is set.

Fixes: bug 355 (Documents displayed via WTD aren't added to globhist)
2006-02-07 02:25:27 +01:00
Kalle Olavi Niemitalo
b1f8756c59 Merge with http://elinks.cz/elinks.git 2006-02-05 17:48:43 +02:00
Jonas Fonseca
3324496b57 NET: Replace change_connection with cancel_download and move_download
This simplifies unqueuing of downloads and makes it more obvious that
the 'change' being performed is to migrate or replace an old download
handle with a new one.
2006-02-03 10:44:28 +01:00
witekfl
ea2d7a3325 Simplification. 2006-01-25 20:19:55 +01:00
witekfl
1d65718ace When there is no frame with given name do goto_uri_frame using static
buffer.
2006-01-18 20:16:17 +01:00
Miciah Dashiel Butler Masters
1f68492d57 Move delayed_goto_uri_frame to src/session/task.c
Until the last change in src/ecmascript/see/window.c, the two copies
of delayed_goto_uri_frame in src/ecmascript/spidermonkey/window.c and
in src/ecmascript/see/window.c were identical. That change applies to
both versions, so move the newer one to src/session/task.c and eliminate
the duplication. Also move struct delayed_open to src/session/session.h.
2006-01-16 19:18:33 +00:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Kalle Olavi Niemitalo
2cfd0a9bb4 Merge with http://elinks.cz/elinks.git 2006-01-09 02:20:27 +02:00
Jonas Fonseca
bc55cd55cb Add the basic support for rendering RSS documents
It is very simple for now, so it only displays headlines and doesn't
support a whole lot of RSS flavours.
2006-01-08 03:44:23 +01:00
Jonas Fonseca
d0be89a16c When requested to open local files with a handler use the file in place
Everything else is really stupid, i.e. to go through the callback-infested
download code. A parly fix of bug 238 (caching of local files).
2006-01-07 20:19:37 +01:00
Kalle Olavi Niemitalo
93714a3e35 Merge with http://elinks.cz/elinks.git 2006-01-06 02:13:11 +02:00
Laurent MONIN
c39a30ca49 Autocreate directories needed to download a file. 2006-01-04 21:52:15 +01:00
Kalle Olavi Niemitalo
eb99af7a33 Merge with http://elinks.cz/elinks.git 2006-01-02 01:27:11 +02:00
Jonas Fonseca
021af4e87c Although aware ELinks doesn't need another sgml/doctype here is DocBook
It was created a long time ago so (I think) it deserves to survive. It
maps .sgml files to applicatino/docbook+xml and uses the highlighter.
2006-01-01 23:22:10 +01:00
Kalle Olavi Niemitalo
345ba7afcd Merge with http://elinks.cz/elinks.git 2006-01-01 19:05:44 +02:00
Kalle Olavi Niemitalo
4c2831677a Here is a framework that detects cases where a PO file assigns
the same accelerator key to multiple buttons in a dialog box or
to multiple items in a menu.  ELinks already has some support for
this but it requires the translator to run ELinks and manually
scan through all menus and dialogs.  The attached changes make it
possible to quickly detect and list any conflicts, including ones
that can only occur on operating systems or configurations that
the translator is not currently using.

The changes have no immediate effect on the elinks executable or
the MO files.  PO files become larger, however.

The scheme works like this:

- Like before, accelerator keys in translatable strings are
  tagged with the tilde (~) character.

- Whenever a C source file defines an accelerator key, it must
  assign one or more named "contexts" to it.  The translations in
  the PO files inherit these contexts.  If multiple strings use
  the same accelerator (case insensitive) in the same context,
  that's a conflict and can be detected automatically.

- The contexts are defined with "gettext_accelerator_context"
  comments in source files.  These comments delimit regions where
  all translatable strings containing tildes are given the same
  contexts.  There must be one special comment at the top of the
  region; it lists the contexts assigned to that region.  The
  region automatically ends at the end of the function (found
  with regexp /^\}/), but it can also be closed explicitly with
  another special comment.  The comments are formatted like this:

    /* [gettext_accelerator_context(foo, bar, baz)]
         begins a region that uses the contexts "foo", "bar", and "baz".
         The comma is the delimiter; whitespace is optional.

       [gettext_accelerator_context()]
         ends the region.  */

  The scripts don't currently check whether this syntax occurs
  inside or outside comments.

- The names of contexts consist of C identifiers delimited with
  periods.  I typically used the name of a function that sets
  up a dialog, or the name of an array where the items of a
  menu are listed.  There is a special feature for static
  functions: if the name begins with a period, then the period
  will be replaced with the name of the source file and a colon.

- If a menu is programmatically generated from multiple parts,
  of which some are never used together, so that it is safe to
  use the same accelerators in them, then it is necessary to
  define multiple contexts for the same menu.  link_menu() in
  src/viewer/text/link.c is the most complex example of this.

- During make update-po:

  - A Perl script (po/gather-accelerator-contexts.pl) reads
    po/elinks.pot, scans the source files listed in it for
    "gettext_accelerator_context" comments, and rewrites
    po/elinks.pot with "accelerator_context" comments that
    indicate the contexts of each msgid: the union of all
    contexts of all of its uses in the source files.  It also
    removes any "gettext_accelerator_context" comments that
    xgettext --add-comments has copied to elinks.pot.

  - If po/gather-accelerator-contexts.pl does not find any
    contexts for some use of an msgid that seems to contain an
    accelerator (because it contains a tilde), it warns.  If the
    tilde refers to e.g. "~/.elinks" and does not actually mark
    an accelerator, the warning can be silenced by specifying the
    special context "IGNORE", which the script otherwise ignores.

  - msgmerge copies the "accelerator_context" comments from
    po/elinks.pot to po/*.po.  Translators do not edit those
    comments.

- During make check-po:

  - Another Perl script (po/check-accelerator-contexts.pl) reads
    po/*.po and keeps track of which accelerators have been bound
    in each context.  It warns about any conflicts it finds.
    This script does not access the C source files; thus it does
    not matter if the line numbers in "#:" lines are out of date.

This implementation is not perfect and I am not proposing to
add it to the main source tree at this time.  Specifically:

- It introduces compile-time dependencies on Perl and Locale::PO.
  There should be a configure-time or compile-time check so that
  the new features are skipped if the prerequisites are missing.

- When the scripts include msgstr strings in warnings, they
  should transcode them from the charset of the PO file to the
  one specified by the user's locale.

- It is not adequately documented (well, except perhaps here).

- po/check-accelerator-contexts.pl reports the same conflict
  multiple times if it occurs in multiple contexts.

- The warning messages should include line numbers, so that users
  of Emacs could conveniently edit the conflicting part of the PO
  file.  This is not feasible with the current version of
  Locale::PO.

- Locale::PO does not understand #~ lines and spews warnings
  about them.  There is an ugly hack to hide these warnings.

- Jonas Fonseca suggested the script could propose accelerators
  that are still available.  This has not been implemented.

There are three files attached:

- po/gather-accelerator-contexts.pl: Augments elinks.pot with
  context information.

- po/check-accelerator-contexts.pl: Checks conflicts.

- accelerator-contexts.diff: Makes po/Makefile run the scripts,
  and adds special comments to source files.
2006-01-01 18:55:18 +02:00
Jonas Fonseca
9a0bf83756 Add basic stuff for XBEL parsing/highlighting using the DOM engine 2005-12-30 22:19:32 +01:00
Jonas Fonseca
c0ece18042 Start showing RSS files in the plain view so it gets highlighted 2005-12-30 21:55:53 +01:00
Miciah Dashiel Butler Masters
470da90699 Put documentation (doc/events.txt) and reality back into alignment
by changing goto_url_with_hook not to call goto_uri if get_hooked_uri
returns NULL, which it does if a hook returns "", which several hooks do.
2005-12-30 03:04:04 +00:00
Jonas Fonseca
4104f5d2f0 Only consider application/rss+xml internal with CONFIG_DOM 2005-12-20 03:13:08 +01:00
Jonas Fonseca
56d634b946 Add basic support for RSS parsing for application/rss+xml content types
This means the RSS source will be highlighted, but by default the HTML
renderer will be used for the default rendering.
2005-12-20 03:08:13 +01:00
Miciah Dashiel Butler Masters
fdacffd113 Change the pre-format event so that hooks are given the cache entry
instead of the URI, content, and length of the entry. Change the hooks
to use add_fragment. This should fix the memory leakage when multiple
hooks change the same document, closing bug 703.
2005-12-17 06:32:08 +00:00
Laurent MONIN
4a930507e4 process_file_requests(): move @more, @ftl and @doc_view variables to
inner scope.
2005-12-13 16:57:17 +01:00
Laurent MONIN
1c7b27c99f abort_files_load(): make @more and @ftl variables local to the loop. 2005-12-13 16:53:56 +01:00
Jonas Fonseca
be3223b38e Don't try MIME handlers for application/x-bittorrent
It is an internally supported protocol, so it should be all internal. The
other thing was just causing headacks. Thanks to Neuromancer for suggesting
not to endeavor into another configuration nightmare. And thanks to arcatan
for requesting this for the n-th time. ;)
2005-12-13 16:32:53 +01:00
Witold Filipczyk
6afdbf608f Fix frame-related crash on www.sts.pl (bug 723)
Earlier doc_view was freed in src/document/renderer.c line 455
and used later by load_additional_file.
2005-11-24 16:42:03 +01:00
Jonas Fonseca
acf2ec806b Remove empty lines in start of header files
A left over from the CVS Id removal. Also, for a few files, normalize the
order in which things are declared in headers.
2005-11-15 11:33:27 +01:00
Jonas Fonseca
a0fb29bcd5 Fix typo introduced in cdd3f5d9739d... 2005-11-15 10:20:48 +01:00
Miciah Dashiel Butler Masters
cdd3f5d973 Modify the logic for confirm_submit to flow better. 2005-11-14 09:02:08 +00:00
Miciah Dashiel Butler Masters
683d73d89d Tighten scope for cached in ses_goto. 2005-11-14 08:53:03 +00:00
Miciah Dashiel Butler Masters
97ad0e0f21 Use ses_load in post_yes. 2005-11-14 08:51:09 +00:00
Miciah Dashiel Butler Masters
93d6d959a5 Factor new function ses_load out of ses_goto. 2005-11-14 08:46:17 +00:00
Miciah Dashiel Butler Masters
16c0afb56c Drop a superfluous assignment to confirm_submit in ses_goto. 2005-11-14 08:27:55 +00:00
Laurent MONIN
df065ead80 Remove now useless $Id: lines. 2005-10-21 09:14:07 +02:00
Jonas Fonseca
c88afeb1c2 path_to_top -> top_builddir 2005-10-20 04:00:35 +02:00
Jonas Fonseca
e39a4342d6 Include $(top_srcdir)/Makefile.lib instead of $(path_to_top)/Makefile.lib
A step towards out of tree builds ...
2005-10-20 01:11:47 +02:00