diff options
author | Daniel Stenberg <daniel@haxx.se> | 2010-07-06 23:25:32 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2010-07-06 23:25:32 +0200 |
commit | 915032ea022f356fe3c626d451c4c92b87c7d406 (patch) | |
tree | 7fcfb89c2ed31cc182542709dc8abc9e15c08047 | |
parent | e01cc7737c92897fb8286e3df6392ab434cdced6 (diff) |
upload: warn users trying to upload from stdin with anyauth
Since uploading from stdin is very likely to not work with anyauth and
its multi-phase probing for what authentication to actually use, alert
the user about it. Multi-phase negotiate almost certainly will involve
sending data and thus libcurl will need to rewind the stream to send
again, and it cannot do that with stdin.
-rw-r--r-- | src/main.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index 709f6206a..7aa698505 100644 --- a/src/main.c +++ b/src/main.c @@ -4920,6 +4920,31 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) } else if(uploadfile && stdin_upload(uploadfile)) { + /* count to see if there are more than one auth bit set + in the authtype field */ + int authbits = 0; + int bitcheck = 0; + while(bitcheck < 32) { + if(config->authtype & (1 << bitcheck)) { + authbits++; + if(authbits > 1) { + /* more than one, we're done! */ + break; + } + } + } + + /* + * If the user has also selected --anyauth or --proxy-anyauth + * we should warn him/her. + */ + if(config->proxyanyauth || (authbits>1)) { + warnf(config, + "Using --anyauth or --proxy-anyauth with upload from stdin" + " involves a big risk of it not working. Use a temporary" + " file or a fixed auth type instead!\n"); + } + SET_BINMODE(stdin); infd = STDIN_FILENO; if (curlx_strequal(uploadfile, ".")) { |