1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-28 03:06:20 -04:00
Commit Graph

199 Commits

Author SHA1 Message Date
Witold Filipczyk
033f15fe7b [session] Shorter 2020-05-20 20:38:39 +02:00
Witold Filipczyk
2273c4a370 [session] Because all terminals are slaves, choose first session for remote. 2020-05-20 19:05:58 +02:00
sgerwk
d1be5c322f add -remote 'search(string)' 2020-04-25 19:55:16 +02:00
Witold Filipczyk
3d96b0d7d7 Revert "Compile with C++."
This reverts commit 4f4df33638.
2019-04-21 12:27:40 +02:00
Witold Filipczyk
4f4df33638 Compile with C++.
Weak points:
- alignof
- js problems

Todo:
- make js work with C++ and mozjs-17
- then mozjs-24
- then mozjs-52
- then mozjs-60
- decrease number of warnings
2019-02-17 20:46:16 +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
Marco Migliori
a75e8dd35c new -remote command: reload() 2017-05-16 20:55:33 +02:00
Witold Filipczyk
257422f28c Reorganisation of code to make C++ happy 2016-04-20 22:21:31 +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
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
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
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
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
Witold Filipczyk
a27e7d95ee Do not delete temporary files of external handlers. 2010-07-31 21:15:12 +02:00
Witold Filipczyk
6c7fbaeeaa Unification of protocol handler names. 2010-07-27 10:07:52 +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
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
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
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
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
62316163f3 Comment fixes 2009-07-18 23:31:10 +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
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