/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
- curl_easy_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
+ curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
/* set user name and password for the authentication */
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
#include <curl/curl.h>
#define MSG_OUT g_print /* Change to "g_error" to write to stderr */
-#define SHOW_VERBOSE 0 /* Set to non-zero for libcurl messages */
+#define SHOW_VERBOSE 0L /* Set to non-zero for libcurl messages */
#define SHOW_PROGRESS 0 /* Set to non-zero to enable progress callback */
/* Global information, common to all connections */
curl_easy_setopt(conn->easy, CURLOPT_URL, conn->url);
curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb);
curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, &conn);
- curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, (long)SHOW_VERBOSE);
+ curl_easy_setopt(conn->easy, CURLOPT_VERBOSE, SHOW_VERBOSE);
curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error);
curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn);
curl_easy_setopt(conn->easy, CURLOPT_NOPROGRESS, SHOW_PROGRESS ? 0L : 1L);
struct state st = {0};
/* enable HSTS for this handle */
- curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, (long)CURLHSTS_ENABLE);
+ curl_easy_setopt(curl, CURLOPT_HSTS_CTRL, CURLHSTS_ENABLE);
/* function to call at first to populate the cache before the transfer */
curl_easy_setopt(curl, CURLOPT_HSTSREADFUNCTION, hstsread);
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
/* Use HTTP/3 but fallback to earlier HTTP if necessary */
- curl_easy_setopt(curl, CURLOPT_HTTP_VERSION,
- (long)CURL_HTTP_VERSION_3);
+ curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3);
/* Perform the request, res gets the return code */
res = curl_easy_perform(curl);
* of using CURLUSESSL_TRY here, because if TLS upgrade fails, the
* transfer continues anyway - see the security discussion in the libcurl
* tutorial for more details. */
- curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
/* If your server does not have a valid certificate, then you can disable
* part of the Transport Layer Security protection by setting the
* using CURLUSESSL_TRY here, because if TLS upgrade fails, the transfer
* continues anyway - see the security discussion in the libcurl tutorial
* for more details. */
- curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
/* If your server does not have a valid certificate, then you can disable
* part of the Transport Layer Security protection by setting the
* of using CURLUSESSL_TRY here, because if TLS upgrade fails, the
* transfer continues anyway - see the security discussion in the libcurl
* tutorial for more details. */
- curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
/* If your server does not have a valid certificate, then you can disable
* part of the Transport Layer Security protection by setting the
~~~c
#include <curl/curl.h>
-#define CURLHSTS_ENABLE (1<<0)
-#define CURLHSTS_READONLYFILE (1<<1)
+#define CURLHSTS_ENABLE (long)(1<<0)
+#define CURLHSTS_READONLYFILE (long)(1<<1)
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HSTS_CTRL, long bitmask);
~~~
if(curl) {
CURLcode ret;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
- curl_easy_setopt(curl, CURLOPT_HTTP_VERSION,
- (long)CURL_HTTP_VERSION_2TLS);
+ curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, (long)CURL_HTTP_VERSION_2TLS);
ret = curl_easy_perform(curl);
if(ret == CURLE_HTTP_RETURNED_ERROR) {
/* an HTTP response error problem */
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
/* of all addresses example.com resolves to, only IPv6 ones are used */
- curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6);
+ curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V6);
res = curl_easy_perform(curl);
/* new in libcurl 7.10.6 */
if(config->proxyanyauth)
- my_setopt_bitmask(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY);
+ my_setopt_bitmask(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
else if(config->proxynegotiate)
my_setopt_bitmask(curl, CURLOPT_PROXYAUTH, CURLAUTH_GSSNEGOTIATE);
else if(config->proxyntlm)
curl_easy_setopt(hnd, CURLOPT_XFERINFOFUNCTION, my_progress_d_cb);
curl_easy_setopt(hnd, CURLOPT_XFERINFODATA, t);
if(use_earlydata)
- curl_easy_setopt(hnd, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_EARLYDATA);
+ curl_easy_setopt(hnd, CURLOPT_SSL_OPTIONS, CURLSSLOPT_EARLYDATA);
if(forbid_reuse_d)
curl_easy_setopt(hnd, CURLOPT_FORBID_REUSE, 1L);
if(host)
curl_easy_setopt(hnd, CURLOPT_WRITEFUNCTION, my_write_u_cb);
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, t);
if(use_earlydata)
- curl_easy_setopt(hnd, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_EARLYDATA);
+ curl_easy_setopt(hnd, CURLOPT_SSL_OPTIONS, CURLSSLOPT_EARLYDATA);
if(!t->method || !strcmp("PUT", t->method))
curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
easy_setopt(curl, CURLOPT_URL, URL);
easy_setopt(curl, CURLOPT_HEADER, 1L);
- easy_setopt(curl, CURLOPT_TIMECONDITION, (long)CURL_TIMECOND_IFMODSINCE);
+ easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
/* TIMEVALUE in the future */
easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680L);
easy_init(curl);
easy_setopt(curl, CURLOPT_URL, URL);
- easy_setopt(curl, CURLOPT_TIMEOUT, (long)7);
- easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1);
+ easy_setopt(curl, CURLOPT_TIMEOUT, 7L);
+ easy_setopt(curl, CURLOPT_NOSIGNAL, 1L);
easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressKiller);
easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL);
- easy_setopt(curl, CURLOPT_NOPROGRESS, (long)0);
+ easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
res = curl_easy_perform(curl);
easy_init(t1555_curl);
easy_setopt(t1555_curl, CURLOPT_URL, URL);
- easy_setopt(t1555_curl, CURLOPT_TIMEOUT, (long)7);
- easy_setopt(t1555_curl, CURLOPT_NOSIGNAL, (long)1);
+ easy_setopt(t1555_curl, CURLOPT_TIMEOUT, 7L);
+ easy_setopt(t1555_curl, CURLOPT_NOSIGNAL, 1L);
easy_setopt(t1555_curl, CURLOPT_PROGRESSFUNCTION, progressCallback);
easy_setopt(t1555_curl, CURLOPT_PROGRESSDATA, NULL);
- easy_setopt(t1555_curl, CURLOPT_NOPROGRESS, (long)0);
+ easy_setopt(t1555_curl, CURLOPT_NOPROGRESS, 0L);
res = curl_easy_perform(t1555_curl);
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
curl_easy_setopt(hnd, CURLOPT_USERPWD, "testuser:testpass");
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "lib1568");
- curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
+ curl_easy_setopt(hnd, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
curl_easy_setopt(hnd, CURLOPT_PORT, strtol(libtest_arg2, NULL, 10));
easy_init(curl);
easy_setopt(curl, CURLOPT_URL, URL);
- easy_setopt(curl, CURLOPT_TIMECONDITION, (long)CURL_TIMECOND_IFMODSINCE);
+ easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
/* Some TIMEVALUE; it doesn't matter. */
easy_setopt(curl, CURLOPT_TIMEVALUE, 1566210680L);
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
- curl_easy_setopt(curl, CURLOPT_NETRC, (long)CURL_NETRC_REQUIRED);
+ curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_REQUIRED);
curl_easy_setopt(curl, CURLOPT_NETRC_FILE, libtest_arg2);
res = curl_easy_perform(curl);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/2000");
curl_easy_setopt(hnd, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
- curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION,
- (long)CURL_HTTP_VERSION_2TLS);
+ curl_easy_setopt(hnd, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
curl_easy_setopt(curl, CURLOPT_URL, URL);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_PROXY, libtest_arg3);
- curl_easy_setopt(curl, CURLOPT_NETRC, (long)CURL_NETRC_REQUIRED);
+ curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_REQUIRED);
curl_easy_setopt(curl, CURLOPT_NETRC_FILE, libtest_arg2);
curldupe = curl_easy_duphandle(curl);
easy_setopt(curl[i], CURLOPT_URL, target_url);
/* go http2 */
easy_setopt(curl[i], CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3ONLY);
- easy_setopt(curl[i], CURLOPT_CONNECTTIMEOUT_MS, (long)5000);
+ easy_setopt(curl[i], CURLOPT_CONNECTTIMEOUT_MS, 5000L);
easy_setopt(curl[i], CURLOPT_CAINFO, libtest_arg4);
/* wait for first connection established to see if we can share it */
easy_setopt(curl[i], CURLOPT_PIPEWAIT, 1L);
test_setopt(curl, CURLOPT_HTTPHEADER, slist);
if(testnum == 565) {
- test_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
+ test_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
test_setopt(curl, CURLOPT_USERPWD, "foo:bar");
}
if(res)
goto init_failed;
- res_easy_setopt(testeh[num], CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY);
+ res_easy_setopt(testeh[num], CURLOPT_PROXYAUTH, CURLAUTH_ANY);
if(res)
goto init_failed;
test_setopt(curl, CURLOPT_PROXY, libtest_arg2);
test_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3);
test_setopt(curl, CURLOPT_PROXYAUTH,
- (long) (CURLAUTH_NTLM | CURLAUTH_DIGEST | CURLAUTH_BASIC) );
+ CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM);
res = curl_easy_perform(curl);
/* Accept any auth. But for this bug configure proxy with DIGEST, basic
might work too, not NTLM */
- test_setopt(curl, CURLOPT_PROXYAUTH, (long)CURLAUTH_ANY);
+ test_setopt(curl, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
res = curl_easy_perform(curl);
easy_setopt(curl, CURLOPT_PROXY, libtest_arg2);
easy_setopt(curl, CURLOPT_PROXYUSERPWD, libtest_arg3);
easy_setopt(curl, CURLOPT_PROXYAUTH,
- (long) (CURLAUTH_NTLM | CURLAUTH_DIGEST | CURLAUTH_BASIC) );
+ CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM);
multi_init(m);
/* enforce chunked transfer by setting the header */
test_setopt(curl, CURLOPT_HTTPHEADER, slist);
- test_setopt(curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_DIGEST);
+ test_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
test_setopt(curl, CURLOPT_USERPWD, "foo:bar");
/* we want to use our own progress function */
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
easy_setopt(curl, CURLOPT_URL, URL);
- easy_setopt(curl, CURLOPT_INFILESIZE, (long)5);
+ easy_setopt(curl, CURLOPT_INFILESIZE, 5L);
multi_add_handle(multiHandle, curl);
It is reproducible by the following steps:
- - Use a proxy that offers NTLM and Negotiate ( CURLOPT_PROXY and
- CURLOPT_PROXYPORT)
- - Tell libcurl NOT to use Negotiate CURL_EASY_SETOPT(CURLOPT_PROXYAUTH,
- CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM)
+ - Use a proxy that offers NTLM and Negotiate
+ (CURLOPT_PROXY and CURLOPT_PROXYPORT)
+ - Tell libcurl NOT to use Negotiate
+ curl_easy_setopt(CURLOPT_PROXYAUTH,
+ CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM)
- Start the request
*/
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_HEADER, 1L);
test_setopt(curl, CURLOPT_PROXYAUTH,
- (long) (CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM));
+ CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM);
test_setopt(curl, CURLOPT_PROXY, libtest_arg2); /* set in first.c */
/* set the name + password twice to test that the API is fine with it */
curl_easy_setopt(curl, CURLOPT_HEADER, 1L);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_USERAGENT, "CURLOPT_CAINFO_BLOB");
- curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS,
- (long)CURLSSLOPT_REVOKE_BEST_EFFORT);
+ curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, CURLSSLOPT_REVOKE_BEST_EFFORT);
blob.data = certdata;
blob.len = certsize;
test_setopt(curl, CURLOPT_HEADER, 1L);
test_setopt(curl, CURLOPT_VERBOSE, 1L);
test_setopt(curl, CURLOPT_HTTPAUTH,
- (long) (CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM));
+ CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_NTLM);
test_setopt(curl, CURLOPT_USERPWD, "me:password");
do {