1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-19 01:36:33 -04:00
Commit Graph

2267 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
a0d624cd61 Hurd bug 22861: Do not select() exceptions from pipes.
The GNU Hurd has a bug that can make select() report an exception in a
pipe even though none has actually occurred.  The typical result is
that ELinks closes the pipe through which it internally passes all
input events, such as keypresses.  It then no longer reacts to what
the user is trying to do.

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

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

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

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

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

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

Reported by Witold Filipczyk.
2008-09-07 06:31:36 +03:00
Kalle Olavi Niemitalo
7de8b9940c Bug 1013: Fix type mismatches in gopher.c
When I replaced enum connection_state with struct connection_state,
I missed parts of src/protocol/gopher/gopher.c.  Finish the change there.
2008-09-04 11:57:03 +03:00
Kalle Olavi Niemitalo
b7d3b4f687 1041: Add ftp_add_unparsed_line: HTML entities and more error checks.
Separate the formatting of unparsed lines from ftp_process_dirlist()
to a new function ftp_add_unparsed_line().  Check for all possible
out-of-memory errors.  Encode HTML metacharacters as entity references
and document how charsets are handled FTP directory listings.
Add a NEWS entry.
2008-09-04 11:21:06 +03:00
Witold Filipczyk
298f3af6c6 1041: Do not show the "Error parsing" on ftp://sunsite.icm.edu.pl/. 2008-09-04 10:24:42 +03:00
Kalle Olavi Niemitalo
018af50f1d Rename cache_entry.id and related members.
cache_entry.id => cache_entry.cache_id
document.id => document.cache_id
ecmascript_interpreter.onload_snippets_owner => .onload_snippets_cache_id

This is a combination of:

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

commit 6007043458bf8f14abfc18b9db60785bdc0279f6
Revert addition of document.document_id
2008-08-03 21:27:56 +03:00
Kalle Olavi Niemitalo
c1ffba2f95 Work around fsp_open_session() not setting errno.
fsp_open_session() has a bug where it does not set errno if getaddrinfo fails.
Before the bug 1013 fix, this caused an assertion failure.
After the bug 1013 fix, this caused a "Success" error message.
Now it instead causes "FSP server not found".
2008-08-03 20:26:50 +03:00
Kalle Olavi Niemitalo
6c2e8cd7b2 Bug 1013: Don't assume errno is between 0 and 100000
Replace almost all uses of enum connection_state with struct
connection_status.  This removes the assumption that errno values used
by the system are between 0 and 100000.  The GNU Hurd uses values like
ENOENT = 0x40000002 and EMIG_SERVER_DIED = -308.

This commit is derived from my attachments 450 and 467 to bug 1013.
2008-08-03 17:56:41 +03:00
Kalle Olavi Niemitalo
abe4927d69 1022: NEWS and option documentation 2008-07-27 20:11:39 +03:00
Witold Filipczyk
2e1983ce93 1022: Fixes issue with mbank.
New patch, fixes issue with mbank's certificate verification.
2008-07-27 17:15:36 +03:00
Kalle Olavi Niemitalo
a83ff1f565 1040: Blacklist servers that support SSL3 but not TLS1.
It seems GnuTLS is not as good at negotiating a supported protocol as
OpenSSL is.  ELinks tries to work around that by retrying with a
different protocol if the SSL library reports an error.  However,
ELinks must not automatically retry POST requests where some data may
have already reached the server; POST is not a safe method in HTTP.
So instead, collect the name of the TLS-incapable server in a blacklist
when ELinks e.g. loads an HTML form from it; the actual POST can then
immediately use the protocol that worked.

It's a bit ugly that src/network/socket.c now uses
protocol/http/blacklist.h.  It might be better to move the blacklist
files out of the http directory, and perhaps merge them with the
BitTorrent blacklisting code.
2008-07-27 01:39:01 +03:00
Jonas Fonseca
5ef63a5d01 Drop unneeded include.
(cherry picked from commit fe7c163c45f32800632939b8d161844deb9a8465)
2008-07-26 15:57:20 +03:00
Kalle Olavi Niemitalo
6b9be71150 1018: Avoid assertion failure in SELECT pop-up for non-current tab
Check in refresh_view() whether the tab is still current; if not, skip
the draw_doc() and draw_frames() calls because draw_current_link()
called within them asserts that the tab is current.  However, do
always call print_screen_status(), because that handles non-current
tabs correctly too.

I think it was not yet possible to trigger the assertion failure with
setTimeout, because input.value modifications by ECMAScript do not
trigger a redraw (bug 1035).
2008-07-22 12:13:27 +03:00
Witold Filipczyk
7116daf43e 1038: Remove remembering last 8 URLs. It did not work.
Enable the rate limiting of opening new windows in SEE
to be consistent with SpiderMonkey.
Fixed a possible memleak (the frame variable).
2008-07-21 00:39:30 +03:00
Kalle Olavi Niemitalo
327fc1e46e 1034: NEWS, comments, and tests 2008-07-20 14:34:12 +03:00
Kalle Olavi Niemitalo
b9d48ad7e8 1034: Initialize l in deflate_read to shut up GCC
Avoid this warning:

      [CC]   src/encoding/deflate.o
cc1: warnings being treated as errors
/home/Kalle/src/elinks-0.12/src/encoding/deflate.c: In function ‘deflate_read’:
/home/Kalle/src/elinks-0.12/src/encoding/deflate.c:96: warning: ‘l’ may be used uninitialized in this function
2008-07-20 14:34:11 +03:00
Witold Filipczyk
e213a91bad 1034: Fixed deflate decompression.
First try decompress in zlib format.
If this fails, restart with the raw deflate.
Works for both blogs.msdn.com and for URL of the bug 1034.
2008-07-20 13:58:11 +03:00
Kalle Olavi Niemitalo
83ccaa3673 Bug 698: Keep forms contiguous and non-overlapping and start from 0.
In document.forms, each struct form has form_num and form_end members
that reserve a subrange of [0, INT_MAX] to that form.  Previously,
multiple forms in the list could have form_end == INT_MAX and thus
overlap each other.  Prevent that by adjusting form_end of each form
newly added to the list.

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

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

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

(cherry picked from commit 386a5d517b)
2008-07-20 11:46:01 +03:00
Kalle Olavi Niemitalo
85bfba4530 SEE: Do not check thisobj->objectclass in window functions.
init_js_window_object() copies the alert, open, and setTimeout methods
from the window object to the global object.  My fix for bug 846 on
2006-12-10 incorrectly made the corresponding C functions refuse to
work if they were not called as methods of the window object.
2008-07-20 09:26:52 +03:00
Kalle Olavi Niemitalo
ae8080b172 952, 954: Finalize form_view.ecmascript_obj for SEE 2008-07-19 14:58:11 +03:00
Kalle Olavi Niemitalo
c81e2051f8 952, 954: Finalize form_state.ecmascript_obj for SEE 2008-07-19 14:58:11 +03:00
Kalle Olavi Niemitalo
f4213ac350 952, 954: Finalize form_view.ecmascript_obj for SpiderMonkey 2008-07-19 14:58:07 +03:00
Kalle Olavi Niemitalo
2d49f6e9cd 952, 954: Finalize form_state.ecmascript_obj for SpiderMonkey
JSObject instances of input_class now again contain a private pointer
directly to struct form_state.  This pointer is cleared or updated
when appropriate.
2008-07-19 14:57:25 +03:00
Kalle Olavi Niemitalo
759fbb1142 952, 954: Add ecmascript_detach_form_view stub
Anything that frees struct form_view must now call the new function
ecmascript_detach_form_view.  This function should then clear out any
dangling pointers, but that has not yet been implemented.
2008-07-18 20:00:16 +03:00
Kalle Olavi Niemitalo
bbadb99dd1 952, 954: Add ecmascript_{detach,moved}_form_state stubs
Anything that frees or reallocates struct form_state must now call the
new functions ecmascript_detach_form_state or ecmascript_moved_form_state.
These functions should then clear out any dangling pointers, but that has
not yet been implemented.
2008-07-18 19:56:49 +03:00
Kalle Olavi Niemitalo
8f2f9e7265 952, 954: Add spidermonkey_empty_context 2008-07-18 19:24:29 +03:00
Kalle Olavi Niemitalo
5ad675e244 Remove my comment about prefixes used with SpiderMonkey 2008-07-18 19:01:48 +03:00
Witold Filipczyk
e9f3a4a9d3 1033: Fixed memory leak in open(...). 2008-07-16 16:38:50 +03:00
Kalle Olavi Niemitalo
031c1e6143 1031: Replace jsrt with spidermonkey_runtime
src/ecmascript/spidermonkey/ now uses a JSRuntime managed by
spidermonkey-shared.c.
2008-07-16 14:50:41 +03:00
Kalle Olavi Niemitalo
2024ea610b 1031: Replace smjs_rt with spidermonkey_runtime
src/scripting/smjs/ now uses a JSRuntime managed by spidermonkey-shared.c.
2008-07-16 14:28:22 +03:00
Kalle Olavi Niemitalo
32889bf908 1031: Add spidermonkey-shared.c used for both web and user scripts
Rename src/ecmascript/spidermonkey/util.c to
src/ecmascript/spidermonkey-shared.c and compile it also when
CONFIG_SCRIPTING_SMJS is enabled but CONFIG_ECMASCRIPT_SPIDERMONKEY is
not.  Then use its functions from src/scripting/smjs/ too.  Move the
corresponding declarations, as well as the inline functions needed by
src/scripting/smjs/, from src/ecmascript/spidermonkey/util.h to
src/ecmascript/spidermonkey-shared.h.

ELinks is nowadays using two JSRuntimes and SpiderMonkey has bugs that
make it crash in such use.  To work around them, ELinks will need to
be changed to use only one JSRuntime.  I am planning to define and
initialize that JSRuntime in src/ecmascript/spidermonkey-shared.c,
now that it's compiled whenever either of the modules is enabled.
2008-07-16 12:32:24 +03:00
Kalle Olavi Niemitalo
e9d4d3aef2 Fix crash after a tab was opened during reload.
Commit 0b99fa70ca "Bug 620: Reset form
fields to default values on reload" made render_document() decrement
vs->form_info_len to 0 while vs->form_info remained non-NULL.
copy_vs() then copied the whole structure with copy_struct and did not
change form_info because form_info_len was 0.  Both view_state
structures had form_info pointing to the same memory block, causing a
segfault when destroy_vs() tried to free that block a second time.

Reported by أحمد المحمودي.
2008-07-15 11:43:03 +03:00
Kalle Olavi Niemitalo
e287ca9265 1030: Wrap get_search_region_from_search_nodes in #ifdef HAVE_REGEX_H
This change avoids the following error:

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

get_search_region_from_search_nodes is called only from
search_for_pattern, which already was inside #ifdef HAVE_REGEX_H.
(cherry picked from commit 2aec302d47)
2008-07-14 22:38:08 +03:00
Witold Filipczyk
e83f76b79e 1030: Fixed issue with undefined HAVE_REGEX_H.
(cherry picked from commit 442b0d83b0)
2008-07-14 22:36:52 +03:00
Kalle Olavi Niemitalo
c5a012eca5 Bug 1029: Use JS_CallFunctionValue in keybinding.c
JS_CallFunction does not support closures in SpiderMonkey versions
earlier than 1.8.  Test case:

elinks.keymaps.main["\""] = function() {
    elinks.keymaps.main["e"] = function() {
	elinks.alert("hello!");
    };
}
2008-07-12 01:54:49 +03:00
Kalle Olavi Niemitalo
e3830cfd67 Bug 1029: Use JS_CallFunctionValue in elinks_object.c
JS_CallFunction does not support closures in SpiderMonkey versions
earlier than 1.8.  Test case:

function set_suffix(suffix) {
    elinks.preformat_html = function(cached, vs) {
	cached.content += suffix;
    }
}
set_suffix("hello");
2008-07-12 01:49:08 +03:00
Kalle Olavi Niemitalo
079b97d21b Bug 1026: Protect callback of elinks.load_uri from GC 2008-07-12 01:37:51 +03:00
Kalle Olavi Niemitalo
b2c387f1f4 Bug 1029: Use JS_CallFunctionValue in load_uri.c
JS_CallFunction does not support closures in SpiderMonkey versions
earlier than 1.8.  Test case:

elinks.keymaps.main["!"] = function() {
    elinks.load_uri("http://www.eldar.org/cgi-bin/fortune.pl?text_format=yes",
		    function (cached) { elinks.alert(cached.content); });
}
2008-07-12 01:24:51 +03:00
Kalle Olavi Niemitalo
fd27acf784 Bug 1027, SMJS: make null mean "none" in elinks.keymaps
elinks.keymaps.main["/"] = null;
used to crash ELinks with a segfault in JS_ObjectIsFunction.
Fix that by recognizing JSVAL_NULL explicitly and treating it as "none".
Likewise, if keymap_get_property would return "none" to ECMAScript,
return JSVAL_NULL instead.
2008-07-11 17:08:35 +03:00
Kalle Olavi Niemitalo
8ee5e8c4a1 Bug 951: Revert "Garbage-collect SMJS objects before flushing caches."
This reverts commit c33d195ff4.
ELinks no longer needs to collect garbage in this situation
because it can now free cache entries even if the corresponding
SMJS objects remain.
2008-07-08 15:21:07 +03:00
Kalle Olavi Niemitalo
06c39a8ac4 Bug 951: Lock the cache entry while the hook runs. 2008-07-08 15:20:38 +03:00
Kalle Olavi Niemitalo
314a41588c Bug 951: weaken pointer from JSObject to cache_entry
The SpiderMonkey scripting module handles the "pre-format-html" event
by constructing a JSObject for the struct cache_entry and then calling
elinks.preformat_html(cache_entry, view_state) if such a function
exists.  The problem with this was that each such JSObject kept the
struct cache_entry locked until SpiderMonkey garbage-collected the
JSObject, even if the user had not defined an elinks.preformat_html
function and the JSObject was thus never needed at all.  To work
around that, the SpiderMonkey scripting module ran a garbage
collection whenever the user told ELinks to flush caches.

Remove the SpiderMonkey scripting module's use of object_lock and
object_unlock on struct cache_entry, and instead make the pointers
weak so that ELinks can free the cache_entry whenever it wants even if
a JSObject is pointing to it.  Each cache_entry now has a pointer back
to the JSObject; done_cache_entry calls smjs_detach_cache_entry_object,
which follows the pointer and detaches the cache_entry and the JSObject
from each other.

This commit does not yet remove the workaround mentioned above.
2008-07-07 23:24:43 +03:00
Kalle Olavi Niemitalo
5c0128d82d Bug 1021: initialize version in http_got_header
gcc-4.3 -O2 was complaining that http_got_header may use uninitialized
version.major and version.minor.  That indeed happened with HTTP/0.9
servers, and the PRE_HTTP_1_1(version) check then had an undefined
result, so http->close could remain 0 even though it should have
become 1; fortunately, it was then set to 1 anyway, because there was
no Content-Length header.  The undefined version was also saved in
http->recv_version, but it appears nothing ever reads that.  So in the
end, the bug did not cause any symptoms at runtime, but the warning
broke the build on gcc-4.3 if ELinks was configured with --enable-debug.
2008-07-04 16:42:35 +03:00
Miciah Dashiel Butler Masters
5733f17856 goto_current_link: do nothing on input buttons
The following is in the HTML 4 standard
(<http://www.w3.org/TR/html401/interact/forms.html#push-button>):

    push buttons: Push buttons have no default behavior. Each push
    button may have client-side scripts associated with the element's
    event attributes. When an event occurs (e.g., the user presses the
    button, releases it, etc.), the associated script is triggered.

Currently, a button such created by such HTML as "<input type="button"
value="foo" />" submits the form by default in ELinks.  According to
the above, it shouldn't.
2008-07-03 13:48:08 +03:00
Witold Filipczyk
429e08e073 bug 955: Do not call onsubmit for RESET. 2008-07-03 13:48:07 +03:00
Jonas Fonseca
26e8e52f23 Fix sgml-parser so it compiles
The test does however segfault in the incremental parsing test.
2008-07-03 01:45:45 +02:00
Jonas Fonseca
1bd98053b0 Fix memory leak in the DOM configuration module
... by making the (only) user (which is the RSS renderer) responsible
allocation of the dom_config structure.
2008-06-21 00:19:15 +02:00
Kalle Olavi Niemitalo
ed17eb18df Bug 1016: Avoid JSFunctionSpec.
(cherry picked from commit 6bfaa7ca8d)

Conflicts:

	src/ecmascript/spidermonkey/form.c
	src/scripting/smjs/elinks_object.c
2008-06-17 00:25:59 +03:00
Miciah Dashiel Butler Masters
0b99fa70ca Bug 620: Reset form fields to default values on reload
Do not retain changed values in form fields when the user reloads.  Doing
so can be confusing or even cause data-loss when new default values are
specified in the updated document.  For example, when editing an article on
Wikipedia, one loads the edit page for the article, makes and submits
changes, goes back to the edit page to make further modifications, and
reloads to get the new article text.  Before this change, reloading the
edit page would not update the textarea on the page with the new article
source, which can lead one (and has led me) to make changes to the original
version of the article by accident.

This fixes bug 620.
(cherry picked from commit 9e1e94bee0)
2008-06-15 22:49:57 +03:00
Kalle Olavi Niemitalo
69cae5d791 Revert "Gradual rendering in pager mode. ELinks is almost as good as less."
I am reverting all /dev/fd recognition because of bug 917.
This reverts commit c283f8cfd9,
except src/protocol/file/file.c still needs #include "osdep/osdep.h"
for STRING_DIR_SEP.
2008-06-15 19:31:29 +03:00
Kalle Olavi Niemitalo
006b68716b Revert "set_nonblocking_fd seems to be superfluous"
I am reverting all /dev/fd recognition because of bug 917.
This reverts commit 9c3817675f.
2008-06-15 19:24:53 +03:00
Kalle Olavi Niemitalo
fcb3ba5ba4 Revert "Some day in the future ELinks will handle copiousoutput without external"
I am reverting all copiousoutput support because of bug 917.
This reverts commit 8ebcddeff4.
2008-06-15 14:39:02 +03:00
Kalle Olavi Niemitalo
eb8bbc9286 Revert "Copiousoutput part II. To be continued ..."
I am reverting all copiousoutput support because of bug 917.
This reverts commit f6115e65ec.

Conflicts:

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

Conflicts:

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

Conflicts:

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

Conflicts:

	src/network/connection.h: After the original commit, the declaration
	  of copiousoutput_data had been changed to use the LIST_OF macro.
	  Also, connection.cgi had been added next to the connection.popen
	  member added by the original commit.
	src/session/download.c: After the original commit, the definition of
	  copiousoutput_data had been changed to use the INIT_LIST_OF macro.
2008-06-15 14:17:44 +03:00
Kalle Olavi Niemitalo
5ef6c9e395 Revert "copiousoutput: only mark /dev/fd/%d as popen data . I reflect if ELinks may"
I am reverting all copiousoutput support because of bug 917.
This reverts commit f377e6f4af.
2008-06-15 14:09:12 +03:00
Kalle Olavi Niemitalo
1661109a99 Revert "copiousoutput: I'm not sure about this. pclose may hang ELinks for long time,"
I am reverting all copiousoutput support because of bug 917.
This reverts commit 47f3dd0421.
2008-06-15 14:08:18 +03:00
Kalle Olavi Niemitalo
95c2c941eb Revert "Fix to the new internal copiousoutput handling"
I am reverting all copiousoutput support because of bug 917.
This reverts commit ae58ab8fd7.
2008-06-15 14:06:47 +03:00
Kalle Olavi Niemitalo
01dd1b3b65 Revert "When prompting a program for copiousoutput don't show the block checkbox"
I am reverting all copiousoutput support because of bug 917.
This reverts commit 0c2ce62459.
2008-06-15 14:05:55 +03:00
Witold Filipczyk
1544b5f4b9 bug 991: fix crash when the file is already cached
If the user opens the same file again after it is in the cache, then
ELinks does not always open a new connection, so download->conn can be
NULL in init_type_query(), and download->conn->cgi would crash.
Don't read that, then; instead add a new flag cache_entry.cgi, which
http_got_header() sets or clears as soon as possible after the cache
entry has been created.
(cherry picked from commit 81f8ee1fa2)
2008-06-15 13:53:34 +03:00
Witold Filipczyk
d15439edff bug 991: Added the bit field cgi to the structs connection and type_query.
CGI scripts are distinguishable from normal files. I hope that this
fixes the bug 991. This commit also reverts the previous revert.
(cherry picked from commit 7ceba1e461)
2008-06-15 13:07:02 +03:00
Kalle Olavi Niemitalo
a3fba83f80 Remove a comment about kill_timer()
The comment said "it is not possible to call kill_timer from a timer
handler."  Sure, such calls used to crash occasionally, but that was
bug 868 and has already been fixed.
2008-06-15 11:41:52 +03:00
Kalle Olavi Niemitalo
a833d6d093 Bug 1015: Define and use Py_ssize_t. 2008-06-09 23:18:03 +03:00
Kalle Olavi Niemitalo
5e4a565603 Bug 1014: Fix incompatible pointer type in init_perl.
The second argument of PERL_SYS_INIT3 should be a char ***
but ELinks was giving it a char *(*)[1].

Also, enlarge the array to 2 elements, so that my_argv[my_argc] == NULL
like in main().  PERL_SYS_INIT3 seems hardly documented at all so I'm
not sure this is necessary, but it shouldn't hurt.
(cherry picked from commit 8d0677e76a)
2008-06-08 20:40:17 +03:00
Kalle Olavi Niemitalo
bed84c483e Bug 517: read_encoded() == 0 might not mean EOF if non-blocking.
Without this patch, ELinks showed garbage at
<http://www.dwheeler.com/oss_fs_why.html> when bzip2 decompression was
enabled.  safe_read() in bzip2_read() did not see all of the body
bytes that ELinks had received from the server.  After bzip2_read()
received EAGAIN from safe_read() and returned 0, something skipped
1460 bytes.

decompress_data() apparently assumed that read_encoded() returning 0
meant the end of the file, and returned even though len still was
nonzero, i.e. it had not yet written to the pipe all the data that
the caller (read_chunked_http_data() or read_normal_http_data()) had
provided.  The caller did not know this, and discarded the data.
(cherry picked from commit 7e5e05ca60)
2008-06-07 23:33:23 +03:00
Paul B. Mahol
b03ddccf08 Recognize Insert key on cons25 (FreeBSD console) 2008-05-31 13:04:25 +03:00
Kalle Olavi Niemitalo
2463c1b2f8 Bug 939: Documented the fix.
The fix itself is in the parent commit.
(cherry picked from commit 4c390589ea,
 rewriting the NEWS entry because the bug also occurred on Debian)
2008-04-28 11:04:27 +03:00
Witold Filipczyk
8a02678bed fsp: Fixed a serious bug.
*fresult pointed to nowhere. On FreeBSD *fresult == NULL
and directories weren't displayed.
Check also if safe_write writes all data.
(cherry picked from commit 06bcc48487)
2008-04-28 11:04:06 +03:00
Witold Filipczyk
f994ef4335 mkalldirs: Reset ret when errno is EEXIST.
This bug was revelead while using bittorrent.
For filenames started with a dot and two slashes .//
the open_bittorrent_file returned -1 and set errno to EEXIST.
2008-03-29 18:41:22 +02:00
Witold Filipczyk
08894be379 bittorrent: Overflow occuring when a piece was rejected. 2008-03-25 22:35:06 +01:00
Kalle Olavi Niemitalo
4b408dd860 Display subtrees last in --config-help.
elinks --config-help used to sort options like this:

  document.history
  document.history.global
    document.history.global.enable
    document.history.global.max_items
    document.history.global.display_type
    document.history.keep_unhistory

Now it'll instead be:

  document.history
    document.history.keep_unhistory
  document.history.global
    document.history.global.enable
    document.history.global.max_items
    document.history.global.display_type

i.e. all the options listed under a subheading are children of the
tree named by it.  This makes elinks.conf(5) look saner.
2008-03-23 19:20:12 +02:00
Witold Filipczyk
dafb726a49 bug 976: do not use stdout and stderr in a child processing smb://
libsmbclient's stdout and stderr interferred with ELinks's stdout
and stdin. That caused an assertion failure. Now the ELinks uses
different streams for processing of the smb protocol.
2008-03-15 18:09:23 +02:00
Kalle Olavi Niemitalo
cd4a9d77b9 Revert "bug 991: Added the bit field cgi to the structs connection and type_query."
This reverts commit 7ceba1e461,
which is causing an assertion to fail if I open the same PDF
twice in a row, even if I cancel the dialog box when ELinks
first asks which program to run:

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

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

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

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

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

The commit being reverted also claims to partially fix bug 238
(caching of local files).  That bug is still open.
2008-03-08 21:20:58 +02:00
Kalle Olavi Niemitalo
5419414b59 Bug 991: Tell users not to quote % in MIME handlers.
ELinks quotes the file name automatically and user-written quote
characters would just interfere with that.
2008-03-08 21:20:58 +02:00
Witold Filipczyk
19079733df Bug 991: URI-decode and shell-quote file name for MIME handler
Currently, when ELinks passes the name of a local file to an external
MIME handler program, it encodes the name as a URI.  Programs
typically do not expect this, and they then fail to open the file.
This patch makes ELinks instead quote the file name for the shell.

(The patch was attachment 425 of bug 991, by Witold Filipczyk.
 This commit message was written by Kalle Olavi Niemitalo.)
2008-03-08 21:20:58 +02:00
Witold Filipczyk
a6966e9472 Bug 991: Replace '%s' by % in the mailcap.c
Currently, when ELinks passes the name of a local file to an external
MIME handler program, it encodes the name as a URI.  Programs
typically do not expect this, and they then fail to open the file.
ELinks should instead quote the file name for the shell.
Unfortunately, Debian has lines like this in /etc/mailcap:

audio/mpeg; xmms '%s'; test=test "$DISPLAY" != ""

If ELinks were changed to replace the %s with e.g.
'/home/Kalle/doc/Topfield/How to upgraded the Firmware(English).pdf'
(quotes included), then the quotes would cancel out and the shell
would split the file name into multiple arguments.  That could even
provide a way for malicious persons to make ELinks run arbitrary
shell commands.

The examples in RFC 1524 all have %s without any quotes.
Debian has two bug reports about the quoting behaviour:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=90483
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=221717

This patch therefore tries to detect whether the %s has been quoted
already, and remove the quotes if so.  That way, the next patch will
be able to safely add its own quotes.  This removal of quotes applies
only to mailcap files; MIME handlers defined in elinks.conf should
already be in the format preferred by ELinks.

(The patch was attachment 438 of bug 991, by Witold Filipczyk.
 This commit message was written by Kalle Olavi Niemitalo.)
2008-03-08 21:20:57 +02:00
Jonas Fonseca
e04b420897 Minor fixes and improvements to option strings
This syncs some changes (ie. -> e.g. etc.) from elinks-0.12 or beyond.
I noticed them while updating the web pages, and apologize that I will
not spent the time to attribute it to the individual commits.

(cherry picked from commit 2bfc7b3724,
 omitting generated files)
2008-03-06 10:31:20 +02:00
Kalle Olavi Niemitalo
4d06362a50 Mark option changed in "File extensions -> Add".
Previously, file extensions added or modified via the menu did not get
saved to elinks.conf when config.saving_style was 3 (the default).
This patch makes the file-extension dialog box call option_changed,
which then sets OPT_TOUCHED, so that the option appears modified in
the option manager and will be saved.

Reported and patch reviewed by Witold Filipczyk.
2008-03-04 23:33:05 +02:00
Witold Filipczyk
8f46de65d6 bug 1000: Do not discard the query part of URI.
(cherry picked from commit 3a4c053bd5)
2008-03-02 17:45:29 +02:00
Kalle Olavi Niemitalo
8b5de30f72 Bug 1001: fix uninitialized-pointer crash in URI rewriting
(cherry picked from commit 6d2e034007)
2008-03-01 16:09:41 +02:00
Kalle Olavi Niemitalo
b0c5da3ddf BUILD_ID: Fix dirt check when srcdir != builddir.
I also tried git --work-tree=$(top_srcdir) but did not get it to work.
2008-03-01 14:30:57 +02:00
Kalle Olavi Niemitalo
747b32b735 BUILD_ID: Show the full SHA-1, instead of git describe.
Git describe happily picks whatever annotated tag is closest to the
commit.  I make use of many annotated tags that correspond not to
ELinks releases but rather to patches posted in bugzilla or sent in
email.  So with git describe, the About window can display e.g.
"email/witekfl/2008-02-29-2-g705acfa-dirty", which is not the intended
use of this tag.

In the "next" branch of git.git, git describe apparently supports a
--match option with which it could be made to consider ELinks releases
only.  However, that option is not yet in any released version of Git,
and anyhow ELinks should support older versions too.

Instead of using git describe, just show the full SHA-1, like
cg-commit-id would.  The About dialog box also displays VERSION
from configure.in, so it isn't even particularly useful to show
the name of the latest tag.  (The commit count might help though.)
2008-03-01 14:01:28 +02:00
Jonas Fonseca
705acfa05a Use git tools instead of cogito for getting the build ID
The build ID now includes both last tagged version, commit generation
since last tagged version, as well as the leading characters of the
commit ID and a flag for dirty working tree.
(cherry picked from commit c2a0d3b969)
2008-03-01 13:55:16 +02:00
Witold Filipczyk
d8a062cffc http encoding: Moved the accept_encoding_header to the http.c. 2008-02-29 15:32:10 +01:00
Jonas Fonseca
8bb0f20471 FTP: Test and fix handling of symbolic link name containing spaces
The bug was reported by Paul B. Mahol on elinks-users. The example is
from the FTP site he provided:

	ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-ia64/

Message-ID: <3a142e750802262008l6fd55be5v44207bc4479dd3fc@mail.gmail.com>
(cherry picked from commit c069403b75)
2008-02-28 23:39:04 +02:00
Jonas Fonseca
1ad9d5b2b8 Fix the FTP parser test program to handle multiline responses
... so all the tests with responses stretching multiple lines are
actually tested in their entirety.

(cherry picked from commit aa9a847c00,
 resolving a conflict due to the use of get_test_opt)
2008-02-28 23:38:55 +02:00
Jonas Fonseca
577c241438 parse_time: set tm_sec to zero before conditional second parsing
This fixes test 9 (Basic VMS responses) that uses time specs with
seconds left out (e.g. 17:44) for me.
(cherry picked from commit 397bef882b)
2008-02-28 23:38:42 +02:00
Kalle Olavi Niemitalo
3aecdfc095 Content-Encoding: deflate means neither zlib nor gzip header.
deflate.c used to call inflateInit2(stream, MAX_WBITS + 32).
This makes zlib first check for a gzip header, and if it doesn't
find one, assume a zlib header.  However, if the server said
"Content-Encoding: deflate", then neither header is there, and
zlib does not detect this automatically.  So ELinks has to
distinguish between the gzip and deflate encodings, and tell
zlib which one was meant.

This bug resulted in blank pages at blogs.msdn.com accessed
through proxy.suomi.net.
2008-02-27 00:52:24 +02:00
Kalle Olavi Niemitalo
a03698d695 lzma: Set *new_len even if data was truncated.
Commit 474f1f4268 did the same
to bzip2 and deflate.
2008-02-24 20:45:33 +02:00
Witold Filipczyk
26607d2263 decompress_data: Do not leak memory in mem_realloc. 2008-02-24 20:45:33 +02:00
Witold Filipczyk
902522fbdf content encoding: New function accept_encoding_header. 2008-02-24 20:45:32 +02:00
Witold Filipczyk
8492e6b1af lzma: used the lzma library from tukaani.org. 2008-02-24 20:45:32 +02:00
Kalle Olavi Niemitalo
a7232792dd encoding: Don't leak a pipe fd if open_encoded() fails. 2008-02-17 21:54:19 +02:00
Kalle Olavi Niemitalo
474f1f4268 encoding: Set *new_len even if data was truncated.
Previously, bzip2_decode_buffer and deflate_decode_buffer left
*new_len unchanged if the compressed input data ended unexpectedly.
This behaviour was also inherited by decode_encoded_buffer,
whose only caller render_encoded_document preinitializes the variable
and so did not crash.

With this change, the functions now store in *new_len the number of
bytes that were successfully decoded, even if more bytes were expected.
An error should perhaps be reported to the user, but I don't think the
previous version did that either, as it returned a non-NULL pointer.
2008-02-17 21:54:19 +02:00
Witold Filipczyk
0b363eb245 content encoding: handle the case when the len is 0 in the chunked encoding.
We do not want to start decompression when the len is 0
with the chunked encoding.
2008-02-17 21:54:18 +02:00