1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00
Commit Graph

3410 Commits

Author SHA1 Message Date
Witold Filipczyk
6ec3fc3f33 More user friendly method to set expires in cookie dialog. 2018-08-25 22:44:11 +02:00
Witold Filipczyk
9eaf03cf2a Added HttpOnly cookies 2018-08-25 15:28:29 +02:00
Witold Filipczyk
6f001ea50f Check for NULL to avoid segmentation fault.
Entering in cookie dialog expires:
123456789012345678
and then Info button, caused segfault.
2018-08-18 20:53:40 +02:00
sgerwk
2f58dfce13 when searching in a node, only search within its box 2018-06-25 10:47:51 +02:00
Fabienne Ducroquet
3665ee2ef7 Move check on number of search points to move_search_do
If doc_view->document->number_of_search_points is 0, move_search_number
crashes at:

pt = doc_view->document->search_points;
x = pt[number].x;
y = pt[number].y;

so it is not sufficient to make find_first_search_in_view return
immediately in this case, move_search_do should return immediately.
2018-06-07 17:25:21 +02:00
Witold Filipczyk
f2c0a380ab Check if nothing has found. Refs #21 2018-04-15 18:08:54 +02:00
Witold Filipczyk
ad5f8165b2 Wraparound search 2018-04-15 16:45:23 +02:00
Witold Filipczyk
798a7cc4e6 Reuse existing functions to scroll. Added horizontal_scroll_extended. 2018-04-15 14:32:18 +02:00
Witold Filipczyk
7a006b6dd2 Rewritten searching. Refs #21
Before only visible part of screen was searched for pattern.
Now whole document is searched, and beginings of found text
is remembered in document->search_points.
2018-04-14 21:49:52 +02:00
Witold Filipczyk
fd1ae61131 Let search for more unbreakable spaces. Refs #20 2018-04-07 11:43:28 +02:00
Witold Filipczyk
fbfbe4013c Interpret 0xA0 (nbsp in UTF-8 mode) as space char for searches. Issue #20 2018-04-06 20:02:49 +02:00
Witold Filipczyk
3b279e5ec6 No warning 2018-03-10 10:36:25 +01:00
Witold Filipczyk
00d34fd0ed ruby: missing change PTR to LEN 2018-03-10 10:27:46 +01:00
Felix Janda
7a403ef735 Fix compatibility with Ruby >= 1.9
Based on patch by Ian Abbott

Bug: https://bugs.gentoo.org/424789
2018-03-09 17:34:30 -05:00
Witold Filipczyk
0dd3aaabe6 int -> size_t 2018-02-25 17:14:46 +01:00
Felix Janda
254f440de4 Remove references to internal-hooks.scm 2018-02-24 15:08:17 -05:00
Felix Janda
cec24f11a4 guile: update deprecated string functions 2018-02-24 15:05:45 -05:00
Felix Janda
a0a063f784 guile: replace discouraged SCM_FALSEP, SCM_NULLP, SCM_STRINGP 2018-02-24 14:18:25 -05:00
Felix Janda
e739ed07dc Fix broken double-width chars when displaying status leds 2017-12-28 15:36:03 +01:00
Witold Filipczyk
8a8af596e0 gnutls: GNUTLS_E_PREMATURE_TERMINATION on www.raspberrypi.org 2017-12-23 14:51:43 +01:00
أحمد المحمودي (Ahmed El-Mahmoudy)
887f85f6a9 Add signal.h to heartbeat,c includes
Build failed because hearbeat.c uses SIGVTALRM
2017-12-02 02:47:02 +01:00
Witold Filipczyk
2c6d782aef Check returned value of tiparm. 2017-11-28 22:07:57 +01:00
Witold Filipczyk
d466e84eb6 TERMINFO does not work well for linux-m 2017-11-28 20:31:41 +01:00
rkd77
3d8da2e48c
Merge pull request #11 from aelmahmoudy/gnutls_client_cert
SSL authentication using client certs
2017-11-26 11:06:51 +01:00
Witold Filipczyk
c9a0df7a67 This condition was useless IMO. 2017-11-26 11:03:02 +01:00
rkd77
d539a45c98
Merge pull request #3 from aelmahmoudy/color_link_num
Allow link number colors to be changed.
2017-11-26 10:58:04 +01:00
Witold Filipczyk
03968b93c8 Do not use terminfo for true color mode. 2017-11-25 11:46:28 +01:00
rkd77
26d1759d35
Merge pull request #15 from doughdemon/musl
Musl compatibility
2017-11-24 15:19:55 +01:00
Felix Janda
336e596a83 Rename VA_COPY to va_copy
With this, the C99 standard macro va_copy is used when available
instead of the prestandard __va_copy.
2017-11-23 19:18:20 -05:00
Felix Janda
9555619c50 Remove __va_copy configure test
__va_copy is a macro and can be detected via #ifdef.
2017-11-23 19:15:35 -05:00
Felix Janda
ca44c53f59 Make Japanese language selectable 2017-11-23 18:53:15 -05:00
Felix Janda
bfb4733f39 Don't use <sys/signal.h>
This legacy header appears to be unused. Removing its includes
avoids numerous warnings when compiling with musl libc:

/usr/include/sys/signal.h:1:2: warning: #warning redirecting incorrect #include <sys/signal.h> to <signal.h> [-Wcpp]
2017-11-23 17:51:41 -05:00
Witold Filipczyk
0420ce5cc9 Similar code as in original ELinks.
Still issues with displaying freshcode.club on konsole.
2017-11-23 18:00:20 +01:00
Witold Filipczyk
d1ddf27332 Cleaner code of checking if line is dirty. 2017-11-23 15:53:52 +01:00
Witold Filipczyk
2bd6ac3f08 terminfo_cursor_address 2017-11-23 13:39:04 +01:00
Witold Filipczyk
49f41d4371 Rewritten add_chars macro.
Before it redrawn only changed cells, but were problems with ghosts.
See test/fresh.html. Now it redraws whole lines, which were modified.
2017-11-23 11:40:21 +01:00
Witold Filipczyk
48ba074969 mem_free_set instead two lines 2017-11-23 10:33:10 +01:00
Felix Janda
06832623ad Rename configure.in to configure.ac
Avoids aclocal warning
2017-11-22 17:01:48 -05:00
Witold Filipczyk
4d85cd24eb Removed code suspected for traces on screen when scrolling. 2017-11-22 18:19:32 +01:00
Witold Filipczyk
5b390d6b55 Make 0 the default. 2017-11-22 12:11:42 +01:00
rkd77
be719e1ac1
Merge pull request #10 from aelmahmoudy/select_forms
Make select forms look more like other forms.
2017-11-22 12:02:06 +01:00
rkd77
77ea5759ed
Merge pull request #9 from aelmahmoudy/preferred_document_width_option
Add preferred_document_width option.
2017-11-22 11:59:17 +01:00
rkd77
1fecca1a15
Merge pull request #8 from aelmahmoudy/larger_doc_margin
Allow larger document.browse.margin_width
2017-11-22 11:56:25 +01:00
rkd77
a6996b7d3a
Merge pull request #7 from aelmahmoudy/keep_forms_bold
Keep forms in bold even when active.
2017-11-22 11:55:40 +01:00
rkd77
addd051c97
Merge pull request #6 from aelmahmoudy/dont_underline_unselected_forms
Dont underline unselected forms
2017-11-22 11:54:50 +01:00
rkd77
f44fdc25ed
Merge pull request #5 from aelmahmoudy/dont_underline_active_textarea
Avoid underlining active text areas.
2017-11-22 11:53:32 +01:00
rkd77
baf0c5b689
Merge pull request #4 from aelmahmoudy/color_textarea
Provide different color for text areas in insert mode.
2017-11-22 11:51:10 +01:00
rkd77
2b786ac7fe
Merge pull request #2 from aelmahmoudy/underline_links
Underline links even in numbered links mode
2017-11-22 11:42:02 +01:00
rkd77
ef8a3ccddf
Merge pull request #1 from aelmahmoudy/source_element
Add rendering for html source element
2017-11-22 11:38:57 +01:00
Nils Dagsson Moskopp
aae79c95fe Add rendering for html source element 2017-11-22 03:19:33 +01:00
Guillem Jover
85b8dd8f42 SSL authentication using client certs 2017-11-22 01:46:30 +01:00
Yozo Hida
49988d305f Do not underline forms (unless selected). 2017-11-22 01:16:50 +01:00
Yozo Hida
948d019fc0 Add preferred_document_width option.
Option document.browse.preferred_document_width controls the
width of the document, so that documents are rendered with narrower
width than screen width.  Makes it easier to read paragraphs.

Patch originally from Shalon Wood <dstar@pele.cx>, see bug #1063.

Instead of using max_document_width as the hard limit to the document
width, it uses a soft limit, where if the document does not fit (due to
tables, etc.), then larger width is used.  This reduces the need for
horizontal scrolling for wide documents.

Also added toggle-document-width action to toggle between preferred
width and full screen width.  This is bound to 'M' by default.  Initial
toggle status is determined by document.browse.use_preferred_document_width
option.

During dumps, document.dump.width option is still used.  Perhaps we
should consolidate document.dump.width option with
document.browse.preferred_document_width ?
2017-11-21 16:09:13 +01:00
Yozo Hida
7e58737619 Make select forms look more like other forms.
Insert "[_" and "_]" as part of the form link, and
include it as part of the link.
2017-11-21 16:06:33 +01:00
Yozo Hida
2a09148e5a Avoid underlining active text areas.
They already have underscores, so underlining them is redundant (and looks a
bit strange).
2017-11-21 16:04:27 +01:00
Yozo Hida
6ad3e541c8 Keep forms in bold even when active. 2017-11-21 16:02:26 +01:00
Yozo Hida
4ed958b067 Provide different color for text areas in insert mode.
The color is controlled by

  document.browse.links.active_link.insert_mode_colors.background
  document.browse.links.active_link.insert_mode_colors.text

Also avoid overloading local variable "i" in get_current_link().
2017-11-21 16:00:39 +01:00
Yozo Hida
a4d8f25a9c Allow link number colors to be changed.
These settings are specified by

  document.colors.link_number
  document.colors.use_link_number_color

The latter setting determines whether the color is used when document
colors are being used.

See bug #1050.
2017-11-21 15:56:32 +01:00
Yozo Hida
a9e7768b76 Allow larger document.browse.margin_width 2017-11-21 15:53:17 +01:00
Yozo Hida
468e7aaff9 Underline links even in numbered links mode 2017-11-21 15:50:23 +01:00
Witold Filipczyk
99058d53d7 terminfo_max_colors() 2017-11-21 15:36:28 +01:00
Witold Filipczyk
d8e749c0f4 terminfo_clear_screen 2017-11-20 11:28:53 +01:00
Witold Filipczyk
299e2b9aa4 Missing files 2017-11-19 20:18:44 +01:00
Witold Filipczyk
c4cb7ed8e5 Beginnings of terminfo support.
--with-terminfo must be added for configure
and --terminfo to command line.
terminfo is only used for output and not all sequences are changed.
2017-11-19 18:29:38 +01:00
Witold Filipczyk
9175f8ed39 Terminate slave browsers with libev(ent). 2017-11-18 15:16:22 +01:00
Witold Filipczyk
d5261654f4 libev or libevent in About dialog. 2017-11-17 17:33:51 +01:00
Witold Filipczyk
21d36fcbd1 Add --with-libev, because libev is smaller.
When both --with-libev and --with-libevent are used, libev takes
precedence.
2017-11-17 16:34:03 +01:00
Witold Filipczyk
f52e3187e3 Add command line option -no-libevent 2017-11-16 18:23:47 +01:00
Witold Filipczyk
4c4717b82a Repeat gnutls_handshake until success
It's blocking, but better than SSL errors.
2017-11-15 01:01:36 +01:00
Witold Filipczyk
91beac7ee3 gnutls_certificate_set_x509_system_trust
If this function is available and gnutls is used,
and connection.ssl.trusted_ca_file is "",
gnutls_certificate_set_x509_system_trust is called
to load certificates.
2017-11-14 16:02:22 +01:00
Witold Filipczyk
0266633025 Fix issue with one char documents. Patch by Felix Janda 2017-11-14 09:54:05 +01:00
Witold Filipczyk
b6fd548049 threads might be NULL for --lookup 2017-11-13 14:44:24 +01:00
Witold Filipczyk
3b6ff1d22f Introduced --with-libevent based on links code
I don't know how to deal with select's exception fds in libevent,
so some functions may not work properly.
2017-11-12 13:41:31 +01:00
Witold Filipczyk
050f304161 poll and EINTRLOOP - added fragment from links 2017-11-11 21:37:08 +01:00
Witold Filipczyk
8c39acc277 Info about brotli. 2017-11-11 16:31:32 +01:00
Witold Filipczyk
f86be65971 Retry only for https protocol 2017-07-23 19:50:15 +02:00
Witold Filipczyk
affcebbab1 Add to blacklist only valid uri 2017-07-23 19:15:10 +02:00
Witold Filipczyk
a6799737f5 Forgot about possible memleak 2017-07-23 19:09:13 +02:00
Witold Filipczyk
442f4936dc Use blacklist to skip verification of certificates 2017-07-23 18:59:05 +02:00
Witold Filipczyk
f43f5714e8 Let users retry connection in case of error. Especially SSL error.
Also verify ssl certificates by default.
It has some weak points, for example in load_uri not always data
is a session.
2017-07-23 14:33:40 +02:00
Witold Filipczyk
b1d1e4a15b Fixes related to brotli. Errors occured on https://www.thetrendspotter.net/ 2017-07-02 15:20:03 +02:00
Witold Filipczyk
3e436b8869 brotli code updated 2017-07-01 22:38:06 +02:00
Witold Filipczyk
f3ab69bb13 Color trailing spaces with color of last non-space cell 2017-06-13 22:39:53 +02:00
Witold Filipczyk
c610fcf334 Off by one, also 200 instead of 30 2017-06-13 17:07:23 +02:00
Marco Migliori
5e31308da0 text direction mark 2017-05-16 20:57:25 +02:00
Marco Migliori
a75e8dd35c new -remote command: reload() 2017-05-16 20:55:33 +02:00
Marco Migliori
f1fb95835a display lua hooks errors 2017-05-16 20:54:56 +02:00
Witold Filipczyk
54ebe365b7 Compilation fix for OpenSSL-1.1 2017-03-06 17:39:36 +01:00
Arjen Stolk
e957e60d5c mailcap: prevent segfault on test entry with %s
When a mailcap entry with a testcommand containing %s is encountered, it is ignored. The
entry was freed, but not set to NULL, leading to a segfault later on.
2016-12-28 14:22:01 +01:00
Witold Filipczyk
6d78cf1c23 Set encoding 2016-12-13 17:43:56 +01:00
Witold Filipczyk
6777006d73 Code reuse 2016-12-13 10:37:27 +01:00
Witold Filipczyk
5a217e37df Empty text node is '\n' 2016-12-11 21:18:14 +01:00
Witold Filipczyk
06fb11baee Experimental html source highlight using libdom 2016-12-11 16:52:44 +01:00
Witold Filipczyk
2fc9b0bf5a Better handling of content-disposition (line without semicolon)
This time it was copied from links2.
2016-08-21 22:02:46 +02:00
Witold Filipczyk
ab63ee8f82 Revert "Fix saving files from speccy.pl archives"
This reverts commit 29d85fdb3b.
2016-08-21 18:22:33 +02:00
Witold Filipczyk
29d85fdb3b Fix saving files from speccy.pl archives 2016-05-28 17:58:17 +02:00
Pete Deas
e9152c8772 gopher: ensure slash after entity type in links
This prevents links with null selectors being interpreted as pointing to
a (likely non-existent) file gopher://server/1
An example of a page with such links: gopher://gopher.floodgap.com/1/new
2016-04-30 10:45:42 +02:00
Witold Filipczyk
38c12d9dfc Compilation fix 2016-04-24 17:36:20 +02:00
Witold Filipczyk
3212ee4e54 C++ comaptibility 2016-04-24 17:23:58 +02:00
Witold Filipczyk
257422f28c Reorganisation of code to make C++ happy 2016-04-20 22:21:31 +02:00
Witold Filipczyk
da15322705 Cast to (const char *) in strrchr calls 2016-04-20 21:03:27 +02:00
Witold Filipczyk
2e7a7a5ca3 Compilation fixes for C++ 2016-04-20 20:57:09 +02:00
Witold Filipczyk
96e65c105f Explicit cast in strstr for C++ 2016-04-20 20:46:33 +02:00
Witold Filipczyk
5b2efc8976 Compilation fix for C++ 2016-04-20 20:33:32 +02:00
Witold Filipczyk
1b06539694 Explicit cast to (const char *) in strcasestr for C++ 2016-04-20 20:11:08 +02:00
Witold Filipczyk
52d6f37c8e Explicit cast to (const char *) for strchr function (C++) 2016-04-20 19:43:37 +02:00
Witold Filipczyk
89387e3679 Compilation fix (C++) 2016-04-20 19:41:12 +02:00
Witold Filipczyk
8cf00fa61c delete -> delete_ for C++ compatibility 2016-04-20 18:57:32 +02:00
Witold Filipczyk
67673f5fe5 new -> new_ for C++ compatibility 2016-04-20 18:42:22 +02:00
Witold Filipczyk
f4981bb553 class -> class_ for C++ compatibility 2016-04-20 18:18:27 +02:00
Witold Filipczyk
2e721e051a template -> template_ for C++ compatibility 2016-04-20 18:05:00 +02:00
Fabienne Ducroquet
13f3da8416 Improve isolated combining characters handling
If there are isolated combining characters, e.g. at the beginning of a paragraph
or table cell:
– if it’s not the first screen column, combine them with whatever character is
printed to their left;
– otherwise, add a no-break space as the base character.

Previously, such combining characters were combined with the last letter
displayed, i.e. the last letter of the previous paragraph or cell.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2016-04-12 21:59:50 +02:00
Fabienne Ducroquet
a43ec1075c Display combining characters at the end of the current string in set_hline
without waiting for the next non zero width character. This way combining
characters at the end of the document are displayed.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2016-04-12 21:58:54 +02:00
Fabienne Ducroquet
c1140f54c4 Compute correct number of cells with CONFIG_COMBINE
Otherwise, there are unnecessary spaces at the end of lines in tables containing
combining characters.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2016-04-12 21:41:53 +02:00
Fabienne Ducroquet
ec30a09a36 Bug 1139: Fix internal error: "bad split" with CONFIG_COMBINE
A combining character sequence where the base character is a space remained
recorded as a space although the initial space was replaced with an internal
code corresponding to the combined character. This caused an internal error when
ELinks tried to split the line at that place and did not find the space.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2016-04-12 21:41:49 +02:00
Fabienne Ducroquet
73b09749ac Use the proxied URI to verify server certificates
Otherwise, the verification fails when using a HTTPS proxy because ELinks checks
whether the proxy matches the certificate.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2016-04-12 21:41:46 +02:00
Witold Filipczyk
4efea7e314 Added support for label_key in references of dumps.
Added base parameter to dec2qwerty and qwerty2dec to avoid strlen calls
im dumps.
2016-02-07 11:51:17 +01:00
Witold Filipczyk
69986f1bd1 Multiplication instead of pow calls and minor style changes. 2016-01-31 12:38:18 +01:00
Martin Miller
28b7bd1ec2 Transfer changes for ascii link labeling 2016-01-31 10:23:08 +01:00
Witold Filipczyk
aec900f2ae Flush decompression with len = 0
This is required by code in encoding/brotli.c.
2016-01-16 13:03:54 +01:00
Kylie McClain
f4a58ba3b5 ssl: Make RAND_egd optional
Fixes compilation with LibreSSL.
2015-12-30 11:12:35 +01:00
Witold Filipczyk
6eba447e8a Experimental brotli encoding support.
https://github.com/bagder/libbrotli
2015-10-12 23:18:23 +02:00
Witold Filipczyk
ca18522eec Revert "Shorten add_chars. Do not call compare_fg_color and compare_bg_color."
This reverts commit 8132c156dd.
On download dialog cursor jumps too much
2015-09-17 21:38:35 +02:00
Witold Filipczyk
8132c156dd Shorten add_chars. Do not call compare_fg_color and compare_bg_color.
Some sites while scrolling showed "artifacts". For example twojepc.pl.
2015-09-17 21:08:15 +02:00
Witold Filipczyk
66fa83f7b5 deflate once again. 2015-08-22 19:28:50 +02:00
Witold Filipczyk
b4adf0d70d Prefer gzip. 2015-08-22 11:22:58 +02:00
Witold Filipczyk
e015e2be21 -VERS-SSL3.0 in gnutls to avoid SSL error. 2015-07-01 16:23:19 +02:00
Witold Filipczyk
3688bb9c61 auto-completion reads not only the first character, but also the next ones.
This behaviour is similar to other browsers.
2015-05-12 16:12:56 +02:00
Witold Filipczyk
c84dfd7e18 mem_free_if where aplicable. Initialised memory in encoding/* 2015-05-10 17:27:55 +02:00
Witold Filipczyk
ca4d770c0b Revert "Apply styles of html element for body element."
This reverts commit 5f9b54f594.
2015-05-09 22:11:13 +02:00
Witold Filipczyk
03c4eec1d4 Unitialised variable found by valgrind. 2015-05-09 21:27:12 +02:00
Witold Filipczyk
f778e66d88 Changes to let it build with bison-3.0. 2015-02-25 21:16:09 +01:00
Witold Filipczyk
46767f6bf0 Introduced the document.browse.show_refresh_link option.
Whether to show Refresh: link line. Default 1.
2015-01-02 14:53:18 +01:00
Witold Filipczyk
06f0dff43f expert is also proper suffix. 2015-01-02 13:53:10 +01:00
Witold Filipczyk
bdfb3ec754 bug 1145: The freecode.com successor has the URL "freecode.club" but "club"
is not recognized as a TLD. Patch by Dr. Markus Waldeck
2014-09-22 21:47:53 +02:00
Witold Filipczyk
7453b03279 deflate switched on again.
askubuntu.com uses deflate compression.
2014-09-01 12:50:23 +02:00
Witold Filipczyk
e7ebfa06c3 deflate is broken. 2014-09-01 12:19:49 +02:00
Bin Guo
7553d321a1 Fixed problem of converting more thant 256 chars. 2014-06-26 21:21:59 +02:00
Fabienne Ducroquet
3379fc988c Respect alphabetical order for the actions
I didn’t respect the right order when I added the functions to move up and down
by half a page a few years ago.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2013-12-18 16:38:57 +01:00
Fabienne Ducroquet
60a5fce0f0 Add a function to put the current line at the top of the screen
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2013-12-18 10:01:34 +01:00
Witold Filipczyk
40fdc14012 30 instead of 10. Python tutorial looks better. 2013-12-16 17:04:59 +01:00
Fabienne Ducroquet
b2bc6f5049 Add support for the CSS list-style-type property
Use the same functions as for the list-style property since only the "type" part
of the list-style property is supported at this stage.

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2013-09-07 10:52:01 +02:00
Fabienne Ducroquet
ad7ff0386d Changes in the handling of the format flags for list elements
* Rename P_STAR as P_DISC and P_PLUS as P_SQUARE.

* Delete P_NONE because it was used only as the default flag in init_html_parser
  and a list with P_NONE then got bullets, so instead use P_DISC by default (as
  per the CSS specification), and P_NO_BULLET for lists with no bullets.

* Use as bullets the characters:
  - U+25E6 WHITE BULLET for the circle style;
  - U+25AA BLACK SMALL SQUARE (alias square bullet) for the square style;
  - U+2022 BULLET for the disc style (default).

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2013-09-07 10:51:54 +02:00
M. Levinson
a229adb19a A more nuanced approach to Python warnings.
By default some Python warning messages would be written to standard error
by the interpreter. To prevent these warnings from making a mess of the
ELinks screen, all warnings were turned into exceptions so they could be
caught and displayed through the usual report_scripting_error() mechanism.

With Python 3.2, this approach backfires: A new class of ResourceWarnings
that are filtered by default (and hence would *not* have been written to
standard error) are now turned into exceptions, and these exceptions can't
be caught because they're emitted from the interpreter's cleanup code. As
a result, the uncaught exceptions would make a mess of the ELinks screen.

The new solution is to replace Python's standard library function
warnings.showwarning() with one that turns warning messages into exceptions.
This means we'll wait until a warning would have been written to standard
error before turning it into an exception, so other warnings that would
never have reached that point because they're filtered will remain unseen.

(The behavior of warning messages is described in the documentation for
the "warnings" module from Python's standard library.)
2013-07-05 12:29:58 +02:00
witekfl
91515990c8 Removed --with-gc and CONFIG_GC related code.
CONFIG_GC was added with SEE, but SEE support was removed, so
I don't see the reason to keep gc.
2013-05-14 15:36:32 +02:00
witekfl
7dd4d9b737 iconv: Bail out of the loop when an illegal sequence of bytes occurs.
Before, with the default codepage GB2312 and a mysql sql dump in UTF-8
I got segfaults in the iconv related code.
2013-02-27 09:33:55 +01:00
Techlive Zheng
0ba951021a Elinks currently only support GB2312 as Chinese encoding, but GBK and
GB18030 are also widely used. Codepage CP936 is almost identical to
GBK, so I add it as an alias.
2013-01-20 12:58:03 +01:00
witekfl
26e41cb6c3 Redefine FD_SETSIZE on Windows. Set it to 4096.
There was hardcoded 4096 for threads size, but below there was:
	assertm(fd >= 0 && fd < FD_SETSIZE,
		"get_handler: handle %d >= FD_SETSIZE %d",
		fd, FD_SETSIZE);
	if_assert_failed return NULL;
which fails for fd > 1024 (1024 was previous value of FD_SETSIZE)
2013-01-05 13:42:35 +01:00
witekfl
4fc6343407 mem_free_if(data) instead of if (data) mem_free(data). Shorter. 2013-01-04 17:54:57 +01:00
witekfl
b0ea7cd7c1 decompress_data is now cleaner, isn't it? 2013-01-04 16:23:09 +01:00
witekfl
6fae43511c Call decompress_data only for compressed data.
Hope this is less missleading than before.
2013-01-04 16:00:50 +01:00
Kalle Olavi Niemitalo
642e164ec3 rewrite: update default dumb and smart prefixes
DELETED:

* dumb {b}, smart {bb, bb_fr_en, bb_en_fr}: Redirects to Microsoft
  Translator, which I can't get to work without JavaScript.  Deleted.

* dumb {pyhelp}, smart {py, pydev}: Deleted as recommended by the
  author of the CGI script.

* dumb {pyvault, lyrics}, smart {pyvault}: Can't find a new URL for the
  service.  Deleted.

* smart {gd}: Google Directory has been shut down.  Deleted.

* smart {sd, sdc, sdu, sdp, sdj, whatis}: These don't seem to work
  without JavaScript.  Deleted.

* smart {id, draft}: The search still exists but I can't get it to
  take the words from the URL.  Deleted.

UPDATED:

* dumb {cia}: Had changed its URL, and the service is down, but they
  intend to restore it.  Updated and kept.

* dumb {lua}: ELinks no longer supports Lua 4.0.  Changed to 5.1 as
  installed by Debian.

* smart {cliki, foldoc, gwho, gwhat, gwhere, gwhen, a, imdb, wn, fsd,
  rfcs, cr}: Updated URLs.
2012-11-30 09:24:53 +02:00
Kalle Olavi Niemitalo
268249c50b SMJS: move comments to match spidermonkeyFunctionSpec[]
Each C function that can be called as a method of an ECMAScript object
is typically listed in a spidermonkeyFunctionSpec array and has a
comment that shows the name of the array and the name of the method.
For example, elinks_alert has a comment /* @elinks_funcs{"alert"} */
because elinks_funcs[] contains an element { "alert", elinks_alert, 1 }.

When some of those functions were split into outer and inner functions
for SpiderMonkey 1.8.5 compatibility, the comments were attached to
the inner functions, which contain the bulk of the code.  Move the
comments to the outer functions, to which the array elements point.
2012-11-26 00:15:09 +02:00
Kalle Olavi Niemitalo
c4a23543fd SMJS: verbose comment about JS_AddNamedStringRoot 2012-11-25 21:06:09 +02:00
witekfl
767a1c4228 bug 1126: use draw_text for titles
I didn't check big dialog boxes.
2012-11-19 14:24:34 +01:00
Kalle Olavi Niemitalo
d3022aa7be SMJS bookmark_set_property: Don't use JS_ValueToId.
Partially revert commits
a1c5fe51 (2011-05-08) bookmark_folder_get_property: xulrunner-2.0 fix
e86ec567 (2012-03-04) Compilation fixes (--enable-debug)

jsval_to_bookmark_string once again takes jsval val, rather than jsid id.
This way, bookmark_set_property does not have to call JS_ValueToId,
which would needlessly intern the new string value of the property,
i.e. the title or the URI.  Instead, bookmark_folder_get_property
has to call JS_IdToValue.
2012-11-19 02:53:14 +02:00
Kalle Olavi Niemitalo
380d910ad8 SMJS: Use JS_THIS_OBJECT and JS_CALLEE, not argv[-1] and argv[-2]
https://developer.mozilla.org/en-US/docs/SpiderMonkey/1.8.5 mentions
that JSNative functions must not use negative indices of argv in
SpiderMonkey 1.8.5.  Use the JS_THIS_OBJECT and JS_CALLEE macros
instead.  They are documented in
https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JSNative
2012-11-19 00:39:51 +02:00
Kalle Olavi Niemitalo
465923e386 ECMAScript: Initialize jsval variables for return values
forms_item declared a variable (jsval val), passed its address to
forms_item2, and set it as the return value.  However, forms_item2
could return without initializing the jsval, especially if given too
many arguments.  Fix by initializing to JSVAL_VOID right away.
I'm not sure that is the correct value to return in such cases,
but at least it's better than risking a crash.

Likewise in form_elements_item and form_elements_namedItem.
2012-11-19 00:39:51 +02:00
Kalle Olavi Niemitalo
245df547ab doxygen: Fix link to bookmark::url
Fix this warning:

Generating docs for page todo...
todo:12: warning: explicit link request to 'url' could not be resolved

The #url syntax was supposed to refer to the url member of the
containing structure, but it apparently doesn't work when @todo
copies the paragraph to a separate page.
2012-11-18 20:17:47 +02:00
Kalle Olavi Niemitalo
31242e8029 doxygen: Document tree parameter of prepare_mustsave_flags
Doxygen complained that not all parameters of prepare_mustsave_flags
were documented.
2012-11-18 20:17:40 +02:00
Kalle Olavi Niemitalo
90d7c11f28 doxygen: Escape <uri> in doc of bittorrent_download
Doxygen warned that <uri> is an unsupported xml/html tag.
It was not intended as a tag though; rather as a placeholder
akin to <var>uri</var>.  Escape with a backslash.
2012-11-18 20:16:59 +02:00
Kalle Olavi Niemitalo
bfeb09fe37 doxygen: Document dump.c some more
Doxygen complained that the cp parameter of dump_output_alloc was not
documented.  Fix that, and document dump_output_prepare_frame too.
2012-11-18 20:16:37 +02:00
Kalle Olavi Niemitalo
6628a3f477 parse_header: document parameters and return value 2012-11-18 17:36:36 +02:00
Kalle Olavi Niemitalo
0386a3e14b parse_header: make the 2nd parameter point to const
In almost all calls to parse_header, the second argument is a string
literal: parse_header(head, "Charset", NULL) for example.
Of course, parse_header does not write to that string.  Accordingly,
make the parameter point to const, so calls that use a variable rather
than a string literal can make that variable point to const too.

Leaving the other parameters non-const for now.
2012-11-18 16:39:04 +02:00
Kalle Olavi Niemitalo
ed6a33d318 http_negotiate: Fix int* vs. size_t* type mismatch
http_negotiate_parse_data passed &token->length as the int *outlen
parameter of base64_decode_bin, which stores an int at that location.
However, gss_buffer_desc::length is size_t in all implementations that
I checked: MIT Kerberos Version 5 Release 1.10, libgssglue 0.4, and
GNU GSS 1.0.2.  This mismatch could cause the build to fail:

.../src/protocol/http/http_negotiate.c: In function ‘http_negotiate_parse_data’:
.../src/protocol/http/http_negotiate.c:173:2: error: passing argument 3 of ‘base64_decode_bin’ from incompatible pointer type [-Werror]
In file included from .../src/protocol/http/http_negotiate.c:30:0:
.../src/util/base64.h:8:16: note: expected ‘int *’ but argument is of type ‘size_t *’

On 64-bit big-endian hosts, it might also cause the GSSAPI
implementation to read too much data from memory and disclose it to
some network server, or crash ELinks.
(cherry picked from elinks-0.12 commit d33c807dd9)
2012-11-03 23:01:29 +02:00
Kamil Dudka
5e113362da http_negotiate: do not delegate GSSAPI credentials
CVE-2012-4545.  Reported by Marko Myllynen.
(cherry picked from elinks-0.12 commit da18694ff7)
2012-11-03 23:01:28 +02:00
Kalle Olavi Niemitalo
cd0f6feec3 bug 764: Convert sentinel to struct option
unregister_options() requires as a sentinel an instance of struct
option where option.name is NULL.  However, the NULL_OPTION_INFO macro
used for these sentinels actually initializes a struct option_init
instead.  Make register_options() overwrite the NULL_OPTION_INFO with
a sentinel in the correct format.  This probably makes a difference
only on platforms where null pointers don't have all bits zero.
(cherry picked from elinks-0.12 commit 8ac10e00d4)
2012-11-03 23:01:28 +02:00
Kalle Olavi Niemitalo
9e11e30fe3 bug 764, LUA: option_types[OPT_INT].set needs long *
l_set_option() was passing the address of an int to
option_types[OPT_INT].set and option_types[OPT_BOOL].set.
That looks correct but is not: both function pointers
point to num_set(), which actually reads *(long *) str.
Change l_set_option() to pass the address of a long instead,
and add comments about this dependency.
(cherry picked from elinks-0.11 commit 8766e3829f)
(cherry picked from elinks-0.12 commit 0797f04921)
2012-11-03 23:01:28 +02:00
Kalle Olavi Niemitalo
237d30b936 bug 1084: Allow '+' and '*' in names in option manager
ELinks already allowed '+' and '*' in the names of options when
reading a configuration file.  The option manager however didn't
let the user add such options.  Allow the characters there too.

These characters are needed especially in the mime.type tree,
where '*' is used as a replacement for '.'.  For example:

set mime.type.audio.prs*sid = "sid"
set mime.type.application.atom+xml = "atom"

This commit changes one gettextised string.
(cherry picked from elinks-0.12 commit 064ff3921d)
2012-11-03 23:01:21 +02:00
Kalle Olavi Niemitalo
58d2fe8eeb config/options: More Doxygen markup
No changes in program logic or data layout.
(cherry picked from elinks-0.12 commit 972afa1c26)

Conflicts:
	src/config/options.c:
		0.13.GIT has a new function get_option_shadow, now
		doxygenized likewise.
2012-11-03 22:17:47 +02:00
Kalle Olavi Niemitalo
8b00e1ef70 bug 764: Initialize the right member of union option_value
INIT_OPTION used to initialize union option_value at compile time by
casting the default value to LIST_OF(struct option) *, which is the
type of the first member.  On sparc64 and other big-endian systems
where sizeof(int) < sizeof(struct list_head *), this tended to leave
option->value.number as zero, thus messing up OPT_INT and OPT_BOOL
at least.  OPT_LONG however tended to work right.

This would be easy to fix with C99 designated initializers,
but doc/hacking.txt says ELinks must be kept C89 compatible.
Another solution would be to make register_options() read the
value from option->value.tree (the first member), cast it back
to the right type, and write it to the appropriate member;
but that would still require somewhat dubious conversions
between integers, data pointers, and function pointers.

So here's a rather more invasive solution.  Add struct option_init,
which is somewhat similar to struct option but has non-overlapping
members for different types of values, to ensure nothing is lost
in compile-time conversions.  Move unsigned char *path from struct
option_info to struct option_init, and replace struct option_info
with a union that contains struct option_init and struct option.
Now, this union can be initialized with no portability problems,
and register_options() then moves the values from struct option_init
to their final places in struct option.

In my x86 ELinks build with plenty of options configured in, this
change bloated the text section by 340 bytes but compressed the data
section by 2784 bytes, presumably because union option_info is a
pointer smaller than struct option_info was.
(cherry picked from elinks-0.12 commit e5f6592ee2)

Conflicts:
	src/protocol/fsp/fsp.c: All options had been removed in 0.13.GIT.
	src/protocol/smb/smb2.c: Ditto.
2012-11-03 22:16:32 +02:00
Kalle Olavi Niemitalo
87eac68dc3 Fix "parameter has incomplete type" on GCC 3.4.6
Fix this GCC 3.4.6 warning, which becomes an error
if configure --enable-debug adds -Werror to CFLAGS:

      [CC]   src/document/css/apply.o
In file included from /home/Kalle/src/elinks-0.12/src/document/html/internal.h:6,
                 from /home/Kalle/src/elinks-0.12/src/document/css/apply.c:35:
/home/Kalle/src/elinks-0.12/src/document/html/parser.h:149: warning: parameter has incomplete type
In file included from /home/Kalle/src/elinks-0.12/src/document/css/apply.c:35:
/home/Kalle/src/elinks-0.12/src/document/html/internal.h:125: warning: parameter has incomplete type

Even without this warning, "enum html_special_type;"
would not be standard C89.
(cherry picked from elinks-0.12 commit c9f487cdf4)

Conflicts:
	src/document/html/parser.h: 0.13.GIT had more #includes already.
2012-11-03 22:16:23 +02:00
Kalle Olavi Niemitalo
263c1836cb Don't retry get_window_title
Call get_window_title() at most once per terminal, even if it fails.
If ELinks is configured with X11 support, get_window_title() calls
XOpenDisplay(), which can sleep if $DISPLAY does not respond.
This delay was previously incurred every time ELinks changed the
title.  Besides, if ELinks had already changed the title, setting
ditrm->orig_title = get_window_title(); did not make sense anyway.
(cherry picked from elinks-0.12 commit 5d4beadc4b)

Conflicts:
	src/terminal/kbd.c:
		get_window_title has a codepage parameter in 0.13.GIT.
2012-11-03 22:14:48 +02:00
Kalle Olavi Niemitalo
6f4c95cc7f Bug 943: Refuse user JS actions in unfocused tabs
(cherry picked from elinks-0.12 commit 51dc3beee7)

Conflicts:
	NEWS: Both 0.12pre5.GIT and 0.13.GIT had inserted a new section.
	src/terminal/window.c: Both had inserted a new function.
2012-11-03 22:10:27 +02:00
Kamil Dudka
a96d8a17e5 rewrite: add default "ddg" dumb/smart prefixes for DuckDuckGo
... and mention that URI rewriting rules may leak ELinks' identity
in the documentation of protocol.http.user_agent.

Originally requested at <https://bugzilla.redhat.com/856348>.
2012-10-05 14:05:13 +02:00
witekfl
88be88c819 Revert "Show the URI in the title bar even if document title is set."
This reverts commit d06cccffd6.

Some people wants URL in the title bar, but some wants the title.
I restored previous version (the title). If you want the URL, create
the patch with a configurable option.
2012-09-02 19:19:02 +02:00
witekfl
71bd75f759 Avoid a warning when gzip, bzip2 nor lzma is compiled-in. 2012-08-08 22:36:21 +02:00
witekfl
a556fba1d2 Label bad was unused without fork. 2012-08-08 22:31:05 +02:00
witekfl
15ebc25704 Avoid compilation warning on Windows. 2012-08-08 22:28:04 +02:00
witekfl
9543ed96a4 Do not set FD_SETSIZE too high on Windows.
Alloc more space for threads in main/select.c instead.
2012-08-08 22:22:37 +02:00
mancha
bc3fcb4696 Fix hostname verification code.
[ From bug 1123 attachment 569.  --KON ]
2012-07-18 12:37:55 +03:00
witekfl
ba9bbc9e46 draw_space: Check for a non-space only in first 10 chars of the line.
I know it is totally brainless, but buildlogs.pld-linux.org
looks good now.
2012-07-11 11:39:26 +02:00
witekfl
4ec188d75e When shifting characters (for example with ALIGN_CENTER) set
colors of the empty area to the color of the first char of the centered
text. Previously it was set to the default background.
2012-07-11 11:17:24 +02:00
witekfl
42d2433f4b Color leading spaces with the color of the first non-space character.
Also color trailing spaces with the color of the last character.

See for example gtk-doc.
2012-07-11 11:14:03 +02:00
witekfl
aead2de59a Do not treat <li> specially and handle </li>. See test/ul_a_li.html. 2012-06-12 14:31:55 +02:00
witekfl
9313aae906 Set FD_SETSIZE 1024 2012-05-25 19:47:27 +02:00
witekfl
2ec6c54697 On Windows safe_read or safe_write return -1 and set errno = EWOULDBLOCK
for nonblocking io.
2012-05-25 19:43:10 +02:00
witekfl
a140e1d79f Set FD_SETSIZE to 1024 on Mingw32.
The default value of FD_SETSIZE on Windows is 64,
but can be bigger if set before including winsock2.h
2012-05-25 17:54:46 +02:00
witekfl
bebde69507 Compilation fixes for Mingw32.
* check if fork is available
* use set_nonblocking_fd
2012-05-25 16:13:25 +02:00
witekfl
5f9b54f594 Apply styles of html element for body element.
See test/css/css_body.html and test/css/css_html.html
2012-05-22 15:22:48 +02:00
witekfl
7328bb9c9e gnutls_transport_ptr is deprecated. 2012-05-08 13:41:26 +02:00
witekfl
e58fc7e2cb Show fractions of MiBs in download progress dialogs.
It is useful especially for slow links.
2012-05-08 13:29:20 +02:00
witekfl
12803e4075 Check if hb is NULL. 2012-03-04 18:20:48 +01:00
witekfl
e86ec567f2 Compilation fixes (--enable-debug) 2012-03-04 18:11:18 +01:00
witekfl
36070d3277 The union of the color and the node_number in the struct screen_char.
The long term goal is good looking of the Python docs in ELinks, especially
background colors. Every start tag and every text node would have associated
a natural number. Those numbers would be "drawn" in the document instead
of colors. Finally, the screen driver would change numbers into colors.

This will be done in small steps. The next step is to implement this change
in the screen driver.
2012-03-03 11:27:58 +01:00
witekfl
9c0d7dde79 Do not set title for the GNU Screen, because it beeps. 2012-01-05 19:49:22 +01:00
Miciah Dashiel Butler Masters
416d7fac7d css_apply_list_style: fix compiler warning
Add a case for CSS_LIST_ORDINAL (and assert(0)) to the switch in
css_apply_list_style.  This change should eliminate a warning from the
compiler reported by Witold that CSS_LIST_ORDINAL is not handled.
2011-11-16 16:58:08 +00:00
Miciah Dashiel Butler Masters
e37caa01ec exec_later: use mem_calloc instead of calloc
Before this change, exec_later allocates memory for the struct exec_mailcap
structure using calloc.  However, the memory is freed in
exec_mailcap_command using mem_free.  Change exec_later to use mem_calloc
instead of calloc.

Unless CONFIG_FASTMEM is used, mem_free expects to find debugging metadata
that only the mem_alloc family of functions store, and thus using mem_free
on the memory allocated using calloc causes a crash.
2011-11-15 20:14:14 +00:00
Miciah Dashiel Butler Masters
c74ddb29c5 SMJS: add terminal object
Add terminal_class, which defines a JSObject wrapper for struct terminal.

Add terminal_array_class, which defines a JSObject wrapper for accessing
the "terminals" linked list of struct terminal.

Add session_array_class, which defines a JSObject wrapper for accessing the
tabs (sessions) of a terminal.

Add pointers from struct terminal to the terminal_class object and
the session_array_class object.

Add terminal_props and terminal_get_property for terminal_class.

Add terminal_finalize, which clears the pointers between a struct terminal
and the JSObject wrapper in question.

Add smjs_init_terminal_interface, which creates a terminal_array_class
instance and assigns it to  the "terminal" property on the "elinks" object.
Call smjs_init_terminal_interface from smjs_init_elinks_object.

Add smjs_get_terminal_object and smjs_get_session_array_object to get
the wrapper objects for a given struct terminal, and add
smjs_get_terminal_array_object to get a terminal_array_class object.

Add smjs_detach_terminal_object and smjs_detach_session_array_object, which
clear the pointers between a given struct terminal and its JSObject
wrappers.

Add terminal_array_get_property for terminal_array_class.

Add session_array_get_property for session_array_class.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
cdad9adf19 SMJS: add session object
Add session_class, which defines a JSObject wrapper for struct session.

Add location_array_class, which defines a JSObject wrapper for struct
ses_history.  The "history" member of struct session is a struct
ses_history, which is a linked list of struct location.

Add a pointer from struct session to the session_class object and the
location_array object.

Add smjs_get_session_object to return a session_class JSObject wrapper for
a given struct session.

Add smjs_get_session_location_array_object to return a location_array_class
JSObject wrapper for a given struct session.

Add "session" property to the "elinks" object, which uses
smjs_get_session_object to get a JSObject wrapper for smjs_ses.

Add smjs_location_array_get_property, which allows indexing
a location_array object using a positive number for history forward or
a negative number for history backward.

Add session_props, session_get_property, session_set_property,
session_funcs, smjs_session_goto_url (which implements the "goto" method),
and smjs_init_session_interface for session_class.

Add session_construct, which creates a new tab and returns the JSObject
session_class wrapper.

Add session_finalize and smjs_location_array_finalize, which clear the
pointers between struct session and the JSObject wrappers in question.

Add smjs_detach_session_object, which clears the pointers between a given
struct session and the corresponding JSObject wrappers.

In destroy_session, call smjs_detach_session_object.

Add jsval_to_object helper in ecmascript/spidermonkey/util.h;
jsval_to_object is used in smjs_session_goto_url.

Modify delayed_goto_uri_frame to allow the target to be NULL.
smjs_session_goto_url needs this modification.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
3932af9b17 SMJS: handle view_state outliving wrapping object
Currently, it is possible for the JSObject that wraps a struct view_state
to outlive the view_state.  Using the properties of the JSObject wrapper
will then cause a crash.

This patch adds a smjs_detach_view_state_object function, which is called
in destroy_vs, to dissociate the struct view_state from the JSObject
wrapper.  To this end, the patch modifies the struct view_state to point
the JSObject wrapper.  smjs_get_view_state_object will use this pointer
if it is set, and copy_vs will copy this pointer to the new view_state.
The patch also modifies view_state_get_property and
view_state_set_property to return immediately if the view_state has been
destroyed.  Finally, the patch adds a finalizer (view_state_finalize)
that clears the pointer from the struct view_state to the JSObject.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
211c624aca smjs_get_elinks_object: drop jsobj temp variable
After recent simplifications, the jsobj variable is no longer necessary.
Instead of assigning it a value and then returning it, just return the
value that was being assigned to it.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
54c33284fc elinks_get_property: return empty string if no URI
For the elinks.location property, if elinks_get_property fails to find
a URI, just return the empty string rather than returning an error.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
e092b6b08b SMJS: refactor elinks object's property handlers
Add elinks_get_property and elinks_set_property functions and
a JSPropertySpec elinks_props table to handle properties rather than
defining eilnks_get_home, elinks_get_location, and elinks_set_location
and adding them individually to the class using JS_DefineProperty.
This approach will make it easier to add further properties.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
68801b7382 elinks_object: use usrerror if there is no term
Currently, elinks_alert assumes that smjs_ses is not NULL and crashes if
it is.  Change elinks_alert to check whether smjs_term is NULL, try
get_default_terminal if so, and fall back on printing to stderr using
usrerror if no terminal is found.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
e310843a2a smjs_load_uri: check for empty URI
In smjs_load_uri, check whether the the given URI string is empty.  If it
is, return JS_FALSE right away rather than continuing on and passing
get_uri an empty string, which triggers an assertion failure later on.
2011-11-14 04:34:51 +00:00
Miciah Dashiel Butler Masters
f8bdc3ca9e read_http_post_inline: fix assertion-failed message
read_http_post_inline decodes two hexadecimal digits into one byte at
a time, and it asserts that each hexadecimal digit is valid; however,
both assertions print the first digit when they fail.  Fix the assertion
on the second digit to print the second digit.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
daa6f36e83 Perform the work of try_form_insert_mode in enter
Currently, the function try_form_insert_mode checks whether the current
link is a text area, insert mode is off, and the current action is enter,
and if so, it sets insert mode on.  Perform this work in enter instead,
and delete try_form_insert_mode.

The old code works as follows: send_kbd_event → send_to_frame
→ frame_ev → frame_ev_kbd → try_form_insert_mode.  The new code works
as follows: send_kbd_event → do_action → enter.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
a3918d8c30 cache_entry_get_property: fix assertion failure
In cache_entry_get_property, don't assert the return value from
get_cache_fragment; instead, just return JS_FALSE if the value is NULL.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
da209c6b6f smjs_load_uri: return if there is an external handler
Currently, using smjs_load_uri on javascript: URIs cause an assertion
failure in run_connection because smjs_load_uri uses
get_protocol_handler to find the handler and asserts that the returned
handler is not NULL, but get_protocol_handler returns NULL for
javascript: URIs.

In smjs_load_uri, if the given URI has a protocol for which some
external handler is defined, immediately return JS_FALSE because
smjs_load_uri implements an asynchronous operation, and we cannot
reasonably carry out the operation and callback with an external
handler.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
bdeace4811 keymap_set_property: xulrunner-2.0 fix
In keymap_set_property, convert the jsid value into a jsval value before
calling JS_ValueToString on it.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
0189b6bfc9 Add support & test for the CSS list-style property
Recognise the list-style property and apply it by setting the
appropriate flag on the element's parattr based on the property's value.

Add test/list-style.html with an example of each possible list-style
value (many are unsupported by the HTML engine).
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
4eb7827fe5 Call follow-url hook on redirects
In redirect_cache, call the follow-url hook so that scripts can modify
URIs in redirects.
2011-11-14 04:34:50 +00:00
Miciah Dashiel Butler Masters
56f1b5d834 follow_url: do not pass POST requests to scripts
In follow_url, do not call the follow-url hook if the URI encodes a POST
request.  If scripts try to change such a URI, they can corrupt it and
cause problems later on.

This change can be reverted later when the URI structure is changed not
to store the POST data in the URI string.
2011-11-14 04:34:50 +00:00
witekfl
3d4fe9c4d2 Always do reload after submitting forms.
In fact, it does reload after pressing any button, but it should not
hurt. To remember to press 'x' for submitting forms was too hard.
2011-11-12 15:17:53 +01:00
witekfl
d06cccffd6 Show the URI in the title bar even if document title is set.
ECMAcript's window.title overrides this.
2011-10-18 20:57:32 +02:00
witekfl
c656c5c929 Pass -Wno-uninitialized for the gettext compilation.
The compilation --with-debug failed on the plural.c.
2011-10-08 12:07:02 +02:00
witekfl
0e5822edae Memorize the auth form only when the "document.browse.forms.show_formhist" is on. 2011-10-06 10:54:11 +02:00
witekfl
ddc0d8d7be Use formhist for 401 Unauthorized and others. 2011-10-05 22:42:41 +02:00
Petr Baudis
9a001f051a Remove variables that were set but not used
Required to make new gcc with default warning settings happy.
2011-09-24 02:25:51 +02:00
Petr Baudis
69a226eba1 find_clonable_bittorrent_peer_request(): Remove likely wrong inner clone declaration 2011-09-24 02:21:59 +02:00
Petr Baudis
b9fb1d3c7d menu_keys(): Do not compare different enums 2011-09-24 02:10:54 +02:00
Kalle Olavi Niemitalo
0c3f3e09a7 1024: Verify server certificate hostname with OpenSSL
Not tested with nss-compat-ossl.
2011-07-28 17:23:51 +03:00
Kalle Olavi Niemitalo
7c40e03421 1024: Always disable TLS1.1 with GnuTLS
Using the RFC 3546 server_name TLS extension with TLS 1.1 made
https://bugzilla.novell.com/ never respond to negotiation.
Disable TLS 1.1 with GnuTLS, like it has already been disabled with
OpenSSL.  And if an SSL error is detected, disable TLS 1.2 as well.
2011-07-28 17:23:51 +03:00
Kalle Olavi Niemitalo
6c84978cf5 1024: Use RFC 3546 server_name TLS extension
For both GnuTLS and OpenSSL.  Not tested with nss-compat-openssl.
2011-07-28 17:23:51 +03:00
Kalle Olavi Niemitalo
5d0e4e2452 1024: Reject OpenPGP certificates 2011-07-28 17:23:51 +03:00
Witold Filipczyk
a15216863f 1024: Verify hostname and expiration time of the certificate.
GnuTLS only.

[ From bug 1024 attachment 483.  Resolved conflicts with 0.13.GIT.  --KON ]
2011-07-28 17:23:51 +03:00
witekfl
eb4e5d7e0d Revert "Do not try to use gpm in X11."
This reverts commit 8183aecd90.
2011-07-06 13:41:41 +02:00
witekfl
ab8fa8daed Revert "redraw_terminal_cls instead of redraw_terminal in delete_window."
This reverts commit 03c698e926.
2011-07-06 13:23:30 +02:00
witekfl
8183aecd90 Do not try to use gpm in X11.
X11 is detected by checking DISPLAY variable.
Without this ELinks stopped on reading from /dev/gpmctl.
2011-07-06 13:19:09 +02:00
witekfl
03c698e926 redraw_terminal_cls instead of redraw_terminal in delete_window.
On http://pcarena.pl/ the msgbox is shown saying,
that document.getElementById is not a function.
The "ghosts" remained after pressing OK.
2011-06-17 14:33:46 +02:00
witekfl
81c9f462c2 Deleted ecmascript code using SEE.
AFAIK SEE is no longer developped.
I see no reason to use SEE in ELinks.
2011-05-11 11:31:15 +02:00
Kalle Olavi Niemitalo
ad9c144e5c BFU: Add comments in enum widget_type
I was trying to check which charset WIDGET_TEXT uses in the buffer but
had difficulty finding the code that handles key presses and updates
the buffer.  These comments should make that easier in the future.
2011-05-09 23:28:12 +03:00
Kalle Olavi Niemitalo
dd608c500b BFU: Document additional data in struct dialog 2011-05-09 23:28:12 +03:00
Miciah Dashiel Butler Masters
a1c5fe518b bookmark_folder_get_property: xulrunner-2.0 fix
In bookmark_folder_get_property, convert the jsid value into
a jsval value before passing it to jsval_to_bookmark_string.

This commit fixes a bug in the xulrunner-2.0 compatibility changes
of commit 2844f8b715, which rendered
the bookmarks scripting interface for SpiderMonkey nonfunctional.
2011-05-08 03:04:10 +00:00
Kalle Olavi Niemitalo
5ddf20b85e GNUTLS: Make anon_cred and xcred static
anon_cred and xcred are defined in src/network/ssl/ssl.c and not
mentioned in any other file.  Make them static.
2011-05-02 14:55:17 +03:00
Kalle Olavi Niemitalo
6457a13005 GNUTLS: #if 0 arrays needed by deprecated functions
src/network/ssl/ssl.c defined some constant arrays for passing to
GnuTLS functions.  Those functions have been deprecated and their
calls are in #if 0 nowadays.  Put #if 0 around the arrays as well.
2011-05-02 14:55:17 +03:00
Kalle Olavi Niemitalo
8a89a627bc SMJS: Define XP_UNIX and others as 1, not as empty
This change is intended to prevent a macro redefinition warning
if CFLAGS already contains -DXP_UNIX from pkg-config --cflags mozilla-js.
2011-05-01 23:41:44 +03:00
Kalle Olavi Niemitalo
e22eae2e93 HTML: Rewrite parsing of meta refresh
The URL in <meta http-equiv="Refresh" content="42; URL=target.html">
can now freely contain spaces and semicolons.  There cannot be other
parameters between the delay and the URL.  If the URL is not quoted,
then it spans to the end of the attribute, except not to trailing
spaces.  If the URL is quoted, then it ends at the first closing
quotation mark.  All this is consistent with Debian Iceweasel 3.5.16.
2011-05-01 22:59:23 +03:00
Kalle Olavi Niemitalo
715571a5d6 HTML bug 1114: Don't doubly decode entities in attributes
The HTML parser decoded SGML entity references and numeric character
references in the following attributes, and then the renderer did the
same again:

link/@title
link/@hreflang
link/@type
link/@media
img/@alt
area/@alt
input[@type="image"]/@alt
input[@type="image"]/@name
input[@type="button"]/@value

The result was that e.g. title="&amp;#65;" displayed as "A"
even though it was supposed to display as "&#65;".

Fix by making the HTML parser tell the renderer that the entities have
already been decoded.
2011-05-01 22:54:45 +03:00
Kalle Olavi Niemitalo
2d8fd9cecf bug 1115: Check status after gnutls_certificate_verify_peers2
The deprecated gnutls_certificate_verify_peers function returns -1
if it fails, or a set of gnutls_certificate_status_t bits; each bit
indicates some kind of problem, so the result is zero if the
certificate is OK.

The newer gnutls_certificate_verify_peers2 function returns -1 if it
fails, or 0 if it succeeds; and writes the status bits via a pointer.
When using that function, ELinks must check the status separately.
Do that.

Also, if GnuTLS is not being used, do not declare a status variable,
because leaving it unused would break the debug build:

/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c: In function ‘ssl_want_read’:
/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c:87: error: unused variable ‘status’
/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c: In function ‘ssl_connect’:
/home/Kalle/src/elinks-0.13/src/network/ssl/socket.c:121: error: unused variable ‘status’
2011-05-01 02:27:19 +03:00
witekfl
b228fe82ab bug 1115: Avoid deprecated functions when compile --with-gnutls 2011-04-28 18:21:40 +02:00
witekfl
5a99cca30b gcry_create_nounce is part of libgcrypt.
Lack of -lgcrypt caused linking error when compiled --with-gnutls.
2011-04-28 18:02:00 +02:00
witekfl
218a2250a7 SpiderMonkey: fix issue with javascript:history.back()
In history.back() and others set rval to NULL.
Do not convert NULL to string in spidermoney_eval_stringback.
2011-04-25 21:04:03 +02:00
witekfl
2844f8b715 JS_VERSION at least 185 is required for ECMASCript (xulrunner-2.0 or later)
The code wasn't tested. It compiles
2011-04-19 22:41:05 +02:00
Kalle Olavi Niemitalo
9e4d7d1883 mailcap bug 1113: Don't leak values of duplicate fields
If a mailcap entry has two test commands or two descriptions,
free the first one before replacing it with the second one.
2011-04-17 21:26:08 +03:00
Kalle Olavi Niemitalo
f735bfbe72 I18N bug 1112: Use strange_chars[] for UTF-8 output too
Make u2cp_() map code points U+0080 to U+009F via strange_chars[] even
if the target codepage is UTF-8.  This helps with buggy web pages that
use &#146; when they mean &#x2019;.  This change does not affect how
ELinks decodes raw bytes 0x80 to 0x9F in HTML.

u2cp_() is used only via the u2cp and u2cp_no_nbsp macros.
Possible side effects of this change at each use of these macros:

* get_translation_table(): Not affected because it does not call u2cp
  if the target codepage is UTF-8.
* get_entity_string(): Numeric character references are affected, as intended.
  Character entity references are not affected because entities[]
  does not define any entities in the U+0080...U+009F range.
* kbd_field(), term_send_ucs(), field_op(): Affected.  It is no longer
  possible to enter code points U+0080...U+009F from the terminal.
  This should not be a problem in practice because those would be
  control characters anyway and should therefore be filtered by the
  slave process (which doesn't yet recognize them; bug 777).
2011-04-17 21:24:26 +03:00
Kalle Olavi Niemitalo
e3cb8d6a77 Compile xprop_to_string only #ifdef HAVE_X11
If ELinks was configured --without-x, the build failed at
xprop_to_string:

.../src/osdep/osdep.c:500: error: expected ‘)’ before ‘*’ token

Fix by moving xprop_to_string into the #ifdef HAVE_X11 section.
Reported by Thomas Adam.
2011-04-16 13:03:27 +03:00
Kalle Olavi Niemitalo
d2cf6912b9 Save X11 window title regardless of unconvertible characters
If Xutf8TextPropertyToTextList or XmbTextPropertyToTextList returns a
positive number, that means some characters were unconvertible and
have been replaced with XDefaultString().  Use the resulting string
even in that case, as if the function had returned Success.
The previous version ignored the string and didn't even free it.
2011-04-13 00:18:32 +03:00
Kalle Olavi Niemitalo
d1245c73a8 Recode X11 window title when saving and restoring
gnome-terminal 2.30.2 expects UTF-8 in the "OSC Ps ; Pt BEL" sequence
that sets the window title.  However, XGetWMName typically returns the
title in "STRING" (Latin-1) or "COMPOUND_TEXT" (escape sequences)
encoding.  Recode the title to restore it correctly.  This helps
especially in the fi_FI.UTF-8 locale, where gnome-terminal has "Pääte"
as the default title.

Related to bugs 885 and 336.
2011-04-11 22:13:38 +03:00
witekfl
9cb170f97f ftp: Get filesize from SIZE command instead of guess it from RETR command. 2011-03-22 17:51:13 +01:00
Miciah Dashiel Butler Masters
dfc666dd75 Factor try_menu out of send_kbd_event
Try to make the code a little clearer by pulling try_menu out of
send_kbd_event.  try_menu calls the BFU code and tells send_kbd_event
whether the BFU code did something with the event (i.e. opened a menu)
or whether the event still needs to be handled.
2011-01-19 03:52:08 +00:00
Miciah Dashiel Butler Masters
af5e54d95f send_kbd_event: Fix accesskeys when priority = 0
With document.browse.accesskey.priority = 0, accesskeys were ignored if
the current tab was not the last (rightmost) tab.  This commit fixes the
problem.

Add a function tabs_are_on_top(struct terminal *) which returns
a Boolean value indicating whether the topmost window is a tab (as
opposed to, e.g., a menu).

This commit fixes commit 1bd498cde9.
2011-01-19 03:44:50 +00:00
Witold Filipczyk
7933724dc8 Removed code using pipes for decompression and simplified decompress_data.
Workarounds for sites, which send incorrect data, probably won't work.
2010-09-24 16:12:35 +02:00
Witold Filipczyk
a9c02bbf01 Additional check whether LANGUAGE is not NULL. 2010-09-19 15:29:55 +02:00
Witold Filipczyk
f93d5ccd80 Revert "strcpy -> strlcpy."
This reverts commit 365cbb61be.
There is no strlcpy in libc.
2010-09-19 15:26:05 +02:00
witekfl
365cbb61be strcpy -> strlcpy.
Some of these changes doesn't make sense, but warnings are avoided.
2010-09-19 15:16:00 +02:00
witekfl
d94d9720a1 Use snprintf instead of sprintf. One warning less. 2010-09-19 14:13:28 +02:00
Witold Filipczyk
cbf70d5304 Refactoring: use struct string instead of unsigned char.
It probably doesn't make sense, but there is one warning less on OpenBSD.
2010-09-19 13:56:54 +02:00
Witold Filipczyk
ac275ee172 Compilation fix.
These both variables were unused.
2010-09-19 13:12:54 +02:00
Witold Filipczyk
d112adc8f3 include libgen.h for basename 2010-09-19 13:01:42 +02:00
Witold Filipczyk
236f600148 More headers.
There was a compilation error on OpenBSD, so I guess more includes are required.
2010-09-17 16:13:22 +02:00
Miciah Dashiel Butler Masters
ece4d3dc2d fixup_typeahead_match: improve comment
Clarify the comment for fixup_typeahead_match and put it closer to the
relevant code.
2010-09-16 02:00:01 +00:00
Miciah Dashiel Butler Masters
b53e8450d1 fixup_typeahead_match: use check_vs
Use check_vs instead of set_pos_x and set_pos_y in fixup_typeahead_match.
This saves us a line of code, and in addition, check_vs does not needlessly
scroll when the link is already in view.
2010-09-16 01:56:45 +00:00
Miciah Dashiel Butler Masters
b1422adf20 Move screen update code into set_kbd_repeat_count
Make set_kbd_repeat_count update the status bar and link highlighting
iff the repeat count is changed to a different value.

Delete code to do the same updates from do_action and try_prefix_key.

Besides simplifying the code, this change also fixes some issues with
the status bar and link highlighting not being properly updated in some
situations.
2010-09-16 01:40:10 +00:00
Miciah Dashiel Butler Masters
d6bd7987d4 Introduce set_kbd_repeat_count
Introduce and use ses_kbd_repeat_count to change
ses->kbdprefix.repeat_count instead of setting it directly.

This change should not cause any change in behaviour.
2010-09-16 01:33:45 +00:00
Fabienne Ducroquet
83945b677c Add document.browse.scrolling.vertical_overlap
Add an option to specify the number of overlapping lines when scrolling
page by page (0 by default because this is ELinks' current behaviour).

Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2010-09-14 20:42:32 +00:00
Fabienne Ducroquet
6211b8e725 Add half-page-down and half-page-up commands
Signed-off-by: Fabienne Ducroquet <fabiduc@gmail.com>
2010-09-14 20:42:32 +00:00
Witold Filipczyk
7f164f8633 strtoll instead of strtol to show the filesize of big files in FTP
downloads.
2010-09-08 22:52:59 +02:00
Witold Filipczyk
00ebb8ef4b SMB directory listing looks like normal directory listing. 2010-09-06 18:38:36 +02:00
Witold Filipczyk
f60d85c4c1 Use long long in place of long in conv.c to allow show size of files bigger
than 2GiB in the download dialog. Also let regetting big files.
Previously the Content-Length variable in http.c was int, what is
not enough. Now it is long long.
2010-09-04 14:10:51 +02:00
Witold Filipczyk
79340fa4ac Better looking symbols for LI elements. 2010-08-11 21:22:21 +02:00
Witold Filipczyk
885ffc9d40 Merge branch 'master' of git+ssh://pasky.or.cz/srv/git/elinks 2010-08-08 09:47:01 +02:00
Witold Filipczyk
16ff310884 One of mailcap tests failed because of changed implementation
of copiousoutput. Now tests passed, by I'm not sure whether
they work properly.
2010-08-08 09:44:37 +02:00
Witold Filipczyk
8615e62ffb Compilation fix. make test failed. 2010-08-08 09:38:39 +02:00
Nils Dagsson Moskopp
2f0d954add Rudimentary support for HTML5 media elements
Make use of the HTML5 media elements, <video> and <audio> by adding
links to the media.
2010-08-07 20:44:44 +00:00
Miciah Dashiel Butler Masters
6cb3d30d09 Add missing include and declarations
Add an include for config/options.h to src/ecmascript/spidermonkey.c
and two missing declarations (struct form_view and struct form_state)
to src/ecmascript/spidermonkey.h.
2010-08-07 20:44:02 +00:00
Miciah Dashiel Butler Masters
f113f6a156 field_op: use goto_link
Use the newly introduced goto_link instead of goto_current_link in field_op
since field_op already looks up the current link.
2010-08-07 20:44:02 +00:00
Miciah Dashiel Butler Masters
6a91849889 Don't follow wrong link when an event handler changes documents under us
When a link had an onClick event handler that changes the current document,
ELinks would follow the current link of the document displayed after
executing the handler.

Factor goto_link out of goto_current_link.

Use goto_link instead of goto_current_link in activate_link to ensure that
the link that is passed in by enter() is followed.
2010-08-07 20:44:02 +00:00
Witold Filipczyk
20eee6f2c8 bug 1097: Restart connection when digest proxy authorization
is required for the first time.
2010-08-07 15:51:47 +02:00
Witold Filipczyk
2d906e0886 bug 1097: Better digest proxy authentication.
Added nc to the auth_entry. nc is incremented every time new
digest request is sent.
2010-08-07 15:02:51 +02:00
Witold Filipczyk
cbf5ef6680 Allow empty /dev/stdin
For example: PAGER=elinks git diff
shows nothing, when repo is not dirty.
2010-07-31 21:48:48 +02:00
Witold Filipczyk
a27e7d95ee Do not delete temporary files of external handlers. 2010-07-31 21:15:12 +02:00
Witold Filipczyk
2ff9f1a76f & 15 for foreground. 2010-07-31 20:58:11 +02:00
Witold Filipczyk
17f82a3e21 Decode ESC color sequences in the plain renderer.
Added functions for screen_char->color -> color_T conversion.
2010-07-31 20:51:24 +02:00
Witold Filipczyk
6c7fbaeeaa Unification of protocol handler names. 2010-07-27 10:07:52 +02:00
Witold Filipczyk
98a7ca3635 Silent lua warnings. 2010-07-26 09:30:11 +02:00
Ahmed El-Mahmoudy
dfd399c370 Fixes to make test target to work 2010-07-25 20:32:37 +02:00
Witold Filipczyk
1f98df36a6 copiousoutput: Temporary file is deleted by /bin/rm -f
added with ; at the of the command.

I commented also the line with file_download->delete = 0 because
it left temporary files.
2010-07-25 14:40:19 +02:00
Witold Filipczyk
47e5bec81f Some misleading comments were deleted. 2010-07-25 13:54:34 +02:00
Witold Filipczyk
11f8f65b29 Missing mailcap related files. 2010-07-25 13:50:33 +02:00
Witold Filipczyk
29da031975 Treat /dev/stdin special. Read it in nonblock mode.
Previosly ELinks read /dev/stdin in blocking mode.
export PAGER=elinks
and compare git log before and after this commit.
2010-07-24 18:09:16 +02:00
Witold Filipczyk
7dfb20d11f Handle mailcap's copiousoutput without an external pager.
I tested it only on local PDFs.
I don't know if temporary files are deleted or not.
2010-07-24 17:07:18 +02:00
Witold Filipczyk
d74b9b932f More charsets. 2010-07-24 12:37:29 +02:00
Witold Filipczyk
7c9e858723 Added Shift-JIS charset. 2010-07-24 10:43:42 +02:00
Witold Filipczyk
958cc8dbbc Treat Big5 as Big5-hkscs. 2010-07-24 10:39:18 +02:00
Witold Filipczyk
90b37ff15f Reset iconv_cp when switching from Big5 -> UTF-8 to UTF-8 -> UTF-8.
After viewing a page with Big5 charset and next a page with UTF-8
charset iconv was used, so slows down a bit.
Now iconv is used only for those charsets, which has the iconv
bitfield set.
2010-07-24 09:57:59 +02:00
Witold Filipczyk
6d567bb8ce Support for multibyte encodings using iconv.
New charsets must be added by analogy to Big5.
2010-07-23 19:59:59 +02:00
Witold Filipczyk
b50fd4e8e2 codepage_desc: added the iconv bitfield.
I'm going to use it later for multibyte encodings, such as Big5.
2010-07-23 15:44:12 +02:00
Witold Filipczyk
d157890c0c lzma code requires xz-4.999beta or later. 2010-07-23 14:12:05 +02:00
Witold Filipczyk
331a4dc62b Link against lua51, not lua50. 2010-07-21 19:07:49 +02:00
Witold Filipczyk
13f1c878ac text/plain mime type for pager mode. 2010-07-18 05:11:13 +02:00
Witold Filipczyk
fecb5f1f9d Compilation fix on Mingw32. 2010-07-03 15:11:54 +02:00
Witold Filipczyk
0ec2f8eaa8 Show IP of the document in the status bar.
config options:
ui.show_ip (0/1) default 0
status.showip-text - colors
2010-03-30 14:45:19 +02:00
Witold Filipczyk
d2513cdfbb Added $(EXEEXT) for executables. 2010-03-22 09:35:15 +01:00
Witold Filipczyk
ef33a13713 Do not #define NO_FG_EXEC for Windows.
Editing textareas with external editor works.
There is a possible buffer overflow in mkstemp.
2010-03-21 22:36:01 +01:00
Witold Filipczyk
b10144e5b4 Working implementation of mkstemp on Windows. 2010-03-21 21:44:57 +01:00
Witold Filipczyk
b456fba69f Compilation fix. 2010-03-21 17:18:32 +01:00
Witold Filipczyk
caaa7b3d13 Force tre-0.8.0 or higher.
Functions in the tre-0.8.0 have the "tre_" prefix.
They won't collide with Perl.
2009-11-28 15:45:24 +01:00
Miciah Dashiel Butler Masters
f31cf6f9fe Heartbeat code using JS_TriggerOperationCallback
Implement new heartbeat code to catch runaway execution of document
ECMAScript code.  The old code uses JS_SetBranchCallback which is
deprecated in new versions of SpiderMonkey.  The new code uses setitimer(2)
and the JS_SetOperationCallback and JS_TriggerOperationCallback interfaces,
introduced in SpiderMonkey 1.8.1.  Compatibility with both the old
JS_SetBranchCallback and the new interfaces is maintained.
2009-11-26 00:57:21 +00:00
Witold Filipczyk
5bfeb061db Bug 1082: mem_free_set in abort_preloading
[ From bug 1082 attachment 545.  Added a comment and a NEWS reference.  --KON ]
2009-07-26 20:49:47 +03:00
Kalle Olavi Niemitalo
ef548e5728 Merge branch 'elinks-0.12'
Conflicts:
	src/session/download.c
	src/session/download.h
	src/viewer/text/view.c
2009-07-24 18:32:25 +03:00
Kalle Olavi Niemitalo
db128fecd9 download: Add DOWNLOAD_EXTERNAL flag
Like in ELinks 0.13.GIT commit b3cfede1c1
made on 2007-11-07, only with more comments and a bit different names.
2009-07-24 18:09:59 +03:00
Kalle Olavi Niemitalo
a2c8dc8c61 download: Rename download_resume to download_flags
Bring the code closer to ELinks 0.13.GIT commit
71ccbe0f8d made on 2007-11-07.
Don't define a separate download_flags_T typedef though,
because Doxygen generates nicer links if the enum is used directly.
2009-07-24 17:10:35 +03:00
Kalle Olavi Niemitalo
ab72415130 download: Make BitTorrent's tp_show_header static
There are two identical tp_show_header() functions: one in
src/session/download.c and one in src/protocol/bittorrent/dialogs.c.
Neither is declared in any header, but the latter was not static.
2009-07-23 22:57:41 +03:00
Kalle Olavi Niemitalo
1cca904ce6 download: Document the rest of struct type_query 2009-07-23 22:57:11 +03:00
Kalle Olavi Niemitalo
ce89947fcf download: Use add_dlg_checkbox 2009-07-23 21:25:48 +03:00
Kalle Olavi Niemitalo
53c19e5b66 Bug 770: Comment updates
Since commit b7d03f9b04 on 2009-07-19,
lun_resume() no longer assumes that data points to struct cdf_hop.
2009-07-21 03:28:29 +03:00
Kalle Olavi Niemitalo
4067e54727 lookup_unique_name: Handle NULL from msg_box
If msg_box() runs out of memory, it returns NULL.  In this case,
the done_handler_T callbacks of the buttons will not be called.  So
lookup_unique_name() must instead free the struct lun_hop on its own.
2009-07-21 02:07:10 +03:00
Kalle Olavi Niemitalo
b80c0e8a0d lookup_unique_name: Remove always true condition
Remove the stracpy(ofile) call that could never be executed.
This removes the need to handle errors from that call,
and makes it clear that lun_hop->file need not be separately freed
if an error occurs in lookup_unique_name().
2009-07-21 01:09:37 +03:00
Kalle Olavi Niemitalo
71dfd47dcb lookup_unique_name: Merge error handling 2009-07-21 00:57:17 +03:00
Kalle Olavi Niemitalo
f815d27835 lookup_unique_name: Handle NULL from expand_tilde
expand_tilde() returns NULL if out of memory.
Make lookup_unique_name() handle that.
2009-07-21 00:50:54 +03:00
Kalle Olavi Niemitalo
23fd2d58f4 Make struct action const
With GCC 4.3.1 on i686, this changes the sizes of sections as follows:

section            before       after   change
.text              682428      682492      +64
.rodata            212668      216352    +3684
.data               58092       54444    -3648
.debug_info       1482388     1482472      +84
.debug_abbrev      153714      153723       +9
.debug_line        272299      272319      +20
.debug_loc         540394      540372      -22
.debug_ranges      113784      113792       +8
Total             3917695     3917894     +199

The surprising .text change comes from src/config/dialogs.o.
Some of that is in get_keybinding_text(), where GCC changes the
order of basic blocks and apparently misses some optimizations.
2009-07-19 21:15:39 +03:00
Kalle Olavi Niemitalo
89c7e57890 Bug 770: Don't close fd when resuming download
I added this bug last night.  continue_download_do() passed the
file descriptor to transform_codw_to_cmdw(), which saved it, but
continue_download_do() then closed it.
2009-07-19 13:44:01 +03:00
Kalle Olavi Niemitalo
075171c2c8 Bug 770: Shorten lifetime of session.download_uri
In common_download(), move session.download_uri to the new member
cmdw_hop.download_uri, which common_download_do() then reads.  This
shields the download request against possible session.download_uri
changes made for other downloads.  And transform_codw_to_cmdw() no
longer needs to touch session.download_uri at all, solving a FIXME.
2009-07-19 04:06:32 +03:00
Kalle Olavi Niemitalo
b7d03f9b04 Bug 770: Move codw->cmdw transform to outer layer
Commit ff136e5116 on 2006-07-16 made
lun_resume() check if cdf_hop->data points to struct codw_hop,
and transform that to struct cmdw_hop if so.  Move the transform
into a separate function called from continue_download_do().
This way, the structures used with create_download_file() no longer
need to begin with int magic.
2009-07-19 04:06:32 +03:00
Kalle Olavi Niemitalo
2f04a38c6f Bug 770: Fix URI leak in lun_resume
To reproduce:
- Configure with --enable-debug.
- Go to http://elinks.cz/
- Set the cursor on the "About" link and press d to download,
- ELinks asks where to save the file.  Cancel that with Esc.
  This leaves session.download_uri != NULL.
- Go to /etc/passwd
- ELinks asks what to do with the file.  Choose to download.
- ELinks asks where to save the file.  Type the name of a new file
  and press Enter.
- Again go to /etc/passwd
- ELinks asks what to do with the file.  Choose to download.
- ELinks asks where to save the file.  Type the same name as before
  and press Enter.
- ELinks asks whether to resume or overwrite.  Choose to resume.
  This changes session.download_uri and leaks the original URI.
- Quit ELinks.  It reports memory leaks:

0x88936d8:28 @ alloc'd at /home/Kalle/src/elinks-0.12/src/util/hash.c:89
0x88dac00:95 @ alloc'd at /home/Kalle/src/elinks-0.12/src/protocol/uri.c:1551
0x88c33a8:4104 @ alloc'd at /home/Kalle/src/elinks-0.12/src/util/hash.c:41

This commit fixes the leak, but it's still a bug that lun_resume() can
replace the session.download_uri that will be used by another pending
download.  In particular, this might happen if the user first presses
d to download, and then while ELinks is asking for the file name, a
web script changes window.location to a different URI and that causes
ELinks to ask what to do with the file.  So I'm leaving the FIXME
comment in for now.
2009-07-19 04:06:32 +03:00
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
126d2d1be3 Remove enum {main,edit,menu}_action_offset
Remove enum main_action_offset, enum edit_action_offset, and enum
menu_action_offset.  It seems the original plan (in commit
174eabf1a448d3f084a318aab77805828f35c42e on 2005-05-16) was to include
the action flags in the action IDs, perhaps with something like:

	ACT_##map##_##action = ACT_##map##_OFFSET_##action | flags

However, this OR operation was never implemented; each ACT_*_*
constant had the same value as the corresponding ACT_*_OFFSET_*,
and the code that looked for flags in action IDs found only zeroes.
Then on 2005-06-10, a separate action.flags member was added, and
the flag checks were corrected to read that instead.  So, it seems
safe to say that the original plan has been discarded and the offset
enumerations won't be needed.
2009-07-19 02:32:41 +03:00
Kalle Olavi Niemitalo
62316163f3 Comment fixes 2009-07-18 23:31:10 +03:00
Kalle Olavi Niemitalo
a92bdcf02d Document add_dlg_button, add_dlg_ok_button 2009-07-18 19:51:01 +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
b6a3f28c49 dump: Use box-drawing characters if available 2009-07-11 16:53:59 +03:00
Kalle Olavi Niemitalo
7bb51e7139 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	NEWS
	configure.in
	doc/man/man1/elinks.1.in (regenerated)
	doc/man/man5/elinks.conf.5 (regenerated)
	doc/man/man5/elinkskeys.5 (regenerated)
	po/af.po (kept 0.13.GIT)
	po/be.po (kept 0.13.GIT)
	po/bg.po (kept 0.13.GIT)
	po/ca.po (kept 0.13.GIT)
	po/cs.po (kept 0.13.GIT)
	po/da.po (kept 0.13.GIT)
	po/de.po (kept 0.13.GIT)
	po/el.po (kept 0.13.GIT)
	po/es.po (kept 0.13.GIT)
	po/et.po (kept 0.13.GIT)
	po/fi.po (kept 0.13.GIT)
	po/fr.po (kept 0.13.GIT)
	po/gl.po (kept 0.13.GIT)
	po/hr.po (kept 0.13.GIT)
	po/hu.po (kept 0.13.GIT)
	po/id.po (kept 0.13.GIT)
	po/is.po (kept 0.13.GIT)
	po/it.po (kept 0.13.GIT)
	po/lt.po (kept 0.13.GIT)
	po/nb.po (kept 0.13.GIT)
	po/nl.po (kept 0.13.GIT)
	po/pl.po (kept 0.13.GIT)
	po/pt.po (kept 0.13.GIT)
	po/pt_BR.po (kept 0.13.GIT)
	po/ro.po (kept 0.13.GIT)
	po/ru.po (kept 0.13.GIT)
	po/sk.po (kept 0.13.GIT)
	po/sr.po (kept 0.13.GIT)
	po/sv.po (kept 0.13.GIT)
	po/tr.po (kept 0.13.GIT)
	po/uk.po (kept 0.13.GIT)
	src/ecmascript/ecmascript.c
2009-07-11 16:47:33 +03:00
Yuriy M. Kaminskiy
e5f4c59a20 Fixes failure to search for more than one double-width character. 2009-06-29 23:33:28 +03:00
Kalle Olavi Niemitalo
e452420d5f Debian bug 534835: Don't assert ecmascript_reset_state succeeds
After the recent ecmascript_get_interpreter change, I got an assertion
failure in render_document, which calls ecmascript_reset_state and
then asserts that it has set vs->ecmascript != NULL.
ecmascript_reset_state cannot guarantee that because there might not
even be enough free memory for mem_calloc(1, sizeof(struct
ecmascript_interpreter).  So, replace the assertion in render_document
with error handling, and likewise in call_onsubmit_and_submit.
2009-06-28 11:17:06 +03:00
Kalle Olavi Niemitalo
11c0cb859b Debian bug 534835: Check *_get_interpreter return values
This should fix a crash in:

    at /home/Kalle/src/elinks-0.12/src/ecmascript/spidermonkey.c:251
    at /home/Kalle/src/elinks-0.12/src/ecmascript/ecmascript.c:104
    at /home/Kalle/src/elinks-0.12/src/viewer/text/vs.c:64

It seems that spidermonkey_get_interpreter failed and returned NULL to
ecmascript_get_interpreter, which did not check the return value and
behaved as if the ECMAScript interpreter had been properly initialized.
This caused destroy_vs to call ecmascript_put_interpreter, but
backend_data which should have been a JSContext * was NULL, causing
a crash in SpiderMonkey.

An alternative fix might be to make spidermonkey_put_interpreter skip
the JS_DestroyContext call if ctx is NULL.  However, I think it is
better to make sure ecmascript_get_interpreter returns NULL if
spidermonkey_get_interpreter fails, so that vs->ecmascript is left
NULL and there's no chance that some other code might try to
dereference the (JSContext *) NULL.
2009-06-28 00:18:05 +03:00
Kalle Olavi Niemitalo
10c07f9933 Debian bug 534835: Check some SpiderMonkey return values
Perhaps because of bug 981, if one opened hundreds of pages with
elinks --remote openURL(...), then ELinks 0.11.4 could crash with a
SIGSEGV in JS_InitClass called from spidermonkey_get_interpreter.
SpiderMonkey ran out of memory and began returning NULL and JS_FALSE
but ELinks didn't notice them and pressed on.  Add some checks to
avoid the crash, although the underlying out-of-memory error remains.
2009-06-27 19:48:56 +03:00
Kalle Olavi Niemitalo
645e9f22fe dump: Trim spaces only in color mode 0 or -1
The old code failed to write pending spaces before changing the
background color.  That seems hard to fix without duplicating code,
and ELinks pads dumped lines to the requested width in these color
modes anyway, so this commit just makes ELinks write all spaces
immediately when colors are being used.

Try the following command before and after this commit:
elinks --no-home --eval "set document.colors.use_document_colors = 2" \
--dump-color-mode 1 --dump test/color.html
2009-06-21 19:35:50 +03:00
Kalle Olavi Niemitalo
9bc79e4ecf dump: Define DUMP_COLOR_MODE_NONE 2009-06-21 19:35:50 +03:00
Kalle Olavi Niemitalo
773549180d dump: Use dump functions in add_document_to_string
Now that struct dump_output supports appending to a string,
add_document_to_string() can just use that feature, instead of
duplicating the code.
2009-06-21 19:35:50 +03:00
Kalle Olavi Niemitalo
f64463a780 dump: Let struct dump_output append to a string
struct dump_output can now be initialized in such a way that data
written to it will be appended to a struct string.  Nothing uses this
feature yet.
2009-06-21 19:35:50 +03:00
Kalle Olavi Niemitalo
04dabd5bf1 dump: Move the buffer into new struct dump_output 2009-06-21 19:35:49 +03:00
Kalle Olavi Niemitalo
2f0cefffb5 dump: Replace control characters with spaces
In DUMP_FUNCTION_SPECIALIZED, use isscreensafe_ucs (for UTF-8) or
isscreensafe (for unibyte) to detect control characters, and replace
them with spaces.  add_document_to_string already did the same.
2009-06-21 19:35:49 +03:00
Kalle Olavi Niemitalo
ee182ced2b dump: Unify detection of fullwidth characters
In DUMP_FUNCTION_SPECIALIZED (used by elinks --dump), detect the
second cell of double-cell (aka fullwidth) characters by comparing to
UCS_NO_CHAR, like add_document_to_string does.  Don't use
unicode_to_cell for this any more.

Also, ignore the colors and attributes of the second cell; don't
output any escape sequences for them.
2009-06-21 19:35:49 +03:00
Kalle Olavi Niemitalo
f0c88e1960 dump: One #if for declarations and another for statements 2009-06-21 19:35:49 +03:00
Kalle Olavi Niemitalo
417dcba57f dump: Rename result variables to error
Because 0 in them means OK and nonzero (currently -1) means an error.
2009-06-19 12:48:55 +03:00
Miciah Dashiel Butler Masters
874202ef7a Don't fail assertion on 0-second meta-refresh
In start_document_refresh, use register_bottom_half instead of
install_timer if the timeout is 0 because install_timer asserts that it is
given a delay greater than 0.

Add a test case, test/refresh-0timeout.html.  Note that
document.browse.minimum_refresh_time must be set to 0 to reproduce the
assertion failure.
2009-06-18 18:13:25 +00:00
Miciah Dashiel Butler Masters
2b1aedf6d1 Cache manager: Add 'Search contents' button
Add a 'Search contents' button to the cache manager that searches
through the cache items' data rather than their metadata.

Add match_cache_entry_contents.

Add push_cache_hierbox_search_button and
push_cache_hierbox_search_contents_button, which call
push_hierbox_search_button after setting box->ops to either
cache_entry_listbox_ops or cache_entry_listbox_ops_match_contents,
respectively, which define the appropriate match callback for the
hierbox search code.

Add strlcasestr, used in the new match_cache_entry_contents routine.
2009-06-18 18:09:19 +00:00
Miciah Dashiel Butler Masters
0ad5b642b4 Cache manager: Add "Invalidate" button
Add an "Invalidate" button to the cache manager, which is useful when
a cache entry is locked and cannot be deleted but one does not want
ELinks to use that cache entry.
2009-06-18 17:59:37 +00:00
Kalle Olavi Niemitalo
822e9d6921 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	NEWS
	po/fr.po: kept version from elinks-0.13
	src/viewer/dump/dump.c
2009-06-12 23:18:46 +03:00
Kalle Olavi Niemitalo
dedd01c970 dump: More const
This is especially useful for showing that neither dump_truecolor_utf8
nor dump_truecolor_unibyte modifies its static color[] variable and it
therefore does not matter whether those functions use the same array
or not.
2009-06-09 03:48:40 +03:00
Kalle Olavi Niemitalo
bdcbb9f667 dump: Move local variable to reduce nesting 2009-06-09 03:39:23 +03:00
Kalle Olavi Niemitalo
79ea8d087d dump: Elide trailing spaces in UTF-8 mode too 2009-06-09 03:39:17 +03:00
Kalle Olavi Niemitalo
952c6fa8aa bug 1080: Fold UTF-8 and unibyte dumping together
With all the comments and macros needed for this, the source files
don't become much shorter, but anyway I hope they'll be easier to
maintain this way.
2009-06-09 01:17:06 +03:00
Kalle Olavi Niemitalo
596a7cbd9b bug 1080: Implement color modes for UTF-8 dumping 2009-06-09 00:07:38 +03:00
Kalle Olavi Niemitalo
35a091e8f0 bug 1080: Move common code to dump_references()
This code was included in four variants of dump_to_file().
Move it to a new function dump_references() and make dump_to_file()
then call that.  This makes the code size a little smaller.
The time cost will be negligible.
2009-06-09 00:07:38 +03:00
Kalle Olavi Niemitalo
200e36c002 bug 1080: Fold dump_color_mode* functions together
Instead of having four separate function definitions, have just one
sprinkled with #ifdefs, and #include that four times.  The purpose
being to make it clearer which parts of these functions are identical
and which ones differ.

As a side effect, this change makes ELinks ignore --dump-color-mode
when dumping in UTF-8.  Colourful UTF-8 dumping has not been
implemented and the fallback is now different from before.
2009-06-09 00:06:10 +03:00
Kalle Olavi Niemitalo
da4bd42e43 bug 1017: Disable protocol.http.compression by default
To work around buggy servers until bug 1017 has actually been fixed,
i.e., ELinks reports decompression errors to the user.
2009-06-07 12:49:41 +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
Kalle Olavi Niemitalo
681e377027 Debian bug 528661: Check for gnutls_priority_set_direct
Avoid compilation error with GNUTLS 1.2.9:

/home/Kalle/src/elinks-0.12/src/network/ssl/ssl.c:258: error: implicit declaration of function ‘gnutls_priority_set_direct’

If the function is not available, use gnutls_set_default_priority instead.
Perhaps it'll work with bugzilla.novell.com, perhaps not.
2009-05-30 14:34:01 +03:00
Witold Filipczyk
864fa0b56a Debian bug 528661: Disable some TLS extensions on GNUTLS.
- gnutls_handshake_set_private_extensions: Do not enable private cipher
  suites that might not be supported by anything other than GNUTLS.
  The GNUTLS 2.8.0 documentation notes that enabling these extensions
  can cause interoperability problems.
- gnutls_set_default_priority: Explicitly disable OpenPGP certificates.
- gnutls_certificate_type_set_priority: Do not enable OpenPGP certificates.
  The GNUTLS 2.8.0 documentation notes that OpenPGP certificate support
  requires libgnutls-extra.  Because libgnutls-extra 2.2.0 and later are
  under GPLv3-or-later and thus not GPLv2 compatible, ELinks doesn't use
  libgnutls-extra, so OpenPGP certificates didn't work anyway.
- gnutls_server_name_set: Do not tell the server the hostname from the URL.
  This was supposed to let the server choose the appropriate certificate
  for each name-based virtual host, but ELinks actually always sent just
  "localhost", so it didn't work anyway.  This will have to be revisited
  when ELinks is changed to actually verify the subject name from the
  server's certificate (ELinks bug 1024).

These changes should help ELinks negotiate SSL with bugzilla.novell.com.

[NEWS and commit message by me.  --KON]
2009-05-30 11:21:17 +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
Kalle Olavi Niemitalo
b6aca8d9a7 Add tests for utf8_step_forward
I am not hooking these to "make test", for two reasons:

1. utf8_step_forward is inside #ifdef CONFIG_UTF8 and I don't see
   how to make tests conditional on such options.

2. test/libtest.sh was copied from Git, which is under GPLv2-only.
   Adding more dependencies on it could make ELinks more difficult
   to relicense under GPLv2-or-later.
2009-05-27 01:11:03 +03:00
Kalle Olavi Niemitalo
5aae1b81cc Define die() with __attribute__((noreturn))
This will prevent some compiler warnings in the test I'm about to
commit.
2009-05-27 01:11:03 +03:00
Kalle Olavi Niemitalo
6d7b904fe3 Don't overcount in utf8_step_forward
Reported by witekfl.
2009-05-27 01:11:02 +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
d16e0c974f Use cache if at all possible if CACHE_MODE_ALWAYS
In load_uri, if there is no valid cache entry and no existing connection
for the requested URI, make one last check in case there is an
incomplete cache entry.
2009-05-22 23:09:07 +00:00
Miciah Dashiel Butler Masters
60c50ea378 Fix a compilation error.
Fix another silly error that I introduced in commit
3334efb32c.
2009-05-22 21:54:47 +00:00
Miciah Dashiel Butler Masters
30a8d2faed Fix compilation error in src/bfu/listbox.c
Fix a silly error introduced by me in commit
66e1baec77.
2009-05-22 21:48:10 +00:00
Miciah Dashiel Butler Masters
bd752e95ad get_search_region_from_search_nodes: add comment
Document why we add pattern_len to doclen.
2009-05-22 20:39:47 +00:00
Miciah Dashiel Butler Masters
812c4bafc1 get_search_region_from_search_nodes: simplify
Simplify the end-of-line check in get_search_region_from_search_nodes by
relying on the fact that the n member of an instance of struct search
that marks the end of a line will be 0.
2009-05-22 20:26:32 +00:00
Miciah Dashiel Butler Masters
aafebad3f5 Document struct search 2009-05-22 20:24:34 +00:00
Miciah Dashiel Butler Masters
da838a9317 Include last character of document in search range
Allow searching on the last character of the document.  Plain-text searches
already match on the last character as long as it isn't the first character
of a match, and regular-expression searches match on the last character if
the search pattern is longer than 1 character, so the problem addressed by
this commit is very much a corner case.

This commit reverts a portion of commit
fd15049622594d151104d43917984c7ce10993e6 (CVS revision 1.17).
2009-05-22 20:19:59 +00:00
Miciah Dashiel Butler Masters
8d8ff02bbf Fix behaviour for search-toggle-regex
text_typeahead_handler: Document that passing -2 for action_id will cause
a search without error reporting.  This behaviour is unintentionally the
current behaviour of text_typeahead_handler, but now it is documented so
that it can be used.

input_line_event_handler: When rewinding, pass -2 for the action_id
parameter to the handler instead of passing again whatever action led to
the rewinding.

The old behavior of input_line_event_handler was particularly problematic
with the search-toggle-regex action and the text_typeahead_handler handler:
input_line_event_handler would call the handler with
ACT_EDIT_SEARCH_TOGGLE_REGEX, and the handler would toggle the setting and
perform the search again; then if the search string no longer matched
anything, the handler would return INPUT_LINE_REWIND to
input_line_event_handler, which would rewind and call the handler with
ACT_EDIT_SEARCH_TOGGLE_REGEX again, thus toggling the option back to the
original setting.

With the new behaviour, input_line_event_handler will not repeat the same
action when re-invoking the handler; in the above example with
search-toggle-regex, the search string will simply be rewound until it
matches with the new setting.
2009-05-22 20:15:52 +00:00
Miciah Dashiel Butler Masters
0ced0c9851 do_typeahead: restructure.
Reduce indentation, eliminate a goto, and make the code a little clearer
(IMO).
2009-05-22 20:11:26 +00:00
Miciah Dashiel Butler Masters
d17a632417 field_op: use goto_link (micro-optimisation)
Use the newly introduced goto_link instead of goto_current_link in field_op
since field_op already looks up the current link.
2009-05-22 20:05:16 +00:00
Miciah Dashiel Butler Masters
9e5d79a803 Follow right link when link onClick changes docs
When a link had an onClick event handler that changed the current
document and that link was clicked, ELinks would follow the current link
of the document displayed after executing the handler instead of the
link that was clicked.

Factor goto_link out of goto_current_link.

Use goto_link instead of goto_current_link in activate_link to ensure that
the link that is passed in by enter() is followed.
2009-05-22 20:00:59 +00:00
Miciah Dashiel Butler Masters
76de375d3d Do not redraw listbox when deleting invisible item
In done_listbox_item, do not call update_hierbox_browser if the item
that is being deleted was not visible.
2009-05-22 19:58:41 +00:00
Miciah Dashiel Butler Masters
66e1baec77 Fix hierbox line characters WRT item visibility
Hierarchical listboxes draw items with upper-left corner, lower-left
corner, or horizontal border characters to indicate whether a given item is
the first item in a listbox, the last, or any other, respectively.
However, the wrong character can be drawn if there are invisible items: if
an item is the first (or last) visible item but there is an invisible item
before (or after) it, it will be drawn with a horizontal border character,
not a corner.

This patch fixes that problem using traverse_listbox_items_list in
display_listbox_item to ignore invisible items when determining whether
an item is either the first or the last among its siblings.
2009-05-22 19:53:45 +00:00
Miciah Dashiel Butler Masters
f1dee0d04f Drop special handling of ctrl-l
Drop special handling of ctrl-l in handle_interlink_event.

To make sure that the 'redraw' action works everywhere, first modify
menu_kbd_handler and mainmenu_kbd_handler to handle ACT_MENU_REDRAW; and
second, drop the ACTION_REQUIRE_VIEW_STATE flag from the 'redraw' action in
the 'main' keymap so that it works even if there is no document loaded.

Ctrl-l is already bound to 'redraw' in all keymaps by default, so the
current default behaviour is preserved.
2009-05-22 19:50:28 +00:00
Miciah Dashiel Butler Masters
3334efb32c Add support for ECMA-48 SGR italic
Add 'Italic' checkbox to Terminal options dialog box.

Enable italic text by default for rxvt-unicode (and also enable
frames, 88-colour mode, and underline).
2009-05-22 19:48:59 +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
Kalle Olavi Niemitalo
82e67f8ebc Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/intl/charsets.h
	src/viewer/text/search.c
2009-05-21 19:50:16 +03:00
Kalle Olavi Niemitalo
0c756fc3e8 TRE: Check for 32-bit wchar_t at configure time
This check used to be in src/elinks.h.  Move it to configure.in so
that (1) the result can be logged and (2) ELinks won't even link with
TRE if wchar_t prevents its use.

Also, rename HAVE_TRE_REGEX_H to CONFIG_TRE, to reflect that it is not
always defined if the header exists.
2009-05-21 17:22:12 +03: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
e3ce7e4274 Bug 1070: Add fbterm to terminal options dialog box 2009-04-26 18:43:53 +03:00
Witold Filipczyk
7751102ce7 Bug 1070: Support for fbterm.
fbterm uses different 256 color sequences than xterm.
color256_seqs are part of the driver info.
2009-04-26 18:12:00 +03:00
Kalle Olavi Niemitalo
6dfc25f5d2 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	NEWS
	src/config/options.c (session-specific options vs. TERM_* constants)
2009-04-26 17:16:00 +03:00
Kalle Olavi Niemitalo
8acf2e36c3 big dialogs: Always show help in terminal options dialog
We now have scrollable dialog boxes so the height check is no longer
necessary.
2009-04-26 17:07:03 +03:00
Kalle Olavi Niemitalo
35acde4a10 big dialogs: fix unused term in dlg_format_text_do
Fix this error when configured with --enable-debug --disable-utf-8:

      [CC]   src/bfu/text.o
cc1: warnings being treated as errors
/home/Kalle/src/elinks-0.13/src/bfu/text.c: In function ‘dlg_format_text_do’:
/home/Kalle/src/elinks-0.13/src/bfu/text.c:220: error: unused variable ‘term’
2009-04-26 17:07:02 +03:00
Kalle Olavi Niemitalo
fe8cd7d7ba big dialogs: fix unused term in dlg_format_buttons
Fix this error when configured with --enable-debug --disable-utf-8:

      [CC]   src/bfu/button.o
cc1: warnings being treated as errors
/home/Kalle/src/elinks-0.13/src/bfu/button.c: In function ‘dlg_format_buttons’:
/home/Kalle/src/elinks-0.13/src/bfu/button.c:122: error: unused variable ‘term’
2009-04-26 17:07:02 +03:00
Kalle Olavi Niemitalo
a91a08f82b Named constants in terminal option defaults
When setting up default values for terminal options, use named
constants like TERM_VT100 or COLOR_MODE_16, rather than plain integers
like 1.  This is just to make the source code easier to read and
perhaps more resistant to future bugs.  The binary should not change.
2009-04-19 20:32:37 +03:00
Kalle Olavi Niemitalo
5e0032551b Fix out-of-memory crash in globhist
If globhist_simple_search ran out of memory in stracpy(search_url), it
could leave gh_last_searched_title pointing to freed memory and cause
a crash in the next call.  Fix by not freeing gh_last_searched_title.
It is then possible to have gh_last_searched_title and
gh_last_searched_url pointing to strings from different searches;
but that was already possible if stracpy(search_title) failed.

Because this bug occurs only in out-of-memory situations and I don't
think ELinks in general has been properly tested in those, the fix is
perhaps not worth mentioning in NEWS and backporting to elinks-0.11.
2009-04-19 20:25:37 +03:00
Kalle Olavi Niemitalo
b4567b402b Bug 1071: Add precautionary assertions and recovery 2009-04-05 20:59:41 +03:00
Miciah Dashiel Butler Masters
6a8e0ccd9b Lua: Report bad arguments to edit_bookmark_dialoga
If edit_bookamrk_dialogs is given the wrong number or types of
arguments, report the problem to the user instead of failing silently.
2009-04-05 12:57:35 +00:00
Kalle Olavi Niemitalo
b7f45ca80b Bug 1071: Add NULL check in get_dom_node_list_index
If the parent parameter of get_dom_node_list_index referred to a node
that did not have children, then get_dom_node_list called by it could
return the address of a null pointer, and get_dom_node_list_index would
then pass that null pointer to get_dom_node_list_pos, which would crash.
That would be the same kind of crash as the one in get_dom_node_child.
It never happened in practice though: because all calls are in the form
get_dom_node_list_index(node->parent, node), the list must contain at
least the given node, and the pointer cannot be null.  The documentation
of get_dom_node_list_index allows arbitrary nodes as arguments however,
so it's best to add a check.
2009-04-04 22:41:43 +03:00
Kalle Olavi Niemitalo
0c1a27ee99 Bug 1071: Document get_dom_node_value return values 2009-04-04 22:38:56 +03:00
Kalle Olavi Niemitalo
8465b19d0c Bug 1071: Fix null-ptr crash in get_dom_node_child
struct dom_node contains a union that contains various structs that
have members of type struct dom_node * in them.
get_dom_node_list_by_type returns the address (struct dom_node **) of
one of those members, or NULL.  However the member itself can also be
NULL if no nodes have been added to the list and the list has thus not
yet been allocated.  (add_to_dom_node_list lazily allocates the lists.)
get_dom_node_child did not expect a null pointer there and crashed, as
shown in bug 1071.  Fix by adding a check so that it treats a NULL list
as an empty list.
2009-04-04 21:56:53 +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
1bb71f3732 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/config/conf.c
	src/network/ssl/ssl.c
2009-03-12 08:46:02 +02:00
Kalle Olavi Niemitalo
5a43c55c9e Rewrap lines in option documentation.
Documentation strings of most options used to contain a "\n" at the
end of each source line.  When the option manager displayed these
strings, it treated each "\n" as a hard newline.  On 80x24 terminals
however, the option description window has only 60 columes available
for the text (with the default setup.h), and the hard newlines were
further apart, so the option manager wrapped the text a second time,
resulting in rather ugly output where long lones are interleaved with
short ones.  This could also cause the text to take up too much
vertical space and not fit in the window.

Replace most of those hard newlines with spaces so that the option
manager (or perhaps BFU) will take care of the wrapping.  At the same
time, rewrap the strings in source code so that the source lines are
at most 79 columns wide.

In some options though, there is a list of possible values and their
meanings.  In those lists, if the description of one value does not
fit in one line, then continuation lines should be indented.  The
option manager and BFU are not currently able to do that.  So, keep
the hard newlines in those lists, but rewrap them to 60 columns so
that they are less likely to require further wrapping at runtime.
2009-03-08 15:18:10 +02:00
Kalle Olavi Niemitalo
a277c0ad3b Wrap option descriptions in --config-help, --long-help 2009-03-08 13:29:51 +02:00
Kalle Olavi Niemitalo
bd5d3a173f Add wrap_option_desc() in conf.c, still static
Move the description wrapping code from smart_config_output_fn()
to a separate function wrap_option_desc() so that --config-help
can soon use it too.
2009-03-08 13:29:51 +02:00
Kalle Olavi Niemitalo
8ad32809e1 bug 153, 1066: Fix search in bookmark manager.
test_search() was supposed to compare bookmark titles with
strcasestr(), but in commit 311d95358d
"bug 153, 1066: Convert bookmarks to/from UTF-8 when searching."
on 2009-02-08, I inadvertently changed that to strcasecmp(), even
while adding a comment about why strcasestr() is needed.  strcasestr()
returns non-NULL if the strings match, and strcasecmp() returns
nonzero if they differ, so the search didn't work at all.
2009-03-01 09:21:29 +02:00
Kalle Olavi Niemitalo
3581e2848e Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	doc/installation.txt
	src/protocol/http/http.c
2009-02-28 18:22:54 +02:00
Kalle Olavi Niemitalo
1487d206db Bug 1069: Revert "1031: JS_SetErrorReporter only once per JSRuntime."
This reverts commit b94657869b.
I don't know where I got the idea that JS_SetErrorReporter affects the
entire JSRuntime, rather than only the provided JSContext.  The people
on #jsapi say it has never worked that way.
2009-02-26 22:56:33 +02:00
Miciah Dashiel Butler Masters
e9370fe5b9 Comment the last change 2009-02-25 01:54:36 +00:00
Miciah Dashiel Butler Masters
44dc9a1f46 Comment the last change 2009-02-25 01:54:16 +00:00
Miciah Dashiel Butler Masters
f11b2a8f97 utf8_to_jsstring: Don't free mem handed over to JS
In utf8_to_jsstring, do not free the string that is passed to
JS_NewUCString if the latter is successful; if it is, SpiderMonkey
handles the memory from then on.

Use libc routines instead of ELinks's routines to allocate and free the
string so that ELinks's memory debugging code does not try to keep track
of it after it has been handed to SpiderMonkey.

This commit fixes a bug introdued in
97d72d15a0.
2009-02-25 01:45:56 +00:00
Miciah Dashiel Butler Masters
50ff8fd835 utf8_to_jsstring: Don't free mem handed over to JS
In utf8_to_jsstring, do not free the string that is passed to
JS_NewUCString if the latter is successful; if it is, SpiderMonkey
handles the memory from then on.

Use libc routines instead of ELinks's routines to allocate and free the
string so that ELinks's memory debugging code does not try to keep track
of it after it has been handed to SpiderMonkey.

This commit fixes a bug introdued in
97d72d15a0.
2009-02-25 01:37:13 +00:00
Kalle Olavi Niemitalo
39707c4102 Rewrap protocol.http.compression doc to 59 columns
This makes the option manager display it much better on an 80x24
terminal.

Alternatively, the "\n" newline characters within paragraphs could
have been removed entirely.  ELinks would then have line-wrapped the
text to the appropriate width in the info window of the option
manager, but unfortunately not in --config-help.
2009-02-22 21:28:14 +02:00
Kalle Olavi Niemitalo
2a7346d371 Tone down the protocol.http.compression warning
AFAIK, all bugs in it have been fixed.  Some bugs may still be lurking
but they are more likely to get caught if compression is enabled.

I also replaced COMP_NOTE with static text because xgettext does not
support macros in the argument of N_.
(cherry picked from commit 3a9b5d091d)
2009-02-22 20:55:05 +02:00
Petr Baudis
a7f94dbbd1 Introduce protocol.http.compression knob
When disabled, no Accept-Encoding header is sent.
(cherry picked from commit d4cec950ec)

Conflicts:

	src/protocol/http/http.c
2009-02-22 20:17:53 +02:00
Miciah Dashiel Butler Masters
84259ff26a Fix crash on search-toggle-regex when RE disabled
Check the return value of get_opt_rec on "document.browse.search.regex"
before dereferencing it.  The option is not there if regular expression
support is disabled at build time.

This commit fixes a bug introduced in commit
b2d51c75ff0d6c52a4f6a2761801beb641cba3a2.
2009-02-22 04:06:51 +00:00
Miciah Dashiel Butler Masters
b81821a21c Fix crash on search-toggle-regex when RE disabled
Check the return value of get_opt_rec on "document.browse.search.regex"
before dereferencing it.  The option is not there if regular expression
support is disabled at build time.

This commit fixes a bug introduced in commit
b2d51c75ff0d6c52a4f6a2761801beb641cba3a2.
2009-02-22 04:00:05 +00:00
Witold Filipczyk
4a2fd2d964 Fallback to the raw deflate only when nothing was decompressed so far.
It lets view the site from bug 1017.
(cherry picked from commit 3131de4767)

Conflicts:

	src/protocol/http/http.c
2009-02-21 14:12:03 +01:00
Witold Filipczyk
3131de4767 Fallback to the raw deflate only when nothing was decompressed so far.
It lets view the site from bug 1017.
2009-02-21 12:27:01 +01:00
Witold Filipczyk
53ab6d493e bug 1068: Decompress data when the socket is closed.
The reasons why the decompression failed:
- the server gave wrong Content-Length
- the socket was closed
2009-02-21 10:36:44 +01:00
Witold Filipczyk
391394063f bug 1068: Decompress data when the socket is closed.
The reasons why the decompression failed:
- the server gave wrong Content-Length
- the socket was closed
2009-02-20 14:11:15 +01: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
ece4bfcc28 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/document/dom/renderer.c (split into rss.c, source.c)
2009-02-15 05:08:06 +02:00
Kalle Olavi Niemitalo
d14f65a331 bug 1067: Comments about freeing the DOM document node. 2009-02-15 04:27:39 +02:00
Kalle Olavi Niemitalo
eb820a57a6 bug 1067: Assertions and comments about done_dom_node().
In bug 1067, dom_rss_pop_document() freed a node with done_dom_node()
even though call_dom_node_callbacks() was still using that node.  This
made call_dom_node_callbacks() read a function pointer from beyond the
end of an array and call that.  Add assertions to detect out-of-range
node types, and comments to warn about the bug.
2009-02-15 03:39:00 +02:00
Witold Filipczyk
f77748299b bug 1067: Fix for elinks-0.13. 2009-02-12 10:05:35 +01:00
Witold Filipczyk
9054e57c55 Merge branch 'elinks-0.12'
Conflicts:
	src/document/dom/renderer.c
2009-02-12 10:01:57 +01:00
Witold Filipczyk
a7c2f14e6d bug 1067: the node was freed, but still used. 2009-02-12 09:48:04 +01:00
Kalle Olavi Niemitalo
7067fc7af9 Check for JS_ReportAllocationOverflow before using it.
Debian libmozjs-dev 1.9.0.4-2 has JS_ReportAllocationOverflow but
js-1.7.0 reportedly hasn't.  Check at configure time whether that
function is available.  If not, use JS_ReportOutOfMemory instead.

Reported by Witold Filipczyk.
2009-02-08 23:07:22 +02: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
Witold Filipczyk
664048098a Bug 1060: #undef HAVE_TRE_REGEX_H only in elinks.h
I didn't read the code of the tre library, but I suppose that when sizes of
wchar_t and unicode_val_T are equal it will work fine.

[ From bug 1060 attachment 508.  --KON ]
2009-02-08 18:26:22 +02:00
Witold Filipczyk
c5a7f87c43 Bug 1060: Use libtre for regexp searches.
When the user tells ELinks to search for a regexp, ELinks 0.11.0
passes the regexp to regcomp() and the formatted document to
regexec(), both in the terminal charset.  This works OK for unibyte
ASCII-compatible charsets because the regexp metacharacters are all in
the ASCII range.  And ELinks 0.11.0 doesn't support multibyte or
ASCII-incompatible (e.g. EBCDIC) charsets in terminals, so it is no
big deal if regexp searches fail in such locales.

ELinks 0.12pre1 attempts to support UTF-8 as the terminal charset if
CONFIG_UTF8 is defined.  Then, struct search contains unicode_val_T c
rather than unsigned char c, and get_srch() and add_srch_chr()
together save UTF-32 values there if the terminal charset is UTF-8.
In plain-text searches, is_in_range_plain() compares those values
directly if the search is case sensitive, or folds them to lower case
if the search is case insensitive: with towlower() if the terminal
charset is UTF-8, or with tolower() otherwise.  In regexp searches
however, get_search_region_from_search_nodes() still truncates all
values to 8 bits in order to generate the string that
search_for_pattern() then passes to regexec().  In UTF-8 locales,
regexec() expects this string to be in UTF-8 and can't make sense of
the truncated characters.  There is also a possible conflict in
regcomp() if the locale is UTF-8 but the terminal charset is not, or
vice versa.

Rejected ways of fixing the charset mismatches:

* When the terminal charset is UTF-8, recode the formatted document
  from UTF-32 to UTF-8 for regexp searching.  This would work if the
  terminal and the locale both use UTF-8, or if both use unibyte
  ASCII-compatible charsets, but not if only one of them uses UTF-8.

* Convert both the regexp and the formatted document to the charset of
  the locale, as that is what regcomp() and regexec() expect.  ELinks
  would have to somehow keep track of which bytes in the converted
  string correspond to which characters in the document; not entirely
  trivial because convert_string() can replace a single unconvertible
  character with a string of ASCII characters.  If ELinks were
  eventually changed to use iconv() for unrecognized charsets, such
  tracking would become even harder.

* Temporarily switch to a locale that uses the charset of the
  terminal.  Unfortunately, it seems there is no portable way to
  construct a name for such a locale.  It is also possible that no
  suitable locale is available; especially on Windows, whose C library
  defines MB_LEN_MAX as 2 and thus cannot support UTF-8 locales.

Instead, this commit makes ELinks do the regexp matching with regwcomp
and regwexec from the TRE library.  This way, ELinks can losslessly
recode both the pattern and the document to Unicode and rely on the
regexp code in TRE decoding them properly, regardless of locale.

There are some possible problems though:

1. ELinks stores strings as UTF-32 in arrays of unicode_val_T, but TRE
   uses wchar_t instead.  If wchar_t is UTF-16, as it is on Microsoft
   Windows, then TRE will misdecode the strings.  It wouldn't be too
   hard to make ELinks convert to UTF-16 in this case, but (a) TRE
   doesn't currently support UTF-16 either, and it seems possible that
   wchar_t-independent UTF-32 interfaces will be added to TRE; and (b)
   there seems to be little interest on using ELinks on Windows anyway.

2. The Citrus Project apparently wanted BSD to use a locale-dependent
   wchar_t: e.g. UTF-32 in some locales and an ISO 2022 derivative in
   others.  Regexp searches in ELinks now do not support the latter.

[ Adapted to elinks-0.12 from bug 1060 attachment 506.
  Commit message by me.  --KON ]
2009-02-08 18:26:22 +02:00
Kalle Olavi Niemitalo
264a66fe4d bug 153: UTF-8 bookmark.title has been fully implemented.
Mention it in NEWS too.
2009-02-08 18:26:21 +02:00
Kalle Olavi Niemitalo
311d95358d bug 153, 1066: Convert bookmarks to/from UTF-8 when searching. 2009-02-08 18:26:21 +02:00
Kalle Olavi Niemitalo
8c0fa7f09c bug 153, 1066: Convert strings to edit-bookmark dialog from UTF-8. 2009-02-08 18:26:21 +02:00
Kalle Olavi Niemitalo
5a29dbc4a1 bug 153, 1066: Convert strings to bookmark info dialog from UTF-8. 2009-02-08 18:26:20 +02:00
Kalle Olavi Niemitalo
b3acd2a5bc bug 153: Convert titles in bookmark manager from UTF-8. 2009-02-08 18:26:20 +02:00
Kalle Olavi Niemitalo
b3f9d48bba bug 153, 1066: Convert strings from add-bookmark dialogs to UTF-8.
In src/bookmarks/dialogs.c, do_add_bookmark() gets the title and URL
in the terminal charset and needs to know which one that is.  When a
bookmark is being added, save the struct terminal * to dialog.udata2
and read the charset from there.  When a bookmark is being edited,
dialog.udata2 is needed for the struct bookmark *, but there we always
have the parent struct dialog_data * in dialog.udata and can get the
terminal from that.
2009-02-08 18:26:19 +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