1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-28 01:35:32 +00:00
Commit Graph

3452 Commits

Author SHA1 Message Date
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
9c17d8e805 Merge branch 'elinks-0.12' into elinks-0.13 2008-10-04 15:17:11 +03:00
Kalle Olavi Niemitalo
00f5831812 Bug 1053: Fix crash when download ends prematurely.
Call stacks reported by valgrind:

==14702==    at 0x80DD791: read_from_socket (socket.c:945)
==14702==    by 0x8104D0C: read_more_http_data (http.c:1180)
==14702==    by 0x81052FE: read_http_data (http.c:1388)
==14702==    by 0x80DD69B: read_select (socket.c:910)
==14702==    by 0x80D27AA: select_loop (select.c:307)
==14702==    by 0x80D1ADE: main (main.c:358)
==14702==  Address 0x4F4E598 is 56 bytes inside a block of size 81 free'd
==14702==    at 0x402210F: free (vg_replace_malloc.c:233)
==14702==    by 0x812BED8: debug_mem_free (memdebug.c:484)
==14702==    by 0x80D7C82: done_connection (connection.c:479)
==14702==    by 0x80D8A44: abort_connection (connection.c:769)
==14702==    by 0x80D99CE: cancel_download (connection.c:1053)
==14702==    by 0x8110EB6: abort_download (download.c:143)
==14702==    by 0x81115BC: download_data_store (download.c:337)
==14702==    by 0x8111AFB: download_data (download.c:446)
==14702==    by 0x80D7B33: notify_connection_callbacks (connection.c:458)
==14702==    by 0x80D781E: set_connection_state (connection.c:388)
==14702==    by 0x80D7132: set_connection_socket_state (connection.c:234)
==14702==    by 0x80DD78D: read_from_socket (socket.c:943)

read_from_socket() attempted to read socket->fd in order to set
handlers on it, but the socket had already been freed.  Incidentally,
socket->fd was -1, which would have resulted in an assertion failure
if valgrind hadn't caught the bug first.

To fix this, add a list of weak references to sockets.
read_from_socket() registers a weak reference on entry and unregisters
it before exit.  done_socket() breaks any weak references to the
specified socket.  read_from_socket() then checks whether the weak
reference was broken, and doesn't access the socket any more if so.
2008-10-04 14:19:00 +03:00
Kalle Olavi Niemitalo
bda58a124a Revert "Use given connections id in connection_disappeared()."
This reverts src/{network,sched}/connection.c CVS revision 1.43,
which was made on 2003-07-03 and converted to Git commit
cae65f7941628109b51ffb2e2d05882fbbdc73ef in elinks-history.

It is pointless to check whether (c == d && c->id == d->id).
If c == d, then surely c->id == d->id, and I wouldn't be surprised
to see a compiler optimize that out.
Whereas, by taking the id as a parameter, connection_disappeared()
can check whether the pointer now points to a new struct connection
with a different id.
2008-10-04 13:00:57 +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
22975bb0ec Remove unclearly licensed test files.
test/align.html: from www.czech-tv.cz
test/css/idnes_mail.html: apparently from idnes.cz
test/erreurs_en.htm: unclear origin
test/javascript_broken.html: presumably from www.hotjobs.com
test/poocs.net.html: presumably from poocs.net

I did not find in the source tree a licence to distribute any of these.
2008-10-03 10:39:12 +03:00
Kalle Olavi Niemitalo
4c1f0f5647 NEWS: mention Samba GPLv2 incompatibility
Samba 3.2.0 switched to version 3 of the GNU General Public License,
which is not compatible with GPLv2 used in ELinks.  Perhaps we can
eventually relicense ELinks to "GPL version 2 or later", or resolve
this in some other way.  Until then, warn distributors of binaries
about the conflict.
2008-10-03 00:40:53 +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
6ee45c710a AUTHORS: Add a licensing statement.
It is all in one line because <http://elinks.cz/authors.html>
is converted from AUTHORS and the conversion script is not
clever enough to know which newlines should be kept.

If the licence of ELinks is ever changed to "GNU GPL v3 or later",
I'll probably stop hacking it, but I don't want to legally forbid
such a change.
2008-09-29 00:47:59 +03:00
Kalle Olavi Niemitalo
c67885d880 Upgrade ISC licence to July 2007 version
Make it clear that modified versions may also be distributed.
I am the sole copyright holder for these ELinks files
so I can replace the licence like this.

This version of the licence is used in bind-9.5.0-P2.tar.gz.
Wikipedia claims ISC made the change in July 2007 after a request
from the FSF.
2008-09-28 23:16:37 +03:00
Kalle Olavi Niemitalo
b0ce4adcbe Let Perl scripts dynamically load libraries.
XML::LibXML::SAX appears to require this.
2008-09-27 21:58:08 +03:00
Kalle Olavi Niemitalo
4f9ed3e76b doc/installation: Mention nss_compat_ossl 2008-09-27 16:33:03 +03:00
Kalle Olavi Niemitalo
db97105bee Add Kamil Dudka to AUTHORS.
The relicensing permission was in message
<200808271214.22088.kdudka@redhat.com> posted to elinks-dev on
2008-08-27.  COPYING suggests such things should be added to AUTHORS.
2008-09-27 16:32:46 +03:00
Kamil Dudka
a00a413765 add support for nss_compat_ossl library (OpenSSL replacement)
* configure.in: New configure parameter --with-nss_compat_ossl.
 * socket.c: New configure option connection.ssl.client_cert.nickname.
 * ssl.h: Handle CONFIG_NSS_COMPAT_OSSL macro.
 * ssl.c: Add support for nss_compat_ossl.
 * TODO: Remove completed task.
 * NEWS: Mention the change.
2008-09-27 16:32:36 +03:00
Kalle Olavi Niemitalo
b40736cafe Merge branch 'elinks-0.12' into elinks-0.13
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/fr.po (kept 0.13.GIT version)
	po/pl.po (kept 0.13.GIT version)
2008-09-27 16:28:28 +03:00
Kamil Dudka
58ebb4447b fix mangled indentation in configure --help 2008-09-27 15:53:17 +03:00
Kalle Olavi Niemitalo
4e973e4875 doc/installation: libsmbclient, not smbclient 2008-09-27 15:52:47 +03:00
Kalle Olavi Niemitalo
b5cf81d8be doc/installation: convert dependency table to dsv format
The dependency table was originally in "fixed" format, so that
AsciiDoc took a fixed number of characters to the first column
and the rest to the second column.  However, "OpenSSL or GNU TLS
or nss_compat_ossl" will not fit in that number of characters,
and backslash line continuation will not help because AsciiDoc
apparently parses that before it counts the characters.
I could widen the column in the AsciiDoc source but switching
to "dsv" format seems prettier.
2008-09-27 15:52:29 +03:00
Kalle Olavi Niemitalo
ba32759970 Regenerate manpages for 0.12pre2.GIT
Including elinkskeys.5, which should have been regenerated for the
ELinks 0.12pre2 release, but apparently was not.
2008-09-27 15:51:02 +03:00
Kalle Olavi Niemitalo
fe78a0249a test/optgroup.html is under GNU Free Documentation License
test/optgroup.html was added on 2004-04-17 with no comment about licensing.
I contacted the author via <http://iccl.fi/feedback.cgi?id=mail>, asking
for a licence.  The author noted that a developer of ELinks had originally
asked on the #debian.fi channel whether the file could be used, and he had
allowed it then.  That permission grant had not been recorded in the source
tree though, and it is not clear whether modification had been allowed.
Anyway, the author now explicitly grants us the GNU free documentation
licence on this file, and is willing to consider other licences.
2008-09-24 02:08:51 +03:00
Kalle Olavi Niemitalo
df19e421f0 ELinks 0.11.5 and 0.12pre2 release date 2008-09-21 20:59:30 +03:00
Kalle Olavi Niemitalo
856a429038 ELinks 0.12pre2.GIT 2008-09-21 14:49:04 +03:00
Kalle Olavi Niemitalo
319e05d106 ELinks 0.12pre2 2008-09-21 11:45:22 +03:00
Kalle Olavi Niemitalo
b0a01398af NEWS for ELinks 0.12pre2 2008-09-21 10:41:23 +03:00
Kalle Olavi Niemitalo
00bf5f7baf 1045: Temporarily mention in NEWS. 2008-09-15 23:44:24 +03:00
Fabio Bonelli
c692bf8222 1045: fix "void function cannot return value" in formhist
never_for_this_site(form) did return remember_form(form).
In ELinks 0.11.0, both functions returned int, so this was OK.
In commit 2b7788614f however, the
functions were changed to return void, as required by msg_box().
GCC still accepted the return statement but Sun Studio 11 did not.
2008-09-15 23:43:52 +03:00
Kalle Olavi Niemitalo
0f6add14f2 Update document.comb_x and comb_y when splitting lines.
On 2008-09-05, it was reported to elinks-dev that ELinks hits an
internal error (bad alloc_header) when given a specific HTML file.
On 2008-09-09, out-of-range values of document->comb_x and
document->comb_y were noted as the cause of memory corruption.
Update those variables when splitting, aligning, or justifying a line.
Add many assertions to detect the bug if it occurs again.
2008-09-14 17:29:39 +03:00
Kalle Olavi Niemitalo
8548108e39 Make document.comb_{x,y} not relative to part.box.
Previously, the character at (document.comb_x, document.comb_y) was
accessed via the POS macro, which adds part.box.x and part.box.y to
the coordinates.  However, if document.comb and document.y are set
at the end of one part and read at the beginning of another, then
the struct screen_char used by the original part should be updated,
even though the new part has a different box.  Change comb_{x,y} to
be relative to the document, rather than to the box of a single part.
2008-09-14 16:15:25 +03:00
Kalle Olavi Niemitalo
a0d624cd61 Hurd bug 22861: Do not select() exceptions from pipes.
The GNU Hurd has a bug that can make select() report an exception in a
pipe even though none has actually occurred.  The typical result is
that ELinks closes the pipe through which it internally passes all
input events, such as keypresses.  It then no longer reacts to what
the user is trying to do.

Work around the Hurd bug by making set_handlers() check whether the
file descriptor refers to a pipe, and if so, pretend the caller did
not provide any handler for exceptions.  This is a minimal change that
avoids slowing down the select() loop itself and does not require
careful analysis of the callers to statically find out which file
descriptors might refer to pipes.  The extra stat() calls may slow
ELinks down somewhat, but anyway it'll work better than it did without
the patch, and if the Hurd bug is ever fixed, we can remove the
workaround at that time.
2008-09-07 22:52:47 +03:00
Kalle Olavi Niemitalo
b94657869b 1031: JS_SetErrorReporter only once per JSRuntime.
Previously, spidermonkey_get_interpreter() and init_smjs() each called
JS_SetErrorReporter on the JSContexts they created.  However,
JS_SetErrorReporter actually sets the error reporter of the JSRuntime
associated with the JSContext, and all of our JSContexts use the same
JSRuntime nowadays, so only the error_reporter() of
src/ecmascript/spidermonkey.c was left installed.  Because this
error_reporter() asserts that JS_GetContextPrivate(ctx) returns a
non-NULL pointer, and init_smjs() does not set a private pointer for
smjs_ctx, any error in smjs_ctx could cause an assertion failure, at
least in principle.

Fix this by making spidermonkey_runtime_addref() install a shared
error_reporter() when it creates the JSRuntime and the first JSContext.
The shared error_reporter() then checks the JSContext and calls the
appropriate function.

The two error reporters are quite similar with each other.  In the
future, we could move the common code into shared functions.  I'm not
doing that yet though, because fixing the bug doesn't require it.
2008-09-07 20:17:25 +03:00
Kalle Olavi Niemitalo
0ee1d05d81 1031: Return 0 from spidermonkey_runtime_addref if JS_NewContext fails.
Previously, this would have caused an assertion failure.
2008-09-07 18:04:18 +03:00
Kalle Olavi Niemitalo
d93bceb9bd Fix blacklist crash in BitTorrent
make_bittorrent_peer_connection() used to construct a struct uri on
the stack. This was hacky but worked nicely because the struct uri
was not really accessed after make_connection() returned.  However,
since commit a83ff1f565, the struct uri
is also needed when the connection is being closed.  Valgrind shows:

Invalid read of size 2
   at 0x8100764: get_blacklist_entry (blacklist.c:33)
   by 0x8100985: del_blacklist_entry (blacklist.c:64)
   by 0x80DA579: complete_connect_socket (socket.c:448)
   by 0x80DA84A: connected (socket.c:513)
   by 0x80D0DDF: select_loop (select.c:297)
   by 0x80D00C6: main (main.c:353)
 Address 0xBEC3BFAE is just below the stack ptr.  To suppress, use: --workaround-gcc296-bugs=yes

To fix this, allocate the struct uri on the heap instead, by
constructing a string and giving that to get_uri().  This string
cannot use the "bittorrent" URI scheme because parse_uri() does not
recognize the host and port fields in that.  (The "bittorrent" scheme
has protocol_backend.free_syntax = 1 in order to support strings like
"bittorrent:http://beta.legaltorrents.com/get/159-noisome-beasts".)
Instead, define a new "bittorrent-peer" URI scheme for this purpose.
If the user attempts to use this URI scheme, its handler aborts the
connection with an error; but when make_bittorrent_peer_connection()
uses a bittorrent-peer URI, the handler is not called.

This change also lets get_uri() set the ipv6 flag if peer_info->ip is
an IPv6 address literal.

Reported by Witold Filipczyk.
2008-09-07 06:31:36 +03:00
Miciah Dashiel Butler Masters
f62d2d1ae4 Add the number of interpreters to Resources box
Introduce static int interpreter_count in src/ecmascript/ecmascript.c.

Maintain interpreter_count in ecmascript_get_interpreter and
ecmascript_put_interpreter.

Introduce ecmascript_get_interpreter_count.

Display the number of ECMAScript interpreters that have been allocated
for documents in the Resources dialog box.
2008-09-06 20:18:10 +00:00
Kalle Olavi Niemitalo
80a5c6d466 Merge branch 'elinks-0.12' into elinks-0.13 2008-09-04 12:08:38 +03:00
Kalle Olavi Niemitalo
7de8b9940c Bug 1013: Fix type mismatches in gopher.c
When I replaced enum connection_state with struct connection_state,
I missed parts of src/protocol/gopher/gopher.c.  Finish the change there.
2008-09-04 11:57:03 +03:00
Kalle Olavi Niemitalo
b7d3b4f687 1041: Add ftp_add_unparsed_line: HTML entities and more error checks.
Separate the formatting of unparsed lines from ftp_process_dirlist()
to a new function ftp_add_unparsed_line().  Check for all possible
out-of-memory errors.  Encode HTML metacharacters as entity references
and document how charsets are handled FTP directory listings.
Add a NEWS entry.
2008-09-04 11:21:06 +03:00
Witold Filipczyk
298f3af6c6 1041: Do not show the "Error parsing" on ftp://sunsite.icm.edu.pl/. 2008-09-04 10:24:42 +03:00
Kalle Olavi Niemitalo
49f529a582 1044: Check for -rdynamic with libraries.
With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
-dynamic"; then, cc proceeds anyway, but the option can prevent the
linker from finding the libraries listed in -l operands.  To detect
this, move the -rdynamic check in configure.in down to a place where
the libraries have already been added to $LDFLAGS.  So if -rdynamic
interferes with the search for libraries, ELinks won't use it.

Merely moving the test would also change the location of -rdynamic in
$LDFLAGS.  Counteract that by making the test add -rdynamic to the
beginning of $LDFLAGS, rather than to the end.  This may make the test
more reliable on Solaris.
2008-09-04 02:41:46 +03:00
Kalle Olavi Niemitalo
64f0f6e7a8 Don't link with libgnutls-openssl, which is now GPLv3+.
ELinks used to call the MD5 code in libgnutls-openssl, part of
GNUTLS-EXTRA, which was licensed under GNU GPL version 2 or later.
In GnuTLS 2.2.0 however, the license of GNUTLS-EXTRA has been changed
to GNU GPL version 3 or later.  This is no longer compatible with
GNU GPL version 2 as used in the current ELinks, because GPLv2 clause
2. b) requires the whole work to be licensed under GPLv2, and GPLv3
does not allow that.

If anyone is still using a pre-2.2 GnuTLS, he or she can tweak
configure.in to check the version or just assume it's old enough.
There is not much reason to do so though, as including the MD5 code
in ELinks seems to cost only about 4 kilobytes on i686.
(cherry picked from commit 9ca0182ec6)
2008-08-17 21:43:20 +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
018af50f1d Rename cache_entry.id and related members.
cache_entry.id => cache_entry.cache_id
document.id => document.cache_id
ecmascript_interpreter.onload_snippets_owner => .onload_snippets_cache_id

This is a combination of:

commit 232c07aa7f
bug 1009: id variables renamed, added document_id to the document.

commit 6007043458bf8f14abfc18b9db60785bdc0279f6
Revert addition of document.document_id
2008-08-03 21:27:56 +03:00
Kalle Olavi Niemitalo
c1ffba2f95 Work around fsp_open_session() not setting errno.
fsp_open_session() has a bug where it does not set errno if getaddrinfo fails.
Before the bug 1013 fix, this caused an assertion failure.
After the bug 1013 fix, this caused a "Success" error message.
Now it instead causes "FSP server not found".
2008-08-03 20:26:50 +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
40715ffbd4 Import and use AsciiDoc 7.1.2 configuration files
In the past, we have hit annoying incompatibilities when
people have attempted to rebuild ELinks documentation
with new versions of AsciiDoc:

http://bugzilla.elinks.cz/show_bug.cgi?id=989
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=491820

So now we bundle the configuration files from a known good version
to let ELinks documentation be built with them regardless of which
version has been installed on the machine.
2008-08-02 11:28:24 +03:00
Miciah Dashiel Butler Masters
3433c9d0f6 Adjust LED update interval according to need
Add new routine compute_redraw_interval, which returns the appropriate
interval in milliseconds for updating the LED panel, namely 100ms if there
are any downloads, 1000 if the clock is enabled (with a TODO noted to check
whether the date format includes seconds), or 0 otherwise to indicate that
the LED paanel need not be updated

Use the new compute_redraw_interval routine in draw_leds and redraw_leds.

This fixes bug 973, "LED indicators wake system up every 100ms".
2008-08-02 03:34:51 +00:00
Kalle Olavi Niemitalo
e019038c17 When checking for <net/if.h>, #include <sys/socket.h> first.
On Mac OS X 10.5.4, <net/if.h> does not #include <sys/socket.h> but
uses struct sockaddr defined there.  Autoconf 2.61 generates a
configure script that warns if the header can be preprocessed but not
compiled.  The Autoconf manual cautions that future versions of
Autoconf will treat the file as missing in this case.  To let ELinks
detect <net/if.h> even with a future Autoconf, make the test program
#include <sys/socket.h> before <net/if.h>.
2008-08-01 00:40:34 +03:00
Kalle Olavi Niemitalo
abe4927d69 1022: NEWS and option documentation 2008-07-27 20:11:39 +03:00
Witold Filipczyk
2e1983ce93 1022: Fixes issue with mbank.
New patch, fixes issue with mbank's certificate verification.
2008-07-27 17:15:36 +03:00
Kalle Olavi Niemitalo
a83ff1f565 1040: Blacklist servers that support SSL3 but not TLS1.
It seems GnuTLS is not as good at negotiating a supported protocol as
OpenSSL is.  ELinks tries to work around that by retrying with a
different protocol if the SSL library reports an error.  However,
ELinks must not automatically retry POST requests where some data may
have already reached the server; POST is not a safe method in HTTP.
So instead, collect the name of the TLS-incapable server in a blacklist
when ELinks e.g. loads an HTML form from it; the actual POST can then
immediately use the protocol that worked.

It's a bit ugly that src/network/socket.c now uses
protocol/http/blacklist.h.  It might be better to move the blacklist
files out of the http directory, and perhaps merge them with the
BitTorrent blacklisting code.
2008-07-27 01:39:01 +03:00
Jonas Fonseca
5ef63a5d01 Drop unneeded include.
(cherry picked from commit fe7c163c45f32800632939b8d161844deb9a8465)
2008-07-26 15:57:20 +03:00