History log of /curl/src/tool_cb_wrt.c (Results 1 – 25 of 59)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# b0c82239 30-Sep-2024 Daniel Stenberg

tool: support --show-headers AND --remote-header-name

By keeping the headers in memory until we know the target file name,
then output them all.

Previously this option combinati

tool: support --show-headers AND --remote-header-name

By keeping the headers in memory until we know the target file name,
then output them all.

Previously this option combination would cause an error.

Add test 1310 and 1492 to verify. Adjusted test 1460 to work in the new
conditions.

Closes #15110

show more ...


# 0cfc7fcc 17-Sep-2024 Daniel Stenberg

tool_cb_wrt: use "curl_response" if no file name in URL

Use the same fallback for content-disposition cases as for regular -O

Add test692: verify -JO with URL without a file name

tool_cb_wrt: use "curl_response" if no file name in URL

Use the same fallback for content-disposition cases as for regular -O

Add test692: verify -JO with URL without a file name

Reported-by: Brian Inglis
Fixes #14939
Closes #14940

show more ...


# 573e7e82 23-Aug-2024 Viktor Szakats

lib, src: delete stray `curl_` prefix from printf calls

Also:
- unit1398: delete redundant `curl/mprintf.h` include.

Closes #14664


# 118f446a 22-Aug-2024 Viktor Szakats

src: delete `curlx_m*printf()` aliases

A couple of seemingly random calls used them.
They were all mapped to `curl_m*printf()`.

Closes #14647


# c0450488 21-Aug-2024 Viktor Szakats

src: fix potential macro confusion in cmake unity builds

Sources used `lib/curlx.h` with both `ENABLE_CURLX_PRINTF` set and unset
before including it.

In a cmake "unity" batch w

src: fix potential macro confusion in cmake unity builds

Sources used `lib/curlx.h` with both `ENABLE_CURLX_PRINTF` set and unset
before including it.

In a cmake "unity" batch where the first included source had it unset,
the next sources did not get the macros requested with
`ENABLE_CURLX_PRINTF` because `lib/curl.x` had already been included
without them.

Fix it by by making the macros enabled permanently and globally for
internal sources, and dropping `ENABLE_CURLX_PRINTF`.

This came up while testing unity builds with smaller batches. The full,
default unity build where all `src` is bundled up in a single unit, was
not affected.

Fixes:
```
$ cmake -B build -DCMAKE_UNITY_BUILD=ON -DCMAKE_UNITY_BUILD_BATCH_SIZE=15
$ make -C build
...
curl/src/tool_getparam.c: In function ‘getparameter’:
curl/src/tool_getparam.c:2409:11: error: implicit declaration of function ‘msnprintf’; did you mean ‘vsnprintf’? [-Wimplicit-function-declaration]
2409 | msnprintf(buffer, sizeof(buffer), "%" CURL_FORMAT_CURL_OFF_T "-",
| ^~~~~~~~~
| vsnprintf
curl/src/tool_getparam.c:2409:11: warning: nested extern declaration of ‘msnprintf’ [-Wnested-externs]
[...]
```

Reported-by: Daniel Stenberg
Bug: https://github.com/curl/curl/pull/14626#issuecomment-2301663491

Closes #14632

show more ...


# f81f351b 02-Aug-2024 Viktor Szakats

tidy-up: OS names

Use these words and casing more consistently across text, comments and
one curl tool output:
AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux,

tidy-up: OS names

Use these words and casing more consistently across text, comments and
one curl tool output:
AIX, ALPN, ANSI, BSD, Cygwin, Darwin, FreeBSD, GitHub, HP-UX, Linux,
macOS, MS-DOS, MSYS, MinGW, NTLM, POSIX, Solaris, UNIX, Unix, Unicode,
WINE, WebDAV, Win32, winbind, WinIDN, Windows, Windows CE, Winsock.

Mostly OS names and a few more.

Also a couple of other minor text fixups.

Closes #14360

show more ...


# c074ba64 01-Jul-2024 Daniel Stenberg

code: language cleanup in comments

Based on the standards and guidelines we use for our documentation.

- expand contractions (they're => they are etc)
- host name = > hostname

code: language cleanup in comments

Based on the standards and guidelines we use for our documentation.

- expand contractions (they're => they are etc)
- host name = > hostname
- file name => filename
- user name = username
- man page => manpage
- run-time => runtime
- set-up => setup
- back-end => backend
- a HTTP => an HTTP
- Two spaces after a period => one space after period

Closes #14073

show more ...


# 1a895383 13-May-2024 Viktor Szakats

src: tidy up types, add necessary casts

Cherry-picked from #13489
Closes #13614


# 9126b141 30-Mar-2024 Daniel Stenberg

curl: use curl_getenv instead of the curlx_ version

The curlx one was once introduced when we still considered dropping the
libcurl function at some point. To reduce confusion and to mak

curl: use curl_getenv instead of the curlx_ version

The curlx one was once introduced when we still considered dropping the
libcurl function at some point. To reduce confusion and to make it
easier to understand when curl_free() should be used, use the actual
libcurl function call directly instead.

Closes #13230

show more ...


# 941b56d7 02-Jan-2024 Daniel Stenberg

tool: prepend output_dir in header callback

When Content-Disposition parsing is used and an output dir is prepended,
make sure to store that new file name correctly so that it can be use

tool: prepend output_dir in header callback

When Content-Disposition parsing is used and an output dir is prepended,
make sure to store that new file name correctly so that it can be used
for setting the file timestamp when --remote-time is used.

Extended test 3012 to verify.

Co-Authored-by: Jay Satiro
Reported-by: hgdagon on github
Fixes #12614
Closes #12617

show more ...


# e9a7d4a1 21-Nov-2023 Viktor Szakats

windows: use built-in `_WIN32` macro to detect Windows

Windows compilers define `_WIN32` automatically. Windows SDK headers
or build env defines `WIN32`, or we have to take care of it. T

windows: use built-in `_WIN32` macro to detect Windows

Windows compilers define `_WIN32` automatically. Windows SDK headers
or build env defines `WIN32`, or we have to take care of it. The
agreement seems to be that `_WIN32` is the preferred practice here.
Make the source code rely on that to detect we're building for Windows.

Public `curl.h` was using `WIN32`, `__WIN32__` and `CURL_WIN32` for
Windows detection, next to the official `_WIN32`. After this patch it
only uses `_WIN32` for this. Also, make it stop defining `CURL_WIN32`.

There is a slight chance these break compatibility with Windows
compilers that fail to define `_WIN32`. I'm not aware of any obsolete
or modern compiler affected, but in case there is one, one possible
solution is to define this macro manually.

grepping for `WIN32` remains useful to discover Windows-specific code.

Also:

- extend `checksrc` to ensure we're not using `WIN32` anymore.

- apply minor formatting here and there.

- delete unnecessary checks for `!MSDOS` when `_WIN32` is present.

Co-authored-by: Jay Satiro
Reviewed-by: Daniel Stenberg

Closes #12376

show more ...


# b1b75528 15-Oct-2023 LoRd_MuldeR

tool_cb_wrt: fix write output for very old Windows versions

- Pass missing parameter for 'lpNumberOfCharsWritten' to WriteConsoleW()
function.

Apparently this parameter was *n

tool_cb_wrt: fix write output for very old Windows versions

- Pass missing parameter for 'lpNumberOfCharsWritten' to WriteConsoleW()
function.

Apparently this parameter was *not* optional on older Windows versions.

Issue observed on Windows XP SP2. Issue not observed on Windows 7 SP1.
So at some point between those two Microsoft changed the behavior.

Prior to this change, on those versions if parameter is NULL then the
function call fails with error ERROR_INVALID_ACCESS.

Regression since af3f4e41.

Ref: https://github.com/MicrosoftDocs/Console-Docs/issues/299

Fixes https://github.com/curl/curl/issues/12131
Closes https://github.com/curl/curl/pull/12130

show more ...


# 73980f9a 13-Sep-2023 Jay Satiro

tool_cb_wrt: fix debug assertion

- Fix off-by-one out-of-bounds array index in Windows debug assertion.

Bug: https://github.com/curl/curl/commit/af3f4e41#r127212213
Reported-by:

tool_cb_wrt: fix debug assertion

- Fix off-by-one out-of-bounds array index in Windows debug assertion.

Bug: https://github.com/curl/curl/commit/af3f4e41#r127212213
Reported-by: Gisle Vanem

show more ...


# af3f4e41 04-Apr-2023 Jay Satiro

tool_cb_wrt: fix invalid unicode for windows console

- Suppress an incomplete UTF-8 sequence at the end of the buffer.

- Attempt to reconstruct incomplete UTF-8 sequence from prior

tool_cb_wrt: fix invalid unicode for windows console

- Suppress an incomplete UTF-8 sequence at the end of the buffer.

- Attempt to reconstruct incomplete UTF-8 sequence from prior call(s)
in current call.

Prior to this change, in Windows console UTF-8 sequences split between
two or more calls to the write callback would cause invalid "replacement
characters" U+FFFD to be printed instead of the actual Unicode
character. This is because in Windows only UTF-16 encoded characters are
printed to the console, therefore we convert the UTF-8 contents to
UTF-16, which cannot be done with partial UTF-8 sequences.

Reported-by: Maksim Arhipov

Fixes https://github.com/curl/curl/issues/9841
Closes https://github.com/curl/curl/pull/10890

show more ...


# 6661bd58 31-May-2023 Daniel Stenberg

tool: remove exclamation marks from error/warning messages


# 6d45b9ca 30-May-2023 Daniel Stenberg

tool: remove newlines from all helpf/notef/warnf/errorf calls

Make voutf() always add one.

Closes #11226


# 2bc1d775 02-Jan-2023 Daniel Stenberg

copyright: update all copyright lines and remove year ranges

- they are mostly pointless in all major jurisdictions
- many big corporations and projects already don't use them
- save

copyright: update all copyright lines and remove year ranges

- 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

show more ...


# 6d751154 08-Nov-2022 Jay Satiro

lib: add CURL_WRITEFUNC_ERROR to signal write callback error

Prior to this change if the user wanted to signal an error from their
write callbacks they would have to use logic to return

lib: add CURL_WRITEFUNC_ERROR to signal write callback error

Prior to this change if the user wanted to signal an error from their
write callbacks they would have to use logic to return a value different
from the number of bytes (nmemb) passed to the callback. Also, the
inclination of some users has been to just return 0 to signal error,
which is incorrect as that may be the number of bytes passed to the
callback.

To remedy this the user can now return CURL_WRITEFUNC_ERROR instead.

Ref: https://github.com/curl/curl/issues/9873

Closes https://github.com/curl/curl/pull/9874

show more ...


# 2b0ddb65 20-Jul-2022 Daniel Stenberg

tool_cfgable: make 'synthetic_error' a plain bool

The specific reason was not used.

Closes #9179


# ad9bc597 17-May-2022 max.mehl

copyright: make repository REUSE compliant

Add licensing and copyright information for all files in this repository. This
either happens in the file itself as a comment header or in the

copyright: make repository REUSE compliant

Add licensing and copyright information for all files in this repository. This
either happens in the file itself as a comment header or in the file
`.reuse/dep5`.

This commit also adds a Github workflow to check pull requests and adapts
copyright.pl to the changes.

Closes #8869

show more ...


# a7b29122 30-Apr-2022 Daniel Gustafsson

curl: free resource in error path

If the new filename cannot be generated due to memory pressure, free
the allocated aname on the way out to avoid a small leak.

Closes: #8770

curl: free resource in error path

If the new filename cannot be generated due to memory pressure, free
the allocated aname on the way out to avoid a small leak.

Closes: #8770
Reviewed-by: Daniel Stenberg <daniel@haxx.se>

show more ...


# 6d861933 30-Apr-2022 Daniel Gustafsson

curl: guard against size_t wraparound in no-clobber code

When generating the new filename, make sure we aren't overflowing the
size_t limit when calculating the new length. This is mostl

curl: guard against size_t wraparound in no-clobber code

When generating the new filename, make sure we aren't overflowing the
size_t limit when calculating the new length. This is mostly academic
but good code hygeine nonetheless.

Closes: #8771
Reviewed-by: Daniel Stenberg <daniel@haxx.se>

show more ...


# a3f4d7ce 30-Mar-2022 Daniel Stenberg

misc: spelling fixes

Mostly in comments but also in the -w documentation for headers_json.

Closes #8647


# 1831a6e7 12-Sep-2021 HexTheDragon

curl: add --no-clobber

Does not overwrite output files if they already exist

Closes #7708
Co-authored-by: Daniel Stenberg


Revision tags: curl-7_76_1, curl-7_76_0, curl-7_75_0, curl-7_74_0
# 4d2f8006 04-Nov-2020 Daniel Stenberg

curl.se: new home

Closes #6172


123