diff options
author | Ben Greear <greearb@candelatech.com> | 2010-04-29 00:49:04 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-04-29 08:55:11 +0200 |
commit | 38d2afcefb3519f7e6a3b7c3afda4f5bfb67bde9 (patch) | |
tree | e70c69372560b881ebf809773dbff97a4012dcee /src | |
parent | 7f616eb513a692f3edf36bdbf34372186f5203f0 (diff) | |
download | curl-38d2afcefb3519f7e6a3b7c3afda4f5bfb67bde9.tar.gz |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index 684869379..eff0f9a3b 100644 --- a/src/main.c +++ b/src/main.c @@ -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 */ |