mirror of
https://github.com/curl/curl.git
synced 2026-07-23 12:27:19 +03:00
telnet: Allow programatic use of telnet.
The main change is to allow input from user-specified methods, when they are specified with CURLOPT_READFUNCTION. All calls to fflush(stdout) in telnet.c were removed, which makes using 'curl telnet://foo.com' painful since prompts and other data are not always returned to the user promptly. Use 'curl --no-buffer telnet://foo.com' instead. In general, the user should have their CURLOPT_WRITEFUNCTION do a fflush for interactive use. Also fix assumption that reading from stdin never returns < 0. Old code could crash in that case. Call progress functions in telnet main loop. Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
parent
7f616eb513
commit
38d2afcefb
4 changed files with 86 additions and 30 deletions
|
|
@ -4987,7 +4987,9 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
|||
input.config = config;
|
||||
my_setopt(curl, CURLOPT_READDATA, &input);
|
||||
/* what call to read */
|
||||
my_setopt(curl, CURLOPT_READFUNCTION, my_fread);
|
||||
if ((outfile && !curlx_strequal("-", outfile)) ||
|
||||
!curlx_strnequal(url, "telnet:", 7))
|
||||
my_setopt(curl, CURLOPT_READFUNCTION, my_fread);
|
||||
|
||||
/* in 7.18.0, the CURLOPT_SEEKFUNCTION/DATA pair is taking over what
|
||||
CURLOPT_IOCTLFUNCTION/DATA pair previously provided for seeking */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue