look_for_link() used to return 0 both when it found the closing </MAP>
tag, and when it hit the end of the file. In the first case, it also
added *menu to the memory_list; in the second case, it did not. The
caller get_image_map() supposedly distinguished between these cases by
checking whether pos >= eof, and freed *menu separately if so.
However, if the </MAP> was at the very end of the HTML file, so that
not even a newline followed it, then look_for_link() left pos == eof
even though it had found the </MAP> and added *menu to the memory_list.
This made get_image_map() misinterpret the result and mem_free(*menu)
even though *menu had already been freed as part of the memory_list;
thus the crash.
To fix this, make look_for_link() return -1 instead of 0 if it hits
EOF without finding the </MAP>. Then make get_image_map() check the
return value instead of comparing pos to eof. And add a test case,
although not an automated one.
Alternatively, look_for_link() could have been changed to decrement
pos between finding the </MAP> and returning 0. Then, the pos >= eof
comparison in get_image_map() would have been false. That scheme
would however have been a bit more difficult to understand and
maintain, I think.
Reported by Paul B. Mahol.
(cherry picked from commit a2404407ce)
This patch fixes an issue whereby a newline character appearing within
a hidden input field is incorrectly reinterpreted as a space character.
The patch handles almost all cases, and includes a test case.
15/18 tests pass, but the remainder currently fail due to the fact
that ELinks does not currently support textarea scripting.
test/align.html: from www.czech-tv.cz
test/css/idnes_mail.html: apparently from idnes.cz
test/erreurs_en.htm: unclear origin
test/javascript_broken.html: presumably from www.hotjobs.com
test/poocs.net.html: presumably from poocs.net
I did not find in the source tree a licence to distribute any of these.
test/optgroup.html was added on 2004-04-17 with no comment about licensing.
I contacted the author via <http://iccl.fi/feedback.cgi?id=mail>, asking
for a licence. The author noted that a developer of ELinks had originally
asked on the #debian.fi channel whether the file could be used, and he had
allowed it then. That permission grant had not been recorded in the source
tree though, and it is not clear whether modification had been allowed.
Anyway, the author now explicitly grants us the GNU free documentation
licence on this file, and is willing to consider other licences.
Run: python w32.py. The server listens on port 8900.
It handles only one request. The proper output are numbers
0 through 33999. I have no free disk to test it, but I'm afraid
that the ELinks will hang on Windows after reading 65536 bytes.
Let me know of results of such a test. The ELinks must be compiled
with the zlib library.
The output should be:
Two lines should be visible.
The second line.
All three tests fail currently when the ELinks is invoked like this:
$ elinks -no-connect path_to_chunked_test
The output should be:
Two lines should be visible.
The second line.
All three tests fail currently when the ELinks is invoked like this:
$ elinks -no-connect path_to_chunked_test
Previously, process_head immediately returned if there was no refresh, never giving the cache-control check further down a chance to run.
Also add new tests:
nocache.html
refresh+nocache.html
Previously, process_head immediately returned if there was no refresh, never giving the cache-control check further down a chance to run.
Also add new tests:
nocache.html
refresh+nocache.html
To use it to test whether that CGI works put the following in your
elinks.conf:
set protocol.file.cgi.policy = 1
set protocol.file.cgi.path = "/path/to/elinks/test/cgi"
Then point ELinks to the print-vars.sh script inside the CGI test directory
in the ELinks source directory.
ELinks currently fails this test. Also, it does not support all the
DOM features used here. I don't know whether the scripts should be
simplified or ELinks should be enhanced to support them.
The root makefile is converted as well as some leaf Makefiles. This
also brings in the required infrastructure and adjusts configure.in
appropriately.
I converted only makefiles containing no configurable stuff, since
that'll require more consideration yet.