1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-01 02:05:33 +00:00
Commit Graph

559 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
696496e831 1008: remove unused uri.big_files
The files are instead counted by open_http_post().
2008-06-10 01:05:39 +03:00
Kalle Olavi Niemitalo
b8b54a5325 Merge branch 'top/0.13/bug1008' into elinks-0.13 2008-06-08 19:51:00 +03:00
Kalle Olavi Niemitalo
d2da3f4967 1008: larger POST_BUFFER_SIZE for CPU efficiency
Posting a 91762123-byte file to test/cgi/big_file.cgi.  The CPU
percentages are from "top" set up to update every 10 seconds and
checked near the end of the transfer, so they are less accurate
than the upload rate, which averages over the whole transfer.

buffer=4096: average 1.7 MiB/s, elinks 62% CPU, python 35% CPU.
buffer=8192: average 2.5 MiB/s, elinks 49% CPU, python 42% CPU.
buffer=16384: average 3.1 MiB/s, elinks 40% CPU, python 55% CPU.
buffer=32768: average 3.8 MiB/s, elinks 33% CPU, python 61% CPU.
buffer=65536: average 4.1 MiB/s, elinks 26% CPU, python 70% CPU.
buffer=131072: average 4.2 MiB/s, elinks 28% CPU, python 67% CPU.
buffer=262144: average 4.4 MiB/s, elinks 26% CPU, python 69% CPU.

I'm choosing 32768 as POST_BUFFER_SIZE because the advantages of
larger buffers don't seem very high and keeping this under 65536
may help anyone trying to port ELinks to DOS.

I'm using the same value for HTTP too, just to keep things consistent
until there is a reason to diverge.
2008-06-08 18:38:48 +03:00
Kalle Olavi Niemitalo
5839aa070a 1008: show upload progress in local CGI too 2008-06-08 17:30: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
Kalle Olavi Niemitalo
7e5e05ca60 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.
2008-06-07 21:27:37 +03:00
Kalle Olavi Niemitalo
08941fd47d 1008: rename connection.upload_progress to .http_upload_progress 2008-06-03 09:57:58 +03:00
Kalle Olavi Niemitalo
fa51846f68 1008: increment http_post->uploaded in read_http_post() 2008-06-03 09:45:40 +03:00
Kalle Olavi Niemitalo
2d2cc6c5f5 1008: Abort connection if a file is resized. 2008-06-03 01:49:10 +03:00
Kalle Olavi Niemitalo
d3ee4e2e47 1008: error parameter in read_http_post
This function will need to set ELinks-specific errors
and it would not be right to write those in errno.
2008-06-03 01:26:19 +03:00
Kalle Olavi Niemitalo
44bf538cab 1008: Remember the sizes of files during the upload.
This will soon allow read_http_post_fd() to detect if a size has
changed.
2008-06-03 00:46:12 +03:00
Kalle Olavi Niemitalo
c2d854b240 1008: open_http_post() can return an error.
It does not yet take advantage of that though.
2008-06-03 00:18:47 +03:00
Kalle Olavi Niemitalo
533e7fc62b 1008: replace post_length() with open_http_post() 2008-06-02 10:41:55 +03:00
Kalle Olavi Niemitalo
88a59a06c0 1008: move stuff to new src/protocol/http/post.{c,h} 2008-06-02 10:40:34 +03:00
Kalle Olavi Niemitalo
0a95ae85ab 1008: finish renaming http_read_post_data to read_http_post
Fix the compilation error caused in the previous commit.
2008-06-02 01:06:23 +03:00
Kalle Olavi Niemitalo
4768243d0c 1008: rename http_read_post_data to read_http_post 2008-05-26 10:40:43 +03:00
Kalle Olavi Niemitalo
1b707208d3 1008: New struct http_post.
Move connection.post_fd to http_post.post_fd.
Make connection.done point to the new done_http_connection(),
which calls the new done_http_post(), which closes post_fd.
So done_connection() no longer needs to do that.

Now that done_http_post() exists, a later commit can add dynamically
allocated data in struct http_post and ensure that it will be freed.
2008-05-26 01:56:58 +03:00
Kalle Olavi Niemitalo
6e616e4f93 1008: Remove assertion from init_http_connection_info().
As the comment near the end of this function says, conn->info is
already non-NULL if a HTTPS proxy is being used, and the code in fact
correctly frees the previous info.  So there is no need to assert its
nonexistence.  I added that bug on 2008-05-22, in commit 291a913d1e.
2008-05-25 22:40:27 +03:00
Kalle Olavi Niemitalo
7a72a685e5 1008: Centralize random numbers.
If ELinks is being linked with SSL library, use its random number
generator.

Otherwise, try /dev/urandom and /dev/prandom.  If they do not work,
fall back to rand(), calling srand() only once.  This fallback is
mostly interesting for the Hurd and Microsoft Windows.

BitTorrent piece selection and dom/test/html-mangle.c still use rand()
(but not srand()) directly.  Those would not benefit from being
unpredictable, I think.
2008-05-25 18:44:21 +03:00
Kalle Olavi Niemitalo
291a913d1e 1008: Call and reset conn->done when freeing conn->info.
In the places that set conn->info without freeing the original value,
assert that both conn->info and conn->done are NULL.
2008-05-22 03:59:33 +03:00
Kalle Olavi Niemitalo
2256a8c94a 1008: HTTP upload counters are off_t, not size_t.
So that ELinks can upload files larger than 4 GiB even if size_t is
32-bit.
2008-05-21 08:20:03 +03:00
Kalle Olavi Niemitalo
3b5e10d3da 1008: Merge POST data sending of HTTP and local CGI.
To reduce code duplication, src/protocol/file/cgi.c no longer parses
connection->uri->post on its own but rather calls the new function
http_read_post_data(), provided by src/protocol/http/http.c.  The same
code is now also used for POST requests that do not include files.
2008-05-19 08:09:39 +03:00
Kalle Olavi Niemitalo
181486696b 1008: comments about struct http_connection_info 2008-05-18 22:30:30 +03:00
Kalle Olavi Niemitalo
0298d88167 1008: Save errno if open() fails in file upload. 2008-05-17 10:39:10 +03:00
Miciah Dashiel Butler Masters
e174b9b023 Drop unused local variable scriptlen and strlen call in execute_cgi 2008-05-16 04:00:18 +00:00
Witold Filipczyk
f09a5f235e 1008: s/big_file/file/g . 2008-05-12 12:51:53 +02:00
Witold Filipczyk
9f768354b9 1008: Moved the definition of the big_files_offset to the form.c. 2008-05-12 12:42:43 +02:00
Witold Filipczyk
20f0ed6e1b 1008: Added a comment realted to http_version's macros. 2008-05-12 11:50:40 +02:00
Witold Filipczyk
639799740c 1008: Changed misleading comment. 2008-05-12 11:48:41 +02:00
Witold Filipczyk
df2e601d9b 1008: Added a comment about use of the struct http_version. 2008-05-12 11:46:09 +02:00
Witold Filipczyk
a85a87a574 1008: abort connection when opening a big file fails. 2008-05-12 11:37:48 +02:00
Witold Filipczyk
a6184b3081 1008: Moved post_fd to the struct connection. 2008-05-12 11:24:00 +02:00
Witold Filipczyk
a14cad36ba 1008: big_files is unsigned int. 2008-05-11 13:14:12 +02:00
Witold Filipczyk
8508c18341 1008: big uploads. Added info in the status bar about uploded data. 2008-05-11 13:14:06 +02:00
Witold Filipczyk
6c0979aae9 1008: Added upload_progress to the connection. 2008-05-11 13:14:00 +02:00
Witold Filipczyk
a685470da9 1008: Added the total_upload_length and uploaded to the http_info. 2008-05-11 13:13:55 +02:00
Witold Filipczyk
ec382345c8 1008: upload of big files.
Files bigger than 65536 bytes are loaded on "demand".
TODO: Add a progress bar of uploads.
2008-05-11 13:13:49 +02:00
Kalle Olavi Niemitalo
d26c8cf836 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	NEWS (bug 939 was listed twice)
	doc/man/man5/elinks.conf.5 (regenerated)
	po/fr.po (only in comments and such)
	po/pl.po (only in comments and such)
	src/protocol/fsp/fsp.c (the relevant changes were already here)
2008-04-28 22:08:19 +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
08894be379 bittorrent: Overflow occuring when a piece was rejected. 2008-03-25 22:35:06 +01:00
Witold Filipczyk
81f8ee1fa2 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.
2008-03-15 20:49:15 +02:00
Witold Filipczyk
2aa70f77bc 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-03-15 19:25:01 +02:00
Kalle Olavi Niemitalo
fb966b87a3 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	doc/Doxyfile.in
2008-03-15 19:24:51 +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
bff789d421 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	doc/elinks.conf.5.txt
	src/mime/dialogs.c (resolved by Witold Filipczyk)
2008-03-08 15:35:12 +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
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
3a9b5d091d Enable protocol.http.compression by default.
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_.
2008-03-01 19:30:04 +02:00
Kalle Olavi Niemitalo
af9ed54c0f Merge branch 'elinks-0.12' into elinks-0.13 2008-03-01 17:28:37 +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
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
3c861fd530 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	configure.in
	src/protocol/http/http.c
2008-02-24 22:49:47 +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
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
Witold Filipczyk
cfb2ef63d6 encoding: Fixed a chunked decompression and added the deflate. 2008-02-17 21:54:18 +02:00
Y Giridhar Appaji Nag
4a1e296c3b Bug 1002: Fix build failure on Debian GNU/Linux arch powerpc
Change char id to enum bittorrent_message_id id to prevent FTBFS on
powerpc and s390
(cherry picked from commit 01b0c81227,
 with a conflict)
2008-02-10 14:34:21 +02:00
Kalle Olavi Niemitalo
61019c3130 Debian bug 464384: fix OFF_T_FORMAT mismatches on amd64
On AMD64 apparently, off_t is long but ELinks detected SIZEOF_OFF_T == 8
and defined OFF_T_FORMAT as "lld", which expects long long and so causes
GCC to warn about a mismatching format specifier.  Because --enable-debug
adds -Werror to $CFLAGS, this warning breaks the build.  When both
SIZEOF_LONG and SIZEOF_LONG_LONG are 8, ELinks cannot know which type
it should use.

To fix this, do not attempt to find a format specifier for off_t itself.
Instead cast all printed off_t values to a new typedef off_print_T that
is large enough, and replace OFF_T_FORMAT with OFF_PRINT_FORMAT which
is suitable for off_print_T altough not necessarily for off_t.  ELinks
already had a similar scheme with time_print_T and TIME_PRINT_FORMAT.
2008-02-10 11:30:27 +02:00
Miciah Dashiel Butler Masters
3a0286e447 Strings corrections from Malcolm Parsons
Fix the spelling and grammar in various comments, variable names, comment
descriptions, and documentation.
2008-01-27 04:19:23 +00:00
Miciah Dashiel Butler Masters
643a34e6af Strings corrections from Malcolm Parsons
Fix the spelling and grammar in various comments, variable names, comment
descriptions, and documentation.
2008-01-27 04:09:18 +00:00
Kalle Olavi Niemitalo
dae9b988f6 const in scanner
So that render_dom_document_start() is better assured that
default_colors[] won't be modified by the CSS code.
2008-01-26 18:20:17 +02:00
Kalle Olavi Niemitalo
f0d10c9f29 Add struct bittorrent_const_string.
Previously, struct string was used here.  However,
bittorrent_fetch_callback does not initialize response.magic,
and parse_bittorrent_tracker_response changes response->source
to point to data that must not be freed.  So the util/string.h
functions are not actually safe to use on these objects.
For this reason, it is safer to use a separate type.
2008-01-26 18:16:45 +02:00
Kalle Olavi Niemitalo
4138b401ca Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	src/document/css/stylesheet.c
	src/document/css/stylesheet.h
2008-01-26 18:15:33 +02:00
Kalle Olavi Niemitalo
a831beb6c8 const in BitTorrent 2008-01-26 18:10:35 +02:00
Kalle Olavi Niemitalo
721af4e749 Detect all overflows in BitTorrent parse_bencoding_integer.
The previous check (integer > (off_t) integer * 10) did not detect all
overflows.  Examples with 32-bit off_t:

integer = 0x1C71C71D (0x100000000/9 rounded up);
integer * 10 = 0x11C71C722, wraps to 0x1C71C722 which is > integer.

integer = 0x73333333;
integer * 10 = 0x47FFFFFFE, wraps to 0x7FFFFFFE which is > integer.

Examples with 64-bit off_t:

integer = 0x1C71C71C71C71C72 (0x10000000000000000/9 rounded up);
integer * 10 = 0x11C71C71C71C71C74, wraps to 0x1C71C71C71C71C74
which is > integer.

integer = 0x7333333333333333;
integer * 10 = 0x47FFFFFFFFFFFFFFE, wraps to 0x7FFFFFFFFFFFFFFE
which is > integer.

It is unclear to me what effect an undetected overflow would actually
have from the user's viewpoint, so I'm not adding a NEWS entry.
(cherry picked from commit a25fd18e56)
2008-01-26 16:47:51 +02:00
Kalle Olavi Niemitalo
9699a03e74 Don't assume sizeof(int)==4 in bittorrent
(cherry picked from commit f3bad399e2)
2008-01-26 16:47:47 +02:00
Witold Filipczyk
213b1933b3 fsp: Drop the protocol.fsp.sort, always sort entries.
The fsp_opendir always read the whole directory.
Sorting entries do not slow down noticeably.
2008-01-19 17:09:09 +02:00
Kalle Olavi Niemitalo
4c390589ea Bug 939: Documented the fix.
The fix itself is in the parent commit.
2008-01-19 10:55:11 +02:00
Witold Filipczyk
06bcc48487 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.
2008-01-18 21:15:28 +01:00
Petr Baudis
6c4e01f483 Disable protocol.http.compression by default
The compression support in ELinks has always been buggy, with some large pages
failing to decompress and containing garbage at the end instead. However,
with the recent attempts to fix the compression support, it has been actually
made *so* buggy that not only these cases seem to occur more often, but in
some cases, the page is just silently chopped and no content visible; in other
cases, "Resource temporarily unavailable" is displayed. Etc.

The compression support got now to the point where it is so awfully unstable
that it is actively harmful to have it enabled by default. I've been burnt by
it several times already and once made a very serious error because of page
being chopped silently.
2007-11-01 02:28:00 +01:00
Petr Baudis
d4cec950ec Introduce protocol.http.compression knob
When disabled, no Accept-Encoding header is sent.
2007-11-01 02:24:55 +01:00
Miciah Dashiel Butler Masters
13523248ed Merge commit 'origin/elinks-0.12'
Conflicts:

	po/fr.po
	src/document/dom/renderer.c
	src/document/html/parser.c
	src/document/options.c
	src/document/refresh.c
2007-10-09 14:05:03 +00:00
Laurent MONIN
11e477a63e ELINKS_HOMEPAGE -> ELINKS_WEBSITE_URL 2007-10-03 11:23:29 +02:00
Kalle Olavi Niemitalo
07535cf886 Define BITTORRENT_NULL_ID in common.c; declare extern in common.h.
This change avoids linker warnings when building with Debian tcc
0.9.23-4 + patch from Debian bug 418360:

      [LD]   src/protocol/bittorrent/lib.o
bittorrent.o: 'BITTORRENT_NULL_ID' defined twice
common.o: 'BITTORRENT_NULL_ID' defined twice
connection.o: 'BITTORRENT_NULL_ID' defined twice
dialogs.o: 'BITTORRENT_NULL_ID' defined twice
peerconnect.o: 'BITTORRENT_NULL_ID' defined twice
peerwire.o: 'BITTORRENT_NULL_ID' defined twice
piececache.o: 'BITTORRENT_NULL_ID' defined twice
tracker.o: 'BITTORRENT_NULL_ID' defined twice
2007-09-14 16:58:16 +02:00
Miciah Dashiel Butler Masters
a46379a931 Move is_in_domain from cookies/cookies.c to protocol/uri.c and export 2007-09-14 16:51:04 +02:00
Laurent MONIN
f0e66866f5 Trim trailing whitespaces. 2007-09-14 15:12:32 +02:00
Jonas Fonseca
8dbd38eded NNTP: Improve listing of articles for groups
It now uses ordered list with the message number as the list item
number. Only the message subject and from field are shown.
2007-09-11 17:01:06 +02:00
Jonas Fonseca
0b0222d64f NNTP: Add support for handling RFC2047 encoded words
Code adapted from git's builtin-mailinfo.c file.
2007-09-11 16:59:56 +02:00
Jonas Fonseca
8393dc901e Bug 744: Make removal of double slashes more protocol specific
Add a boolean protocol flag which says whether "//" in the path
part of an URI can be safely substituted with "/". Be conservative
and enable it only for file://, ftp:// and nntp[s]://. Other
can be turned on later, if needed.

Generalizes the fix from 58b3b1e752.
2007-09-11 14:14:17 +02:00
Jonas Fonseca
5d5f7fc078 NNTP: Fix group listing links having bad URL syntax due to double slashes 2007-09-11 13:50:17 +02:00
Jonas Fonseca
1961a0ca50 NNTP: HTML escape header field values 2007-09-11 13:21:00 +02:00
Kalle Olavi Niemitalo
db115bfece Add tests for cwd-relative file URIs.
Test 6 currently fails.
2007-09-09 20:06:25 +03:00
Jonas Fonseca
0240c469b7 Merge branch 'elinks-0.12'
Conflicts:

	src/document/dom/renderer.c
2007-09-09 18:25:49 +02:00
Jonas Fonseca
58b3b1e752 Reinstate "canonicalization" of path names for file URIs
This reverts commit 4f0aaa166e
and insert check for the "//" -> "/" change only to occur for
file:// URIs. This fixes the recent reports on broken handling
of relative file URIs starting with "..".
2007-09-09 18:17:25 +02:00
Miciah Dashiel Butler Masters
9a5f76dbd5 Move is_in_domain from cookies/cookies.c to protocol/uri.c and export 2007-08-29 13:33:19 +00:00
Jonas Fonseca
8376feb6b1 Fix protocol/test ignore rule for the uri-test program 2007-08-28 20:35:14 +02:00
Jonas Fonseca
bbd7c8354a Move get_test_opt to util/test.h and use throughout test programs 2007-08-28 20:34:17 +02:00
Jonas Fonseca
0f53941fef Introduce test library in util/test.h containing the die() function
Fix the die() function to exit with EXIT_FAILURE value as pointed
out by Kalle on elinks-dev in <87tzqkxhlp.fsf@Astalo.kon.iki.fi>.
2007-08-28 20:14:08 +02:00
Miciah Dashiel Butler Masters
ea372bd0cd get_opt_*: Add ses parameter
Add a session parameter to get_opt_ and its wrappers in preparation for session-specific and domain-specific options.
2007-08-28 17:24:59 +00:00
Miciah Dashiel Butler Masters
3975d28bce Merge commit 'origin/elinks-0.12'
Conflicts:

	doc/Doxyfile.in
	src/protocol/bittorrent/common.h
2007-08-28 14:47:39 +00:00
Jonas Fonseca
5f18156708 Change protocol/test to use the shell-based test infrastructure 2007-08-10 13:30:28 +02:00
Jonas Fonseca
d083619988 Fix doxygen warning about list end marker 2007-08-08 14:24:55 +02:00
Jonas Fonseca
4e710a3aa6 Doxygenate main header files of src/protocol/bittorrent 2007-08-08 13:20:26 +02:00
Kalle Olavi Niemitalo
fd902e81da Rewrite wiki to en.wikipedia.org, avoid server bug.
<http://www.wikipedia.org/w/wiki.phtml?search=sue%20lawley>
incorrectly redirects to
<http://en.wikipedia.org/w/wiki.phtml?search=sue%2520lawley>
which searches for "sue%20lawley" rather than "sue lawley".
By using en.wikipedia.org directly, we avoid the server bug.
Prompted by an elinks-users post on 2007-07-27.

I asked on #wikimedia-tech, and www.wikipedia.org does always
redirect to en.wikipedia.org; it does not guess any other
language based on headers or IP addresses or such.  Also, the
redirection exists only for compatibility, and skipping it
avoids a few roundtrips to the server.  So this change is good
even if the server is eventually fixed.
2007-07-30 15:07:20 +03:00
Kalle Olavi Niemitalo
2437d35904 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13
There were conflicts in src/document/css/ because 0.12.GIT switched
to LIST_OF(struct css_selector) and 0.13.GIT switched to struct
css_selector_set.  Resolved by using LIST_OF(struct css_selector)
inside struct css_selector_set.
2007-07-28 03:22:29 +03:00
Kalle Olavi Niemitalo
96176a8c77 Declare element types of lists. 2007-07-26 22:47:23 +03:00
Kalle Olavi Niemitalo
d3d2bb26c5 New macro LIST_OF for better Doxygen support. 2007-07-26 22:45:51 +03:00
Jonas Fonseca
39a50f07c0 Add .gitignore file listing the test_uri program 2007-07-24 12:35:11 +02:00
Kalle Olavi Niemitalo
ab9e0821d6 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13 2007-07-22 18:48:45 +03:00
Kalle Olavi Niemitalo
56d3f4ff6c Bug 744: Consume semicolons and fix parameters of stubs.
Most stub protocol handlers were protocol_external_handler_T when they
should have been protocol_handler_T.
2007-07-19 17:07:28 +03:00
Jonas Fonseca
d26b7b0b23 Add stub.o to cleaned files and more protocol module and handler stubs 2007-07-19 15:46:31 +02:00
Kalle Olavi Niemitalo
a2f3ec1ef7 Bug 744: More tests and fix failures. 2007-07-19 14:28:20 +03:00
Kalle Olavi Niemitalo
273ae1ff6d Bug 744: Add tests. There are four failures. 2007-07-19 13:46:47 +03:00
Jonas Fonseca
4f0aaa166e Remove normalization of "//" to "/"
This patch changes normalize_uri() to no replace "//" with "/" in URIs. This
fixed this bug but will also lead to possibility that duplicate entries can
exist in ELinks' cache. ELinks might be able to detect in another way by
hashing the content or something.

[ From attachment 310 of bug 744.  --KON ]
2007-07-19 11:22:01 +03:00
Kalle Olavi Niemitalo
375d8cc905 Win32: Don't check file_is_dir if name ends with backslash. 2007-07-18 00:25:07 +03:00
Kalle Olavi Niemitalo
131cf0dd73 Win32: End local subdir HREFs with "/" not "\".
The href attribute is supposed to be URL and so the directory
separator should not depend on the conventions of the local operating
system.
2007-07-18 00:24:09 +03:00
Kalle Olavi Niemitalo
8097929290 Merge with #elinks-0.12 2007-07-16 00:18:17 +03:00
Kalle Olavi Niemitalo
6117f8a164 Name the exec_on_terminal() fg values. 2007-07-15 23:46:18 +03:00
Kalle Olavi Niemitalo
4e2e8b219f http doc: "e.g." rather than "ie." when it's an example 2007-07-12 00:22:26 +03:00
Kalle Olavi Niemitalo
eccc8c23f0 Merge with http://elinks.cz/elinks.git#elinks-0.12 2007-07-09 16:03:06 +03:00
Kalle Olavi Niemitalo
028145ac10 Define BITTORRENT_NULL_ID in common.c; declare extern in common.h.
This change avoids linker warnings when building with Debian tcc
0.9.23-4 + patch from Debian bug 418360:

      [LD]   src/protocol/bittorrent/lib.o
bittorrent.o: 'BITTORRENT_NULL_ID' defined twice
common.o: 'BITTORRENT_NULL_ID' defined twice
connection.o: 'BITTORRENT_NULL_ID' defined twice
dialogs.o: 'BITTORRENT_NULL_ID' defined twice
peerconnect.o: 'BITTORRENT_NULL_ID' defined twice
peerwire.o: 'BITTORRENT_NULL_ID' defined twice
piececache.o: 'BITTORRENT_NULL_ID' defined twice
tracker.o: 'BITTORRENT_NULL_ID' defined twice
2007-07-09 15:55:42 +03:00
Kalle Olavi Niemitalo
0cf15ca9d9 URI: Inline check_uri_file.
And reorder the characters in the string given to strcspn(), to match
their expected order in the URI.  This is also how strcspn() is called
elsewhere in uri.c.
2007-06-17 19:50:05 +03:00
Witold Filipczyk
581ef57bb4 URI file: Fixed. CGI scripts work, URI fragments work too. 2007-06-17 19:46:07 +03:00
Witold Filipczyk
4fe68ce6fd uri, file: Commented out broken code.
CGI scripts using GET method didn't work.
2007-06-17 19:45:55 +03:00
Jonas Fonseca
ba66ff37db Simplify TESTDEPS maintainance by adding common objects in Makefile.lib 2007-05-26 14:04:29 +02:00
Jonas Fonseca
8bfab2242e Fix 'make test' dependency when building test utility programs
Problems was caused by undefined symbols:

	src/util/conv.c:308: undefined reference to `is_cp_utf8'
	src/util/conv.c:320: undefined reference to `cp2u'
2007-05-26 13:46:12 +02:00
Kalle Olavi Niemitalo
45d1750d03 Bug 914: Don't let UTF-8 I/O affect internal representations.
Use it for the actual I/O only.  Previously, defining CONFIG_UTF8 and
enabling UTF-8 used to force many strings to the UTF-8 charset
regardless of the terminal charset option.  Now, those strings always
follow the terminal charset.  This fixes bug 914 which was caused
because _() returned strings in the terminal charset and functions
then assumed they were in UTF-8.  This reduction in the effects of
UTF-8 I/O may also simplify future testing.
2007-05-20 15:31:02 +03:00
Laurent MONIN
0b98c5051b Fix trailing whitespaces 2007-04-26 15:02:04 +02:00
Kalle Olavi Niemitalo
049cc9c6b3 Bug 941: Survive an unexpected number of 227 or 229 FTP responses.
And document the functions a little.

[ From commit 71ff470f2e in ELinks
  0.11.2.GIT.  --KON ]
2007-04-12 01:02:00 +03:00
Kalle Olavi Niemitalo
9955ca8e5a do_smb: URI-encode the username and password.
I tested that this does the right thing for the username "Kalle %50"
(encodes it to "Kalle%20%2550", and libsmbclient then decodes back).
2007-03-25 12:13:46 +03:00
Kalle Olavi Niemitalo
d30eb255ce do_smb: Don't decode_uri.
libsmbclient will decode the URI on its own, so if ELinks does that too,
file names like "2%200" will be incorrectly handled.
2007-03-24 21:19:41 +02:00
Kalle Olavi Niemitalo
2558688456 Merge with http://elinks.cz/elinks.git 2007-03-22 07:48:49 +02:00
Laurent MONIN
90980a944e Mark all module names for translation and include needed header files. 2007-03-21 11:01:06 +01:00
Kalle Olavi Niemitalo
62bdfcf732 ftp: Decode strftime results from the system codepage. 2007-03-20 21:34:39 +02:00
Kalle Olavi Niemitalo
ef1d6c563d ftp: Collect HTML formatting parameters into a structure. 2007-03-20 21:30:20 +02:00
Kalle Olavi Niemitalo
c8eccc486b ftp: Allocate a larger buffer for the timestamp string. 2007-03-20 21:28:30 +02:00
Kalle Olavi Niemitalo
9d45ff5be1 ftp: Don't pad the timestamp column with spaces. 2007-03-20 21:26:46 +02:00
Kalle Olavi Niemitalo
3c6c79a637 show_http_error_document: Generate a charset parameter. 2007-03-20 20:53:03 +02:00
Kalle Olavi Niemitalo
9a8fa9d7db file: Directory listings are in the system charset.
Give them a corresponding Content-Type header.  This must go in
cached->head because cached->content_type is supposed to be just
type/subtype.  It will also be deduced from cached->head, so don't set
it separately.
2007-03-20 20:50:41 +02:00
Kalle Olavi Niemitalo
44adb76799 Use add_string_to_string where applicable. 2007-03-18 20:29:08 +02:00
Kalle Olavi Niemitalo
3ee04479d4 init_directory_listing: Link to original URLs. Decode for display only.
HTML-escape all strings that are not intended to contain markup.
2007-03-18 11:04:02 +02:00
Kalle Olavi Niemitalo
b48a2d660d More const in URI functions.
Not yet all of them, though.
2007-03-18 09:57:29 +02:00
Kalle Olavi Niemitalo
c6b8fa7151 ftp, add_file_cmd_to_str: Check errors from string functions.
Use goto for error handling.  Free all strings in the same place.
2007-03-18 09:32:47 +02:00
Kalle Olavi Niemitalo
adfde652b9 Reject CR and LF characters in FTP pathnames. 2007-03-18 08:53:56 +02:00
Witold Filipczyk
3f4de99f16 ftp: ftp didn't handle filenames with spaces. 2007-03-18 08:15:54 +02:00
Kalle Olavi Niemitalo
a495f6d26a Cast the NULL argument of string_concat to unsigned char *.
string_concat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to string_concat.
This is in principle also a violation, but I'm ignoring it for now
because if it becomes a problem with some C implementation, then so
will the use of unsigned char * with printf "%s", which is so
widespread in ELinks that I'm not going to try fixing it now.
2007-03-11 13:01:50 +02:00
Kalle Olavi Niemitalo
7645a836fc Cast the NULL argument of straconcat to unsigned char *.
straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to straconcat.  This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.
2007-03-11 12:59:11 +02:00
Kalle Olavi Niemitalo
a05f7203cd Cast variadic arguments of getml to void *.
getml reads the args with va_arg(ap, void *), and the NULL macro in
particular may have the wrong type.
2007-03-11 12:41:17 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Kalle Olavi Niemitalo
2b7788614f Type-check button arguments of msg_box.
Don't cast function pointers; calling functions via pointers of
incorrect types is not guaranteed to work.  Instead, define the
functions with the desired types, and make them cast the incoming
parameters.  Or define wrapper functions if the return types don't
match.

really_exit_prog wasn't being used outside src/dialogs/menu.c,
and I had to change its parameter type, so it's now static.
2007-03-10 23:50:56 +02:00
Kalle Olavi Niemitalo
701e7e3e64 cgi: Avoid assertion failure when the POST data is empty. 2007-03-10 16:56:16 +02:00
Witold Filipczyk
035ce283c7 cgi: Fix the possible memleak and close pipes in case of error. 2007-03-10 13:45:56 +02:00
Witold Filipczyk
eef7924ff1 POST method of CGI did not work. It works now. 2007-03-10 13:45:35 +02:00
Kalle Olavi Niemitalo
4c636d74f1 cgi: Ensure correct type of NULL pointer to variadic execl. 2007-03-10 13:19:31 +02:00
Witold Filipczyk
2828d587b2 cgi: set_nonblocking_fd
[ This is part of commit 71adb0e6cc
  from the witekfl branch.  The SMB part is in commit
  36477ffa45, and the FSP part is
  in commit 93f3dc3bbf.  --KON ]
2007-03-10 13:10:35 +02:00
Kalle Olavi Niemitalo
87431832be Document the syntax of protocol.rewrite.default_template. 2007-03-10 12:15:06 +02:00
Kalle Olavi Niemitalo
c068ca92c0 get_http_error_document: Change "happenned" to "happened". 2007-03-10 11:16:26 +02:00
Kalle Olavi Niemitalo
f2fc402093 Merge with http://elinks.cz/elinks.git 2007-03-06 16:01:21 +02:00
Kalle Olavi Niemitalo
f905379aed smb: Use atol rather than atoi for file sizes.
Corresponds to FSP commit 9f47368894.
2007-03-06 15:59:14 +02:00
Kalle Olavi Niemitalo
3b634ffee6 smb: Don't call qsort with a NULL pointer.
Corresponds to FSP commit 97edc3a2cc.
2007-03-06 15:59:06 +02:00
Kalle Olavi Niemitalo
6ae6c0b438 smb: Remove a cast.
Corresponds to FSP commit 95a377e81b.
2007-03-06 15:59:00 +02:00
Kalle Olavi Niemitalo
846a368fb0 smb: Assert that there is room for a terminating null.
Corresponds to FSP commit 23b4b912ac.
2007-03-06 15:58:50 +02:00
Kalle Olavi Niemitalo
588375444b smb: Comment about not freeing memory in the child process.
Corresponds to FSP commit 368a749123.
2007-03-06 15:58:45 +02:00
Kalle Olavi Niemitalo
146a605938 smb: Call close_socket(socket) rather than close(socket->fd).
Corresponds to FSP commit 3ba31763a9.
2007-03-06 15:58:38 +02:00
Kalle Olavi Niemitalo
c19ad66070 smb: Comment and FIXME about closing file descriptors.
Corresponds to FSP commit 1ad016bdd5.
2007-03-06 15:58:28 +02:00
Kalle Olavi Niemitalo
e08d040c4c smb: Don't cast the qsort comparison function pointer.
Inspired by FSP commit c3a6ca3ef0.
This time, the cast was a no-op though.
2007-03-06 15:58:24 +02:00
Kalle Olavi Niemitalo
9665f1b813 smb: More const.
Inspired by FSP commit c06d6ba5d0.
2007-03-06 15:58:07 +02:00
Kalle Olavi Niemitalo
327de14aa8 smb: Fix libsmbclient 3.0.10 compatibility.
Also, allocate memory for only one copy of each comment string, rather
than two.
2007-03-06 15:57:58 +02:00
Kalle Olavi Niemitalo
f621ed63b4 Revert 11e6aa8d97, "Bug 944, SMB: Fix leaks and libsmbclient 3.0.10 compatibility."
Revert commit 11e6aa8d97.
It is not useful to complicate the code to free the memory,
because the process is soon going to exit, and it has inherited
a lot more memory allocations from its parent.

The libsmbclient 3.0.10 compatibility changes are good though.
I'll re-apply them soon enough.
2007-03-06 15:57:40 +02:00
Kalle Olavi Niemitalo
e517ef22a9 fsp: Try to recover from ABI mismatches caused by _FILE_OFFSET_BITS. 2007-03-06 15:57:18 +02:00
Laurent MONIN
d7400bed08 asprintf() is not used in this file. 2007-03-05 22:04:34 +01:00
Laurent MONIN
5acb3a68fb If there is nothing to write do not even open the file for write (test
formdata length). Patch by Alexey Tourbin.
2007-03-05 21:37:24 +01:00
Laurent MONIN
edb8d9001c If there is nothing to write do not even open the file for write. Patch
by Alexey Tourbin.
2007-03-05 21:34:45 +01:00
Laurent MONIN
4b9ddf1481 Take care of fwrite() and fclose() return values. Patch by Alexey Tourbin. 2007-03-05 21:30:16 +01:00
Laurent MONIN
6bdc34cfbc Unlink file on error. Patch by Alexey Tourbin. 2007-03-05 21:24:02 +01:00
Laurent MONIN
0a8b52282c formfd -> fd, formfile -> fp, formfilename -> filename. Idea by Alexey
Tourbin.
2007-03-05 21:17:09 +01:00
Kalle Olavi Niemitalo
9f47368894 fsp: Try to support large files.
FSP v2 uses 32-bit file offsets in its UDP packets and cannot get past
4 GiB.  ELinks should however try not to wrap the numbers to negative
at 2 GiB, if it is built with large file support.
2007-03-05 22:09:17 +02:00
Kalle Olavi Niemitalo
1d0a3e9f7c fsp: Call fsp_closedir also if protocol.fsp.sort is true. 2007-03-05 22:01:22 +02:00
Kalle Olavi Niemitalo
0eb0f05b35 fsp: Don't call decode_uri(NULL). It will crash. 2007-03-05 21:59:34 +02:00
Kalle Olavi Niemitalo
97edc3a2cc fsp: Don't call qsort with a NULL pointer. 2007-03-05 21:36:36 +02:00
Kalle Olavi Niemitalo
f1d400ab3e fsp: Use copy_struct rather than memcpy. 2007-03-05 21:27:32 +02:00
Kalle Olavi Niemitalo
bb79836cb7 fsp: HTML-encode file names in the directory listing. 2007-03-05 21:24:25 +02:00
Kalle Olavi Niemitalo
380deb2c1d fsp: Comment about not calling fsp_close_session on error. 2007-03-05 21:21:26 +02:00
Kalle Olavi Niemitalo
95a377e81b fsp: Remove a cast. 2007-03-05 20:51:38 +02:00
Kalle Olavi Niemitalo
23b4b912ac fsp: Assert that there is room for a terminating null. 2007-03-05 20:50:27 +02:00
Kalle Olavi Niemitalo
368a749123 fsp: Comment about not freeing memory in the child process. 2007-03-05 20:48:17 +02:00
Kalle Olavi Niemitalo
3ba31763a9 fsp: Call close_socket(socket) rather than close(socket->fd). 2007-03-05 20:46:15 +02:00
Kalle Olavi Niemitalo
fb184a4cd0 fsp: prompt_username_pw is in the parent process. 2007-03-05 20:21:24 +02:00
Kalle Olavi Niemitalo
1ad016bdd5 fsp: Comment and FIXME about closing file descriptors. 2007-03-05 20:20:04 +02:00
Kalle Olavi Niemitalo
c3a6ca3ef0 fsp: Don't cast the qsort comparison function pointer.
Cast the parameters of the function instead.  The C standard does not
guarantee that a function can be properly called via a pointer of a
different type.
2007-03-05 20:18:59 +02:00
Kalle Olavi Niemitalo
c06d6ba5d0 fsp: More const. 2007-03-05 20:01:14 +02:00
Kalle Olavi Niemitalo
d17005e23f encode_uri_string: Let name point to const. 2007-03-05 19:59:17 +02:00
Kalle Olavi Niemitalo
136ff42bb1 fsp: Comments about interprocess communication. 2007-03-05 19:32:55 +02:00
Witold Filipczyk
e34d646f1a fsp: remember the username and the password given in the uri.
[ This is half of commit c7f6f76951
  from the witekfl branch.  The SMB half is in commit
  a0db520267.  --KON ]
2007-03-03 17:26:19 +02:00
Witold Filipczyk
05b19b05e6 fsp: call find_auth in both cases.
When the username and the password were given in the uri and when
they weren't. I'm not sure if it changes anything.
2007-03-03 17:25:00 +02:00
Witold Filipczyk
636f4e6aa4 fsp: used strings, encode and decode filenames with spaces. 2007-03-03 17:24:26 +02:00
Witold Filipczyk
93f3dc3bbf fsp: set_nonblocking_fd
[ This is part of commit 71adb0e6cc
  from the witekfl branch.  The SMB part is in commit
  36477ffa45.  The CGI part will
  come later.  --KON ]
2007-03-03 17:24:07 +02:00
Witold Filipczyk
6cf69b2948 fsp: abort connection on empty files.
Empty files were causing 'read from socket' errors.

[ This is half of commit eef1c17dce
  from the witekfl branch.  The SMB half is in commit
  916b5cf545.  --KON ]
2007-03-03 17:20:41 +02:00
Witold Filipczyk
8c5ef76e52 fsp: prompt for password when the authentication fails.
It works only for directory listings.
2007-03-03 17:17:33 +02:00
Witold Filipczyk
a020450830 Removed unneded header file accidentally included by the previous commit. 2007-03-03 17:17:21 +02:00
Witold Filipczyk
ff087c3e06 fsp: Pass the filesize by ctype (stderr). 2007-03-03 17:17:13 +02:00
Witold Filipczyk
b517367cc8 dup2 closes given descriptors, so no need for the explicit close. 2007-03-03 17:17:00 +02:00
Witold Filipczyk
bef03e6106 FSP: The preparation for the error handling.
Numeric codes are returned instead of a plain text in the event
of the fsp error.
2007-03-03 17:15:21 +02:00