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

3123 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
8f4d7f9903 Define cp_to_unicode() even without CONFIG_UTF8.
And make its last parameter point to const.  add_cp_html_to_string()
no longer needs to pretend UTF-8 is ISO-8859-1.
2009-01-01 16:17:03 +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
25da8085b3 Fix double-free crash if EOF immediately follows </MAP>.
look_for_link() used to return 0 both when it found the closing </MAP>
tag, and when it hit the end of the file.  In the first case, it also
added *menu to the memory_list; in the second case, it did not.  The
caller get_image_map() supposedly distinguished between these cases by
checking whether pos >= eof, and freed *menu separately if so.

However, if the </MAP> was at the very end of the HTML file, so that
not even a newline followed it, then look_for_link() left pos == eof
even though it had found the </MAP> and added *menu to the memory_list.
This made get_image_map() misinterpret the result and mem_free(*menu)
even though *menu had already been freed as part of the memory_list;
thus the crash.

To fix this, make look_for_link() return -1 instead of 0 if it hits
EOF without finding the </MAP>.  Then make get_image_map() check the
return value instead of comparing pos to eof.  And add a test case,
although not an automated one.

Alternatively, look_for_link() could have been changed to decrement
pos between finding the </MAP> and returning 0.  Then, the pos >= eof
comparison in get_image_map() would have been false.  That scheme
would however have been a bit more difficult to understand and
maintain, I think.

Reported by Paul B. Mahol.
(cherry picked from commit a2404407ce)
2008-12-31 20:15:44 +00:00
Kalle Olavi Niemitalo
d668b3b6aa mouse: Exit cursor-routing mode when a link is clicked
Before this patch, if you first moved the cursor to link X with
move-cursor-up and similar actions, and then clicked link Y with the
mouse, ELinks would activate link X, i.e. not the one you clicked.
This happened because the NAVIGATE_CURSOR_ROUTING mode was left
enabled and made ELinks ignore the doc_view->vs->current_link
member that ELinks had updated according to the click.
Make ELinks return the session to NAVIGATE_LINKWISE mode, so that
the update takes effect.

Reported by Paul B. Mahol.
(cherry picked from commit 4086418069)
2008-12-28 13:24:07 +02:00
Witold Filipczyk
cc9c620179 pl.po: Statystyki -> Statystyka 2008-11-20 15:53:35 +01:00
Kalle Olavi Niemitalo
e2cbb79634 AUTHORS: Peter Collingbourne allows relicensing
Peter Collingbourne posted to elinks-dev on 3 November 2008:

>> ELinks is currently licensed under GPLv2 only.  I hope we can
>> eventually change the licence to also allow later versions of
>> GPL and permit linking with OpenSSL.  Do you allow such
>> relicensing for your patch?
>
> I agree to this.

According to COPYING, such permissions should be listed in AUTHORS.
2008-11-10 00:02:44 +02:00
Kalle Olavi Niemitalo
5d540e1f95 NEWS entry for newlines in hidden fields 2008-11-09 23:36:35 +02:00
Peter Collingbourne
658b9cc70f Fixed bug relating to newlines in hidden input fields
This patch fixes an issue whereby a newline character appearing within
a hidden input field is incorrectly reinterpreted as a space character.
The patch handles almost all cases, and includes a test case.
15/18 tests pass, but the remainder currently fail due to the fact
that ELinks does not currently support textarea scripting.
2008-11-09 23:28:46 +02:00
Kalle Olavi Niemitalo
c56f3928ec Bug 1004: Rewrite FSF code to avoid GPLv2 2. c)
c_strcasecmp and c_strncasecmp were taken from GNU coreutils 6.9,
which is copyrighted by the Free Software Foundation and licensed
under GNU GPL version 2 or later.  It seems the programs in coreutils
do not normally read commands interactively.  So, including coreutils
code in an interactive program such as ELinks could trigger GPLv2
section 2. c), which would require ELinks to display a copyright
notice and a warranty disclaimer each time it is started.  Rewrite
those functions to remove the FSF-copyrighted code and make ELinks
not a work based on GNU coreutils.

Avoiding FSF code has the additional benefit that we won't have to ask
FSF for permission if we want to add a licence exception that allows
linking ELinks with OpenSSL.  So it seems a good idea even if my
interpretation of GPLv2 2. c) is overly strict.  I haven't checked
though whether there are other FSF-copyrighted portions in ELinks.
2008-11-02 22:15:38 +02:00
Kalle Olavi Niemitalo
ffffa763e4 Bug 1004: NEWS and AUTHORS
The licensing statement is from comment #18 of bug 1004.
2008-11-01 22:32:44 +02:00
M. Vefa Bicakci
20a7a6c460 Patch 3: Further fixes including strcasestr and convert_to_lowercase 2008-11-01 22:32:43 +02:00
Kalle Olavi Niemitalo
1ba7d5a260 Bug 1004: Use c_toupper in a few more places.
src/config/kbdbind.c (parse_keystroke): If the user types "Ctrl-i",
it should mean "Ctrl-I" rather than "Ctrl-İ", because the Ctrl-
combinations are only well known for ASCII characters.  This does not
matter in practice though, because src/terminal/kbd.c converts 0x09
to (KBD_MOD_NONE, KBD_TAB) and not to (KBD_MOD_CTRL, 'I').

src/osdep/beos/beos.c (get_system_env): Changing the locale does not
affect the TERM environment variable, I think, so it should not affect
the interpretation either.
2008-11-01 22:32:43 +02:00
Kalle Olavi Niemitalo
aaf6be8a36 Bug 1004: Fix implicit declarations of c_* functions
Add #include directives to fix these errors:

      [CC]   src/intl/gettext/l10nflist.o
cc1: warnings being treated as errors
.../src/intl/gettext/l10nflist.c: In function ‘_nl_normalize_codeset’:
.../src/intl/gettext/l10nflist.c:352: error: implicit declaration of function ‘c_tolower’

      [CC]   src/dom/css/scanner.o
cc1: warnings being treated as errors
In file included from .../src/dom/scanner.h:4,
                 from .../src/dom/css/scanner.h:4,
                 from .../src/dom/css/scanner.c:12:
.../src/dom/string.h: In function ‘dom_string_casecmp’:
.../src/dom/string.h:34: error: implicit declaration of function ‘c_strncasecmp’
2008-11-01 22:27:08 +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
M. Vefa Bicakci
86085de07e Patch 1: Finalize modifications to the HTML parser
[Forward ported to 0.12 from bug 1004 attachment 498.  --KON]
2008-10-26 18:00:19 +02:00
M. Vefa Bicakci
85c26ddc45 Patch 0: Partial modification of the HTML parser and modification of the FastFind subsystem
[Forward ported to 0.12 from bug 1004 attachment 500.  --KON]
2008-10-26 16:13:38 +02:00
Kalle Olavi Niemitalo
12d66ff043 Bug 932: Redisable 0x80...0x9F mappings in some charsets.
Bug 932 is about ELinks letting control characters 0x80...0x9F through
to the terminal.  It did not occur with ISO 8859-1, 8859-2, 8859-15,
or 8859-16, because the ELinks mappings for those charsets did not
include those bytes.  However, the www.unicode.org versions imported
in the previous commit do include the problematic bytes.

To avoid a possible regression before the ELinks 0.12.0 release,
comment those control-character mappings out again.  This workaround
should be reverted after bug 932 has been fixed properly.
2008-10-11 15:35:34 +03:00
Kalle Olavi Niemitalo
c9ca6fd448 Refresh charsets from www.unicode.org.
Add copyright and licence notices, and a NEWS entry.

The data in the new versions is not entirely the same as what ELinks
used to have:

- Unicode/8859_1.cp: Adds control characters.
- Unicode/8859_2.cp: Adds control characters.
- Unicode/8859_4.cp: Adds some control characters that ELinks assumed
  there already.
- Unicode/8859_7.cp: Adds three characters.
- Unicode/8859_15.cp: Adds control characters.
- Unicode/8859_16.cp: Adds control characters and swaps 0xA5 with 0xAB.
- Unicode/koi8_r.cp: Changes 0x95 and adds some control characters
  that ELinks assumed there already.
- Unicode/macroman.cp: Changes 0xC6 and removes some control characters
  that ELinks assumes there anyway.
2008-10-11 15:35:09 +03:00
Kalle Olavi Niemitalo
5d45f18250 COPYING: List the known licences in the source tree. 2008-10-11 14:32:26 +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
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
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
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
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
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