Re: Cirrus CI limiting free compute time

2023-08-21 Thread Timothe Litt via curl-library
At $3500/mo, you could buy a pretty decent physical server in less than 
a month.  Last one I bought was ~USD $2500 - I went for a model year 
behind (besides being cheaper, I have no use for the "efficiency"/large 
core mixes).  Several Tb of disk, ECC memory, 6 cores (12 counting HT), 
3.4GHz,


You do need to do the system admin, have physical space & power - but 
one box can host all 8 of your VMs.  And the dollar cost is low after 
the 1-time investment.  (OK, 1-time every 5 - 8 years...)


You don't need much (external) network bandwidth once setup - a git 
mirror is cheap, as is start/stop/status for CI jobs.


Cloud virtual seems like a bargain initially, but as you've discovered, 
in the long run they make money by enticing you with special 
introductory offers, then eventually raising the costs.


Timothe Litt
ACM Distinguished Engineer
--
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.

On 21-Aug-23 20:53, Dan Fandrich via curl-library wrote:

The curl Cirrus CI pages now link[1] to a notice that they're limiting their
free CI tier starting next week. The new limit will be "50 compute credits" per
month, which seems to buy us about 260 hours of compute time.  Unfortunately,
curl has been using about 6000 hours of compute time per month lately[2]. At
that rate, our free time will be used up on the first day.

They have an easy-to-use credit-card entry form for us to buy credits, but it
looks to me like that would cost us almost $3500 per month (presumably USD).

Another option is to rent one or more virtual servers somewhere and hook them up
to Cirrus CI for only $10 per month. To replace our current usage would require
at least 8 virtual servers, though, so still several hundred dollars per month.

Finally, we could migrate all but the FreeBSD jobs to one of the CI services
still offering a reasonable free tier (Azure and GHA). We can almost squeeze in
our FreeBSD builds within our the Cirrus CI monthly credits, and I'm not aware
of another CI service that offers FreeBSD servers, so that's probably the
cheapest way forward. But it probably means more latency and slower build
results as we load the other services even more.

Dan

[1]https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/
[2]https://cirrus-ci.com/settings/github/curl  (must be logged in)



OpenPGP_signature
Description: OpenPGP digital signature
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html


Cirrus CI limiting free compute time

2023-08-21 Thread Dan Fandrich via curl-library
The curl Cirrus CI pages now link[1] to a notice that they're limiting their
free CI tier starting next week. The new limit will be "50 compute credits" per
month, which seems to buy us about 260 hours of compute time.  Unfortunately,
curl has been using about 6000 hours of compute time per month lately[2]. At
that rate, our free time will be used up on the first day.

They have an easy-to-use credit-card entry form for us to buy credits, but it
looks to me like that would cost us almost $3500 per month (presumably USD).

Another option is to rent one or more virtual servers somewhere and hook them up
to Cirrus CI for only $10 per month. To replace our current usage would require
at least 8 virtual servers, though, so still several hundred dollars per month.

Finally, we could migrate all but the FreeBSD jobs to one of the CI services
still offering a reasonable free tier (Azure and GHA). We can almost squeeze in
our FreeBSD builds within our the Cirrus CI monthly credits, and I'm not aware
of another CI service that offers FreeBSD servers, so that's probably the
cheapest way forward. But it probably means more latency and slower build
results as we load the other services even more.

Dan

[1] https://cirrus-ci.org/blog/2023/07/17/limiting-free-usage-of-cirrus-ci/
[2] https://cirrus-ci.com/settings/github/curl (must be logged in)

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html


Re: help - libcurl frozen when retrieve token from microsoft cognitive api

2023-08-21 Thread Daniel Stenberg via curl-library

On Mon, 21 Aug 2023, Hua-Tong Shi via curl-library wrote:


   curl_easy_setopt(curl_ptr, CURLOPT_POST, 1L);


You ask libcurl to do a POST, but without telling it *what* to post. Like 
CURLOPT_POSTFIELDS set to "" (a zero length string) since you seem to not want 
to actually send any data in the POST.


Without knowing what to post and with no callback set, it reads from stdin by 
default.



 headers_ptr = curl_slist_append(headers_ptr, "Content-Length: 0");


Then you also won't have to artificially add this header since libcurl will 
do that by itself.


--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html


Re: Reseting a curl multi handle for reuse

2023-08-21 Thread Daniel Stenberg via curl-library

On Mon, 21 Aug 2023, Taw via curl-library wrote:

I want to use a multi handle for async connection.Not sure if the code 
belowis correct, because I don't see any curl_multi_reset in the 
documentation and I don't know how to reset it.


There is no curl_multi_reset(). I have never seen anyone wanting one or having 
had a good reason for it.


What would you like the reset to do? Just restore all setopts to their default 
values?


What happens to the curlMulti if I don't reset it between calls, especially 
in case of errors? 


Nothing. There's no persistent error state stored in the handle. An 
application could very well spend forever just using the same multi handle, 
adding and removing easy handles over time.


--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html


Reseting a curl multi handle for reuse

2023-08-21 Thread Taw via curl-library
Hello, 
I am already reusing a curl easy handle, but not sure how to reuse a curl multi 
handle.
My current (psuedo)code is like this.
curlEasy = curl_easy_init();
// connection 1// set options 
1curl_easy_perform(curlEasy);curl_easy_reset(curlEasy);
// connection 2// set options 
2curl_easy_perform(curlEasy);curl_easy_reset(curlEasy);
// and so on
curl_easy_cleanup(curlEasy);
I want to use a multi handle for async connection.Not sure if the code belowis 
correct, because I don't see any curl_multi_reset in the documentation and I 
don't know how to reset it.What happens to the curlMulti if I don't reset it 
between calls, especially in case of errors? 

curlMulti = curl_multi_init();curlEasy = curl_easy_init();
// connection 1// set options 1curl_multi_add_handle(curlMulti, curlEasy);
curl_multi_perform(curlMulti);curl_multi_remove_handle(curlMulti, curlEasy);
curl_easy_reset(curlEasy);
// connection 2// set options 2 curl_multi_add_handle(curlMulti, curlEasy);
curl_multi_perform(curlMulti);curl_multi_remove_handle(curlMulti, curlEasy);
curl_easy_reset(curlEasy);
curl_easy_cleanup(curlEasy);
curl_multi_cleanup(curlMulti)
thank you


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html


help - libcurl frozen when retrieve token from microsoft cognitive api

2023-08-21 Thread Hua-Tong Shi via curl-library
I referred to the curl sample and wrote the following program.

```C
#include 
#include 
#include 
#include 
#include 

struct data {
char trace_ascii; /* 1 or 0 */
};

struct MemoryStruct {
char  *memory;
size_t size;
};

static void dump(const char *text, FILE *stream, unsigned char *ptr, size_t 
size, char nohex)
{
size_t   i;
size_t   c;

unsigned int width = 0x10;

if (nohex) /* without the hex output, we can fit more on screen */
width = 0x40;

fprintf(stream, "%s, %10.10lu bytes (0x%8.8lx)\n", text, (unsigned 
long)size, (unsigned long)size);

for (i = 0; i < size; i += width) {
fprintf(stream, "%4.4lx: ", (unsigned long)i);

if (!nohex) {
/* hex not disabled, show it */
for (c = 0; c < width; c++)
if (i + c < size)
fprintf(stream, "%02x ", ptr[i + c]);
else
fputs("   ", stream);
}

for (c = 0; (c < width) && (i + c < size); c++) {
/* check for 0D0A; if found, skip past and start a new line of 
output */
if (nohex && (i + c + 1 < size) && ptr[i + c] == 0x0D && ptr[i + c 
+ 1] == 0x0A) {
i += (c + 2 - width);
break;
}
fprintf(stream, "%c", (ptr[i + c] >= 0x20) && (ptr[i + c] < 0x80) ? 
ptr[i + c] : '.');
/* check again for 0D0A, to avoid an extra \n if it's at width */
if (nohex && (i + c + 2 < size) && ptr[i + c + 1] == 0x0D && ptr[i 
+ c + 2] == 0x0A) {
i += (c + 3 - width);
break;
}
}
fputc('\n', stream); /* newline */
}
fflush(stream);
}

static int my_trace(CURL *handle, curl_infotype type, char *data, size_t size, 
void *userp)
{
struct data *config = (struct data *)userp;
const char  *text;
(void)handle; /* prevent compiler warning */

switch (type) {
case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data);
/* FALLTHROUGH */
default: /* in case a new one is introduced to shock us */
return 0;

case CURLINFO_HEADER_OUT:
text = "=> Send header";
break;
case CURLINFO_DATA_OUT:
text = "=> Send data";
break;
case CURLINFO_SSL_DATA_OUT:
text = "=> Send SSL data";
break;
case CURLINFO_HEADER_IN:
text = "<= Recv header";
break;
case CURLINFO_DATA_IN:
text = "<= Recv data";
break;
case CURLINFO_SSL_DATA_IN:
text = "<= Recv SSL data";
break;
}

dump(text, stderr, (unsigned char *)data, size, config->trace_ascii);
return 0;
}

static size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, 
void *userp)
{
size_t   realsize = size * nmemb;
struct MemoryStruct *mem = (struct MemoryStruct *)userp;

char*ptr = realloc(mem->memory, mem->size + realsize + 1);
if (!ptr) {
/* out of memory! */
printf("not enough memory (realloc returned NULL)\n");
return 0;
}

mem->memory = ptr;
memcpy(&(mem->memory[mem->size]), contents, realsize);
mem->size += realsize;
mem->memory[mem->size] = 0;

return realsize;
}

int main(void)
{
CURL   *curl_ptr = NULL;
struct data config;
struct MemoryStruct chunk;
struct curl_slist  *headers_ptr = NULL;
charsubscriptionHeader[128];
CURLcoderes;

config.trace_ascii = 1;   /* enable ascii tracing */
chunk.memory = malloc(1); /* will be grown as needed by realloc above */
chunk.size = 0;   /* no data at this point */

curl_ptr = curl_easy_init();
if (curl_ptr) {
headers_ptr = curl_slist_append(headers_ptr, "Content-Length: 0");

snprintf(subscriptionHeader, 128, "%s: %s", 
"Ocp-Apim-Subscription-Key", "My-Key");
headers_ptr = curl_slist_append(headers_ptr, subscriptionHeader);

curl_easy_setopt(curl_ptr, CURLOPT_URL, 
"https://eastasia.api.cognitive.microsoft.com/sts/v1.0/issueToken";);
curl_easy_setopt(curl_ptr, CURLOPT_POST, 1L);

if (NULL != headers_ptr) {
curl_easy_setopt(curl_ptr, CURLOPT_HTTPHEADER, headers_ptr);
}

curl_easy_setopt(curl_ptr, CURLOPT_DEBUGFUNCTION, my_trace);
curl_easy_setopt(curl_ptr, CURLOPT_DEBUGDATA, &config);

/* the DEBUGFUNCTION has no effect until we enable VERBOSE */
curl_easy_setopt(curl_ptr, CURLOPT_VERBOSE, 1L);

/* send all data to this function  */
curl_easy_setopt(curl_ptr, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);

/* we pass our 'chunk' struct to the callback function */
curl_easy_setopt(curl_ptr, CURLOPT_WRITEDATA, (void *)&chunk);

/* Perform the request, res will get the return code */
  

should we retract CVE-2023-32001?

2023-08-21 Thread Daniel Stenberg via curl-library

Hello friends,

Harry makes a very compelling argument in this issue [*].

I'm interested in more comments and thoughts on the topic before I act on it.

[*] = https://github.com/curl/curl/issues/11530

--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html