summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* tool_operate: refuse (--data or --form) and --continue-at comboDaniel Stenberg2023-05-081-8/+19
| | | | | | | | | | | | | libcurl assumes that a --continue-at resumption is done to continue an upload using the read callback and neither --data nor --form use that and thus won't do what the user wants. Whatever the user wants with this strange combination. Add test 426 to verify. Reported-by: Smackd0wn on github Fixes #11081 Closes #11083
* tool_cb_hdr: Fix 'Location:' formatting for early VTE terminalsJay Satiro2023-05-051-0/+9
| | | | | | | | | | | | | - Disable hyperlink formatting for the 'Location:' header value in VTE 0.48.1 and earlier, since it is buggy in some of those versions. Prior to this change those terminals may show the location header value as gibberish or show it twice. Ref: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#backward-compatibility Fixes https://github.com/curl/curl/issues/10428 Closes https://github.com/curl/curl/pull/11071
* checksrc: find bad indentation in conditions without open braceDaniel Stenberg2023-04-282-3/+3
| | | | | | | | | | | If the previous line starts with if/while/for AND ends with a closed parenthesis and there's an equal number of open and closed parentheses on that line, verify that this line is indented $indent more steps, if not a cpp line. Also adjust the fall-out from this fix. Closes #11054
* checksrc: check for spaces before the colon of switch labelsEmanuele Torre2023-04-271-1/+1
| | | | Closes #11047
* checksrc: fix SPACEBEFOREPAREN for conditions starting with "*"Daniel Stenberg2023-04-273-4/+4
| | | | | | | | | | | | | | | The open paren check wants to warn for spaces before open parenthesis for if/while/for but also for any function call. In order to avoid catching function pointer declarations, the logic allows a space if the first character after the open parenthesis is an asterisk. I also spotted what we did not include "switch" in the check but we should. This check is a little lame, but we reduce this problem by not allowing that space for if/while/for/switch. Reported-by: Emanuele Torre Closes #11044
* src/tool_operhlp.c: fix value stored to 'uerr' is never readDaniel Stenberg2023-04-171-1/+1
| | | | | | Ref: https://github.com/curl/curl/pull/10974#issuecomment-1510461343 Reported-by: Viktor Szakats Closes #10982
* curl: do NOT append file name to path for upload when there's a queryDaniel Stenberg2023-04-151-1/+8
| | | | | | | | Added test 425 to verify. Reported-by: Dirk Rosenkranz Bug: https://curl.se/mail/archive-2023-04/0008.html Closes #10969
* curl: add --proxy-http2Daniel Stenberg2023-04-142-2/+11
| | | | | | For trying HTTP/2 with an HTTPS proxy. Closes #10926
* tool_writeout: add URL component variablesDaniel Stenberg2023-04-042-0/+151
| | | | | | | | | | | | | | | | | Output specific components from the used URL. The following variables are added for this purpose: url.scheme, url.user, url.password, url.options, url.host, url.port, url.path, url.query, url.fragment, url.zoneid Add the following for outputting parts of the "effective URL": urle.scheme, urle.user, urle.password, urle.options, urle.host, urle.port, urle.path, urle.query, urle.fragment, urle.zoneid Added test 423 and 424 to verify. Closes #10853
* tool_operate: pass a long as CURLOPT_HEADEROPT argumentDaniel Stenberg2023-03-221-1/+1
| | | | Closes #10798
* tool_getparam: error if --next is used without a prior URLDaniel Stenberg2023-03-171-0/+4
| | | | | | | Reported-by: 積丹尼 Dan Jacobson Ref: https://github.com/curl/curl/pull/10769#discussion_r1137895629 Closes #10782
* tool_operate: silence unused parameter warningMarcel Raad2023-03-131-0/+1
| | | | | | | `global` is only used in the `my_setopt` macro version without `CURL_DISABLE_LIBCURL_OPTION` since commit 4774decf10a. Closes https://github.com/curl/curl/pull/10752
* tool: improve --stderr handlingJay Satiro2023-03-1214-60/+151
| | | | | | | | | | | | | | | | - freopen stderr with the user-specified file (--stderr file) instead of using a separate 'errors' stream. - In tool_setup.h override stdio.h's stderr macro as global variable tool_stderr. Both freopen and overriding the stderr macro are necessary because if the user-specified filename is "-" then stdout is assigned to tool_stderr and no freopen takes place. See the PR for more information. Ref: https://github.com/curl/curl/issues/10491 Closes https://github.com/curl/curl/pull/10673
* src: silence wmain() warning for all build methodsViktor Szakats2023-03-112-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | llvm/clang and gcc doesn't recognize the wmain() function in Unicode Windows builds: llvm/clang: ``` ../../src/tool_main.c:239:5: warning: no previous prototype for function 'wmain' [-Wmissing-prototypes] int wmain(int argc, wchar_t *argv[]) ^ 1 warning generated. ``` gcc: ``` ../../src/tool_main.c:239:5: warning: no previous prototype for 'wmain' [-Wmissing-prototypes] 239 | int wmain(int argc, wchar_t *argv[]) | ^~~~~ ``` Before this patch, we already silenced it with CMake. This patch moves the silencing to the source, so that it applies to all build tools. Bug: https://github.com/curl/curl/issues/7229#issuecomment-1464806651 Reviewed-by: Marcel Raad Closes #10744
* tool_writeout_json. fix the output for duplicate header namesDaniel Stenberg2023-03-091-6/+11
| | | | | | | | | Header entries with index != 0 are handled at the index 0 level so they should then be skipped when iterated over. Reported-by: Boris Okunskiy Fixes #10704 Closes #10707
* tool: dump headers even if file is write-onlyGrisha Levit2023-03-061-2/+2
| | | | | | | | | | | | | The fixes in #10079 brought a (seemingly unrelated) change of open mode from `wb`/`ab` to `wb+`/`ab+` for the headerfile. This makes it no longer possible to write the header file to e.g. a pipe, like: curl -D >(grep ...) file:///dev/null Which presently results in `Warning: Failed to open /dev/fd/63` See #10079 Closes #10675
* misc: remove support for curl_off_t < 8 bytesDaniel Stenberg2023-02-243-20/+9
| | | | Closes #10597
* curl: make -w's %{stderr} use the file set with --stderrJay Satiro2023-02-233-4/+8
| | | | | | Reported-by: u20221022 on github Fixes #10491 Closes #10569
* tool_operate: propagate error codes for missing URL after --nextDaniel Stenberg2023-02-221-2/+5
| | | | | | Fixes #10558 Reported-by: u20221022 on github Closes #10580
* tool_getparam: don't add a new node for just --no-remote-nameDaniel Stenberg2023-02-221-1/+4
| | | | | | | | Unless --remote-name-all is used. Fixes #10564 Reported-by: u20221022 on github Closes #10582
* tool_progress: shut off progress meter for --silent in parallelDaniel Stenberg2023-02-211-1/+1
| | | | | | Reported-by: finkjsc on github Fixes #10573 Closes #10579
* tool_operate: avoid fclose(NULL) on bad header dump fileDaniel Stenberg2023-02-211-2/+3
| | | | | | Fixes #10570 Reported-by: Jérémy Rabasco Closes #10571
* tool_operate: fix scanbuild compiler warningJay Satiro2023-02-181-7/+8
| | | | | | | | | | | Prior to this change Azure CI scanbuild warned of a potential NULL pointer string passed to strtol when CURLDEBUG enabled, even though the way the code was written it wouldn't have happened. Bug: https://github.com/curl/curl/commit/5479d991#r101159711 Reported-by: Marcel Raad Closes https://github.com/curl/curl/pull/10559
* curl: make --silent work stand-aloneDaniel Stenberg2023-02-175-34/+26
| | | | | | | | | | | | | | - renamed the struct field to 'silent' to match the cmdline option - make --show-error toggle independently of --silent - make --silent independent of ->noprogress as well By doing this, the three options --silent, --no-progress-meter and --show-error should work independently of each other and also work with and without '--no-' prefix as documented. Reported-by: u20221022 on github Fixes #10535 Closes #10536
* tool_operate: allow debug builds to set buffersizeDaniel Stenberg2023-02-161-5/+15
| | | | | | Using the CURL_BUFFERSIZE environment variable. Closes #10532
* tool_getparam: make --get a true booleanDaniel Stenberg2023-02-161-1/+1
| | | | | | | | To match how it is documented in the man page. Fixes #10527 Reported-by: u20221022 on github Closes #10531
* tool_operate: move the 'updated' variableDaniel Stenberg2023-02-071-1/+1
| | | | | | | This was already done by Dan Fandrich in the previous PR but somehow I lost that fixup. Follow-up to 349c5391f2121e
* tool_operate: Fix error codes during DOS filename sanitizeDan Fandrich2023-02-071-8/+11
| | | | | | It would return CURLE_URL_MALFORMAT in an OOM condition. Closes #10414
* tool_operate: Fix error codes on bad URL & OOMDan Fandrich2023-02-073-50/+86
| | | | | | | | | | curl would erroneously report CURLE_OUT_OF_MEMORY in some cases instead of CURLE_URL_MALFORMAT. In other cases, it would erroneously return CURLE_URL_MALFORMAT instead of CURLE_OUT_OF_MEMORY. Add a test case to test the former condition. Fixes #10130 Closes #10414
* tool_operate: repair --rateDaniel Stenberg2023-01-291-2/+3
| | | | | | | Regression from a55256cfb242 (7.87.0) Reported-by: highmtworks on github Fixes #10357 Closes #10358
* tool_getparam: fix compiler warning when !HAVE_WRITABLE_ARGVDaniel Stenberg2023-01-131-4/+5
| | | | | | Follow-up to 2ed0e1f70ee176edf3d2 Closes #10286
* curl: output warning at --verbose output for debug-enabled versionDaniel Stenberg2023-01-121-0/+11
| | | | | | | | | + a libcurl warning in the debug output Assisted-by: Jay Satiro Ref: https://curl.se/mail/lib-2023-01/0039.html Closes #10278
* src: add --http3-onlyDaniel Stenberg2023-01-123-6/+27
| | | | | | | Warning: --http3 and --http3-only are subject to change again (or be removed) before HTTP/3 support goes non-experimental. Closes #10264
* tool_getparam: fix hiding of command line secretsHarry Sintonen2023-01-123-7/+10
| | | | Closes #10276
* tool_operate: fix headerfile writingStefan Eissing2023-01-041-7/+8
| | | | | | | | | Do not rely on the first transfer started to be the first to get a response (remember -Z). All transfers now write the headefile (-D) in append mode, making sure that the order of transfer responses does not lead to overwrites of previous data. Closes #10224
* copyright: update all copyright lines and remove year rangesDaniel Stenberg2023-01-0387-87/+87
| | | | | | | | | | | | - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - saves us from pointless churn - git keeps history for us - the year range is kept in COPYING checksrc is updated to allow non-year using copyright statements Closes #10205
* writeout: add %{certs} and %{num_certs}Daniel Stenberg2022-12-274-0/+66
| | | | | | Let users get the server certificate chain using the command line Closes #10019
* tool_operate: share HSTS between handlesDaniel Stenberg2022-12-271-0/+1
|
* misc: fix grammar and spellingJohn Bampton2022-12-221-2/+2
| | | | Closes #10137
* tool_operate: fix `CURLOPT_SOCKS5_GSSAPI_NEC` typeMarcel Raad2022-12-211-2/+1
| | | | | | | `CURLOPT_SOCKS5_GSSAPI_NEC` is a long, while `socks5_gssapi_nec` was made a bool in commit 4ac64eadf60. Closes https://github.com/curl/curl/pull/10124
* tool_paramhlp: free the proto strings on exitDaniel Stenberg2022-12-152-0/+3
| | | | | | | | | And also make sure that repeated use of the options free the previous string before it stores a new. Follow-up from e6f8445edef8e7996d Closes #10098
* tool_cfgable: free the ssl_ec_curves on exitDaniel Stenberg2022-12-151-2/+1
| | | | | | Follow-up to ede125b7b Closes #10097
* tool: determine the correct fopen option for -DEmil Engler2022-12-121-1/+15
| | | | | | | | | | | | This commit fixes a bug in the dump-header feature regarding the determination of the second fopen(3) option. Reported-by: u20221022 on github See #4753 See #4762 Fixes #10074 Closes #10079
* tool_cfgable: make socks5_gssapi_nec a booleanBoris Verkhovskiy2022-12-111-1/+1
| | | | Closes #10078
* tool_formparse: avoid clobbering on function paramsDaniel Gustafsson2022-12-081-5/+6
| | | | | | | | | | | | | While perfectly legal to do, clobbering function parameters and using them as local variables is confusing at best and rarely improves code readability. Fix by using a local variable instead, no functionality is changed. This also renames the parameter from data to mime_data since the term data is (soft) reserved for the easy handle struct. Closes: #10046 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* setup: do not require __MRC__ defined for Mac OS 9 buildsRyan Schmidt2022-12-061-1/+1
| | | | | | | | | | | | | | | | Partially reverts "somewhat protect Mac OS X users from using Mac OS 9 config file", commit 62519bfe059251af2914199f284c736553ff0489. Do things that are specific to classic Mac OS (i.e. include config-mac.h in curl_setup.h and rename "main" to "curl_main" in tool_setup.h) when only "macintosh" is defined. Remove the additional condition that "__MRC__" should be defined since that would only be true with the MPW MrC compiler which prevents the use of other reasonable compilers like the MPW SC compiler and especially the Metrowerks CodeWarrior compilers. "macintosh" is only defined by classic Mac OS compilers so this change should not affect users of Mac OS X / OS X / macOS / any other OS. Closes #10037
* Makefile.mk: address minor issuesViktor Szakats2022-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | - Fix `NROFF` auto-detection with certain shell/make-build combinations: When a non-MSYS2 GNU Make runs inside an MSYS2 shell, Make executes the detection command as-is via `CreateProcess()`. It fails because `command` is an `sh` built-in. Ensure to explicitly invoke the shell. - Initialize user-customizable variables: Silences a list of warnings when running GNU Make with the option `--warn-undefined-variables`. Another benefit is that it's now easy to look up all user-customizable `Makefile.mk` variables by grepping for ` ?=` in the curl source tree. Suggested-by: Gisle Vanem Ref: https://github.com/curl/curl/pull/9764#issuecomment-1330674433 - Fix `MKDIR` invocation: Avoid a warning and potential issue in envs without forward-slash support. Closes #10000
* tool_operate: override the numeric locale and set "C" by forceDaniel Stenberg2022-11-251-1/+2
| | | | | | | | | | | | | Makes curl always use dot as decimal separator for options, independently of what the locale says. Makes scripts and command lines portable. Updated docs accordingly. Reported-by: Daniel Faust Fixes #9969 Closes #9972
* netware: remove leftover tracesDaniel Gustafsson2022-11-237-143/+0
| | | | | | | | | Commit 3b16575ae938dec2a29454631a12aa52b6ab9c67 removed support for building on Novell Netware, but a few leftover traces remained. This removes the last bits. Closes: #9966 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* Makefile.mk: portable Makefile.m32Viktor Szakats2022-11-224-171/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update bare GNU Make `Makefile.m32` to: - Move objects into a subdirectory. - Add support for MS-DOS. Tested with DJGPP. - Add support for Watt-32 (on MS-DOS). - Add support for AmigaOS. - Rename `Makefile.m32` to `Makefile.mk` - Replace `ARCH` with `TRIPLET`. - Build `tool_hugehelp.c` proper (when tools are available). - Drop MS-DOS compatibility macro `USE_ZLIB` (replaced by `HAVE_LIBZ`) - Add support for `ZLIB_LIBS` to override `-lz`. - Omit object files when building examples. - Default `CC` to `gcc` once again, for convenience. (Caveat: compiler name `cc` cannot be set now.) - Set `-DCURL_NO_OLDIES` for examples, like autotools does. - Delete `makefile.dj` files. Notice the configuration details and defaults are not retained with the new method. - Delete `makefile.amiga` files. A successful build needs a few custom options. We're also not retaining all build details from the existing Amiga make files. - Rename `Makefile.m32` to `Makefile.mk` to reflect that they are not Windows/MinGW32-specific anymore. - Add support for new `CFG` options: `-map`, `-debug`, `-trackmem` - Set `-DNDEBUG` by default. - Allow using `-DOS=...` in all `lib/config-*.h` headers, syncing this with `config-win32.h`. - Look for zlib parts in `ZLIB_PATH/include` and `ZLIB_PATH/lib` instead of bare `ZLIB_PATH`. Note that existing build configurations for MS-DOS and AmigaOS likely become incompatible with this change. Example AmigaOS configuration: ``` export CROSSPREFIX=/opt/amiga/bin/m68k-amigaos- export CC=gcc export CPPFLAGS='-DHAVE_PROTO_BSDSOCKET_H' export CFLAGS='-mcrt=clib2' export LDFLAGS="${CFLAGS}" export LIBS='-lnet -lm' make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Example MS-DOS configuration: ``` export CROSSPREFIX=/opt/djgpp/bin/i586-pc-msdosdjgpp- export WATT_PATH=/opt/djgpp/net/watt export ZLIB_PATH=/opt/djgpp export OPENSSL_PATH=/opt/djgpp export OPENSSL_LIBS='-lssl -lcrypt' export CFG=-zlib-ssl make -C lib -f Makefile.mk make -C src -f Makefile.mk ``` Closes #9764