1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00
Commit Graph

1272 Commits

Author SHA1 Message Date
M. Vefa Bicakci
f957ffbe4b Patch 1: Finalize modifications to the HTML parser 2008-11-01 19:52:06 +02:00
M. Vefa Bicakci
3dc7f2d85f Patch 0: Partial modification of the HTML parser and modification of the FastFind subsystem 2008-11-01 19:52:06 +02:00
Kalle Olavi Niemitalo
3615e17c31 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.
(cherry picked from commit 00f5831812)
2008-10-04 14:52:05 +03:00
Kalle Olavi Niemitalo
faebee18d1 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.
(cherry picked from commit 22975bb0ec)
2008-10-03 10:56:05 +03:00
Kalle Olavi Niemitalo
6e2476ea4d 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 أحمد المحمودي.
2008-10-02 23:39:58 +03:00
Kalle Olavi Niemitalo
983419b606 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.
(cherry picked from commit fe78a0249a)
2008-09-28 22:00:35 +03:00
Kalle Olavi Niemitalo
66b5d9f649 ELinks 0.11.5 release date 2008-09-21 20:58:03 +03:00
Kalle Olavi Niemitalo
baba32e2fc ELinks 0.11.5.GIT 2008-09-21 00:27:40 +03:00
Kalle Olavi Niemitalo
5ddd54a1f8 ELinks 0.11.5 2008-09-20 23:58:02 +03:00
Kalle Olavi Niemitalo
f17524c7c6 NEWS for ELinks 0.11.5 2008-09-20 23:34:13 +03:00
Kalle Olavi Niemitalo
9ca0182ec6 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.
2008-08-17 17:36:43 +03:00
Kalle Olavi Niemitalo
fd7968e638 Bug 698: Keep forms contiguous and non-overlapping and start from 0.
In document.forms, each struct form has form_num and form_end members
that reserve a subrange of [0, INT_MAX] to that form.  Previously,
multiple forms in the list could have form_end == INT_MAX and thus
overlap each other.  Prevent that by adjusting form_end of each form
newly added to the list.

Revert 438f039bda,
"check_html_form_hierarchy: Old code was buggy.", which made
check_html_form_hierarchy attach controls to the wrong forms.
Instead, construct the dummy form ("for those Flying Dutchmans") at
form_num == 0 always before adding any real forms to the list.
This prevents the assertion failure by ensuring that every possible
form_control.position is covered by some form, if there are any forms.

Add a function assert_forms_list_ok, which checks that the set of
forms actually covers the [0, INT_MAX] range without overlapping,
as intended.  Call that from check_html_form_hierarchy to detect
any corruption.

I have tested this code (before any cherry-picking) with:
- bug 613 attachment 210: didn't crash
- bug 714 attachment 471: didn't crash
- bug 961 attachment 382: didn't crash
- bug 698 attachment 239: all the submit buttons showed the right URLs
- bug 698 attachment 470: the submit button showed the right URL

(cherry picked from commit 386a5d517b,
 with conflicts)
2008-07-25 22:31:35 +03:00
Kalle Olavi Niemitalo
295c7760f7 1030: List the bug in NEWS. 2008-07-14 22:34:43 +03:00
Kalle Olavi Niemitalo
2aec302d47 1030: Wrap get_search_region_from_search_nodes in #ifdef HAVE_REGEX_H
This change avoids the following error:

gcc -DHAVE_CONFIG_H -I../../.. -I/home/Kalle/src/elinks-0.11/src -I/home/Kalle/prefix/include -I/usr/include/smjs -I/usr/include -I/usr/include/lua50 -I/usr/include -I/usr/include -O0 -ggdb -Wall -Wall -Werror -fno-strict-aliasing -Wno-pointer-sign -Wno-address -fno-strict-overflow -o search.o -c /home/Kalle/src/elinks-0.11/src/viewer/text/search.c
cc1: warnings being treated as errors
/home/Kalle/src/elinks-0.11/src/viewer/text/search.c:257: warning: 'get_search_region_from_search_nodes' defined but not used
make[3]: *** [search.o] Error 1
make[3]: Leaving directory `/home/Kalle/build/i686-pc-linux-gnu/elinks-0.11/src/viewer/text'

get_search_region_from_search_nodes is called only from
search_for_pattern, which already was inside #ifdef HAVE_REGEX_H.
2008-07-14 22:26:38 +03:00
Witold Filipczyk
442b0d83b0 1030: Fixed issue with undefined HAVE_REGEX_H. 2008-07-14 22:19:01 +03:00
Kalle Olavi Niemitalo
76c89a6961 config: Count backslashed newlines in str_rd.
If a newline has a backslash in front of it, then str_rd replaces it
with a space.  However, the newline was in the original config file,
so the line number must still be incremented.
(cherry picked from commit 76d803bbb9)
2008-07-11 18:31:50 +03:00
Kalle Olavi Niemitalo
7af9092448 NEWS: mention bug 503
(cherry picked from commit 7e8e52d33f)
2008-07-11 18:31:50 +03:00
Kalle Olavi Niemitalo
a352ac2c64 config: Fix the "include" command.
Previously, it only pretended to rewrite the configuration file, so it
set or cleared OPT_MUST_SAVE but never changed or output any options.
Now, it actually sets the options when ELinks is loading the
configuration file.  Also, when ELinks is rewriting the configuration
file, it now compares the values in the included file to the current
values of the options, and sets or clears OPT_MUST_SAVE accordingly.
(cherry picked from commit 054852ae23)
2008-07-11 18:29:02 +03:00
Kalle Olavi Niemitalo
a4fdf122d1 config: Access OPT_MUST_SAVE in the real option, not alias.
So, if elinks.conf contains a "set" command for an alias and ELinks
updates that, it now knows it doesn't have to append another "set"
command for the underlying option.
(cherry picked from commit 92b430f3dc)
2008-07-11 18:29:02 +03:00
Kalle Olavi Niemitalo
cc2ce681e3 config: Negate the value in redir_rd too.
So if ELinks is rewriting a configuration file that contains a "set"
command for a negated alias, then it properly writes the value of the
alias, rather than the value of the underlying option.
(cherry picked from commit c47d3798a3)
2008-07-11 18:29:02 +03:00
Kalle Olavi Niemitalo
a1769e2377 config: In redir_set, negate the incoming value.
That is, let the setter function of the underlying option store the
negated value.  Previously, redir_set used to tweak the value of the
option after it has already called the underlying setter.
(cherry picked from commit 2dbe6ec34f)
2008-07-11 18:29:01 +03:00
Kalle Olavi Niemitalo
77755cf684 config: Rewrite "set" to "unset" and vice versa.
Also, replace OPT_WATERMARK with OPT_MUST_SAVE, which has the opposite
meaning.

Watermarking of aliases does not yet work correctly in this version.
Neither does the "include" command.
(cherry picked from commit 7cdbc908d8)
2008-07-11 18:29:01 +03:00
Kalle Olavi Niemitalo
841153b625 config: Reset OPT_TOUCHED flags after a successful save.
Previously, they were reset by smart_config_string(), which was not
called if the value of the option was saved by rewriting an existing
command in elinks.conf.  Also, it is better to reset the flags only
after the file operations have actually succeeded.
(cherry picked from commit 6bd961246a)
2008-07-11 18:29:01 +03:00
Kalle Olavi Niemitalo
b2c11e21c9 config: In saving style 2, save deleted options too.
Previously, ELinks set the OPT_WATERMARK flag in all deleted options
when config.saving_style was 2, thus mostly preventing them from being
saved.  This had the unfortunate consequence that if you started with
no elinks.conf, set config.saving_style = 2, deleted some built-in
option (e.g. a URL rewriting rule), saved the settings, and restarted
ELinks, then the built-in option would reappear.
(cherry picked from commit ab8ef9698f)
2008-07-11 18:29:00 +03:00
Kalle Olavi Niemitalo
2e71908995 config: Let mirroring be implicit unless values are rewritten.
(cherry picked from commit 6d55be2043)
2008-07-11 18:29:00 +03:00
Kalle Olavi Niemitalo
bfa41cef38 config: Rearrange mirror-or-not checks.
(cherry picked from commit 72de752f84)
2008-07-11 18:29:00 +03:00
Kalle Olavi Niemitalo
1841d8f399 config: Let "unset" delete built-in options too.
(cherry picked from commit 661dda04c9)
2008-07-11 18:28:59 +03:00
Kalle Olavi Niemitalo
6ef4f017be config: Unsetting a missing option is not an error.
(cherry picked from commit 2c9d966c99)
2008-07-11 18:28:59 +03:00
Kalle Olavi Niemitalo
34c91ea021 config: Remember the address and length of the option name.
A later commit will take advantage of this.
(cherry picked from commit 3f077d109a)
2008-07-11 18:28:59 +03:00
Kalle Olavi Niemitalo
0c8c9cc16f config: More cleverly skip unrecognized or malformed commands.
(cherry picked from commit e7bd23ff37)
2008-07-11 18:28:58 +03:00
Kalle Olavi Niemitalo
f67ddcf851 config: Skip values of unrecognized options.
To avoid parsing them as commands.
(cherry picked from commit e06416d248)
2008-07-11 18:28:58 +03:00
Kalle Olavi Niemitalo
f4e8682193 config: Report errors before the line number is lost.
(cherry picked from commit edad2ddccd)
2008-07-11 18:28:58 +03:00
Kalle Olavi Niemitalo
b7ff11f8d2 config, Bug 503: Keep track of what has been mirrored.
(cherry picked from commit 1f0c361ead,
 fixing the obvious typo)
2008-07-11 18:28:57 +03:00
Kalle Olavi Niemitalo
9dcece750f config: Add struct conf_parsing_state.
(cherry picked from commit 4c64afec26,
 reinserting the parse_config_file change omitted from the previous
 cherry-pick)
2008-07-11 18:28:57 +03:00
Kalle Olavi Niemitalo
0a5652da1c config: Reduce the interface offered to exmode.
(cherry picked from commit 63e82e68e4,
 but removed the parse_config_file change that broke the build)
2008-07-11 18:28:57 +03:00
Kalle Olavi Niemitalo
e4243bd8a3 config: Use memacpy instead of stracpy.
So there is no need to substitute a '\0' into the string, and undo
that afterwards.
(cherry picked from commit 912cff7975)
2008-07-11 18:28:56 +03:00
Kalle Olavi Niemitalo
fafe6583e8 config: Fix two bogus end-of-file checks.
(cherry picked from commit 753aa3054b)
2008-07-11 18:28:56 +03:00
Kalle Olavi Niemitalo
1eeb2b198a config: Don't mem_free(NULL).
(cherry picked from commit 09829a0b52)
2008-07-11 18:28:56 +03:00
Kalle Olavi Niemitalo
3c000d2c2e config: Plug some memory leaks in error handling.
(cherry picked from commit c92cd01e0b)
2008-07-11 18:28:55 +03:00
Kalle Olavi Niemitalo
ffb9321496 config: Explain why get_opt_rec() does not follow OPT_ALIAS.
(cherry picked from commit 4960c65f20)
2008-07-11 18:28:55 +03:00
Kalle Olavi Niemitalo
d67eddc93c config: Swap the "unknown command" and "parse error" messages.
They should be in the same order as in enum parse_error.
(cherry picked from commit 1d16e90dca)
2008-07-11 18:28:55 +03:00
Kalle Olavi Niemitalo
4e0e5cbcb3 config: Each backslash escapes only one character.
Previously, if you did this in elinks.conf:
set document.dump.header = "\'\\"
then str_rd() failed to detect the end of the string.
(cherry picked from commit b216a21b79)
2008-07-11 18:28:54 +03:00
Kalle Olavi Niemitalo
50aea7c94b config: more const in elinks.conf parsing
(cherry picked from commit 9becd108a8)
2008-07-11 18:28:54 +03:00
Kalle Olavi Niemitalo
23b843ae64 option_types: Add comments to be found by grep.
I was looking for code that handles OPT_COMMAND, so I grepped for it,
but did not immediately find this array.  Next time, I will.
(cherry picked from commit f8863183b8)
2008-07-11 18:28:53 +03:00
Jonas Fonseca
9cd19d885f Remove unused add handler in the option_type_info struct
(cherry picked from commit 7fe7b42093)
2008-07-11 18:28:53 +03:00
Laurent MONIN
89acb8f534 INT/LONG: introduce long_wr() and long_set() and use them instead of
num_wr() and num_set() for options of type OPT_LONG.
(cherry picked from commit 9412cc77f0)
2008-07-11 18:28:53 +03:00
Kalle Olavi Niemitalo
a6f556d667 const in name_to_language
(cherry picked from commit 11e9a816f5)
2008-07-11 18:28:53 +03:00
Kalle Olavi Niemitalo
bd6c562a73 const in get_cp_index
(cherry picked from commit cb90ed94f0)
2008-07-11 18:28:52 +03:00
Kalle Olavi Niemitalo
b105694db3 const in decode_color
(cherry picked from commit f02e471762)
2008-07-11 18:28:52 +03:00
Kalle Olavi Niemitalo
2a1fb06d54 const in fastfind_search
(cherry picked from commit 3f508a9803)
2008-07-11 18:28:52 +03:00