How to handle _wcsdup() memory allocation

2021-07-29 Thread Jeff Mears via curl-library
Right now, if you override the memory allocators with curl_global_init_mem() then do an operation that uses Windows NT authentication, you will probably corrupt the heap. This is because libcurl uses _wcsdup() from the C runtime during the NT authentication, then frees the memory using the

Should we CURL_SOCKET_TIMEOUT after curl_multi_add_handle?

2020-10-14 Thread Jeff Mears via curl-library
We use libcurl's "multi" interface on a server to dispatch HTTPS requests when the server code decides it needs to. We create an easy handle, then call curl_multi_add_handle to trigger the download. According to this web page, though:

Repeated calls to ares_init when using c-ares

2020-01-28 Thread Jeff Mears via curl-library
When using c-ares for async DNS, every time curl_easy_init is called, libcurl calls ares_init via Curl_resolver_init. In an environment with many requests being done using the "multi" interface, this is slow. ares_init does things like read /etc/resolv.conf and initializing big arrays. It's

RE: curl_easy_setopt type checking for C++

2019-12-17 Thread Jeff Mears via curl-library
stack memory. -Original Message- From: curl-library On Behalf Of WebMC via curl-library Sent: Tuesday, December 17, 2019 1:27 AM To: Jeff Mears via curl-library Cc: WebMC Subject: Re: curl_easy_setopt type checking for C++ Le 09/12/2019 à 22:37, Jeff Mears via curl-library a écrit

RE: curl_easy_setopt type checking for C++

2019-12-10 Thread Jeff Mears via curl-library
On Tue, 10 Dec 2019, Daniel Stenberg via curl-library wrote: > On Mon, 9 Dec 2019, Jeff Mears via curl-library wrote: > > > curl_easy_setopt and curl_multi_setopt don't currently have a C++ > > implementation that enforces type checking. In C, it uses GCC > > extensions

curl_easy_setopt type checking for C++

2019-12-09 Thread Jeff Mears via curl-library
curl_easy_setopt and curl_multi_setopt don't currently have a C++ implementation that enforces type checking. In C, it uses GCC extensions to do this type checking. In C++, there are many ways to accomplish this type checking, and I was wondering what libcurl devs would actually want. As an

RE: Problem where timer callback keeps setting a 0 timer

2019-12-05 Thread Jeff Mears via curl-library
This worked; thanks. I missed that about the timer callback being non-repeating. -Original Message- From: curl-library On Behalf Of Daniel Stenberg via curl-library Sent: Tuesday, December 3, 2019 11:26 PM To: Sean Burford via curl-library Cc: Daniel Stenberg Subject: Re: Problem

Problem where timer callback keeps setting a 0 timer

2019-12-03 Thread Jeff Mears via curl-library
I have a background thread that starts and stops libcurl downloads using the "multi" interface. It has a poll() loop that waits for something to happen on either one of libcurl's sockets or on a loopback socket that is used to interrupt poll(). After running for a bit, there is a periodic

Supporting atomic noninheritability of FDs

2019-12-02 Thread Jeff Mears via curl-library
By default, file handles are inheritable. This means that if you have a server using libcurl and call fork() + exec(), the file handles used by libcurl are inherited by the child process. This can have security implications in some cases, but more commonly just results in unreliability:

OPENSOCKETFUNCTION documentation weirdness

2019-12-02 Thread Jeff Mears via curl-library
The documentation for CURLOPT_OPENSOCKETFUNCTION is a little weird. https://curl.haxx.se/libcurl/c/CURLOPT_OPENSOCKETFUNCTION.html CURLSOCKTYPE_ACCEPT doesn't make any sense for OPENSOCKETFUNCTION, because there's no listener socket passed in. Indeed, the only code using this constant is

RE: Curl_poll and Windows

2019-11-19 Thread Jeff Mears via curl-library
Sorry if the formatting is messed up. Microsoft Outlook doesn't handle text-only mailing lists very well. > From: Daniel Stenberg > Sent: Monday, November 18, 2019 2:11 PM > > > First, Windows Vista and later have an API called WSAPoll. It works > > almost the same as UNIX poll. > > Almost

Curl_poll and Windows

2019-11-18 Thread Jeff Mears via curl-library
I just noticed the function Curl_poll in libcurl. It has some things that could be improved for usage on Windows. First, Windows Vista and later have an API called WSAPoll. It works almost the same as UNIX poll. https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll

Replacing the whole socket interface of libcurl

2019-11-18 Thread Jeff Mears via curl-library
I work on a project that uses libcurl, and even though it's by far the best multi-platform HTTP client library, several aspects of libcurl frustrate me. The biggest one is that libcurl demands that itself call most socket routines. This means that it can be very difficult to integrate