← all packages

curl

native: 127 functions analysed · 114 typed · 4 untypeable · 0 timed out · 40 entry points (36 typed) · R: 190 definitions, 134 typed strict, 162 gradual, prelude debt 16 · fuzzing: 45 definitions, 0 unsound, 6 accept calls outside their domain · tyr dc7f1a7 · Rsem 5c142d7 · NativeSem 770a1eb · rstt 2b2696f unpinned

Native functions

C functions reachable from an entry point
127 / 127 (100.0%)
typed
114 / 127 (89.8%)
6 more bound at their declared C signature after inference failed.

Native → R

entry points
40 / 40 (100.0%)
defined in src/
40 / 40 (100.0%)
typed
36 / 40 (90.0%)
bound in R
36 / 40 (90.0%)

R definitions

named top-level definitions
190 / 190 (100.0%)
not blocked by an unbound native symbol
187 / 190 (98.4%)
3 definitions report unbound variable on a native symbol tyr could not bind — the native panel’s loss, arriving here.
typed, gradual
162 / 190 (85.3%)
typed, strict
134 / 190 (70.5%)
16 of the strict failures are a name missing from the prelude.
side
mode
318 / 318

Native functions 127

append_buffer typed

([c_ptr, c_int, c_int, c_ptr] -> c_int)&([c_ptr, c_int_na, c_int_na, c_ptr] -> c_int_na)
timing: 0.295 s
source
size_t append_buffer(void *contents, size_t sz, size_t nmemb, void *ctx) {
//if (pending_interrupt())
  //  return 0;

  /* avoids compiler warning on windows */
  size_t realsize = sz * nmemb;
  memory *mem = (memory*) ctx;

  /* realloc can be slow, therefore increase buffer to nearest 2^n */
  mem->buf = realloc(mem->buf, round_up(mem->size + realsize));
  if (!mem->buf)
    return 0;

  /* append data and increment size */
  memcpy(&(mem->buf[mem->size]), contents, realsize);
  mem->size += realsize;
  return realsize;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:168

assert_message typed

[c(1..41) | c(43..99), c_string] | [c(42), c_string] | [c_false, c_string] -> ()
timing: 0.204 s
source
void assert_message(CURLcode res, const char *str){
  if(res == CURLE_OK)
    return;
  if(res == CURLE_ABORTED_BY_CALLBACK)
    send_r_interrupt();
  if(str == NULL)
    str = curl_easy_strerror(res);
  SEXP code = PROTECT(Rf_ScalarInteger(res));
  SEXP message = PROTECT(make_string(str));
  SEXP expr = PROTECT(Rf_install("raise_libcurl_error"));
  SEXP call = PROTECT(Rf_lang3(expr, code, message));
  SEXP env = PROTECT(R_FindNamespace(Rf_mkString("curl")));
  Rf_eval(call, env);
  UNPROTECT(5); //never happens
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:53

assert_setopt typed

[c_false, c(0..596), c_string] -> ()
timing: 1.29 s
source
static void assert_setopt(CURLcode res, CURLoption opt, const char *optname){
  if(res != CURLE_OK){
    char errmsg [256] = {0};
    if(opt == CURLOPT_MAIL_RCPT || opt == CURLOPT_MAIL_FROM || opt == CURLOPT_MAIL_AUTH){
      snprintf(errmsg, 256, "Error setting '%s': your libcurl may have disabled SMTP support", optname);
    } else {
      snprintf(errmsg, 256, "Invalid or unsupported value when setting curl option '%s'", optname);
    }
    assert_message(CURLE_BAD_FUNCTION_ARGUMENT, errmsg);
  }
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:86

assert_status typed

([c(1..99), c_null] -> empty)&([c_false, *struct reference] -> ())
timing: 0.022 s
source
void assert_status(CURLcode res, reference *ref){
  raise_libcurl_error(res, ref, R_NilValue);
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:105

check_handles typed

[c_ptr, c_null] -> ()
timing: 0.150 s
source
static void check_handles(CURLM *manager, reference *ref) {
  for(int msg = 1; msg > 0;){
    CURLMsg *out = curl_multi_info_read(manager, &msg);
    if(out)
      assert_status(out->data.result, ref);
  }
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:101

check_interrupt_fn typed

[c_ptr] -> ()
timing: 0.003 s
source
void check_interrupt_fn(void *dummy) {
  R_CheckUserInterrupt();
}
/__w/r-typing/r-typing/work/sources/curl/src/interrupt.c:9

clean_handle typed

([*struct reference] -> ())&([c_null] -> empty)
timing: 1.45 s
source
void clean_handle(reference *ref){
  if(ref->refCount == 0){
    if(ref->headers)
      curl_slist_free_all(ref->headers);
    if(ref->custom)
      curl_slist_free_all(ref->custom);
    if(ref->form)
      curl_formfree(ref->form);
    if(ref->handle)
      curl_easy_cleanup(ref->handle);
    if(ref->resheaders.buf)
      free(ref->resheaders.buf);
    free(ref);
    total_handles--;
  }
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:17

cleanup typed

[*{ private : any ..}] -> ()
timing: 0.290 s
source
static void cleanup(Rconnection con) {
  request *req = (request*) con->private;
  reference *ref = req->ref;

  /* free thee handle connection */
  curl_multi_remove_handle(req->manager, req->handle);
  curl_easy_setopt(req->handle, CURLOPT_WRITEFUNCTION, NULL);
  curl_easy_setopt(req->handle, CURLOPT_WRITEDATA, NULL);
  curl_easy_setopt(req->handle, CURLOPT_FAILONERROR, 0L);
  ref->locked = 0;

  /* delayed finalizer cleanup */
  (ref->refCount)--;
  clean_handle(ref);

  /* clean up connection */
  curl_multi_cleanup(req->manager);
  free(req->buf);
  free(req->url);
  free(req);
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:152

curl_perform_with_interrupt typed

[c_ptr] -> c(0..99)
timing: 0.332 s
source
CURLcode curl_perform_with_interrupt(CURL *handle){
  /* start settings */
  CURLcode status = CURLE_FAILED_INIT;
  CURLM * temp_multi_handle = NULL;
  CURLM * multi_handle = NULL;
  int still_running = 1;

  /* Do not reuse FTP connections, because it is buggy */
  /* For example https://github.com/jeroen/curl/issues/348 */
  const char *effective_url = NULL;
  curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &effective_url);
  if(effective_url && str_starts_with(effective_url, "ftp")){
    temp_multi_handle = curl_multi_init();
    multi_handle = temp_multi_handle;
  } else {
    multi_handle = shared_multi_handle;
  }

  if(CURLM_OK != curl_multi_add_handle(multi_handle, handle)){
    return CURLE_FAILED_INIT;
  }

  /* non blocking downloading */
  while(still_running) {
    if(pending_interrupt()){
      status = CURLE_ABORTED_BY_CALLBACK;
      break;
    }

    int numfds;
    if(curl_multi_wait(multi_handle, NULL, 0, 1000, &numfds) != CURLM_OK)
      break;

    /* check for multi errors */
    if(curl_multi_perform(multi_handle, &(still_running)) != CURLM_OK)
      break;
  }

  /* set status if handle has completed. This might be overkill */
  if(!still_running){
    int msgq = 0;
    do {
      CURLMsg *m = curl_multi_info_read(multi_handle, &msgq);
      if(m && (m->msg == CURLMSG_DONE)){
        status = m->data.result;
        break;
      }
    } while (msgq > 0);
  }

  /* cleanup first */
  curl_multi_remove_handle(multi_handle, handle);
  if(temp_multi_handle)
    curl_multi_cleanup(temp_multi_handle);
  return status;
}
/__w/r-typing/r-typing/work/sources/curl/src/interrupt.c:26

data_callback typed

[c_ptr, c_int, c_int, any_sexp] -> c_int
timing: 0.069 s
source
size_t data_callback(void * data, size_t sz, size_t nmemb, SEXP fun) {
  size_t size = sz * nmemb;
  SEXP buf = PROTECT(Rf_allocVector(RAWSXP, size));
  memcpy(RAW(buf), data, size);

  /* call the R function */
  int err;
  SEXP call = PROTECT(Rf_lang3(fun, buf, Rf_ScalarInteger(0)));
  R_tryEval(call, R_GlobalEnv, &err);
  UNPROTECT(2);
  return err ? 0 : size;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:187

default_headers typed

() -> *struct curl_slist
timing: 0.061 s
source
static struct curl_slist * default_headers(void){
  static struct curl_slist * headers = NULL;
  if(headers == NULL){
    headers = curl_slist_append(headers, "Expect:");
  }
  return headers;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:78

default_verbose_cb typed

[c_ptr, c(3..7), c_string, c_int_na, c_ptr] -> c_false
timing: 0.201 s
source
static int default_verbose_cb(CURL *handle, curl_infotype type, char *data, size_t size, void *userptr){
  if(type < 3){
    char prefix = type == CURLINFO_TEXT ? '*' : (type == CURLINFO_HEADER_IN ? '<' : '>');
    REprintf("%c %.*s", prefix, (int) size, data);
  }
  return 0;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:108

dummy_read typed

[c_string, c_int_na, c_int_na, c_ptr] -> c_false
timing: 0.006 s
source
static size_t dummy_read(char *buffer, size_t size, size_t nitems, void *instream){
  return 0;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:48

fail_if typed

([c(1..30)] -> empty)&([c_false] -> ())
timing: 0.015 s
source
static void fail_if(CURLUcode err){
  if(err != CURLUE_OK)
#ifdef HAS_CURL_PARSER_STRERROR
    Rf_error("Failed to parse URL: %s", curl_url_strerror(err));
#else
    Rf_error("Failed to parse URL: error code %d", err);
#endif
}
/__w/r-typing/r-typing/work/sources/curl/src/urlparser.c:18

fetchdata typed empty return

[c_null] -> empty
timing: 0.136 s
source
static void fetchdata(request *req) {
  R_CheckUserInterrupt();
  massert(curl_multi_perform(req->manager, &(req->has_more)));
  check_handles(req->manager, req->ref);
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:109

fin_file_writer typed

[externalptr(empty)] | [externalptr(struct _IO_FILE) \ externalptr(empty)] | [externalptr(~struct _IO_FILE) \ externalptr(empty)] -> ()
timing: 0.294 s
source
void fin_file_writer(SEXP ptr){
  FILE *fp = R_ExternalPtrAddr(ptr);
  if(fp != NULL){
    fclose(fp);
    R_ClearExternalPtr(ptr);
    total_open_writers--;
  }
}
/__w/r-typing/r-typing/work/sources/curl/src/writer.c:8

fin_handle typed

[externalptr] -> ()
timing: 0.212 s
source
static void fin_handle(SEXP ptr){
  reference *ref = (reference*) R_ExternalPtrAddr(ptr);

  //this kind of strange but the multi finalizer needs the ptr value
  //if it is still pending
  ref->refCount--;
  if(ref->refCount == 0)
    R_ClearExternalPtr(ptr);

  //free stuff
  clean_handle(ref);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:34

fin_multi typed empty return

[(externalptr<~curl_multi, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty
timing: 0.127 s
source
void fin_multi(SEXP ptr){
  multiref *mref = get_multiref(ptr);
  SEXP handles = mref->handles;
  while(handles != R_NilValue){
    multi_release(get_ref(CAR(handles)));
    handles = CDR(handles);
  }
  curl_multi_cleanup(mref->m);
  free(mref);
  R_ClearExternalPtr(ptr);
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:229

get_curlm typed

([<~curl, ...> | null | p(CHR) | sym] -> c_ptr)&([(externalptr<~curl_multi, ~curl, ...> | (~externalptr)<~curl, ...>) | null | p(CHR) | sym] -> empty)
timing: 0.186 s
source
CURLM *get_curlm(SEXP ptr){
  CURLM *multi;
  if(Rf_inherits(ptr, "curl")){
    ptr = Rf_getAttrib(ptr, Rf_install("conn_id"));
    if (TYPEOF(ptr) != EXTPTRSXP)
      Rf_error("pool ptr is not a curl connection");
    multi = (CURLM*) R_ExternalPtrAddr(ptr);
    if(!multi)
      Rf_error("CURLM pointer is dead");
  } else {
    multiref *mref = get_multiref(ptr);
    multi = mref->m;
  }
  return multi;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:24

get_field typed

[*struct Curl_URL, c(0..10), c(0..30)] -> CHR1 | null
timing: 0.058 s
source
static SEXP get_field(CURLU *h, CURLUPart part, CURLUcode field_missing){
  char *str = NULL;
  SEXP field = NULL;
  CURLUcode err = curl_url_get(h, part, &str, 0);
  if(err == field_missing && err != CURLUE_OK){
    field = R_NilValue;
  } else {
    fail_if(err);
    field = make_string(str);
  }
  curl_free(str);
  return field;
}
/__w/r-typing/r-typing/work/sources/curl/src/urlparser.c:27

get_handle typed

([any_sexp] -> c_ptr)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.041 s
source
CURL* get_handle(SEXP ptr){
  return get_ref(ptr)->handle;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:17

get_multiref typed

([externalptr<curl_multi, ...>] -> *struct multiref)&([externalptr<~curl_multi, ...>] | [(~externalptr)<...> | null | p(CHR) | sym] -> empty)
timing: 0.260 s
source
multiref *get_multiref(SEXP ptr){
  if(TYPEOF(ptr) != EXTPTRSXP || !Rf_inherits(ptr, "curl_multi"))
    Rf_error("pool ptr is not a curl_multi handle");
  multiref *mref = (multiref*) R_ExternalPtrAddr(ptr);
  if(!mref)
    Rf_error("multiref pointer is dead");
  return mref;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:14

get_ref typed

([(externalptr \ externalptr(empty))<curl_handle, ...>] -> *struct reference)&([externalptr(empty)<curl_handle, ...>] | [externalptr<~curl_handle, ...>] | [(~externalptr)<...> | null | p(CHR) | sym] -> empty)
timing: 0.418 s
source
reference* get_ref(SEXP ptr){
  if(TYPEOF(ptr) != EXTPTRSXP || !Rf_inherits(ptr, "curl_handle"))
    Rf_error("handle is not a curl_handle()");
  if(!R_ExternalPtrAddr(ptr))
    Rf_error("handle is dead");
  reference *ref = (reference*) R_ExternalPtrAddr(ptr);
  return ref;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:21

get_string typed

[CHR] -> c_string
timing: 0.025 s
(definition not located in src/)

get_url_host typed

[c_string] -> CHR1 | null
timing: 0.113 s
source
static SEXP get_url_host(const char *source_url){
  if(source_url == NULL)
    return R_NilValue;
  CURLU *h = curl_url();
  SEXP host = R_NilValue;
  if(curl_url_set(h, CURLUPART_URL, source_url, CURLU_NON_SUPPORT_SCHEME) == CURLUE_OK){
    char *str = NULL;
    if(curl_url_get(h, CURLUPART_HOST, &str, 0) == CURLUE_OK){
      host = make_string(str);
      curl_free(str);
    }
  }
  curl_url_cleanup(h);
  return host;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:71

getsyserror typed

() -> c_string
timing: 0.003 s
(definition not located in src/)

make_cookievec typed

[c_ptr] -> CHR
timing: 0.013 s
source
static SEXP make_cookievec(CURL *handle){
  /* linked list of strings */
  struct curl_slist *cookies;
  assert(curl_easy_getinfo(handle, CURLINFO_COOKIELIST, &cookies));
  SEXP out = slist_to_vec(cookies);
  curl_slist_free_all(cookies);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:400

make_filetime typed

[c_ptr] -> DBL1<POSIXt, POSIXct>
timing: 0.077 s
source
static SEXP make_filetime(CURL *handle){
  curl_off_t filetime;
  assert(curl_easy_getinfo(handle, CURLINFO_FILETIME_T, &filetime));

  SEXP classes = PROTECT(Rf_allocVector(STRSXP, 2));
  SET_STRING_ELT(classes, 0, Rf_mkChar("POSIXct"));
  SET_STRING_ELT(classes, 1, Rf_mkChar("POSIXt"));

  SEXP out = PROTECT(Rf_ScalarReal(filetime < 0 ? NA_REAL : (double) filetime));
  Rf_setAttrib(out, R_ClassSymbol, classes);
  UNPROTECT(2);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:437

make_handle_response typed

([c_null] -> empty)&([*struct reference] \ [c_null] -> any_sexp)
timing: 0.278 s
source
SEXP make_handle_response(reference *ref){
  CURL *handle = ref->handle;
  SEXP res = PROTECT(Rf_allocVector(VECSXP, 10));
  SET_VECTOR_ELT(res, 0, make_info_string(handle, CURLINFO_EFFECTIVE_URL));
  SET_VECTOR_ELT(res, 1, make_info_integer(handle, CURLINFO_RESPONSE_CODE));
  SET_VECTOR_ELT(res, 2, make_info_string(handle, CURLINFO_CONTENT_TYPE));
  SET_VECTOR_ELT(res, 3, make_rawvec(ref->resheaders.buf, ref->resheaders.size));
  SET_VECTOR_ELT(res, 4, make_filetime(handle));
  SET_VECTOR_ELT(res, 5, make_timevec(handle));
  SET_VECTOR_ELT(res, 6, make_info_string(handle, CURLINFO_SCHEME));
  SET_VECTOR_ELT(res, 7, make_info_http_version(handle));
  SET_VECTOR_ELT(res, 8, make_info_string(handle, CURLINFO_EFFECTIVE_METHOD));
  SET_VECTOR_ELT(res, 9, R_NilValue);
  Rf_setAttrib(res, R_NamesSymbol, make_namesvec());
  UNPROTECT(1);
  return res;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:479

make_info_http_version typed

[c_ptr] -> INT1 \ ^INT1 | (1L..3L)
timing: 0.140 s
source
static SEXP make_info_http_version(CURL * handle){
  long res = 0;
  assert(curl_easy_getinfo(handle, CURLINFO_HTTP_VERSION, &res));
  switch (res) {
  case CURL_HTTP_VERSION_1_0:
  case CURL_HTTP_VERSION_1_1:
    return Rf_ScalarInteger(1);
  case CURL_HTTP_VERSION_2_0:
    return Rf_ScalarInteger(2);
  case CURL_HTTP_VERSION_3:
    return Rf_ScalarInteger(3);
  default:
    return Rf_ScalarInteger(NA_INTEGER);
  }
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:421

make_info_integer typed

[c_ptr, c(0..6291513)] -> INT1
timing: 0.019 s
source
static SEXP make_info_integer(CURL *handle, CURLINFO info){
  long res_status;
  assert(curl_easy_getinfo(handle, info, &res_status));
  return Rf_ScalarInteger(res_status);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:409

make_info_string typed

[c_ptr, c(0..6291513)] -> CHR1
timing: 0.039 s
source
static SEXP make_info_string(CURL *handle, CURLINFO info){
  char *res_url = NULL;
  assert(curl_easy_getinfo(handle, info, &res_url));
  return make_string(res_url);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:415

make_namesvec typed

() -> CHR
timing: 0.210 s
source
static SEXP make_namesvec(void){
  SEXP names = PROTECT(Rf_allocVector(STRSXP, 10));
  SET_STRING_ELT(names, 0, Rf_mkChar("url"));
  SET_STRING_ELT(names, 1, Rf_mkChar("status_code"));
  SET_STRING_ELT(names, 2, Rf_mkChar("type"));
  SET_STRING_ELT(names, 3, Rf_mkChar("headers"));
  SET_STRING_ELT(names, 4, Rf_mkChar("modified"));
  SET_STRING_ELT(names, 5, Rf_mkChar("times"));
  SET_STRING_ELT(names, 6, Rf_mkChar("scheme"));
  SET_STRING_ELT(names, 7, Rf_mkChar("http_version"));
  SET_STRING_ELT(names, 8, Rf_mkChar("method"));
  SET_STRING_ELT(names, 9, Rf_mkChar("content"));
  UNPROTECT(1);
  return names;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:459

make_rawvec typed

([c_string, c_true] -> raw1)&([c_string, c(..0)] | [c_string, c(1..)] -> raw)
timing: 0.063 s
source
static SEXP make_rawvec(unsigned char *ptr, size_t size){
  SEXP out = PROTECT(Rf_allocVector(RAWSXP, size));
  if(size > 0)
    memcpy(RAW(out), ptr, size);
  UNPROTECT(1);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:451

make_string typed

∀'a. ([c_null] -> na_string)&([c_string('a)] -> ^CHR1('a))
timing: 0.039 s
(definition not located in src/)

make_timevec typed

[c_ptr] -> DBL
timing: 0.228 s
source
static SEXP make_timevec(CURL *handle){
  double time_redirect, time_lookup, time_connect, time_pre, time_start, time_total;
  assert(curl_easy_getinfo(handle, CURLINFO_REDIRECT_TIME, &time_redirect));
  assert(curl_easy_getinfo(handle, CURLINFO_NAMELOOKUP_TIME, &time_lookup));
  assert(curl_easy_getinfo(handle, CURLINFO_CONNECT_TIME, &time_connect));
  assert(curl_easy_getinfo(handle, CURLINFO_PRETRANSFER_TIME, &time_pre));
  assert(curl_easy_getinfo(handle, CURLINFO_STARTTRANSFER_TIME, &time_start));
  assert(curl_easy_getinfo(handle, CURLINFO_TOTAL_TIME, &time_total));

  SEXP result = PROTECT(Rf_allocVector(REALSXP, 6));
  REAL(result)[0] = time_redirect;
  REAL(result)[1] = time_lookup;
  REAL(result)[2] = time_connect;
  REAL(result)[3] = time_pre;
  REAL(result)[4] = time_start;
  REAL(result)[5] = time_total;

  SEXP names = PROTECT(Rf_allocVector(STRSXP, 6));
  SET_STRING_ELT(names, 0, Rf_mkChar("redirect"));
  SET_STRING_ELT(names, 1, Rf_mkChar("namelookup"));
  SET_STRING_ELT(names, 2, Rf_mkChar("connect"));
  SET_STRING_ELT(names, 3, Rf_mkChar("pretransfer"));
  SET_STRING_ELT(names, 4, Rf_mkChar("starttransfer"));
  SET_STRING_ELT(names, 5, Rf_mkChar("total"));
  Rf_setAttrib(result, R_NamesSymbol, names);
  UNPROTECT(2);
  return result;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:370

make_url_names typed

() -> CHR
timing: 0.185 s
source
static SEXP make_url_names(void){
  SEXP names = PROTECT(Rf_allocVector(STRSXP, 9));
  SET_STRING_ELT(names, 0, Rf_mkChar("url"));
  SET_STRING_ELT(names, 1, Rf_mkChar("scheme"));
  SET_STRING_ELT(names, 2, Rf_mkChar("host"));
  SET_STRING_ELT(names, 3, Rf_mkChar("port"));
  SET_STRING_ELT(names, 4, Rf_mkChar("path"));
  SET_STRING_ELT(names, 5, Rf_mkChar("query"));
  SET_STRING_ELT(names, 6, Rf_mkChar("fragment"));
  SET_STRING_ELT(names, 7, Rf_mkChar("user"));
  SET_STRING_ELT(names, 8, Rf_mkChar("password"));
  UNPROTECT(1);
  return names;
}
/__w/r-typing/r-typing/work/sources/curl/src/urlparser.c:3

massert typed

([c(1..12) | c(-1)] -> empty)&([c_false] -> ())
timing: 0.015 s
source
void massert(CURLMcode res){
  if(res != CURLM_OK)
    Rf_error("%s", curl_multi_strerror(res));
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:109

min typed

∀'a,'b. ['a, 'b] -> 'a | 'b
timing: 0.007 s
(definition not located in src/)

multi_release typed empty return

[c_null] -> empty
timing: 1.53 s
source
void multi_release(reference *ref){
  /* Release the easy-handle */
  CURL *handle = ref->handle;
  CURLM *multi = ref->async.mref->m;
  massert(curl_multi_remove_handle(multi, handle));
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, NULL);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL);

  /* Remove the curl handle from the handles list */
  ref->async.mref->handles = reflist_remove(ref->async.mref->handles, ref->handleptr);
  R_SetExternalPtrProtected(ref->async.mref->multiptr, ref->async.mref->handles);
  SET_VECTOR_ELT(R_ExternalPtrProtected(ref->handleptr), 0, R_NilValue);

  /* Reset multi state struct */
  if(ref->async.content.buf){
    free(ref->async.content.buf);
    ref->async.content.buf = NULL;
    ref->async.content.size = 0;
  }
  ref->async.mref = NULL;
  ref->async.content.buf = NULL;
  ref->async.content.size = 0;
  ref->async.complete = NULL;
  ref->async.error = NULL;
  ref->async.data = NULL;
  ref->async.node = NULL;

  /* Unlock handle (and cleanup if needed) */
  ref->locked = 0;
  ref->refCount--;
  clean_handle(ref);
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:40

pending_interrupt typed

() -> c_bool
timing: 0.007 s
source
int pending_interrupt(void) {
  return !(R_ToplevelExec(check_interrupt_fn, NULL));
}
/__w/r-typing/r-typing/work/sources/curl/src/interrupt.c:13

pop typed

([c_ptr, c_int_na, *struct request] -> c_int_na)&([c_ptr, c_int_na, c_null] -> empty)
timing: 0.229 s
source
static size_t pop(void *target, size_t max, request *req){
  size_t copy_size = min(req->size, max);
  memcpy(target, req->cur, copy_size);
  req->cur += copy_size;
  req->size -= copy_size;
  //Rprintf("Requested %d bytes, popped %d bytes, new size %d bytes.\n", max, copy_size, req->size);
  return copy_size;
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:92

process_server typed

() -> c_bool
timing: 0.007 s
source
static int process_server(void) {
  return !(R_ToplevelExec(run_httpuv, NULL));
}
/__w/r-typing/r-typing/work/sources/curl/src/dryrun.c:19

push typed

([c_ptr, c_int, c_int, c_ptr] -> c_int)&([c_ptr, c_int_na, c_int_na, c_ptr] -> c_int_na)
timing: 0.262 s
source
static size_t push(void *contents, size_t sz, size_t nmemb, void *ctx) {
  /* avoids compiler warning on windows */
  request* req = (request*) ctx;
  req->has_data = 1;

  /* move existing data to front of buffer (if any) */
  memmove(req->buf, req->cur, req->size);

  /* allocate more space if required */
  size_t realsize = sz * nmemb;
  size_t newsize = req->size + realsize;
  while(newsize > req->limit) {
    size_t newlimit = 2 * req->limit;
    //Rprintf("Resizing buffer to %d.\n", newlimit);
    void *newbuf = realloc(req->buf, newlimit);
    if(!newbuf)
      Rf_error("Failure in realloc. Out of memory?");
    req->buf = newbuf;
    req->limit = newlimit;
  }

  /* append new data */
  memcpy(req->buf + req->size, contents, realsize);
  req->size = newsize;
  req->cur = req->buf;
  return realsize;
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:64

push_disk typed

[c_ptr, c_int_na, c_int_na, *struct _IO_FILE] -> c_int
timing: 0.009 s
source
size_t push_disk(void* contents, size_t sz, size_t nmemb, FILE *ctx) {
  //if (pending_interrupt())
  //  return 0;
  return fwrite(contents, sz, nmemb, ctx);
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:146

R_curl_callback_debug typed

[c_ptr, c(0..7), c_string, c(..-1) | c(1..), any_sexp] | [c_ptr, c(0..7), c_string, c_false, any_sexp] -> c_false
timing: 0.123 s
source
int R_curl_callback_debug(CURL *handle, curl_infotype type_, char *data,
                          size_t size, SEXP fun) {

  /* wrap type and msg into R types */
  SEXP type = PROTECT(Rf_ScalarInteger(type_));
  SEXP msg = PROTECT(Rf_allocVector(RAWSXP, size));
  if (size) memcpy(RAW(msg), data, size);

  /* call the R function */
  SEXP call = PROTECT(Rf_lang3(fun, type, msg));
  R_tryEval(call, R_GlobalEnv, NULL);

  UNPROTECT(3);
  // Debug function must always return 0
  return 0;
}
/__w/r-typing/r-typing/work/sources/curl/src/callbacks.c:75

R_curl_callback_seek typed

[any_sexp, c_int | c_double, c_int_na] -> c_bool
timing: 0.028 s
source
int R_curl_callback_seek(SEXP fun, curl_off_t offset, int origin){
  SEXP soffset = PROTECT(Rf_ScalarReal(offset));
  SEXP call = PROTECT(Rf_lang2(fun, soffset));
  int ok;
  R_tryEval(call, R_GlobalEnv, &ok);
  UNPROTECT(2);
  return ok ? CURL_SEEKFUNC_FAIL : CURL_SEEKFUNC_OK;
}
/__w/r-typing/r-typing/work/sources/curl/src/callbacks.c:66

R_curl_callback_ssl_ctx typed

[c_ptr, c_ptr, any_sexp] -> c_int_na
timing: 0.077 s
source
int R_curl_callback_ssl_ctx(CURL *handle, void *ssl_ctx, SEXP fun){
  SEXP ptr = PROTECT(R_MakeExternalPtr(ssl_ctx, R_NilValue, R_NilValue));
  Rf_setAttrib(ptr, R_ClassSymbol, Rf_mkString("ssl_ctx"));
  SEXP call = PROTECT(Rf_lang2(fun, ptr));
  int err = 0;
  R_tryEval(call, R_GlobalEnv, &err);
  UNPROTECT(2);
  return err;
}
/__w/r-typing/r-typing/work/sources/curl/src/callbacks.c:100

R_curl_callback_xferinfo typed

[any_sexp, c_double, c_double, c_double, c_double] -> c_int_na
timing: 0.011 s
source
int R_curl_callback_xferinfo(SEXP fun,
                             curl_off_t  dltotal, curl_off_t  dlnow,
                             curl_off_t  ultotal, curl_off_t  ulnow) {
  return R_curl_callback_progress(fun, dltotal, dlnow, ultotal, ulnow);
}
/__w/r-typing/r-typing/work/sources/curl/src/callbacks.c:93

R_curl_connection typed entry .Call empty return

[CHR, (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym, any_sexp] | [(~CHR)<...> | null | p(CHR) | sym, any_sexp, any_sexp] -> empty
timing: 0.252 s
source
SEXP R_curl_connection(SEXP url, SEXP ptr, SEXP partial) {
  if(!Rf_isString(url))
    Rf_error("Argument 'url' must be string.");

  /* create the R connection object, mimicking base::url() */
  Rconnection con;

  /* R wants description in native encoding, but we use UTF-8 URL below */
  SEXP rc = PROTECT(R_new_custom_connection(Rf_translateChar(STRING_ELT(url, 0)), "r", "curl", &con));

  /* setup curl. These are the parts that are recyclable. */
  request *req = malloc(sizeof(request));
  req->handle = get_handle(ptr);
  req->ref = get_ref(ptr);
  req->limit = CURL_MAX_WRITE_SIZE;
  req->buf = malloc(req->limit);
  req->manager = curl_multi_init();
  req->partial = Rf_asLogical(partial); //only for curl_fetch_stream()
  req->used = 0;

  /* allocate url string */
  req->url = malloc(strlen(Rf_translateCharUTF8(Rf_asChar(url))) + 1);
  strcpy(req->url, Rf_translateCharUTF8(Rf_asChar(url)));

  /* set connection properties */
  con->incomplete = FALSE;
  con->private = req;
  con->canseek = FALSE;
  con->canwrite = FALSE;
  con->isopen = FALSE;
  con->blocking = TRUE;
  con->text = TRUE;
  con->UTF8out = TRUE;
  con->open = rcurl_open;
  con->close = reset;
  con->destroy = cleanup;
  con->read = rcurl_read;
  con->fgetc = rcurl_fgetc;
  con->fgetc_internal = rcurl_fgetc;

  /* protect the handle */
  (req->ref->refCount)++;

  /* store the CURLM address in con->ex_ptr which is the 'conn_id' attribute */
  R_SetExternalPtrAddr((SEXP) con->ex_ptr, req->manager);

  UNPROTECT(1);
  return rc;
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:254

R_curl_dryrun typed entry .Call empty return

[(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty
timing: 0.297 s
source
SEXP R_curl_dryrun(SEXP ptr){
  CURL *handle = get_handle(ptr);
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_nothing);
  CURLM * multi_handle = curl_multi_init();
  if(CURLM_OK != curl_multi_add_handle(multi_handle, handle))
    Rf_error("Failed to add handle");
  int still_running = 1;
  while(still_running) {
    if(process_server())
      break;
    if(curl_multi_perform(multi_handle, &(still_running)) != CURLM_OK)
      break;
  }
  int msgq = 0;
  CURLMsg *m = curl_multi_info_read(multi_handle, &msgq);
  CURLcode status = (m && (m->msg == CURLMSG_DONE)) ? m->data.result : CURLE_ABORTED_BY_CALLBACK;
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, NULL);
  curl_multi_remove_handle(multi_handle, handle);
  curl_multi_cleanup(multi_handle);
  assert_status(status, get_ref(ptr));
  return R_NilValue;
}
/__w/r-typing/r-typing/work/sources/curl/src/dryrun.c:23

R_curl_escape typed entry .Call fuzz ok

([CHR, any_sexp] -> CHR)&([CHR1, any_sexp] -> CHR1)&([(~CHR)<...> | null | p(CHR) | sym, any_sexp] -> empty)
timing: 0.513 s
fuzzing: 8 inside (8 ok) · 8 outside (8 rejected)
type drawn from: ((x1: CHR, x2: any_sexp) -> CHR) & ((x1: CHR1, x2: any_sexp) -> CHR1) & ((x1: p(CHR) | (~CHR)<...> | sym | null, x2: any_sexp) -> empty)
source
SEXP R_curl_escape(SEXP url, SEXP unescape_) {
  if (!Rf_isString(url))
    Rf_error("`url` must be a character vector.");
  CURL *handle = curl_easy_init();
  int n = Rf_length(url);
  SEXP output = PROTECT(Rf_allocVector(STRSXP, n));

  for (int i = 0; i < n; i++) {
    const char *input = CHAR(STRING_ELT(url, i));
    char *out = Rf_asLogical(unescape_) ?
      curl_easy_unescape(handle, input, 0, NULL) : curl_easy_escape(handle, input, 0);
    if(out != NULL){
      SET_STRING_ELT(output, i, Rf_mkCharCE(out, CE_UTF8));
      curl_free(out);
    }
  }
  curl_easy_cleanup(handle);
  UNPROTECT(1);
  return output;
}
/__w/r-typing/r-typing/work/sources/curl/src/escape.c:4

R_curl_fetch_disk typed entry .Call empty return

[CHR, any_sexp, (~CHR)<...> | null | p(CHR) | sym, any_sexp, any_sexp] | [CHR, (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym, CHR, any_sexp, any_sexp] | [(~CHR)<...> | null | p(CHR) | sym, any_sexp, any_sexp, any_sexp, any_sexp] -> empty
timing: 3.09 s
source
SEXP R_curl_fetch_disk(SEXP url, SEXP ptr, SEXP path, SEXP mode, SEXP nonblocking){
  if (!Rf_isString(url) || Rf_length(url) != 1)
    Rf_error("Argument 'url' must be string.");
  if (!Rf_isString(path) || Rf_length(path) != 1)
    Rf_error("`path` must be string.");

  /* get the handle */
  CURL *handle = get_handle(ptr);

  /* update the url */
  curl_easy_setopt(handle, CURLOPT_URL, CHAR(STRING_ELT(url, 0)));

  /* reset the response header buffer */
  reset_resheaders(get_ref(ptr));
  reset_errbuf(get_ref(ptr));

  /* open file */
  FILE *dest = fopen(CHAR(Rf_asChar(path)), CHAR(Rf_asChar(mode)));
  if(!dest)
    Rf_error("Failed to open file %s.", CHAR(Rf_asChar(path)));
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, push_disk);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, dest);

  /* perform blocking request */
  CURLcode status = Rf_asLogical(nonblocking) ?
    curl_perform_with_interrupt(handle): curl_easy_perform(handle);

  /* cleanup */
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, NULL);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL);
  fclose(dest);

  /* check for errors */
  assert_status(status, get_ref(ptr));

  /* return the file path */
  return path;
}
/__w/r-typing/r-typing/work/sources/curl/src/fetch.c:54

R_curl_fetch_memory typed entry .Call empty return

[CHR, (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym, any_sexp] | [(~CHR)<...> | null | p(CHR) | sym, any_sexp, any_sexp] -> empty
timing: 0.505 s
source
SEXP R_curl_fetch_memory(SEXP url, SEXP ptr, SEXP nonblocking){
  if (!Rf_isString(url) || Rf_length(url) != 1)
    Rf_error("Argument 'url' must be string.");

  /* get the handle */
  CURL *handle = get_handle(ptr);

  /* update the url */
  curl_easy_setopt(handle, CURLOPT_URL, CHAR(STRING_ELT(url, 0)));

  /* reset the response header buffer */
  reset_resheaders(get_ref(ptr));
  reset_errbuf(get_ref(ptr));

  /* buffer body */
  memory body = {NULL, 0};
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, append_buffer);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, &body);

  /* perform blocking request */
  CURLcode status = Rf_asLogical(nonblocking) ?
    curl_perform_with_interrupt(handle) : curl_easy_perform(handle);

  /* Reset for reuse */
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, NULL);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL);

  /* check for errors */
  if (status != CURLE_OK) {
    free(body.buf);
    assert_status(status, get_ref(ptr));
  }

  /* create output */
  SEXP out = PROTECT(Rf_allocVector(RAWSXP, body.size));

  /* copy only if there is actual content */
  if(body.size)
    memcpy(RAW(out), body.buf, body.size);

  /* cleanup and return */
  UNPROTECT(1);
  free(body.buf);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/fetch.c:8

R_curl_getdate typed entry .Call fuzz ok

([CHR] -> DBL)&([CHR1] -> DBL1)&([(~CHR)<...> | null | p(CHR) | sym] -> empty)
timing: 0.193 s
fuzzing: 7 inside (7 ok) · 8 outside (8 rejected)
type drawn from: ((x1: CHR) -> DBL) & ((x1: CHR1) -> DBL1) & ((x1: p(CHR) | (~CHR)<...> | sym | null) -> empty)
source
SEXP R_curl_getdate(SEXP datestring) {
  if(!Rf_isString(datestring))
    Rf_error("Argument 'datestring' must be string.");

  int len = Rf_length(datestring);
  SEXP out = PROTECT(Rf_allocVector(REALSXP, len));

  for(int i = 0; i < len; i++){
    time_t date = curl_getdate(CHAR(STRING_ELT(datestring, i)), NULL);
    REAL(out)[i] = date < 0 ? NA_REAL : (double) date;
  }
  UNPROTECT(1);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/getdate.c:4

r_curl_is_long_option typed

[c(0..596)] -> c_bool
timing: 0.019 s
source
int r_curl_is_long_option(CURLoption x){
  const curl_easytype type = curl_easy_option_by_id(x)->type;
  return type == CURLOT_LONG || type == CURLOT_VALUES;
}
/__w/r-typing/r-typing/work/sources/curl/src/typechecking.c:11

r_curl_is_off_t_option typed

[c(0..596)] -> c_bool
timing: 0.009 s
source
int r_curl_is_off_t_option(CURLoption x){
  return curl_easy_option_by_id(x)->type == CURLOT_OFF_T;
}
/__w/r-typing/r-typing/work/sources/curl/src/typechecking.c:16

r_curl_is_postfields_option typed

[c(0..596)] -> c_bool
timing: 0.009 s
source
int r_curl_is_postfields_option(CURLoption x){
  return curl_easy_option_by_id(x)->type == CURLOT_OBJECT;
}
/__w/r-typing/r-typing/work/sources/curl/src/typechecking.c:20

r_curl_is_slist_option typed

[c(0..596)] -> c_bool
timing: 0.009 s
source
int r_curl_is_slist_option(CURLoption x){
  return curl_easy_option_by_id(x)->type == CURLOT_SLIST;
}
/__w/r-typing/r-typing/work/sources/curl/src/typechecking.c:7

r_curl_is_string_option typed

[c(0..596)] -> c_bool
timing: 0.009 s
source
int r_curl_is_string_option(CURLoption x){
  return curl_easy_option_by_id(x)->type == CURLOT_STRING;
}
/__w/r-typing/r-typing/work/sources/curl/src/typechecking.c:3

R_curl_version typed entry .Call fuzz ok

() -> { (CHR | ^LGL1) | null }
timing: 1.24 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
SEXP R_curl_version(void) {
  /* retrieve info from curl */
  const curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);

  /* put stuff in a list */
  SEXP list = PROTECT(Rf_allocVector(VECSXP, 12));
  SET_VECTOR_ELT(list, 0, make_string(data->version));
  SET_VECTOR_ELT(list, 1, make_string(LIBCURL_VERSION));
  SET_VECTOR_ELT(list, 2, make_string(data->ssl_version));
  SET_VECTOR_ELT(list, 3, make_string(data->libz_version));
  SET_VECTOR_ELT(list, 4, make_string(data->libssh_version));
  SET_VECTOR_ELT(list, 5, make_string(data->libidn));
  SET_VECTOR_ELT(list, 6, make_string(data->host));

  /* create vector of protocols */
  int len = 0;
  const char *const * temp = data->protocols;
  while(*temp++) len++;
  SEXP protocols = PROTECT(Rf_allocVector(STRSXP, len));
  for (int i = 0; i < len; i++){
    SET_STRING_ELT(protocols, i, Rf_mkChar(*(data->protocols + i)));
  }
  SET_VECTOR_ELT(list, 7, protocols);

  /* add list names */
  SEXP names = PROTECT(Rf_allocVector(STRSXP, 12));
  SET_STRING_ELT(names, 0, Rf_mkChar("version"));
  SET_STRING_ELT(names, 1, Rf_mkChar("headers"));
  SET_STRING_ELT(names, 2, Rf_mkChar("ssl_version"));
  SET_STRING_ELT(names, 3, Rf_mkChar("libz_version"));
  SET_STRING_ELT(names, 4, Rf_mkChar("libssh_version"));
  SET_STRING_ELT(names, 5, Rf_mkChar("libidn_version"));
  SET_STRING_ELT(names, 6, Rf_mkChar("host"));
  SET_STRING_ELT(names, 7, Rf_mkChar("protocols"));
  SET_STRING_ELT(names, 8, Rf_mkChar("ipv6"));
  SET_STRING_ELT(names, 9, Rf_mkChar("http2"));
  SET_STRING_ELT(names, 10, Rf_mkChar("idn"));
  SET_STRING_ELT(names, 11, Rf_mkChar("url_parser"));
  Rf_setAttrib(list, R_NamesSymbol, names);

  #ifdef CURL_VERSION_IPV6
  SET_VECTOR_ELT(list, 8, Rf_ScalarLogical(data->features & CURL_VERSION_IPV6));
  #else
  SET_VECTOR_ELT(list, 8, Rf_ScalarLogical(0));
  #endif

  #ifdef CURL_VERSION_HTTP2
  SET_VECTOR_ELT(list, 9, Rf_ScalarLogical(data->features & CURL_VERSION_HTTP2));
  #else
  SET_VECTOR_ELT(list, 9, Rf_ScalarLogical(0));
  #endif

  #ifdef CURL_VERSION_IDN
    SET_VECTOR_ELT(list, 10, Rf_ScalarLogical(data->features & CURL_VERSION_IDN));
  #else
    SET_VECTOR_ELT(list, 10, Rf_ScalarLogical(0));
  #endif

  // CURL_PARSER is always assumed to be available
  SET_VECTOR_ELT(list, 11, Rf_ScalarLogical(1));


  /* return */
  UNPROTECT(3);
  return list;
}
/__w/r-typing/r-typing/work/sources/curl/src/version.c:3

R_download_curl typed entry .Call empty return

[CHR, CHR, LGL, CHR, (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym, any_sexp] | [CHR, CHR, LGL, (~CHR)<...> | null | p(CHR) | sym, any_sexp, any_sexp] | [CHR, CHR, (~LGL)<...> | null | p(CHR) | sym, any_sexp, any_sexp, any_sexp] | [CHR, (~CHR)<...> | null | p(CHR) | sym, any_sexp, any_sexp, any_sexp, any_sexp] | [(~CHR)<...> | null | p(CHR) | sym, any_sexp, any_sexp, any_sexp, any_sexp, any_sexp] -> empty
timing: 0.432 s
source
SEXP R_download_curl(SEXP url, SEXP destfile, SEXP quiet, SEXP mode, SEXP ptr, SEXP nonblocking) {
  if(!Rf_isString(url))
    Rf_error("Argument 'url' must be string.");

  if(!Rf_isString(destfile))
    Rf_error("Argument 'destfile' must be string.");

  if(!Rf_isLogical(quiet))
    Rf_error("Argument 'quiet' must be TRUE/FALSE.");

  if(!Rf_isString(mode))
    Rf_error("Argument 'mode' must be string.");

  /* get the handle */
  CURL *handle = get_handle(ptr);
  reset_errbuf(get_ref(ptr));

  /* open file */
  FILE *dest = fopen(CHAR(Rf_asChar(destfile)), CHAR(Rf_asChar(mode)));
  if(!dest)
    Rf_error("Failed to open file %s.", CHAR(Rf_asChar(destfile)));

  /* set options */
  curl_easy_setopt(handle, CURLOPT_URL, Rf_translateCharUTF8(Rf_asChar(url)));
  curl_easy_setopt(handle, CURLOPT_NOPROGRESS, (long) Rf_asLogical(quiet));
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, push_disk);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, dest);
  curl_easy_setopt(handle, CURLOPT_FAILONERROR, 1L);

  /* perform blocking request */
  CURLcode status = Rf_asLogical(nonblocking) ?
    curl_perform_with_interrupt(handle) : curl_easy_perform(handle);

  /* cleanup */
  curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, NULL);
  curl_easy_setopt(handle, CURLOPT_WRITEDATA, NULL);
  curl_easy_setopt(handle, CURLOPT_FAILONERROR, 0L);
  fclose(dest);

  /* raise for curl errors */
  assert_status(status, get_ref(ptr));
  return Rf_ScalarInteger(0);
}
/__w/r-typing/r-typing/work/sources/curl/src/download.c:6

R_findport typed entry .Call fuzz ok

([INT] -> INT1 | null)&([^INT1] -> ^INT1 | null)
timing: 0.318 s
fuzzing: 6 inside (6 ok) · 8 outside (8 rejected)
type drawn from: ((x1: INT) -> INT1 | null) & ((x1: ^INT1) -> ^INT1 | null)
source
SEXP R_findport(SEXP candidates){
  for(int i = 0; i < Rf_length(candidates); i++){
    int port = INTEGER(candidates)[i];
    if(port_is_available(port)){
      return Rf_ScalarInteger(port);
    }
  }
  return R_NilValue;
}
/__w/r-typing/r-typing/work/sources/curl/src/findport.c:75

R_get_handle_clength typed entry .Call empty return

[(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty
timing: 0.076 s
source
SEXP R_get_handle_clength(SEXP ptr){
  CURL *handle = get_handle(ptr);
  curl_off_t cl = 0;
  curl_easy_getinfo(handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &cl);
  return Rf_ScalarReal((double) cl < 0 ? NA_REAL : cl);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:515

R_get_handle_cookies typed entry .Call fuzz ok

([any_sexp] -> CHR)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.038 s
fuzzing: 5 inside (5 ok) · 6 outside (6 rejected)
type drawn from: ((x1: any_sexp) -> CHR) & ((x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_get_handle_cookies(SEXP ptr){
  return make_cookievec(get_handle(ptr));
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:475

R_get_handle_mtime typed entry .Call fuzz ok

([any_sexp] -> DBL1<POSIXt, POSIXct>)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.034 s
fuzzing: 8 inside (8 ok) · 6 outside (6 rejected)
type drawn from: ((x1: any_sexp) -> posixct1) & ((x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_get_handle_mtime(SEXP ptr){
  return make_filetime(get_handle(ptr));
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:529

R_get_handle_received typed entry .Call fuzz ok

([any_sexp] -> DBL1)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.066 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
type drawn from: ((x1: any_sexp) -> DBL1) & ((x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_get_handle_received(SEXP ptr){
  CURL *handle = get_handle(ptr);
  curl_off_t dl = 0;
  curl_easy_getinfo(handle, CURLINFO_SIZE_DOWNLOAD_T, &dl);
  return Rf_ScalarReal((double) dl);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:522

R_get_handle_response typed entry .Call fuzz ok

([any_sexp] -> any_sexp)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.148 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
type drawn from: ((x1: any_sexp) -> any_sexp) & ((x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_get_handle_response(SEXP ptr){
  /* get the handle */
  reference *ref = get_ref(ptr);
  return make_handle_response(ref);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:497

R_get_handle_speed typed entry .Call fuzz ok

([any_sexp] -> DBL)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.094 s
fuzzing: 5 inside (5 ok) · 6 outside (6 rejected)
type drawn from: ((x1: any_sexp) -> DBL) & ((x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_get_handle_speed(SEXP ptr){
  CURL *handle = get_handle(ptr);
  curl_off_t dl = 0;
  curl_off_t ul = 0;
  curl_easy_getinfo(handle, CURLINFO_SPEED_DOWNLOAD_T, &dl);
  curl_easy_getinfo(handle, CURLINFO_SPEED_UPLOAD_T, &ul);
  SEXP out = Rf_allocVector(REALSXP, 2);
  REAL(out)[0] = (double) dl;
  REAL(out)[1] = (double) ul;
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:503

R_get_proxy_for_url typed entry .Call fuzz ok

[any_sexp, any_sexp, any_sexp] -> null
timing: 0.005 s
fuzzing: 8 inside (8 ok) · 7 outside (7 rejected)
type drawn from: (x1: any_sexp, x2: any_sexp, x3: any_sexp) -> null
source
SEXP R_get_proxy_for_url(SEXP target_url, SEXP auto_detect, SEXP autoproxy_url){
  return R_NilValue;
}
/__w/r-typing/r-typing/work/sources/curl/src/ieproxy.c:169

R_handle_getcustom typed entry .Call fuzz ok

([any_sexp] -> CHR)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.154 s
fuzzing: 5 inside (5 ok) · 6 outside (6 rejected)
type drawn from: ((x1: any_sexp) -> CHR) & ((x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_handle_getcustom(SEXP ptr){
  reference *ref = get_ref(ptr);
  return slist_to_vec(ref->custom);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:246

R_handle_getheaders typed entry .Call fuzz ok

([any_sexp] -> CHR)&([(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.140 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
type drawn from: ((x1: any_sexp) -> CHR) & ((x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_handle_getheaders(SEXP ptr){
  reference *ref = get_ref(ptr);
  return slist_to_vec(ref->headers);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:241

R_handle_reset typed entry .Call empty return

[(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty
timing: 0.209 s
source
SEXP R_handle_reset(SEXP ptr){
  //reset all fields
  reference *ref = get_ref(ptr);
  set_form(ref, NULL);
  reset_errbuf(ref);
  curl_easy_reset(ref->handle);

  //clear custom vector field
  if(ref->custom){
    curl_slist_free_all(ref->custom);
    ref->custom = NULL;
  }

  //restore default settings
  set_handle_defaults(ref);
  return Rf_ScalarLogical(1);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:223

R_handle_setform typed entry .Call fuzz ok

([any_sexp, list | vec] -> tt)&([any_sexp, (list & ~{ lang | sym } | (env | externalptr | lang | arrow)) | null | p(CHR) | sym] | [(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym, list | vec] -> empty)
timing: 0.169 s
fuzzing: 8 inside (8 ok) · 7 outside (7 rejected)
type drawn from: ((x1: any_sexp, x2: list | vec) -> tt) & ((x1: any_sexp, x2: p(CHR) | (list & ~{ lang | sym } | (env | externalptr | lang | arrow)) | sym | null) | (x1: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null, x2: list | vec) -> empty)
source
SEXP R_handle_setform(SEXP ptr, SEXP form){
  if(!Rf_isVector(form))
    Rf_error("Form must be a list.");
  set_form(get_ref(ptr), make_form(form));
  return Rf_ScalarLogical(1);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:363

R_handle_setopt typed entry .Call empty return

[externalptr, INT, (list & ~{ lang | sym } | (env | externalptr | lang | arrow)) | null | p(CHR) | sym] | [externalptr, (~INT)<...> | null | p(CHR) | sym, any_sexp] | [(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym, any_sexp, any_sexp] -> empty
timing: 0.902 s
source
SEXP R_handle_setopt(SEXP ptr, SEXP keys, SEXP values){
  reference *ref = get_ref(ptr);
  CURL *handle = get_handle(ptr);
  SEXP prot = R_ExternalPtrProtected(ptr);
  SEXP optnames = PROTECT(Rf_getAttrib(values, R_NamesSymbol));

  if(!Rf_isInteger(keys))
    Rf_error("keys` must be an integer");

  if(!Rf_isVector(values))
    Rf_error("`values` must be a list");

  for(int i = 0; i < Rf_length(keys); i++){
    int key = INTEGER(keys)[i];
    const char* optname = CHAR(STRING_ELT(optnames, i));
    SEXP val = VECTOR_ELT(values, i);
    if(val == R_NilValue){
      set_user_option(key, NULL);
    } else if (key == CURLOPT_XFERINFOFUNCTION) {
      if (TYPEOF(val) != CLOSXP)
        Rf_error("Value for option %s (%d) must be a function.", optname, key);

      set_user_option(CURLOPT_XFERINFOFUNCTION, (curl_xferinfo_callback) R_curl_callback_xferinfo);
      set_user_option(CURLOPT_XFERINFODATA, val);
      set_user_option(CURLOPT_NOPROGRESS, 0L);
      SET_VECTOR_ELT(prot, 1, val); //protect gc
    } else if (key == CURLOPT_PROGRESSFUNCTION) {
      if (TYPEOF(val) != CLOSXP)
        Rf_error("Value for option %s (%d) must be a function.", optname, key);

      set_user_option(CURLOPT_PROGRESSFUNCTION,(curl_progress_callback) R_curl_callback_progress);
      set_user_option(CURLOPT_PROGRESSDATA, val);
      set_user_option(CURLOPT_NOPROGRESS, 0L);
      SET_VECTOR_ELT(prot, 2, val); //protect gc
    } else if (key == CURLOPT_READFUNCTION) {
      if (TYPEOF(val) != CLOSXP)
        Rf_error("Value for option %s (%d) must be a function.", optname, key);

      set_user_option(CURLOPT_READFUNCTION, (curl_read_callback) R_curl_callback_read);
      set_user_option(CURLOPT_READDATA, val);
      SET_VECTOR_ELT(prot, 3, val); //protect gc
    } else if (key == CURLOPT_DEBUGFUNCTION) {
      if (TYPEOF(val) != CLOSXP)
        Rf_error("Value for option %s (%d) must be a function.", optname, key);
      set_user_option(CURLOPT_DEBUGFUNCTION, (curl_debug_callback) R_curl_callback_debug);
      set_user_option(CURLOPT_DEBUGDATA, val);
      SET_VECTOR_ELT(prot, 4, val); //protect gc
    } else if (key == CURLOPT_SSL_CTX_FUNCTION){
      if (TYPEOF(val) != CLOSXP)
        Rf_error("Value for option %s (%d) must be a function.", optname, key);

      set_user_option(CURLOPT_SSL_CTX_FUNCTION, (curl_ssl_ctx_callback) R_curl_callback_ssl_ctx);
      set_user_option(CURLOPT_SSL_CTX_DATA, val);
      SET_VECTOR_ELT(prot, 5, val); //protect gc
    } else if (key == CURLOPT_SEEKFUNCTION) {
      if (TYPEOF(val) != CLOSXP)
        Rf_error("Value for option %s (%d) must be a function.", optname, key);
      set_user_option(CURLOPT_SEEKFUNCTION, (curl_seek_callback) R_curl_callback_seek);
      set_user_option(CURLOPT_SEEKDATA, val);
      SET_VECTOR_ELT(prot, 6, val); //protect gc
    } else if (key == CURLOPT_URL) {
      /* always use utf-8 for urls */
      const char * url_utf8 = Rf_translateCharUTF8(STRING_ELT(val, 0));
      set_user_option(CURLOPT_URL, url_utf8);
    } else if(key == CURLOPT_HTTPHEADER){
      if(!Rf_isString(val))
        Rf_error("Value for option %s (%d) must be a string vector", optname, key);
      set_headers(get_ref(ptr), vec_to_slist(val));
    } else if (r_curl_is_slist_option(key)) {
      if(!Rf_isString(val))
        Rf_error("Value for option %s (%d) must be a string vector", optname, key);
      ref->custom = vec_to_slist(val);
      set_user_option(key, ref->custom);
    } else if(r_curl_is_long_option(key)){
      if(!Rf_isNumeric(val) || Rf_length(val) != 1)
        Rf_error("Value for option %s (%d) must be a number.", optname, key);
      /* Go through double and long long because wide bitmasks such as
         CURLAUTH_ANY (see R/values.R) exceed both INT_MAX and, on Windows,
         LONG_MAX. There the truncation to 32-bit long keeps the low bits,
         which is the exact value these masks have in a 32-bit C long. */
      set_user_option(key, (long) (long long) Rf_asReal(val));
    } else if(r_curl_is_off_t_option(key)){
      if(!Rf_isNumeric(val) || Rf_length(val) != 1)
        Rf_error("Value for option %s (%d) must be a number.", optname, key);
      set_user_option(key, (curl_off_t) Rf_asReal(val));
    } else if(r_curl_is_postfields_option(key) || r_curl_is_string_option(key)){
      if(r_curl_is_postfields_option(key)){
        key = CURLOPT_POSTFIELDS; //avoid bug #313
        SET_VECTOR_ELT(prot, 7, val);
      }
      switch (TYPEOF(val)) {
      case RAWSXP:
        if(key == CURLOPT_POSTFIELDS)
          set_user_option(CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t) Rf_xlength(val));
        set_user_option(key, RAW(val));
        break;
      case STRSXP:
        if (Rf_length(val) != 1)
          Rf_error("Value for option %s (%d) must be length-1 string", optname, key);
        set_user_option(key, CHAR(STRING_ELT(val, 0)));
        break;
      default:
        Rf_error("Value for option %s (%d) must be a string or raw vector.", optname, key);
      }
    } else {
      Rf_error("Option %s (%d) has unknown or unsupported type.", optname, key);
    }
  }
  UNPROTECT(1);
  return Rf_ScalarLogical(1);
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:251

R_modify_url typed entry .Call fuzz ok

[(~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym, (~CHR)<...> | null | p(CHR) | sym] -> CHR1
timing: 0.183 s
fuzzing: 8 inside (8 error pkg) · 8 outside (8 rejected)
type drawn from: (x1: p(CHR) | (~CHR)<...> | sym | null, x2: p(CHR) | (~CHR)<...> | sym | null, x3: p(CHR) | (~CHR)<...> | sym | null, x4: p(CHR) | (~CHR)<...> | sym | null, x5: p(CHR) | (~CHR)<...> | sym | null, x6: p(CHR) | (~CHR)<...> | sym | null, x7: p(CHR) | (~CHR)<...> | sym | null, x8: p(CHR) | (~CHR)<...> | sym | null, x9: p(CHR) | (~CHR)<...> | sym | null) -> CHR1

Other calls inside the domain

callverdicterror
R_modify_url(list(quote(f(x))), list(), NULL, local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), quote(f(x)), new.env(), function(...) function(...) NULL, numeric(0), NULL)error_pkg::R_modify_url: Failed to parse URL: No host part in the URL
R_modify_url(NULL, function(...) NULL, list(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), as.name("x")), quote(f(x)), quote(f(x)), function(...) function(...) local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), list(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p })), NULL, list())error_pkg::R_modify_url: Failed to parse URL: No host part in the URL
R_modify_url(new.env(), as.name("x"), new.env(), NULL, NULL, local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), new.env(), NULL, local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }))error_pkg::R_modify_url: Failed to parse URL: No host part in the URL
R_modify_url(c(NA_complex_, NA_complex_, NA_complex_, complex(real = 0, imaginary = 0), complex(real = 0, imaginary = 0)), NULL, local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), quote(f(x)), as.raw(c(0)), list(function(...) local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p })), quote(f(x)), list(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p })), NULL)error_pkg::R_modify_url: Failed to parse URL: No host part in the URL
R_modify_url(as.name("x"), as.name("x"), function(...) as.name("x"), function(...) local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), NULL, local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), new.env(), quote(f(x)))error_pkg::R_modify_url: Failed to parse URL: No host part in the URL
R_modify_url(local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), new.env(), new.env(), list(list(), character(0)), NULL, list(as.name("x")), c(NA_complex_, complex(real = 0, imaginary = 0), complex(real = 1, imaginary = -2), complex(real = 1, imaginary = -2), NA_complex_), quote(f(x)), new.env())error_pkg::R_modify_url: Failed to parse URL: No host part in the URL
and 2 more
source
SEXP R_modify_url(SEXP url, SEXP scheme, SEXP host, SEXP port, SEXP path, SEXP query, SEXP fragment, SEXP user, SEXP password){
  CURLU *h = curl_url();
  set_value(h, CURLUPART_URL, url);
  set_value(h, CURLUPART_SCHEME, scheme);
  set_value(h, CURLUPART_HOST, host);
  set_value(h, CURLUPART_PORT, port);
  set_value(h, CURLUPART_PATH, path);
  set_value(h, CURLUPART_QUERY, query);
  set_value(h, CURLUPART_FRAGMENT, fragment);
  set_value(h, CURLUPART_USER, user);
  set_value(h, CURLUPART_PASSWORD, password);
  char *str = NULL;
  fail_if(curl_url_get(h, CURLUPART_URL, &str, 0));
  SEXP out = make_string(str);
  curl_free(str);
  curl_url_cleanup(h);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/urlparser.c:85

R_multi_add typed entry .Call empty return

[any_sexp, any_sexp, any_sexp, any_sexp, (externalptr<~curl_multi, ...> | (~externalptr)<...>) | null | p(CHR) | sym] | [(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym, any_sexp, any_sexp, any_sexp, any_sexp] -> empty
timing: 0.657 s
source
SEXP R_multi_add(SEXP handle_ptr, SEXP cb_complete, SEXP cb_error, SEXP cb_data, SEXP pool_ptr){
  multiref *mref = get_multiref(pool_ptr);
  CURLM *multi = mref->m;

  reference *ref = get_ref(handle_ptr);
  if(ref->locked)
    Rf_error("Handle is locked. Probably in use in a connection or async request.");

  /* placeholder body */
  if(Rf_isFunction(cb_data)){
    curl_easy_setopt(ref->handle, CURLOPT_WRITEFUNCTION, (curl_write_callback) data_callback);
    curl_easy_setopt(ref->handle, CURLOPT_WRITEDATA, cb_data);
  } else {
    curl_easy_setopt(ref->handle, CURLOPT_WRITEFUNCTION, append_buffer);
    curl_easy_setopt(ref->handle, CURLOPT_WRITEDATA, &(ref->async.content));
  }

  /* add to scheduler */
  massert(curl_multi_add_handle(multi, ref->handle));

  /* create node in ref */
  ref->async.mref = mref;
  mref->handles = reflist_add(mref->handles, handle_ptr);
  R_SetExternalPtrProtected(pool_ptr, mref->handles);

  /* set multi callbacks */
  ref->async.complete = cb_complete;
  ref->async.error = cb_error;
  ref->async.data = cb_data;
  SET_VECTOR_ELT(R_ExternalPtrProtected(handle_ptr), 0,
                 Rf_list3(cb_error, cb_complete, cb_data));

  /* lock and protect handle */
  ref->refCount++;
  ref->locked = 1;
  return handle_ptr;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:80

R_multi_cancel typed entry .Call empty return

[(externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty
timing: 0.158 s
source
SEXP R_multi_cancel(SEXP handle_ptr){
  reference *ref = get_ref(handle_ptr);
  if(ref->async.mref)
    multi_release(ref);
  return handle_ptr;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:73

R_multi_fdset typed entry .Call empty return

[(externalptr<~curl_multi, ~curl, ...> | (~externalptr)<~curl, ...>) | null | p(CHR) | sym] -> empty
timing: 0.409 s
source
SEXP R_multi_fdset(SEXP pool_ptr){
  CURLM *multi = get_curlm(pool_ptr);
  fd_set read_fd_set, write_fd_set, exc_fd_set;
  int max_fd, i, num_read = 0, num_write = 0, num_exc = 0;
  int *pread, *pwrite, *pexc;
  long timeout;
  SEXP result, names;

  FD_ZERO(&read_fd_set);
  FD_ZERO(&write_fd_set);
  FD_ZERO(&exc_fd_set);

  massert(curl_multi_fdset(multi, &read_fd_set, &write_fd_set,
			   &exc_fd_set, &max_fd));

  massert(curl_multi_timeout(multi, &timeout));

  for (i = 0; i <= max_fd; i++){
    if (FD_ISSET(i, &read_fd_set))  num_read++;
    if (FD_ISSET(i, &write_fd_set)) num_write++;
    if (FD_ISSET(i, &exc_fd_set))   num_exc++;
  }

  result = PROTECT(Rf_allocVector(VECSXP, 4));
  SET_VECTOR_ELT(result, 0, Rf_allocVector(INTSXP, num_read));
  SET_VECTOR_ELT(result, 1, Rf_allocVector(INTSXP, num_write));
  SET_VECTOR_ELT(result, 2, Rf_allocVector(INTSXP, num_exc));
  SET_VECTOR_ELT(result, 3, Rf_ScalarReal((double) timeout));

  names = PROTECT(Rf_allocVector(STRSXP, 4));
  SET_STRING_ELT(names, 0, Rf_mkChar("reads"));
  SET_STRING_ELT(names, 1, Rf_mkChar("writes"));
  SET_STRING_ELT(names, 2, Rf_mkChar("exceptions"));
  SET_STRING_ELT(names, 3, Rf_mkChar("timeout"));
  Rf_setAttrib(result, R_NamesSymbol, names);

  pread  = INTEGER(VECTOR_ELT(result, 0));
  pwrite = INTEGER(VECTOR_ELT(result, 1));
  pexc   = INTEGER(VECTOR_ELT(result, 2));

  for (i = 0; i <= max_fd; i++){
    if (FD_ISSET(i, &read_fd_set))  *(pread++)  = i;
    if (FD_ISSET(i, &write_fd_set)) *(pwrite++) = i;
    if (FD_ISSET(i, &exc_fd_set))   *(pexc++)   = i;
  }

  UNPROTECT(2);
  return result;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:267

R_multi_list typed entry .Call fuzz ok

([any_sexp] -> any_sexp)&([(externalptr<~curl_multi, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty)
timing: 0.029 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
type drawn from: ((x1: any_sexp) -> any_sexp) & ((x1: p(CHR) | (externalptr<~curl_multi, ...> | (~externalptr)<...>) | sym | null) -> empty)
source
SEXP R_multi_list(SEXP pool_ptr){
  return get_multiref(pool_ptr)->handles;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:263

R_multi_run typed entry .Call empty return

[(externalptr<~curl_multi, ...> | (~externalptr)<...>) | null | p(CHR) | sym, any_sexp, any_sexp] -> empty
timing: 0.797 s
source
SEXP R_multi_run(SEXP pool_ptr, SEXP timeout, SEXP max){
  multiref *mref = get_multiref(pool_ptr);
  CURLM *multi = mref->m;

  int total_pending = -1;
  int total_success = 0;
  int total_fail = 0;
  int result_max = Rf_asInteger(max);
  double time_max = Rf_asReal(timeout);
  time_t time_start = time(NULL);

  double seconds_elapsed = 0;
  while(1) {
    /* check for completed requests */
    int dirty = 0;
    int msgq = 1;
    while (msgq > 0) {
      CURLMsg *m = curl_multi_info_read(multi, &msgq);
      if(m && (m->msg == CURLMSG_DONE)){
        dirty = 1;
        reference *ref = NULL;
        CURL *handle = m->easy_handle;
        CURLcode status = m->data.result;
        assert(curl_easy_getinfo(handle, CURLINFO_PRIVATE, (char**) &ref));

        // prepare for callback
        SEXP cb_complete = PROTECT(ref->async.complete);
        SEXP cb_error = PROTECT(ref->async.error);
        SEXP cb_data = PROTECT(ref->async.data);
        SEXP buf = PROTECT(Rf_allocVector(RAWSXP, ref->async.content.size));
        if(ref->async.content.buf && ref->async.content.size)
          memcpy(RAW(buf), ref->async.content.buf, ref->async.content.size);

        //release handle for use by callbacks
        multi_release(ref);

        // Trigger a final 'data' with second argument to TRUE
        // This also ensures that a file is consistently created, even for empty responses
        if(Rf_isFunction(cb_data)){
          SEXP buf = PROTECT(Rf_allocVector(RAWSXP, 0));
          SEXP call = PROTECT(Rf_lang3(cb_data, buf, Rf_ScalarInteger(1)));
          Rf_eval(call, R_GlobalEnv);
          UNPROTECT(2);
        }

        // callbacks must be trycatch! we should continue the loop
        if(status == CURLE_OK){
          total_success++;
          if(Rf_isFunction(cb_complete)){
            int arglen = Rf_length(R_ClosureFormals(cb_complete));
            SEXP out = PROTECT(make_handle_response(ref));
            SET_VECTOR_ELT(out, 9, buf);
            SEXP call = PROTECT(Rf_lcons(cb_complete, arglen ? Rf_lcons(out, R_NilValue) : R_NilValue));
            //R_tryEval(call, R_GlobalEnv, &cbfail);
            Rf_eval(call, R_GlobalEnv); //OK to error here
            UNPROTECT(2);
          }
        } else {
          total_fail++;
          if(Rf_isFunction(cb_error)){
            raise_libcurl_error(status, ref, cb_error);
          }
        }
        UNPROTECT(4);
      }
      R_CheckUserInterrupt();
    }

    /* check for user interruptions */
    //if(pending_interrupt())  break;
    R_CheckUserInterrupt();

    /* check for timeout or max result*/
    if(total_pending > 0 && result_max > 0 && total_success + total_fail >= result_max)
      break;
    if(time_max == 0 && total_pending != -1)
      break;
    if(time_max > 0){
      seconds_elapsed = (double) (time(NULL) - time_start);
      if(seconds_elapsed > time_max)
        break;
    }

    /* check if we are done */
    if(total_pending == 0 && !dirty)
      break;

    int numfds;
    double waitforit = fmin(time_max - seconds_elapsed, 1); //at most 1 sec to support interrupts
    if(time_max > 0)
      massert(curl_multi_wait(multi, NULL, 0, (int) (waitforit * 1000), &numfds));

    /* poll libcurl for new data - updates total_pending */
    if(curl_multi_perform(multi, &(total_pending)) != CURLM_OK)
      break;
  }

  SEXP res = PROTECT(Rf_allocVector(VECSXP, 3));
  SET_VECTOR_ELT(res, 0, Rf_ScalarInteger(total_success));
  SET_VECTOR_ELT(res, 1, Rf_ScalarInteger(total_fail));
  SET_VECTOR_ELT(res, 2, Rf_ScalarInteger(total_pending));

  SEXP names = PROTECT(Rf_allocVector(STRSXP, 3));
  SET_STRING_ELT(names, 0, Rf_mkChar("success"));
  SET_STRING_ELT(names, 1, Rf_mkChar("error"));
  SET_STRING_ELT(names, 2, Rf_mkChar("pending"));
  Rf_setAttrib(res, R_NamesSymbol, names);
  UNPROTECT(2);
  return res;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:118

R_multi_setopt typed entry .Call fuzz ok

∀'a. ([any_sexp & 'a, any_sexp, any_sexp, any_sexp, any_sexp] -> any_sexp & 'a)&(['a & ((externalptr<~curl_multi, ...> | (~externalptr)<...>) | null | p(CHR) | sym), any_sexp, any_sexp, any_sexp, any_sexp] -> empty)
timing: 0.120 s
fuzzing: 20 inside (20 ok) · 8 outside (8 rejected)
type drawn from: ((x1: 'I8890 & any_sexp, x2: any_sexp, x3: any_sexp, x4: any_sexp, x5: any_sexp) -> any_sexp & 'I8890) & ((x1: 'I8890 & (p(CHR) | (externalptr<~curl_multi, ...> | (~externalptr)<...>) | sym | null), x2: any_sexp, x3: any_sexp, x4: any_sexp, x5: any_sexp) -> empty)
source
SEXP R_multi_setopt(SEXP pool_ptr, SEXP total_con, SEXP host_con, SEXP max_streams, SEXP multiplex){
    CURLM *multi = get_multiref(pool_ptr)->m;
    massert(curl_multi_setopt(multi, CURLMOPT_MAX_TOTAL_CONNECTIONS, (long) Rf_asInteger(total_con)));
    massert(curl_multi_setopt(multi, CURLMOPT_MAX_HOST_CONNECTIONS, (long) Rf_asInteger(host_con)));
    massert(curl_multi_setopt(multi, CURLMOPT_PIPELINING,
                              Rf_asLogical(multiplex) ? CURLPIPE_MULTIPLEX : CURLPIPE_NOTHING));
    massert(curl_multi_setopt(multi, CURLMOPT_MAX_CONCURRENT_STREAMS, (long) Rf_asInteger(max_streams)));
  return pool_ptr;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:253

R_option_types typed entry .Call fuzz ok

() -> { (CHR | INT) | null }
timing: 0.399 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
SEXP R_option_types(void){
  int len = 0;
  const struct curl_easyoption *o = NULL;
  while((o = curl_easy_option_next(o))){
    if(!(o->flags & CURLOT_FLAG_ALIAS))
      len++;
  }
  SEXP names = PROTECT(Rf_allocVector(STRSXP, len));
  SEXP values = PROTECT(Rf_allocVector(INTSXP, len));
  SEXP types = PROTECT(Rf_allocVector(INTSXP, len));
  int i = 0;
  while((o = curl_easy_option_next(o))){
    if(!(o->flags & CURLOT_FLAG_ALIAS)){
      SET_STRING_ELT(names, i, Rf_mkChar(o->name ? o->name : "???"));
      INTEGER(values)[i] = o->id;
      INTEGER(types)[i] = o->type;
      i++;
    }
  }

  SEXP out = PROTECT(Rf_allocVector(VECSXP, 3));
  SEXP listnms = PROTECT(Rf_allocVector(STRSXP, 3));
  Rf_setAttrib(out, R_NamesSymbol, listnms);
  SET_VECTOR_ELT(out, 0, names);
  SET_VECTOR_ELT(out, 1, values);
  SET_VECTOR_ELT(out, 2, types);
  SET_STRING_ELT(listnms, 0, Rf_mkChar("name"));
  SET_STRING_ELT(listnms, 1, Rf_mkChar("value"));
  SET_STRING_ELT(listnms, 2, Rf_mkChar("type"));
  UNPROTECT(5);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/options.c:3

R_parse_url typed entry .Call accepts outside

[CHR, CHR | null, any_sexp] -> any_sexp
timing: 4.35 s
fuzzing: 8 inside (3 ok, 5 error pkg) · 8 outside (7 rejected, 1 accepted)
type drawn from: (x1: CHR, x2: CHR | null, x3: any_sexp) -> any_sexp

Accepted outside the domain x2: 1

parameterchangecallreturned
x2kind:listR_parse_url(c(NA_character_, NA_character_, "x y", NA_character_, "é"), list(), c("é", "x y", "x y", NA_character_, "a")){ path: "/"<> with { }, url: "https://NA/"<> with { }, port: null, query: null, password: null, user: null, fragment: null, host: "NA"<> with { }, scheme: "https"<> with { } }<> with { names: (CHR & ~vec1)<> with { } }

Other calls inside the domain

callverdicterror
R_parse_url("", "a", logical(0))error_pkg::R_parse_url: Failed to parse URL: Bad scheme
R_parse_url("x y", NULL, as.raw(c(0)))error_pkg::R_parse_url: Failed to parse URL: Bad scheme
R_parse_url(character(0), character(0), as.name("x"))error_pkg::R_parse_url: attempt access index 0/0 in STRING_ELT
R_parse_url(c(NA_character_, NA_character_, "x y", NA_character_, "é"), c("x y", "a", "", "x y", "NA"), c("é", "x y", "x y", NA_character_, "a"))error_pkg::R_parse_url: Failed to parse URL: Bad hostname
R_parse_url(c("x y", "", "", "", NA_character_), NULL, list(function(...) NULL))error_pkg::R_parse_url: Failed to parse URL: Bad hostname
source
SEXP R_parse_url(SEXP url, SEXP baseurl, SEXP default_https) {
  CURLU *h = curl_url();
  int default_scheme = Rf_length(default_https) && Rf_asLogical(default_https);
  if(Rf_length(baseurl)){
    set_url(h, get_string(baseurl), default_scheme);
  }
  set_url(h, get_string(url), default_scheme);
  SEXP out = PROTECT(Rf_allocVector(VECSXP, 9));
  SET_VECTOR_ELT(out, 0, get_field(h, CURLUPART_URL, CURLUE_OK));
  SET_VECTOR_ELT(out, 1, get_field(h, CURLUPART_SCHEME, CURLUE_NO_SCHEME));
  SET_VECTOR_ELT(out, 2, get_field(h, CURLUPART_HOST, CURLUE_NO_HOST));
  SET_VECTOR_ELT(out, 3, get_field(h, CURLUPART_PORT, CURLUE_NO_PORT));
  SET_VECTOR_ELT(out, 4, get_field(h, CURLUPART_PATH, CURLUE_OK));
  SET_VECTOR_ELT(out, 5, get_field(h, CURLUPART_QUERY, CURLUE_NO_QUERY));
  SET_VECTOR_ELT(out, 6, get_field(h, CURLUPART_FRAGMENT, CURLUE_NO_FRAGMENT));
  SET_VECTOR_ELT(out, 7, get_field(h, CURLUPART_USER, CURLUE_NO_USER));
  SET_VECTOR_ELT(out, 8, get_field(h, CURLUPART_PASSWORD, CURLUE_NO_PASSWORD));
  curl_url_cleanup(h);
  Rf_setAttrib(out, R_NamesSymbol, make_url_names());
  UNPROTECT(1);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/urlparser.c:50

R_proxy_info typed entry .Call fuzz ok

() -> null
timing: 0.003 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
SEXP R_proxy_info(void){
  return R_NilValue;
}
/__w/r-typing/r-typing/work/sources/curl/src/ieproxy.c:165

R_split_string typed entry .Call fuzz ok

[CHR, CHR] -> CHR
timing: 0.295 s
fuzzing: 8 inside (6 ok, 2 error pkg) · 8 outside (8 rejected)
type drawn from: (x1: CHR, x2: CHR) -> CHR

Other calls inside the domain

callverdicterror
R_split_string(character(0), character(0))error_pkg::R_split_string: attempt access index 0/0 in STRING_ELT
R_split_string(character(0), NA_character_)error_pkg::R_split_string: attempt access index 0/0 in STRING_ELT
source
SEXP R_split_string(SEXP string, SEXP split){
  const char * str = CHAR(STRING_ELT(string, 0));
  cetype_t enc = Rf_getCharCE(STRING_ELT(string, 0));
  const char * cut = CHAR(STRING_ELT(split, 0));
  const char * out = strstr(str, cut);
  if(!out)
    return string;
  SEXP res = PROTECT(Rf_allocVector(STRSXP, 2));
  SET_STRING_ELT(res, 0, Rf_mkCharLenCE(str, out - str, enc));
  SET_STRING_ELT(res, 1, Rf_mkCharCE(out + strlen(cut), enc));
  UNPROTECT(1);
  return res;
}
/__w/r-typing/r-typing/work/sources/curl/src/split.c:4

R_total_handles typed entry .Call fuzz ok

() -> INT1
timing: 0.013 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
SEXP R_total_handles(void){
  return(Rf_ScalarInteger(total_handles));
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:533

R_total_writers typed entry .Call fuzz ok

() -> INT1
timing: 0.013 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
SEXP R_total_writers(void){
  return(Rf_ScalarInteger(total_open_writers));
}
/__w/r-typing/r-typing/work/sources/curl/src/writer.c:50

R_windows_build typed entry .Call fuzz ok

() -> null
timing: 0.003 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
SEXP R_windows_build(void){
  DWORD dwBuild = 0;
  DWORD dwVersion = GetVersion();
  if (dwVersion < 0x80000000)
    dwBuild = (DWORD)(HIWORD(dwVersion));
  return Rf_ScalarInteger(dwBuild);
}
/__w/r-typing/r-typing/work/sources/curl/src/ieproxy.c:155

R_write_file_writer typed entry .Call fuzz ok

([externalptr(empty, { }), (externalptr | vec1 | arrow) | sym, any_sexp] -> empty)&([externalptr(empty), null, any_sexp] | [externalptr(empty, { }), any_sexp, any_sexp] | [externalptr(struct _IO_FILE) \ externalptr(empty), null, any_sexp] | [externalptr(~struct _IO_FILE) \ externalptr(empty), null, any_sexp] -> 0L)&([externalptr(empty, { CHR }), null | raw, any_sexp] | [externalptr(struct _IO_FILE) \ externalptr(empty), null | raw, any_sexp] | [externalptr(~struct _IO_FILE, { CHR }) \ externalptr(empty), null | raw, any_sexp] -> ^INT1)
timing: 8.59 s
fuzzing: 3 inside (3 ok) · 8 outside (8 rejected)
type drawn from: ((x1: externalptr(empty), x2: null, x3: any_sexp) | (x1: externalptr(empty, { }), x2: any_sexp, x3: any_sexp) | (x1: externalptr(struct _IO_FILE) \ externalptr(empty), x2: null, x3: any_sexp) | (x1: externalptr(~struct _IO_FILE) \ externalptr(empty), x2: null, x3: any_sexp) -> 0L) & ((x1: externalptr(empty, { }), x2: (externalptr | vec1 | arrow) | sym, x3: any_sexp) -> empty) & ((x1: externalptr(empty, { CHR }), x2: raw | null, x3: any_sexp) | (x1: externalptr(struct _IO_FILE) \ externalptr(empty), x2: raw | null, x3: any_sexp) | (x1: externalptr(~struct _IO_FILE, { CHR }) \ externalptr(empty), x2: raw | null, x3: any_sexp) -> ^INT1)
source
SEXP R_write_file_writer(SEXP ptr, SEXP buf, SEXP close){
  FILE *fp = R_ExternalPtrAddr(ptr);
  size_t len = 0;
  if(Rf_length(buf)){
    if(fp == NULL){
      SEXP path = VECTOR_ELT(R_ExternalPtrTag(ptr), 0);
      SEXP append = VECTOR_ELT(R_ExternalPtrTag(ptr), 1);
      fp = fopen(CHAR(STRING_ELT(path, 0)), Rf_asLogical(append) ? "ab" : "wb");
      if(!fp){
        const char *errmsg =  strerror(errno);
        Rf_error("Failed to open file: %s\n%s", CHAR(STRING_ELT(path, 0)), errmsg);
      }
      R_SetExternalPtrAddr(ptr, fp);
      total_open_writers++;
    }
    len = fwrite(RAW(buf), 1, Rf_xlength(buf), fp);
  }
  if(Rf_asLogical(close)){
    fin_file_writer(ptr);
  } else if(Rf_length(buf)) {
    fflush(fp);
  }
  return Rf_ScalarInteger(len);
}
/__w/r-typing/r-typing/work/sources/curl/src/writer.c:17

raise_libcurl_error typed

([c_false, *struct reference, any_sexp] -> ())&([c(1..41) | c(43..99), c_null, any_sexp] | [c(42), c_null, any_sexp] -> empty)
timing: 0.148 s
source
void raise_libcurl_error(CURLcode res, reference *ref, SEXP error_cb){
  if(res == CURLE_OK)
    return;
  if(res == CURLE_ABORTED_BY_CALLBACK)
    send_r_interrupt();
  const char *source_url = NULL;
  curl_easy_getinfo(ref->handle, CURLINFO_EFFECTIVE_URL, &source_url);
  SEXP host = PROTECT(get_url_host(source_url));
  SEXP code = PROTECT(Rf_ScalarInteger(res));
  SEXP message = PROTECT(make_string(curl_easy_strerror(res)));
  SEXP errbuf = PROTECT(make_string(ref->errbuf));
  SEXP expr = PROTECT(Rf_install("raise_libcurl_error"));
  SEXP call = PROTECT(Rf_lang6(expr, code, message, errbuf, host, error_cb));
  SEXP env = PROTECT(R_FindNamespace(Rf_mkString("curl")));
  Rf_eval(call, env);
  UNPROTECT(7); //happens for non-throwing error_cb()
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:87

rcurl_fgetc typed any: arg 1

(tuple1 -> c_int_na)&([c_null] -> empty)
timing: 0.031 s
source
static int rcurl_fgetc(Rconnection con) {
  int x = 0;
#ifdef WORDS_BIGENDIAN
  return rcurl_read(&x, 1, 1, con) ? BSWAP_32(x) : R_EOF;
#else
  return rcurl_read(&x, 1, 1, con) ? x : R_EOF;
#endif
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:143

rcurl_open typed

([*{ private : any ; mode : c_null ..}] -> empty)&(tuple1 \ [*{ private : any ; mode : c_null ..}] -> c_bool)
timing: 0.527 s
source
static Rboolean rcurl_open(Rconnection con) {
  request *req = (request*) con->private;

  //same message as base::url()
  if (con->mode[0] != 'r' || strchr(con->mode, 'w'))
    Rf_error("can only open URLs for reading");

  if(req->ref->locked)
    Rf_error("Handle is already in use elsewhere.");

  /* init a multi stack with callback */
  CURL *handle = req->handle;
  assert(curl_easy_setopt(handle, CURLOPT_URL, req->url));
  assert(curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, push));
  assert(curl_easy_setopt(handle, CURLOPT_WRITEDATA, req));

  /* add the handle to the pool and lock it */
  massert(curl_multi_add_handle(req->manager, handle));
  req->ref->locked = 1;

  /* reset the state */
  req->handle = handle;
  req->cur = req->buf;
  req->size = 0;
  req->used = 1;
  req->has_data = 0;
  req->has_more = 1;

  /* fully non-blocking has 's' in open mode */
  int block_open = strchr(con->mode, 's') == NULL;
  int force_open = strchr(con->mode, 'f') != NULL;
  if(block_open && !force_open)
    curl_easy_setopt(handle, CURLOPT_FAILONERROR, 1L);

 /* Wait for first data to arrive. Monitoring a change in status code does not
   suffice in case of http redirects */
  while(block_open && req->has_more && !req->has_data) {
    int numfds;
    massert(curl_multi_wait(req->manager, NULL, 0, 1000, &numfds));
    if(pending_interrupt()) {
      reset(con); //cleanup before jumping
      assert_message(CURLE_ABORTED_BY_CALLBACK, NULL);
    }
    massert(curl_multi_perform(req->manager, &(req->has_more)));
    for(int msg = 1; msg > 0;){
      CURLMsg *out = curl_multi_info_read(req->manager, &msg);
      if(out && out->data.result != CURLE_OK){
        const char *errmsg = strlen(req->ref->errbuf) ? req->ref->errbuf : curl_easy_strerror(out->data.result);
        Rf_warningcall(R_NilValue, "Failed to open '%s': %s", req->url, errmsg);
        reset(con);
        return FALSE;
      }
    }
  }

  /* check http status code */
  /* Stream connections should be checked via handle_data() */
  /* Non-blocking open connections get checked during read */

  /* set mode in case open() changed it */
  con->text = strchr(con->mode, 'b') ? FALSE : TRUE;
  con->isopen = TRUE;
  con->incomplete = TRUE;
  return TRUE;
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:188

rcurl_read typed

([c_ptr, c_int_na, c_int_na, c_null] -> empty)&([c_ptr, c_int_na, c_int_na, any] \ [c_ptr, c_int_na, c_int_na, c_null] -> c_int_na)
timing: 1.39 s
source
static size_t rcurl_read(void *target, size_t sz, size_t ni, Rconnection con) {
  request *req = (request*) con->private;
  size_t req_size = sz * ni;
  size_t total_size = pop(target, req_size, req);
  if (total_size > 0 && (!con->blocking || req->partial)) {
      // If we can return data without waiting, and the connection is
      // non-blocking (or using curl_fetch_stream()), do so.
      // This ensures that bytes we already received get flushed
      // to the target buffer before a connection error.
      con->incomplete = req->has_more || req->size;
      return total_size;
  }

  while((req_size > total_size) && req->has_more) {
    int numfds;
    massert(curl_multi_wait(req->manager, NULL, 0, con->blocking ? 1000 : 10, &numfds));

    fetchdata(req);
    total_size += pop((char*)target + total_size, (req_size-total_size), req);

    //return less than requested data for non-blocking connections, or curl_fetch_stream()
    if(!con->blocking || req->partial)
      break;
  }
  con->incomplete = req->has_more || req->size;
  return total_size;
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:115

reflist_add typed

([lang, any_sexp] -> lang)&([(~lang)<...> | null | p(CHR) | sym, any_sexp] -> empty)
timing: 0.029 s
source
SEXP reflist_add(SEXP x, SEXP target){
  if(!Rf_isPairList(x))
    Rf_error("Not a LISTSXP");
  return(Rf_cons(target, x));
}
/__w/r-typing/r-typing/work/sources/curl/src/reflist.c:8

reflist_init typed

() -> null
timing: 0.003 s
source
SEXP reflist_init(void){
  return R_NilValue;
}
/__w/r-typing/r-typing/work/sources/curl/src/reflist.c:3

reflist_remove typed

∀'a. ([lang, any_sexp] -> lang | null | 'a)&(['a & ((~lang)<...> | null | p(CHR) | sym), any_sexp] -> empty)
timing: 0.111 s
source
SEXP reflist_remove(SEXP x, SEXP target){
  if(!Rf_isPairList(x))
    Rf_error("Not a LISTSXP");

  //drop head
  if(x != R_NilValue && CAR(x) == target)
    return(CDR(x));
  SEXP prev = x;
  SEXP current = CDR(x);

  //check inner nodes
  while(current != R_NilValue){
    if(CAR(current) == target){
      SETCDR(prev, CDR(current));
      return(x);
    }
    prev = current;
    current = CDR(current);
  }
  Rf_error("Object not found in reflist!");
}
/__w/r-typing/r-typing/work/sources/curl/src/reflist.c:25

reset typed

([*{ private : any ; mode : any ..}] -> ())&([c_null] -> empty)
timing: 0.159 s
source
static void reset(Rconnection con) {
  request *req = (request*) con->private;
  curl_multi_remove_handle(req->manager, req->handle);
  curl_easy_setopt(req->handle, CURLOPT_WRITEFUNCTION, NULL);
  curl_easy_setopt(req->handle, CURLOPT_WRITEDATA, NULL);
  curl_easy_setopt(req->handle, CURLOPT_FAILONERROR, 0L);
  req->ref->locked = 0;
  con->isopen = FALSE;
  con->text = TRUE;
  con->incomplete = FALSE;
  strcpy(con->mode, "r");
}
/__w/r-typing/r-typing/work/sources/curl/src/curl.c:175

reset_errbuf typed

([*struct reference] -> ())&([c_null] -> empty)
timing: 0.030 s
source
void reset_errbuf(reference *ref){
  memset(ref->errbuf, 0, CURL_ERROR_SIZE);
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:49

reset_resheaders typed

([*struct reference] -> ())&([c_null] -> empty)
timing: 0.256 s
source
void reset_resheaders(reference *ref){
  if(ref->resheaders.buf)
    free(ref->resheaders.buf);
  ref->resheaders.buf = NULL;
  ref->resheaders.size = 0;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:42

round_up typed

([c_false] -> c_false)&([c_int_na \ c_false] -> c_int)
timing: 0.058 s
source
static size_t round_up(size_t v){
  if(v == 0)
    return 0;
  v--;
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
/* 64 bit only */
#if SIZE_MAX > 4294967296
    v |= v >> 32;
#endif
  return ++v;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:152

run_httpuv typed

[c_ptr] -> ()
timing: 0.022 s
source
static void run_httpuv(void *dummy) {
  SEXP expr = PROTECT(Rf_lang1(Rf_install("later_wrapper")));
  SEXP env = PROTECT(R_FindNamespace(Rf_mkString("curl")));
  Rf_eval(expr, env);
  UNPROTECT(2);
}
/__w/r-typing/r-typing/work/sources/curl/src/dryrun.c:12

send_r_interrupt typed

() -> ()
timing: 0.002 s
source
void send_r_interrupt(void) {
  Rf_onintr();
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:12

set_form typed

([c_null, *struct curl_httppost] -> empty)&([*struct reference, *struct curl_httppost \ c_null] | [*struct reference, c_null] -> ())
timing: 0.296 s
source
void set_form(reference *ref, struct curl_httppost* newform){
  if(ref->form)
    curl_formfree(ref->form);
  ref->form = newform;
  if(newform){
    assert(curl_easy_setopt(ref->handle, CURLOPT_HTTPPOST, ref->form));
  } else {
    //CURLOPT_HTTPPOST has bug for empty forms. We probably want this:
    assert(curl_easy_setopt(ref->handle, CURLOPT_POSTFIELDS, ""));
  }
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:30

set_handle_defaults typed empty return

[c_null] -> empty
timing: 0.341 s
source
static void set_handle_defaults(reference *ref){

  /* the actual curl handle */
  CURL *handle = ref->handle;
  assert(curl_easy_setopt(handle, CURLOPT_PRIVATE, ref));

  /* set the response header collector */
  reset_resheaders(ref);
  curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, append_buffer);
  curl_easy_setopt(handle, CURLOPT_HEADERDATA, &(ref->resheaders));

  /* Respect CURL_CA_BUNDLE like base R, except for Schannel on Windows */
  const char *ca_bundle = getenv("CURL_CA_BUNDLE");
  #ifdef _WIN32
  curl_easy_setopt(handle, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
  struct curl_tlssessioninfo *tlsinfo = NULL;
  if(curl_easy_getinfo(handle, CURLINFO_TLS_SSL_PTR, &tlsinfo) == CURLE_OK){
    if(tlsinfo->backend == CURLSSLBACKEND_OPENSSL && ca_bundle == NULL) {
      curl_easy_setopt(handle, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE | CURLSSLOPT_NATIVE_CA);
    } else if(tlsinfo->backend == CURLSSLBACKEND_SCHANNEL){
      ca_bundle = NULL;
    }
  }
  #endif

  if(ca_bundle != NULL) {
    curl_easy_setopt(handle, CURLOPT_CAINFO, ca_bundle);
  }

  static const curl_version_info_data *version = NULL;
  if(version == NULL)
    version = curl_version_info(CURLVERSION_NOW);
  /* Enable compression. On MacOS libcurl 8.7.1, deflate is broken, so dont ask for it */
  assert(curl_easy_setopt(handle, CURLOPT_ENCODING, version->version_num == 0x080701 ? "gzip" : ""));

  /* follow redirect */
  assert(curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L));
  assert(curl_easy_setopt(handle, CURLOPT_MAXREDIRS, 10L));

  /* a sensible timeout (10s) */
  assert(curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, 10L));

  /* error if download is stalled for 10 minutes (prevent CI hangs) */
  assert(curl_easy_setopt(handle, CURLOPT_LOW_SPEED_LIMIT, 1L));
  assert(curl_easy_setopt(handle, CURLOPT_LOW_SPEED_TIME, 600L));

  /* needed to start the cookie engine */
  assert(curl_easy_setopt(handle, CURLOPT_COOKIEFILE, ""));
  assert(curl_easy_setopt(handle, CURLOPT_FILETIME, 1L));

  /* set the default user agent to match base R */
  SEXP agent = Rf_GetOption1(Rf_install("HTTPUserAgent"));
  if(Rf_isString(agent) && Rf_length(agent)){
    assert(curl_easy_setopt(handle, CURLOPT_USERAGENT, CHAR(STRING_ELT(agent, 0))));
  } else {
    assert(curl_easy_setopt(handle, CURLOPT_USERAGENT, "r/curl/jeroen"));
  }

  /* set the default netrc path to match base R */
  SEXP netrc = Rf_GetOption1(Rf_install("netrc"));
  if (Rf_isString(netrc) && Rf_length(netrc)) {
    const char *path = R_ExpandFileName(CHAR(STRING_ELT(netrc, 0)));
    assert(curl_easy_setopt(handle, CURLOPT_NETRC, CURL_NETRC_OPTIONAL));
    assert(curl_easy_setopt(handle, CURLOPT_NETRC_FILE, path));
  }

  /* allow all authentication methods */
  assert(curl_easy_setopt(handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY));
  assert(curl_easy_setopt(handle, CURLOPT_PROXYAUTH, CURLAUTH_ANY));

  /* set an error buffer */
  assert(curl_easy_setopt(handle, CURLOPT_ERRORBUFFER, ref->errbuf));

  /* dummy readfunction because default can freeze R */
  assert(curl_easy_setopt(handle, CURLOPT_READFUNCTION, dummy_read));

  /* set default progress printer (disabled by default) */
  assert(curl_easy_setopt(handle, CURLOPT_XFERINFOFUNCTION, xferinfo_callback));

  /* Disable the 'Expect: 100' header (deprecated in recent libcurl) */
  set_headers(ref, NULL);
  assert(curl_easy_setopt(handle, CURLOPT_EXPECT_100_TIMEOUT_MS, 0L));

  /* Send verbose output to R front-end virtual stderr */
  assert(curl_easy_setopt(handle, CURLOPT_DEBUGFUNCTION, default_verbose_cb));

  /* Prefer using multiplex when possible */
  assert(curl_easy_setopt(handle, CURLOPT_PIPEWAIT, 1L));
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:118

set_headers typed

([c_null, *struct curl_slist] -> empty)&([*struct reference, *struct curl_slist \ c_null] | [*struct reference, c_null] -> ())
timing: 0.211 s
source
static void set_headers(reference *ref, struct curl_slist *newheaders){
  if(ref->headers)
    curl_slist_free_all(ref->headers);
  ref->headers = newheaders;
  assert(curl_easy_setopt(ref->handle, CURLOPT_HTTPHEADER,
                          newheaders ? newheaders : default_headers()));
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:100

set_url typed

[*struct Curl_URL, c_string, c_int_na] -> ()
timing: 0.024 s
source
static void set_url(CURLU *h, const char *str, int default_scheme){
  int flags = CURLU_NON_SUPPORT_SCHEME | CURLU_URLENCODE | (default_scheme * CURLU_DEFAULT_SCHEME);
  fail_if(curl_url_set(h, CURLUPART_URL, str, flags));
}
/__w/r-typing/r-typing/work/sources/curl/src/urlparser.c:45

set_value typed

[*struct Curl_URL, c(0..10), (~CHR)<...> | null | p(CHR) | sym] -> ()
timing: 0.612 s
source
static void set_value(CURLU *h, CURLUPart part, SEXP value){
  if(Rf_length(value) && Rf_isString(value)){
    if(STRING_ELT(value, 0) == NA_STRING || Rf_length(STRING_ELT(value, 0)) == 0){
      fail_if(curl_url_set(h, part, NULL, 0));
    } else if(Rf_inherits(value, "AsIs")){
      fail_if(curl_url_set(h, part, get_string(value), 0));
    } else {
      fail_if(curl_url_set(h, part, get_string(value), CURLU_NON_SUPPORT_SCHEME | CURLU_URLENCODE));
    }
  }
}
/__w/r-typing/r-typing/work/sources/curl/src/urlparser.c:73

slist_to_vec typed

[*struct curl_slist \ c_null] | [c_null] -> CHR
timing: 0.704 s
source
SEXP slist_to_vec(struct curl_slist *slist){
  /* linked list of strings */
  struct curl_slist *cursor = slist;

  /* count slist */
  int n = 0;
  while (cursor) {
    n++;
    cursor = cursor->next;
  }

  SEXP out = PROTECT(Rf_allocVector(STRSXP, n));
  cursor = slist;
  for(int i = 0; i < n; i++){
    SET_STRING_ELT(out, i, Rf_mkChar(cursor->data));
    cursor = cursor->next;
  }
  UNPROTECT(1);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:125

str_starts_with typed

[c_string, c_string] -> c_bool
timing: 0.010 s
source
static int str_starts_with(const char *a, const char *b) {
  if(strncmp(a, b, strlen(b)) == 0) return 1;
  return 0;
}
/__w/r-typing/r-typing/work/sources/curl/src/interrupt.c:17

syserror_if typed

([c_false, c_string] -> ())&([c_int_na \ c_false, c_string] -> empty)
timing: 0.016 s
source
static void syserror_if(int err, const char * what){
  if(err)
    Rf_errorcall(R_NilValue, "System failure for: %s (%s)", what, getsyserror());
}
/__w/r-typing/r-typing/work/sources/curl/src/findport.c:41

vec_to_slist typed

([CHR] -> *struct curl_slist)&([(~CHR)<...> | null | p(CHR) | sym] -> empty)
timing: 0.203 s
source
struct curl_slist* vec_to_slist(SEXP vec){
  if(!Rf_isString(vec))
    Rf_error("vec is not a character vector");
  struct curl_slist *slist = NULL;
  for(int i = 0; i < Rf_length(vec); i++){
    slist = curl_slist_append(slist, CHAR(STRING_ELT(vec, i)));
  }
  return slist;
}
/__w/r-typing/r-typing/work/sources/curl/src/utils.c:115

write_nothing typed

([c_ptr, c_int, c_int, c_ptr] -> c_int)&([c_ptr, c_int_na, c_int_na, c_ptr] -> c_int_na)
timing: 0.011 s
source
static size_t write_nothing(void *contents, size_t sz, size_t nmemb, void *ctx) {
  return sz * nmemb;
}
/__w/r-typing/r-typing/work/sources/curl/src/dryrun.c:8

xferinfo_callback typed any: arg 2, arg 4

[c_ptr, any, c_falsy, any, c_falsy] -> c_false
timing: 1.25 s
source
static int xferinfo_callback(void *clientp, xftype dltotal, xftype dlnow, xftype ultotal, xftype ulnow){
  static xftype dlprev = 0;
  static xftype ulprev = 0;
  if(dlnow && dlnow != dlprev){
    dlprev = dlnow;
    if(dltotal){
      int pct_dn = (100 * dlnow)/dltotal;
      REprintf("\r [%d%%] Downloaded %.0lf bytes...", pct_dn, (double) dlnow);
      if(dlnow == dltotal)
        REprintf("\n");
    } else {
      REprintf("\r Downloaded %.0lf bytes...", (double) dlnow);
    }
  } else if(ulnow && ulnow != ulprev){
    ulprev = ulnow;
    int pct_up = (100 * ulnow)/ultotal;
    REprintf("\r [%d%%] Uploaded %.0lf bytes...", pct_up, (double) ulnow);
    if(ulnow == ultotal)
      REprintf("\n");
  }
  return 0;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:54

assert C signature

tuple1 --> any
untypeable application
error detail
function: [c(1..41) | c(43..99), c_string] | [c(42), c_string] | [c_false, c_string] --> ()
argument: ['I1265, c_null]
timing: 0.007 s
(definition not located in src/)

make_form C signature

[any_sexp] --> *struct curl_httppost
untypeable application
error detail
function: [CHR & v('I5418), c_int] --> prim & 'I5418
argument: [CHR | null, c_int]
timing: 0.924 s
source
struct curl_httppost* make_form(SEXP form){
  struct curl_httppost* post = NULL;
  struct curl_httppost* last = NULL;
  SEXP ln = PROTECT(Rf_getAttrib(form, R_NamesSymbol));
  for(int i = 0; i < Rf_length(form); i++){
    const char *name = Rf_translateCharUTF8(STRING_ELT(ln, i));
    SEXP val = VECTOR_ELT(form, i);
    if(TYPEOF(val) == RAWSXP){
      long datalen = Rf_length(val);
      if(datalen > 0){
        unsigned char * data = RAW(val);
        curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_COPYCONTENTS, data, CURLFORM_CONTENTSLENGTH, datalen, CURLFORM_END);
      } else {
        //Note if 'CURLFORM_CONTENTLEN == 0' then libcurl assumes strlen() !
        curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_COPYCONTENTS, "", CURLFORM_END);
      }
    } else if(Rf_isVector(val) && Rf_length(val)){
      if(Rf_isString(VECTOR_ELT(val, 0))){
        //assume a form_file upload
        const char *path = CHAR(Rf_asChar(VECTOR_ELT(val, 0)));
        if(Rf_isString(VECTOR_ELT(val, 1))) {
          const char *content_type = CHAR(Rf_asChar(VECTOR_ELT(val, 1)));
          if(Rf_isString(VECTOR_ELT(val, 2))) {
            const char *file_name = CHAR(Rf_asChar(VECTOR_ELT(val, 2)));
            curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_FILE, path, CURLFORM_CONTENTTYPE, content_type, CURLFORM_FILENAME, file_name, CURLFORM_END);
          } else {
            curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_FILE, path, CURLFORM_CONTENTTYPE, content_type, CURLFORM_END);
          }
        } else {
          if(Rf_isString(VECTOR_ELT(val, 2))) {
            const char *file_name = CHAR(Rf_asChar(VECTOR_ELT(val, 2)));
            curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_FILE, path, CURLFORM_FILENAME, file_name, CURLFORM_END);
          } else {
            curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_FILE, path, CURLFORM_END);
          }
        }
      } else {
        //assume a form_value upload
        unsigned char * data = RAW(VECTOR_ELT(val, 0));
        long datalen = Rf_length(VECTOR_ELT(val, 0));
        //libcurl assumes strlen() if datalen is 0
        if(datalen == 0)
          data = (unsigned char *) "";
        if(Rf_isString(VECTOR_ELT(val, 1))){
          const char * content_type = CHAR(Rf_asChar(VECTOR_ELT(val, 1)));
          curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_COPYCONTENTS, data, CURLFORM_CONTENTSLENGTH, datalen, CURLFORM_CONTENTTYPE, content_type, CURLFORM_END);
        } else {
          curl_formadd(&post, &last, CURLFORM_COPYNAME, name, CURLFORM_COPYCONTENTS, data, CURLFORM_CONTENTSLENGTH, datalen, CURLFORM_END);
        }
      }
    } else {
      Rf_error("form value %s not supported", name);
    }
  }
  UNPROTECT(1);
  return post;
}
/__w/r-typing/r-typing/work/sources/curl/src/form.c:3

port_is_available C signature

[c_int_na] --> c_int_na
untypeable application
error detail
function: [record & 'I10016, any] --> 'I10016
argument: [struct sockaddr_in, c(2)]
timing: 0.010 s
source
static int port_is_available(int port){

  // define server socket
  struct sockaddr_in serv_addr;
  memset(&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  serv_addr.sin_port = htons(port);

  //creates the listening socket
  int sockfd = socket(AF_INET, SOCK_STREAM, 0);
  syserror_if(sockfd < 0, "socket()");

  //Allows immediate reuse of a port in TIME_WAIT state.
  //for Windows see TcpTimedWaitDelay (doesn't work)
#ifndef _WIN32
  int enable = 1;
  syserror_if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) < 0, "SO_REUSEADDR");
#endif

  int res = bind(sockfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
  #ifdef _WIN32
  closesocket(sockfd);
  #else
  close(sockfd);
  #endif
  return res == 0;
}
/__w/r-typing/r-typing/work/sources/curl/src/findport.c:46

R_curl_callback_progress C signature

[any_sexp, c_double, c_double, c_double, c_double] --> c_int_na
unbound variable
error detail
name: Rf_warning
timing: 0.191 s
source
int R_curl_callback_progress(SEXP fun,
                             double dltotal, double dlnow,
                             double ultotal, double ulnow) {

  SEXP down = PROTECT(Rf_allocVector(REALSXP, 2));
  REAL(down)[0] = dltotal;
  REAL(down)[1] = dlnow;

  SEXP up = PROTECT(Rf_allocVector(REALSXP, 2));
  REAL(up)[0] = ultotal;
  REAL(up)[1] = ulnow;

  SEXP call = PROTECT(Rf_lang3(fun, down, up));
  int ok;
  SEXP res = PROTECT(R_tryEval(call, R_GlobalEnv, &ok));

  if (ok != 0) {
    UNPROTECT(4);
    return CURL_READFUNC_ABORT;
  }

  if (TYPEOF(res) != LGLSXP || Rf_length(res) != 1) {
    UNPROTECT(4);
    Rf_warning("progress callback must return boolean");
    return 0;
  }

  int out = Rf_asLogical(res);
  UNPROTECT(4);
  return !out;
}
/__w/r-typing/r-typing/work/sources/curl/src/callbacks.c:3

R_curl_callback_read C signature

[c_string, c_int_na, c_int_na, any_sexp] --> c_int_na
unbound variable
error detail
name: Rf_warning
timing: 0.141 s
source
size_t R_curl_callback_read(char *buffer, size_t size, size_t nitems, SEXP fun) {
  SEXP nbytes = PROTECT(Rf_ScalarInteger(size * nitems));
  SEXP call = PROTECT(Rf_lang2(fun, nbytes));

  int ok;
  SEXP res = PROTECT(R_tryEval(call, R_GlobalEnv, &ok));

  if (ok != 0) {
    UNPROTECT(3);
    return CURL_READFUNC_ABORT;
  }

  if (TYPEOF(res) != RAWSXP) {
    UNPROTECT(3);
    Rf_warning("read callback must return a raw vector");
    return CURL_READFUNC_ABORT;
  }

  size_t bytes_read = Rf_length(res);
  if (bytes_read > size * nitems) {
    UNPROTECT(3);
    Rf_warning("read callback returned more data than requested");
    return CURL_READFUNC_ABORT;
  }
  if (bytes_read) memcpy(buffer, RAW_RO(res), bytes_read);

  UNPROTECT(3);
  return bytes_read;
}
/__w/r-typing/r-typing/work/sources/curl/src/callbacks.c:35

set_user_option C signature

tuple2 --> any
unbound variable
error detail
name: handle
timing: 0.004 s
(definition not located in src/)

R_multi_new untypeable entry .Call

untypeable application
error detail
function: [externalptr, any_sexp --> () | c_void, c_bool] --> c_void
argument: [externalptr(struct multiref, null), [(externalptr<~curl_multi, ...> | (~externalptr)<...>) | null | p(CHR) | sym] -> empty, c_true]
timing: 0.099 s
source
SEXP R_multi_new(void){
  multiref *ref = calloc(1, sizeof(multiref));
  ref->m = curl_multi_init();
  ref->handles = reflist_init();
  SEXP ptr = PROTECT(R_MakeExternalPtr(ref, R_NilValue, ref->handles));
  ref->multiptr = ptr;
  R_RegisterCFinalizerEx(ptr, fin_multi, 1);
  Rf_setAttrib(ptr, R_ClassSymbol, Rf_mkString("curl_multi"));
  UNPROTECT(1);
  return ptr;
}
/__w/r-typing/r-typing/work/sources/curl/src/multi.c:241

R_new_file_writer untypeable entry .Call

untypeable application
error detail
function: [externalptr, any_sexp --> () | c_void, c_bool] --> c_void
argument: [externalptr(empty, 'I13179), [externalptr(empty)] | [externalptr(struct _IO_FILE) \ externalptr(empty)] | [externalptr(~struct _IO_FILE) \ externalptr(empty)] -> (), c_true]
timing: 0.023 s
source
SEXP R_new_file_writer(SEXP opts){
  SEXP ptr = PROTECT(R_MakeExternalPtr(NULL, opts, R_NilValue));
  R_RegisterCFinalizerEx(ptr, fin_file_writer, TRUE);
  Rf_setAttrib(ptr, R_ClassSymbol, Rf_mkString("file_writer"));
  UNPROTECT(1);
  return ptr;
}
/__w/r-typing/r-typing/work/sources/curl/src/writer.c:42

R_new_handle untypeable entry .Call

untypeable application
error detail
function: [c_null] --> empty
argument: [*struct reference]
timing: 0.070 s
source
SEXP R_new_handle(void){
  reference *ref = calloc(1, sizeof(reference));
  ref->refCount = 1;
  ref->handle = curl_easy_init();
  total_handles++;
  set_handle_defaults(ref);
  SEXP prot = PROTECT(Rf_allocVector(VECSXP, 8)); //for protecting callback functions
  SEXP ptr = PROTECT(R_MakeExternalPtr(ref, R_NilValue, prot));
  R_RegisterCFinalizerEx(ptr, fin_handle, TRUE);
  Rf_setAttrib(ptr, R_ClassSymbol, Rf_mkString("curl_handle"));
  UNPROTECT(2);
  ref->handleptr = ptr;
  return ptr;
}
/__w/r-typing/r-typing/work/sources/curl/src/handle.c:208

R_nslookup untypeable entry .Call

untypeable application
error detail
function: [record & 'I6396, any] --> 'I6396
argument: [struct addrinfo, c(2)]
timing: 0.133 s
source
SEXP R_nslookup(SEXP hostname, SEXP ipv4_only) {
  /* Because gethostbyname() is deprecated */
  struct addrinfo hints = {0};
  if(Rf_asLogical(ipv4_only))
    hints.ai_family = AF_INET; //only allow ipv4
  struct addrinfo *addr;
  const char * hoststr = CHAR(STRING_ELT(hostname, 0));
#ifdef _WIN32
  if(Rf_getCharCE(STRING_ELT(hostname, 0)) == CE_UTF8){
    char * punycode;
    if(jeroen_win32_idn_to_ascii(hoststr, &punycode))
      hoststr = punycode;
  }
#endif
  if(getaddrinfo(hoststr, NULL, &hints, &addr))
    return R_NilValue;

  // count number of hits
  int len = 0;
  struct addrinfo * cur = addr;
  while(cur != NULL){
    len++;
    cur = cur->ai_next;
  }

  //allocate output
  SEXP out = PROTECT(Rf_allocVector(STRSXP, len));

  //extract the values
  cur = addr;
  for(size_t i = 0; i < len; i++) {
    struct sockaddr *sa = cur->ai_addr;

    /* IPv4 vs v6 */
    char ip[INET6_ADDRSTRLEN];
    if (sa->sa_family == AF_INET) {
      struct sockaddr_in *sa_in = (struct sockaddr_in*) sa;
      inet_ntop(AF_INET, &(sa_in->sin_addr), ip, INET_ADDRSTRLEN);
    } else {
      struct sockaddr_in6 *sa_in = (struct sockaddr_in6*) sa;
      inet_ntop(AF_INET6, &(sa_in->sin6_addr), ip, INET6_ADDRSTRLEN);
    }
    SET_STRING_ELT(out, i, Rf_mkChar(ip));
    cur = cur->ai_next;
  }
  UNPROTECT(1);
  freeaddrinfo(addr);
  return out;
}
/__w/r-typing/r-typing/work/sources/curl/src/nslookup.c:29

curl_easy_option_by_id skipped

timing: 0.000 s
(definition not located in src/)

curl_easy_option_next skipped

timing: 0.000 s
(definition not located in src/)

curl_url_strerror skipped

timing: 0.000 s
(definition not located in src/)

R definitions 191

R/echo.R

curl_dryrun typed empty return

((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)<>
timing: 0.019 s
source
curl_dryrun <- function(handle){
  .Call(R_curl_dryrun, handle)
}
R/echo.R:143

find_port typed accepts outside

((range: (vec | null)?) -> INT1 | null)<>
timing: 0.127 s
fuzzing: 7 inside (7 ok) · 8 outside (5 rejected, 3 accepted)

Accepted outside the domain range: 3

parameterchangecallreturned
rangekind:listfind_port("range" = list())6412L<> with { }
rangewrapfind_port(list(complex(real = 0, imaginary = 0)))0L<> with { }
rangewrapfind_port(list(character(0)))(INT1 \ ^INT1)<> with { }
source
find_port <- function(range = NULL){
  if(!length(range))
    range <- sample(1024:49151)
  range <- as.integer(range)
  .Call(R_findport, range)
}
R/echo.R:135

format_size typed fuzz ok

(((x: dbl1<~@"/", ...>) -> CHR1<>)&((x: dbl<~@"/", ...>) | (x: vec<@"/", ...>) -> CHR<>))<>
timing: 0.591 s
fuzzing: 8 inside (4 ok, 4 error type) · 6 outside (6 rejected)

Other calls inside the domain

callverdicterror
format_size("x" = NaN)error_typebase::if: missing value where TRUE/FALSE needed
format_size("x" = numeric(0))error_typebase::if: argument is of length zero
format_size("x" = as.raw(c(255, 0)))error_typebase::if: the condition has length > 1
format_size(logical(0))error_typebase::if: argument is of length zero
source
format_size <- function(x){
  if(x < 1024)
    return(sprintf("%d b", x))
  if(x < 1048576)
    return(sprintf("%.2f Kb", x / 1024))
  return(sprintf("%.2f Mb", x / 1048576))
}
R/echo.R:123

replace_host typed accepts outside

(((url: vec, new_host: vec1?) -> CHR<>)&((url: vec1, new_host: vec1?) -> CHR1<>))<>
timing: 0.079 s
fuzzing: 8 inside (8 ok) · 8 outside (5 rejected, 3 accepted)

Accepted outside the domain new_host: 1, url: 2

parameterchangecallreturned
new_hostwrapreplace_host("url" = "x y", "new_host" = list(NA_complex_))"x y"<> with { }
urlkind:symreplace_host("url" = as.name("x"))"x"<> with { }
urlwrapreplace_host(list(complex(real = 1, imaginary = -2)))"1-2i"<> with { }
source
replace_host <- function(url, new_host = 'http://127.0.0.1'){
  sub("[a-zA-Z]+://[^/]+", new_host, url)
}
R/echo.R:103

write_to_file untypeabletyped

unbound variable (line 111)
unbound: base::file — a name the prelude does not declare
error detail
name: base::file
gradual mode: typed
∀'a. ((readfun: @(DBL1<>) -> any, filename: 'a & <connection, ...>) -> 'a)<>
timing: 0.035 s
source
write_to_file <- function(readfun, filename){
  con <- if(inherits(filename, "connection")){
    filename
  } else {
    base::file(filename)
  }
  if(!isOpen(con)){
    open(con, "wb")
    on.exit(close(con))
  }
  while(length(buf <- readfun(1e6))){
    writeBin(buf, con)
  }
  return(filename)
}
R/echo.R:107

curl_echo timeout

timing: 20.00 s
source
curl_echo <- function(handle, port = find_port(), progress = interactive(), file = NULL){
  progress <- isTRUE(progress)
  if(!(is.null(file) || inherits(file, "connection") || is.character(file)))
    stop("Argument 'file' must be a file path or connection object")
  output <- NULL
  echo_handler <- function(req){
    if(progress){
      cat("\nRequest Complete!\n", file = stderr())
      progress <<- FALSE
    }
    body <- if(tolower(req[["REQUEST_METHOD"]]) %in% c("post", "put")){
      if(!length(file)){
        req[["rook.input"]]$read()
      } else {
        write_to_file(req[["rook.input"]]$read, file)
      }
    }

    output <<- list(
      method = req[["REQUEST_METHOD"]],
      path = req[["PATH_INFO"]],
      query = req[["QUERY_STRING"]],
      content_type = req[["CONTENT_TYPE"]],
      body = body,
      headers = req[["HEADERS"]]
    )

    # Dummy response
    list(
      status = 200,
      body = "",
      headers = c("Content-Type" = "text/plain")
    )
  }

  # Start httpuv
  server_id <- httpuv::startServer("0.0.0.0", port, list(call = echo_handler))
  on.exit(httpuv::stopServer(server_id), add = TRUE)

  # Workaround bug in httpuv on windows that keeps protecting handler until next startServer()
  on.exit(rm(handle), add = TRUE)

  # Post data from curl
  xfer <- function(down, up){
    if(progress){
      if(up[1] == 0 && down[1] == 0){
        cat("\rConnecting...", file = stderr())
      } else {
        cat(sprintf("\rUpload: %s (%.0f%%)   ", format_size(up[2]),
                    as.integer(100 * up[2] / up[1])), file = stderr())
      }
    }
    TRUE
  }
  handle_setopt(handle, connecttimeout = 2, xferinfofunction = xfer, noprogress = FALSE, forbid_reuse = TRUE)
  if(progress) cat("\n", file = stderr())
  input_url <- handle_data(handle)$url
  if(length(input_url) && nchar(input_url)){
    target_url <- replace_host(input_url, paste0("http://127.0.0.1:", port))
    host <- sub("https?://([^/]+).*", "\\1", input_url)
    #hostname <- gsub(":[0-9]+$", "", host)
    #handle_setopt(handle, port = port, resolve = paste0(hostname, ":", port, ':127.0.0.1'))
    request_headers <- handle_getheaders(handle)
    if(!any(grepl("^Host:", request_headers, ignore.case = TRUE))){
      request_headers <- c(paste("Host:", host), request_headers)
    }
    handle_setopt(handle, httpheader = request_headers)
  } else {
    target_url <- paste0("http://127.0.0.1:", port)
  }
  handle_setopt(handle, url = target_url)
  curl_dryrun(handle)
  output$url <- input_url
  if(progress) cat("\n", file = stderr())
  return(output)
}
R/echo.R:26

later_wrapper untypeabletyped

unbound variable (line 148)
unbound: later::run_now — a name the prelude does not declare
error detail
name: later::run_now
gradual mode: typed
(() -> any)<>
timing: 0.001 s
source
later_wrapper <- function(){
  later::run_now()
}
R/echo.R:147
R/errcodes.R

libcurl_error_codes timeout

timing: 20.00 s
source
libcurl_error_codes <- 
c("curl_error_unsupported_protocol", "curl_error_failed_init", 
"curl_error_url_malformat", "curl_error_not_built_in", "curl_error_couldnt_resolve_proxy", 
"curl_error_couldnt_resolve_host", "curl_error_couldnt_connect", 
"curl_error_weird_server_reply", "curl_error_remote_access_denied", 
"curl_error_ftp_accept_failed", "curl_error_ftp_weird_pass_reply", 
"curl_error_ftp_accept_timeout", "curl_error_ftp_weird_pasv_reply", 
"curl_error_ftp_weird_227_format", "curl_error_ftp_cant_get_host", 
"curl_error_http2", "curl_error_ftp_couldnt_set_type", "curl_error_partial_file", 
"curl_error_ftp_couldnt_retr_file", "curl_error_obsolete20", 
"curl_error_quote_error", "curl_error_http_returned_error", "curl_error_write_error", 
"curl_error_obsolete24", "curl_error_upload_failed", "curl_error_read_error", 
"curl_error_out_of_memory", "curl_error_operation_timedout", 
"curl_error_obsolete29", "curl_error_ftp_port_failed", "curl_error_ftp_couldnt_use_rest", 
"curl_error_obsolete32", "curl_error_range_error", "curl_error_http_post_error", 
"curl_error_ssl_connect_error", "curl_error_bad_download_resume", 
"curl_error_file_couldnt_read_file", "curl_error_ldap_cannot_bind", 
"curl_error_ldap_search_failed", "curl_error_obsolete40", "curl_error_function_not_found", 
"curl_error_aborted_by_callback", "curl_error_bad_function_argument", 
"curl_error_obsolete44", "curl_error_interface_failed", "curl_error_obsolete46", 
"curl_error_too_many_redirects", "curl_error_unknown_option", 
"curl_error_setopt_option_syntax", "curl_error_obsolete50", "curl_error_peer_failed_verification", 
"curl_error_got_nothing", "curl_error_ssl_engine_notfound", "curl_error_ssl_engine_setfailed", 
"curl_error_send_error", "curl_error_recv_error", "curl_error_obsolete57", 
"curl_error_ssl_certproblem", "curl_error_ssl_cipher", "curl_error_peer_failed_verification", 
"curl_error_bad_content_encoding", "curl_error_ldap_invalid_url", 
"curl_error_filesize_exceeded", "curl_error_use_ssl_failed", 
"curl_error_send_fail_rewind", "curl_error_ssl_engine_initfailed", 
"curl_error_login_denied", "curl_error_tftp_notfound", "curl_error_tftp_perm", 
"curl_error_remote_disk_full", "curl_error_tftp_illegal", "curl_error_tftp_unknownid", 
"curl_error_remote_file_exists", "curl_error_tftp_nosuchuser", 
"curl_error_conv_failed", "curl_error_conv_reqd", "curl_error_ssl_cacert_badfile", 
"curl_error_remote_file_not_found", "curl_error_ssh", "curl_error_ssl_shutdown_failed", 
"curl_error_again", "curl_error_ssl_crl_badfile", "curl_error_ssl_issuer_error", 
"curl_error_ftp_pret_failed", "curl_error_rtsp_cseq_error", "curl_error_rtsp_session_error", 
"curl_error_ftp_bad_file_list", "curl_error_chunk_failed", "curl_error_no_connection_available", 
"curl_error_ssl_pinnedpubkeynotmatch", "curl_error_ssl_invalidcertstatus", 
"curl_error_http2_stream", "curl_error_recursive_api_call", "curl_error_auth_error", 
"curl_error_http3", "curl_error_quic_connect_error", "curl_error_proxy", 
"curl_error_ssl_clientcert", "curl_error_unrecoverable_poll", 
"curl_error_too_large", "curl_error_ech_required")
R/errcodes.R:2
R/utilities.R

curl_symbols untypeabletyped

unbound variable (line 5)
unbound: curl_symbol_data — a name the prelude does not declare
error detail
name: curl_symbol_data
gradual mode: typed
((filter: any?) -> any)<>
timing: 0.005 s
source
curl_symbols <- function(filter = ""){
  m <- grep(filter, curl_symbol_data$name, ignore.case = TRUE)
  curl_symbol_data[m,]
}
R/utilities.R:4

curl_version typed fuzz ok

(() -> { (CHR | ^LGL1) | null })<>
timing: 0.012 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
curl_version <- function(){
  .Call(R_curl_version);
}
R/utilities.R:15

parse_date typed fuzz ok

(((datestring: any_sexp) -> DBL)&((datestring: p(CHR) | (~(CHR & ~CHR1))<...> | sym | null) -> DBL1)&((datestring: p(CHR) | (~CHR)<...> | sym | null) -> empty))<>
timing: 0.078 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
source
parse_date <- function(datestring){
  out <- .Call(R_curl_getdate, datestring);
  class(out) <- c("POSIXct", "POSIXt")
  out
}
R/utilities.R:34

split_string typed fuzz ok

((x: CHR, split: CHR?) -> CHR)<>
timing: 0.025 s
fuzzing: 8 inside (5 ok, 3 error pkg) · 8 outside (8 rejected)

Other calls inside the domain

callverdicterror
split_string("x" = NA_character_, "split" = character(0))error_pkgcurl::split_string: attempt access index 0/0 in STRING_ELT
split_string("é", character(0))error_pkgcurl::split_string: attempt access index 0/0 in STRING_ELT
split_string(character(0))error_pkgcurl::split_string: attempt access index 0/0 in STRING_ELT
source
split_string <- function(x, split = ":"){
  .Call(R_split_string, x, split)
}
R/utilities.R:42

trimws typed accepts outside

(((x: vec) -> CHR<>)&((x: vec1) -> CHR1<>))<>
timing: 0.058 s
fuzzing: 7 inside (7 ok) · 8 outside (6 rejected, 2 accepted)

Accepted outside the domain x: 2

parameterchangecallreturned
xkind:symtrimws("x" = as.name("x"))"x"<> with { }
xwraptrimws(list(raw(0)))"raw(0)"<> with { }
source
trimws <- function(x) {
  sub("\\s+$", "", sub("^\\s+", "", x))
}
R/utilities.R:46

is_string typed fuzz ok

(((x: CHR) -> ff<> | tt<>)&((x: ~CHR) -> ff<>))<>
timing: 0.071 s
fuzzing: 8 inside (6 ok, 2 error type) · 7 outside (7 rejected)

Other calls inside the domain

callverdicterror
is_string("x" = c("x y", NA_character_, NA_character_, "é", "é"))error_typebase::&&: 'length = 5' in coercion to 'logical(1)'
is_string("x" = c("", "NA", "NA", "x y", "NA"))error_typebase::&&: 'length = 5' in coercion to 'logical(1)'
source
is_string <- function(x){
  is.character(x) && length(x) && nchar(x)
}
R/utilities.R:50

raise_libcurl_error skipped

error detail
Failure("Unsupported positional argument after a named one.")
timing: 0.000 s
source
raise_libcurl_error <- function(errnum, message, errbuf = NULL, host = NULL, error_cb = NULL){
  error_code <- libcurl_error_codes[errnum]
  if(is.na(error_code))
    error_code <- NULL #future proof new error codes
  if(is_string(host)){
    message <- sprintf('%s [%s]', message, host)
  }
  if(is_string(errbuf)){
    message <- sprintf('%s:\n%s', message, errbuf)
  }
  if(is.function(error_cb)){
    if(length(formals(error_cb)) > 0){
      error_cb(structure(message, class = c(error_code, "curl_error", "character")))
    } else {
      error_cb()
    }
  } else {
    cl <- sys.call(-1)
    e <- structure(
      class = c(error_code, "curl_error", "error", "condition"),
      list(message = message, call = cl)
    )
    stop(e)
  }
}
R/utilities.R:55
R/writer.R

new_file_writer untypeabletyped

unbound variable (line 40)
unbound: R_new_file_writer — a native symbol tyr could not bind
error detail
name: R_new_file_writer
gradual mode: typed
((path: any, append: any) -> any)<>
timing: 0.002 s
source
new_file_writer <- function(path, append){
  .Call(R_new_file_writer, list(path, append))
}
R/writer.R:39

write_file_writer typed fuzz ok

(((fp: externalptr(empty, { }), data: (externalptr | vec1 | arrow) | sym, close: any_sexp) -> empty)&((fp: externalptr, data: null, close: any_sexp) | (fp: externalptr(empty, { }), data: any_sexp, close: any_sexp) -> 0L)&((fp: externalptr, data: raw | null, close: any_sexp) -> ^INT1))<>
timing: 0.779 s
fuzzing: 3 inside (3 ok) · 8 outside (8 rejected)
source
write_file_writer <- function(fp, data, close){
  .Call(R_write_file_writer, fp, data, close)
}
R/writer.R:44

file_writer untypeabletyped

unbound variable (line 30)
unbound: enc2native — a name the prelude does not declare
error detail
name: enc2native
gradual mode: typed
((path: vec, append: any?) -> any)<>
timing: 0.030 s
source
file_writer <- function(path, append = FALSE){
  path <- enc2native(normalizePath(path, mustWork = FALSE))
  fp <- new_file_writer(path, append)
  structure(function(data = raw(), close = FALSE){
    stopifnot(is.raw(data))
    write_file_writer(fp, data, as.logical(close))
  }, class = "file_writer")
}
R/writer.R:29

total_writers typed fuzz ok

(() -> INT1)<>
timing: 0.006 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
total_writers <- function(){
  .Call(R_total_writers)
}
R/writer.R:49
R/multi.R

multi_set untypeable

unbound variable (line 145)
unbound: multi_default — one of the package’s own names, itself untyped
error detail
name: multi_default
timing: 0.079 s
source
multi_set <- function(total_con = 50, host_con = 6, max_streams = 10, multiplex = TRUE, pool = NULL){
  if(is.null(pool))
    pool <- multi_default()
  stopifnot(inherits(pool, "curl_multi"))
  stopifnot(is.numeric(total_con))
  stopifnot(is.numeric(host_con))
  stopifnot(is.numeric(max_streams))
  stopifnot(is.logical(multiplex))
  .Call(R_multi_setopt, pool, total_con, host_con, max_streams, multiplex)
}
R/multi.R:143

new_pool untypeabletyped

unbound variable (line 176)
unbound: R_multi_new — a native symbol tyr could not bind
error detail
name: R_multi_new
gradual mode: typed
((total_con: any?, host_con: any?, max_streams: any?, multiplex: any?) -> any)<>
timing: 0.017 s
source
new_pool <- function(total_con = 100, host_con = 6, max_streams = 10, multiplex = TRUE){
  pool <- .Call(R_multi_new)
  multi_set(pool = pool, total_con = total_con, host_con = host_con, max_streams = max_streams, multiplex = multiplex)
}
R/multi.R:175

multi_default untypeable

unbound variable (line 184)
unbound: new_pool — one of the package’s own names, itself untyped
error detail
name: new_pool
timing: 0.009 s
source
multi_default <- local({
  global_multi_handle <- NULL
  function(){
    if(is.null(global_multi_handle)){
      global_multi_handle <<- new_pool()
    }
    stopifnot(inherits(global_multi_handle, "curl_multi"))
    return(global_multi_handle)
  }
})
R/multi.R:180

multi_add untypeable

unbound variable (line 89)
unbound: multi_default — one of the package’s own names, itself untyped
error detail
name: multi_default
timing: 0.147 s
source
multi_add <- function(handle, done = NULL, fail = NULL, data = NULL, pool = NULL){
  if(is.null(pool))
    pool <- multi_default()
  if(inherits(data, "connection")){
    con <- data
    if(isOpen(con) && identical(summary(con)$text, "text")){
      data <- function(x, finalize = FALSE){
        cat(rawToChar(x), file = con)
        flush(con)
      }
    } else {
      was_open <- isOpen(con)
      data <- function(x, finalize = FALSE){
        if(!isOpen(con))
          open(con, 'wb')
        writeBin(x, con = con)
        if(isTRUE(finalize && !was_open)){
          close(con)
        } else {
          flush(con)
        }
      }
    }
  } else if(is_string(data)){
    data <- file_writer(path = data)
  }
  stopifnot(inherits(handle, "curl_handle"))
  stopifnot(inherits(pool, "curl_multi"))
  stopifnot(is.null(done) || is.function(done))
  stopifnot(is.null(fail) || is.function(fail))
  stopifnot(is.null(data) || is.function(data))
  .Call(R_multi_add, handle, done, fail, data, pool)
}
R/multi.R:87

multi_run untypeable

unbound variable (line 130)
unbound: multi_default — one of the package’s own names, itself untyped
error detail
name: multi_default
timing: 0.031 s
source
multi_run <- function(timeout = Inf, poll = FALSE, pool = NULL){
  if(is.null(pool))
    pool <- multi_default()
  stopifnot(is.numeric(timeout))
  stopifnot(inherits(pool, "curl_multi"))
  .Call(R_multi_run, pool, timeout, as.integer(poll))
}
R/multi.R:128

multi_list untypeable

unbound variable (line 159)
unbound: multi_default — one of the package’s own names, itself untyped
error detail
name: multi_default
timing: 0.012 s
source
multi_list <- function(pool = NULL){
  if(is.null(pool))
    pool <- multi_default()
  stopifnot(inherits(pool, "curl_multi"))
  as.list(.Call(R_multi_list, pool))
}
R/multi.R:157

multi_cancel typed empty return

((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)<>
timing: 0.023 s
source
multi_cancel <- function(handle){
  stopifnot(inherits(handle, "curl_handle"))
  .Call(R_multi_cancel, handle)
}
R/multi.R:167

print.curl_multi untypeabletyped

unbound variable (line 193)
unbound: multi_list — one of the package’s own names, itself untyped
error detail
name: multi_list
gradual mode: typed
((x: any, ...: any) -> null)<>
timing: 0.004 s
source
print.curl_multi <- function(x, ...){
  len <- length(multi_list(x))
  cat(sprintf("<curl multi-pool> (%d pending requests)\n", len))
}
R/multi.R:192

multi_fdset untypeable

unbound variable (line 203)
unbound: multi_default — one of the package’s own names, itself untyped
error detail
name: multi_default
timing: 0.011 s
source
multi_fdset <- function(pool = NULL){
  if(is.null(pool))
    pool <- multi_default()
  # line below duplicates checks made by C code, but may need to be reinstated if that ever changes
  # stopifnot(inherits(pool, c("curl_multi", "curl")))
  .Call(R_multi_fdset, pool)
}
R/multi.R:201
R/fetch.R

handle_data typed empty return

((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)<>
timing: 0.033 s
source
handle_data <- function(handle){
  stopifnot(inherits(handle, "curl_handle"))
  out <- .Call(R_get_handle_response, handle)
  out$content = NULL
  out
}
R/fetch.R:136

curl_fetch_memory untypeabletyped

unbound variable (line 74)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
gradual mode: typed
((url: any, handle: (p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null)?) -> any)<>
timing: 0.006 s
source
curl_fetch_memory <- function(url, handle = new_handle()){
  nonblocking <- isTRUE(getOption("curl_interrupt", TRUE))
  output <- .Call(R_curl_fetch_memory, enc2utf8(url), handle, nonblocking)
  res <- handle_data(handle)
  res$content <- output
  res
}
R/fetch.R:74

curl_fetch_disk untypeabletyped

unbound variable (line 86)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
gradual mode: typed
((url: any, path: vec, handle: (p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null)?) -> any)<>
timing: 0.010 s
source
curl_fetch_disk <- function(url, path, handle = new_handle()){
  nonblocking <- isTRUE(getOption("curl_interrupt", TRUE))
  path <- enc2native(normalizePath(path, mustWork = FALSE))
  output <- .Call(R_curl_fetch_disk, enc2utf8(url), handle, path, "wb", nonblocking)
  res <- handle_data(handle)
  res$content <- output
  res
}
R/fetch.R:86

curl_fetch_stream untypeabletyped

unbound variable (line 100)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
gradual mode: typed
((url: any, fun: arrow, handle: (p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null)?) -> any)<>
timing: 0.009 s
source
curl_fetch_stream <- function(url, fun, handle = new_handle()){
  # Blocking = TRUE and partial = TRUE to prevent busy-waiting
  con <- curl_connection(url, mode = "", handle = handle, partial = TRUE)

  # 'f' means: do not error for status code
  open(con, "rbf")
  on.exit(close(con))
  while(isIncomplete(con)){
    buf <- readBin(con, raw(), 32768L)
    if(length(buf))
      fun(buf)
  }
  handle_data(handle)
}
R/fetch.R:100

curl_fetch_multi untypeabletyped

unbound variable (line 120)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
gradual mode: typed
((url: any, done: any?, fail: any?, pool: any?, data: any?, handle: any?) -> any)<>
timing: 0.050 s
source
curl_fetch_multi <- function(url, done = NULL, fail = NULL, pool = NULL,
                             data = NULL, handle = new_handle()){
  handle_setopt(handle, url = enc2utf8(url))
  multi_add(handle = handle, done = done, fail = fail, data = data, pool = pool)
  invisible(handle)
}
R/fetch.R:119

curl_fetch_echo untypeabletyped

unbound variable (line 128)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
gradual mode: typed
((url: any, handle: any?) -> any)<>
timing: 0.004 s
source
curl_fetch_echo <- function(url, handle = new_handle()){
  handle_setopt(handle, url = enc2utf8(url))
  curl_echo(handle)
}
R/fetch.R:128
R/options.R

make_option_type_table untypeable

untypeable application of base::$ (line 40)
error detail
argument: @({ (CHR | INT) | null }, "name"<>)
failing call: base::$(list(), "name")
timing: 0.085 s
source
make_option_type_table <- local({
  cache <- NULL
  function(){
    if(is.null(cache)){
      out <- .Call(R_option_types)
      if(!length(out)) return(out)
      out$name <- tolower(out$name)
      out$type <- factor(out$type, levels = 0:8, labels = c("long", "values", "off_t",
        "object", "string", "slist", "cbptr", "blob", "function"))
      cache <<- structure(out, class = 'data.frame', row.names = seq_along(out$name))
    }
    return(cache)
  }
})
R/options.R:34

curl_options untypeabletyped

unbound variable (line 19)
unbound: make_option_type_table — one of the package’s own names, itself untyped
error detail
name: make_option_type_table
gradual mode: typed
((filter: any?) -> any)<>
timing: 0.005 s
source
curl_options <- function(filter = ""){
  option_type_table <- make_option_type_table()
  opts <- structure(option_type_table$value, names = option_type_table$name)
  m <- grep(filter, names(opts), ignore.case = TRUE)
  opts[m]
}
R/options.R:18

curl_options_table untypeabletyped

unbound variable (line 28)
unbound: make_option_type_table — one of the package’s own names, itself untyped
error detail
name: make_option_type_table
gradual mode: typed
((filter: any?) -> any)<>
timing: 0.004 s
source
curl_options_table <- function(filter = ""){
  option_type_table <- make_option_type_table()
  m <- grep(filter, option_type_table$name, ignore.case = TRUE)
  option_type_table[m,]
}
R/options.R:27
R/handle.R

fix_options untypeabletyped

unbound variable (line 228)
unbound: curl_options — one of the package’s own names, itself untyped
error detail
name: curl_options
gradual mode: typed
∀'a,`a. ((opt_names: "progressfunction"<`a>) | (opt_names: "xferinfofunction"<`a>) | (opt_names: ((CHR | v('a)) & ~"progressfunction" & ~"xferinfofunction")<`a>) -> (CHR | v('a))<`a>)<>
timing: 0.009 s
source
fix_options <- function(opt_names){
  # Recent libcurl should use xferinfo instead of progress
  has_xferinfo <- length(curl_options("xferinfofunction"))
  if(has_xferinfo){
    opt_names[opt_names == "progressfunction"] <- "xferinfofunction"
    return(opt_names)
  } else {
    opt_names[opt_names == "xferinfofunction"] <- "progressfunction"
    return(opt_names)
  }
}
R/handle.R:226

handle_setopt untypeable

untypeable application of base::tolower (line 74)
error detail
argument: @(CHR<> | null)
failing call: base::tolower(NULL)
timing: 0.077 s
source
handle_setopt <- function(handle, ..., .list = list()){
  stopifnot(inherits(handle, "curl_handle"))
  values <- c(list(...), .list)
  opt_names <- fix_options(tolower(names(values)))
  keys <- as.integer(curl_options()[opt_names])
  na_keys <- is.na(keys)
  if(any(na_keys)){
    bad_opts <- opt_names[na_keys]
    stop("Unknown option", ifelse(length(bad_opts) > 1, "s: ", ": "),
      paste(bad_opts, collapse=", "))
  }
  stopifnot(length(keys) == length(values))
  .Call(R_handle_setopt, handle, keys, values)
  invisible(handle)
}
R/handle.R:71

new_handle untypeabletyped

unbound variable (line 60)
unbound: R_new_handle — a native symbol tyr could not bind
error detail
name: R_new_handle
gradual mode: typed
((...: any) -> any)<>
timing: 0.002 s
source
new_handle <- function(...){
  h <- .Call(R_new_handle)
  handle_setopt(h, ...)
  h
}
R/handle.R:59

format_request_headers untypeabletyped

unbound variable (line 101)
unbound: ifelse — a name the prelude does not declare
error detail
name: ifelse
gradual mode: typed
((x: { Expect: any?, vec }) -> CHR<>)<>
timing: 0.120 s
source
format_request_headers <- function(x){
  x$Expect = ""
  names <- names(x)
  values <- as.character(unlist(x))
  postfix <- ifelse(grepl("^\\s+$", values), ";", paste(":", values))
  paste0(names, postfix)
}
R/handle.R:97

handle_setheaders untypeabletyped

unbound variable (line 94)
unbound: format_request_headers — one of the package’s own names, itself untyped
error detail
name: format_request_headers
gradual mode: typed
((handle: any, ...: vec, .list: ({ vec } | null)?) -> any)<>
timing: 0.091 s
source
handle_setheaders <- function(handle, ..., .list = list()){
  x <- c(list(...), .list)
  if(!all(vapply(x, is.character, logical(1)))){
    stop("All headers must be strings.")
  }
  handle_setopt(handle, httpheader = format_request_headers(x))
}
R/handle.R:89

handle_getheaders typed fuzz ok

(((handle: any_sexp) -> CHR)&((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty))<>
timing: 0.037 s
fuzzing: 8 inside (8 ok) · 7 outside (7 rejected)
source
handle_getheaders <- function(handle){
  stopifnot(inherits(handle, "curl_handle"))
  .Call(R_handle_getheaders, handle)
}
R/handle.R:107

handle_getcustom typed fuzz ok

(((handle: any_sexp) -> CHR)&((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty))<>
timing: 0.038 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
source
handle_getcustom <- function(handle){
  stopifnot(inherits(handle, "curl_handle"))
  .Call(R_handle_getcustom, handle)
}
R/handle.R:113

handle_setform typed fuzz ok

∀'a. (((handle: 'a & (p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null), ...: absent, .list: ({ } | null)?) -> empty)&((handle: 'a & any_sexp, ...: absent, .list: ({ } | null)?) -> 'a))<>
gradual mode: typed
∀'a. (((handle: 'a & (p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null), ...: ~CHR, .list: ({ ~CHR } | null)?) -> empty)&((handle: 'a & any_sexp, ...: ~CHR, .list: ({ ~CHR } | null)?) -> 'a))<>
timing: 2.26 s
fuzzing: 19 inside (19 ok) · 8 outside (8 rejected)
type drawn from: (((handle: 'handle & (p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null), ...: absent, .list: ({ } | null)?) -> empty) & ((handle: 'handle & any_sexp, ...: absent, .list: ({ } | null)?) -> 'handle))<>
source
handle_setform <- function(handle, ..., .list = list()){
  stopifnot(inherits(handle, "curl_handle"))
  form <- c(list(...), .list)
  for(i in seq_along(form)){
    val <- form[[i]];
    if(is.character(val)){
      form[[i]] <- charToRaw(enc2utf8(val))
    } else if(!is.raw(val) && !inherits(val, "form_file") && !inherits(val, "form_data")){
      stop("Unsupported value type for form field '", names(form[i]), "'.")
    }
  }
  .Call(R_handle_setform, handle, form)
  invisible(handle)
}
R/handle.R:121

handle_reset typed empty return

((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)<>
timing: 0.024 s
source
handle_reset <- function(handle){
  stopifnot(inherits(handle, "curl_handle"))
  .Call(R_handle_reset, handle)
  invisible(handle)
}
R/handle.R:139

handle_cookies typed empty return

((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)<>
gradual mode: typed
(((handle: any_sexp) -> any)&((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty))<>
timing: 0.053 s
source
handle_cookies <- function(handle){
  stopifnot(inherits(handle, "curl_handle"))
  cookies <- .Call(R_get_handle_cookies, handle)
  df <- if(length(cookies)){
    values <- lapply(strsplit(cookies, split="\t"), `[`, 1:7)
    as.data.frame(do.call(rbind, values), stringsAsFactors = FALSE)
  } else {
    as.data.frame(matrix(ncol=7, nrow=0))
  }
  names(df) <- c("domain", "flag", "path", "secure", "expiration", "name", "value")
  df$flag <- as.logical(df$flag)
  df$secure <- as.logical(df$secure)
  expires <- as.numeric(df$expiration)
  expires[expires==0] <- Inf
  class(expires) = c("POSIXct", "POSIXt");
  df$expiration <- expires
  df

}
R/handle.R:169

handle_speed typed fuzz ok

(((handle: any_sexp) -> DBL)&((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty))<>
timing: 0.031 s
fuzzing: 7 inside (7 ok) · 8 outside (8 rejected)
source
handle_speed <- function(handle){
  .Call(R_get_handle_speed, handle)
}
R/handle.R:192

handle_clength typed empty return

((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty)<>
timing: 0.016 s
source
handle_clength <- function(handle){
  .Call(R_get_handle_clength, handle)
}
R/handle.R:197

handle_received typed fuzz ok

(((handle: any_sexp) -> DBL1)&((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty))<>
timing: 0.032 s
fuzzing: 6 inside (6 ok) · 7 outside (7 rejected)
source
handle_received <- function(handle){
  .Call(R_get_handle_received, handle)
}
R/handle.R:202

handle_mtime typed fuzz ok

(((handle: any_sexp) -> posixct1)&((handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null) -> empty))<>
timing: 0.030 s
fuzzing: 8 inside (8 ok) · 4 outside (4 rejected)
source
handle_mtime <- function(handle){
  .Call(R_get_handle_mtime, handle)
}
R/handle.R:207

print.curl_handle untypeable

untypeable application of base::$ (line 214)
error detail
argument: empty
timing: 0.031 s
source
print.curl_handle <- function(x, ...){
  stopifnot(inherits(x, "curl_handle"))
  url <- handle_data(x)$url
  if(!nchar(url)) url <- "empty"
  cat(sprintf("<curl handle> (%s)\n", url))
}
R/handle.R:212

total_handles typed fuzz ok

(() -> INT1)<>
timing: 0.006 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
total_handles <- function(){
  .Call(R_total_handles)
}
R/handle.R:221
R/curl.R

curl_connection typed empty return any: mode

((url: any_sexp, mode: any, handle: p(CHR) | (externalptr(empty)<curl_handle, ...> | externalptr<~curl_handle, ...> | (~externalptr)<...>) | sym | null, partial: any_sexp?) | (url: p(CHR) | (~CHR)<...> | sym | null, mode: any, handle: any_sexp, partial: any_sexp?) -> empty)<>
timing: 0.137 s
source
curl_connection <- function(url, mode, handle, partial = FALSE){
  con <- .Call(R_curl_connection, url, handle, partial)
  if(!identical(mode, "")){
    withCallingHandlers(open(con, open = mode), error = function(err) {
      close(con)
    })
  }
  return(con)
}
R/curl.R:73

curl untypeable

unbound variable (line 67)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
timing: 0.012 s
source
curl <- function(url = "https://hb.cran.dev/get", open = "", handle = new_handle()){
  curl_connection(url, open, handle)
}
R/curl.R:67
R/download.R

curl_download untypeabletyped

unbound variable (line 39)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
gradual mode: typed
((url: any, destfile: vec, quiet: any?, mode: any?, handle: any?) -> any)<>
timing: 0.033 s
source
curl_download <- function(url, destfile, quiet = TRUE, mode = "wb", handle = new_handle()){
  destfile <- enc2native(normalizePath(destfile, mustWork = FALSE))
  nonblocking <- isTRUE(getOption("curl_interrupt", TRUE))
  tmp <- enc2native(paste0(destfile, ".curltmp"))
  on.exit(unlink(tmp))
  .Call(R_download_curl, url, tmp, quiet, mode, handle, nonblocking)
  file.rename(tmp, destfile)
  invisible(destfile)
}
R/download.R:39
R/email.R

send_mail skipped

error detail
Invalid_argument("Variable ..._5 is already bound.")
timing: 0.094 s
source
send_mail <- function(mail_from, mail_rcpt, message, smtp_server = 'smtp://localhost',
                      use_ssl = c("try", "no", "force"), verbose = TRUE, ...){
  if(!grepl('://', smtp_server)) {
    # no protocol was provided
    smtp_server <- if (grepl(":465$", smtp_server)) {
      paste0('smtps://', smtp_server)
    } else {
      paste0('smtp://', smtp_server)
    }
  }
  if (!grepl('^smtps?://', smtp_server)) {
    stop('smtp_server invalid; only smtp:// and smtps:// URLs are supported')
  }

  # Values from: curl_symbols('CURLUSESSL')
  if(is.character(use_ssl)){
    use_ssl <- switch(match.arg(use_ssl), no = 0, try = 1, force = 2)
  }

  if(is.character(message))
    message <- charToRaw(paste(message, collapse = '\r\n'))
  con <- if(is.raw(message)){
    rawConnection(message)
  } else if(inherits(message, "connection")){
    if(!isOpen(message))
      open(message, 'rb')
    message
  } else {
    stop("Body must be a string, raw vector, or connection object")
  }
  on.exit(close(con))
  total_bytes <- 0
  h <- new_handle(upload = TRUE, readfunction = function(nbytes, ...) {
    buf <- readBin(con, raw(), nbytes)
    total_bytes <<- total_bytes + length(buf)
    if(verbose){
      if(length(buf)){
        cat(sprintf("\rUploaded %.0f bytes...", total_bytes), file = stderr())
      } else {
        cat(sprintf("\rUploaded %.0f bytes... all done!\n", total_bytes), file = stderr())
      }
    }
    return(buf)
  }, mail_from = mail_from, mail_rcpt = mail_rcpt, use_ssl = use_ssl,
      verbose = verbose, ...)
  curl_fetch_memory(smtp_server, handle = h)
}
R/email.R:79
R/escape.R

curl_escape untypeabletyped

unbound variable (line 19)
unbound: enc2utf8 — a name the prelude does not declare
error detail
name: enc2utf8
gradual mode: typed
((url: vec | null) -> any)<>
timing: 0.014 s
source
curl_escape <- function(url){
  .Call(R_curl_escape, enc2utf8(as.character(url)), FALSE);
}
R/escape.R:18

curl_unescape untypeabletyped

unbound variable (line 25)
unbound: enc2utf8 — a name the prelude does not declare
error detail
name: enc2utf8
gradual mode: typed
((url: vec | null) -> any)<>
timing: 0.015 s
source
curl_unescape <- function(url){
  .Call(R_curl_escape, enc2utf8(as.character(url)), TRUE);
}
R/escape.R:24
R/form.R

form_file untypeabletyped

unbound variable (line 14)
unbound: enc2native — a name the prelude does not declare
error detail
name: enc2native
gradual mode: typed
((path: vec<~@"[", ...>, type: null?, name: any?) -> any)<>
timing: 0.128 s
source
form_file <- function(path, type = NULL, name = NULL) {
  path <- enc2native(normalizePath(path[1], mustWork = TRUE))
  if(!is.null(type)){
    stopifnot(is.character(type))
  }
  structure(list(path = path, type = type, name = name), class = "form_file")
}
R/form.R:13

form_data untypeabletyped

unbound variable (line 28)
unbound: is.raw — a name the prelude does not declare
error detail
name: is.raw
gradual mode: typed
∀'a. (((value: null | 'a \ CHR, type: 'a?) -> { null | 'a })&((value: ~CHR, type: 'a?) -> any))<>
timing: 0.039 s
source
form_data <- function(value, type = NULL){
  if(is.character(value))
    value <- charToRaw(paste(enc2utf8(value), collapse = "\n"))
  if(!is.raw(value))
    stop("Argument 'value' must be string or raw vector")
  structure(list(value = value, type = type), class = "form_data")
}
R/form.R:25

print.form_file untypeabletyped

unbound variable (line 35)
unbound: basename — a name the prelude does not declare
error detail
name: basename
gradual mode: typed
((x: { type: null, path: any, name: null, any }, ...: any) | (x: { type: null, path: any, name: ~null, any }, ...: any) | (x: { type: ~null, path: any, name: null, any }, ...: any) | (x: { type: ~null, path: any, name: ~null, any }, ...: any) -> null)<>
timing: 0.053 s
source
print.form_file <- function(x, ...){
  txt <- paste("Form file:", basename(x$path))
  if(!is.null(x$name)) {
    txt <- sprintf("%s => %s", txt, x$name)
  }
  if(!is.null(x$type)){
    txt <- sprintf("%s (type: %s)", txt, x$type)
  }
  cat(txt, "\n")
}
R/form.R:34

print.form_data typed accepts outside

((x: { type: null, value: any, any }, ...: any) | (x: { type: ~null, value: any, any }, ...: any) -> null)<>
timing: 0.212 s
fuzzing: 8 inside (6 ok, 2 error type) · 8 outside (5 rejected, 3 accepted)

Accepted outside the domain x: 3

parameterchangecallreturned
xunwrapprint.form_data(NULL, "fuzz_dot1" = NULL)null
xunwrapprint.form_data(NULL, new.env(), new.env())null
xunwrapprint.form_data("x" = NULL, "fuzz_dot1" = quote(f(x)))null

Other calls inside the domain

callverdicterror
print.form_data("x" = list("type" = as.name("x"), "value" = local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }), as.name("x"), list(quote(f(x)), function(...) quote(f(x)))), "fuzz_dot1" = list(), "fuzz_dot2" = as.name("x"))error_typebase::sprintf: invalid type of argument[2]: 'symbol'
print.form_data(list("type" = as.name("x"), "value" = c(complex(real = 1, imaginary = -2), complex(real = 1, imaginary = -2)), -2147483647L), "fuzz_dot1" = as.name("x"))error_typebase::sprintf: invalid type of argument[2]: 'symbol'
source
print.form_data <- function(x, ...){
  txt <- paste(sprintf("Form data of length %.0f", length(x$value)))
  if(!is.null(x$type)){
    txt <- sprintf("%s (type: %s)", txt, x$type)
  }
  cat(txt, "\n")
}
R/form.R:46
R/parse_headers.R

parse_headers untypeable

unbound variable (line 26)
unbound: is.raw — a name the prelude does not declare
error detail
name: is.raw
timing: 0.054 s
source
parse_headers <- function(txt, multiple = FALSE){
  if(!length(txt))
    return(NULL)
  if(is.raw(txt)){
    txt <- rawToChar(txt)
  }
  stopifnot(is.character(txt))
  if(length(txt) > 1){
    txt <- paste(txt, collapse = "\n")
  }

  # Allow for either "\r\n" line breaks or just "\r" or "\n" (i.e. windows servers)
  sets <- strsplit(txt, "\\r\\n\\r\\n|\\n\\n|\\r\\r")[[1]]
  headers <- strsplit(sets, "\\r\\n|\\n|\\r")
  if(multiple){
    headers
  } else {
    headers[[length(headers)]]
  }
}
R/parse_headers.R:23

parse_headers_list untypeabletyped

unbound variable (line 47)
unbound: parse_headers — one of the package’s own names, itself untyped
error detail
name: parse_headers
gradual mode: typed
((txt: any) -> any)<>
timing: 0.007 s
source
parse_headers_list <- function(txt){
  headers <- grep(":", parse_headers(txt), fixed = TRUE, value = TRUE)
  out <- lapply(headers, split_string, ":")
  names <- tolower(vapply(out, `[[`, character(1), 1)) #names are case insensitive
  values <- lapply(lapply(out, `[[`, 2), trimws)
  names(values) <- names
  values
}
R/parse_headers.R:46
R/parser.R

toupper_url_encoding skipped

error detail
Failure("Unsupported positional argument after a named one.")
timing: 0.000 s
source
toupper_url_encoding <- function(x){
  gsub('(%..)', replacement = '\\U\\1', x, perl = TRUE)
}
R/parser.R:125

normalize_field typed any: decode accepts outside

∀'a. ((x: 'a & null, decode: any?) -> 'a)<>
gradual mode: typed
∀'a. (((x: 'a & null, decode: any?) -> 'a)&((x: 'a & vec, decode: any?) -> any))<>
timing: 0.050 s
fuzzing: 12 inside (12 ok) · 8 outside (4 rejected, 4 accepted)
type drawn from: ((x: 'x & null, decode: any?) -> 'x)<>

Accepted outside the domain x: 4

parameterchangecallreturned
xkind:langnormalize_field(quote(f(x)), "decode" = list())(CHR & ~vec1)<> with { }
xkind:langnormalize_field(quote(f(x)), "decode" = local({ p <- unserialize(serialize(new("externalptr"), NULL)); attributes(p) <- NULL; p }))(CHR & ~vec1)<> with { }
xwrapnormalize_field(list(NULL), list(new.env(), as.name("x")))"NULL"<> with { }
xwrapnormalize_field(list(NULL))"NULL"<> with { }
source
normalize_field <- function(x, decode = TRUE){
  if(is.null(x)){
    return(x)
  }
  if(isTRUE(decode)){
    curl_unescape(x)
  } else {
    toupper_url_encoding(x)
  }
}
R/parser.R:129

parse_query_urlencoded untypeable

unbound variable (line 143)
unbound: chartr — a name the prelude does not declare
error detail
name: chartr
timing: 0.043 s
source
parse_query_urlencoded <- function(query){
  if(!length(query)) return(character())
  query <- chartr('+',' ', query)
  argstr <- strsplit(query, "&", fixed = TRUE)[[1]]
  args <- lapply(argstr, function(x){
    c(curl_unescape(split_string(x, "=")), "")
  })
  values <- vapply(args, `[`, character(1), 2)
  names(values) <- vapply(args, `[`, character(1), 1)
  return(values)
}
R/parser.R:141

curl_parse_url untypeable

untypeable assignment (line 68)
error detail
variable: url
expected: (CHR & vec1) & 'url
given: CHR<>
expression may be: NA_character_
timing: 0.891 s
source
curl_parse_url <- function(url, baseurl = NULL, decode = TRUE, params = TRUE,
                           default_scheme = FALSE){
  stopifnot(is.character(url))
  stopifnot(length(url) == 1)
  baseurl <- as.character(baseurl)

  # Workaround for #366
  if(length(baseurl) && substr(url, 1, 1) == '#'){
    url <- sub('(#.*)?$', url, baseurl)
  }

  result <- .Call(R_parse_url, url, baseurl, default_scheme)
  result$url <- toupper_url_encoding(result$url)


  # Need to parse query before url-decoding
  if(params){
    tryCatch({
      result$params <- parse_query_urlencoded(result$query)
      result$query <- NULL
    }, error = message)
  }

  result$path <- normalize_field(result$path, decode)
  result$query <- normalize_field(result$query, decode)
  result$fragment <- normalize_field(result$fragment, decode)
  result$user <- normalize_field(result$user, decode)
  result$password <- normalize_field(result$password, decode)
  result
}
R/parser.R:61

build_query_urlencoded typed empty return

((params: ~CHR) -> empty)<>
timing: 0.063 s
source
build_query_urlencoded <- function(params){
  if(!is.character(params) || length(names(params)) != length(params)){
    stop("params must be named character vector")
  }
  nms <- curl_escape(names(params))
  values <- gsub("%20", "+", curl_escape(params), fixed = TRUE)
  paste(nms, values, collapse = '&', sep = '=')
}
R/parser.R:153

curl_modify_url untypeable

unbound variable (line 115)
unbound: curl_modify_url — one of the package’s own names, itself untyped
error detail
name: curl_modify_url
timing: 0.231 s
source
curl_modify_url <- function(url = NULL, scheme = NULL, host = NULL, port = NULL, path = NULL,
                           query = NULL, fragment = NULL, user = NULL, password = NULL, params = NULL){
  if(is.list(url)){
    url <- do.call(curl_modify_url, url)
  }
  if(!is.null(params)){
    query <- I(build_query_urlencoded(params))
  }
  port <- as.character(port)
  out <- .Call(R_modify_url, url, scheme, host, port, path, query, fragment, user, password)
  toupper_url_encoding(out)
}
R/parser.R:112
R/multi_download.R

guess_handle_filename untypeable

untypeable application of base::$ (line 216)
error detail
argument: empty
timing: 0.089 s
source
guess_handle_filename <- function(handle){
  url <- handle_data(handle)$url
  destfile <- basename(curl_parse_url(url)$path)
  if(!length(destfile) || is.na(destfile) || !nchar(destfile))
    stop("Failed to guess filename for: ", url)
  destfile
}
R/multi_download.R:215

make_one_handle untypeable

untypeable application of base::$ (line 204)
error detail
argument: empty
timing: 0.032 s
source
make_one_handle <- function(url_or_handle){
  if(inherits(url_or_handle, 'curl_handle')){
    handle <- url_or_handle
    url <- handle_data(handle)$url
    if(is.na(url) || identical(url, ""))
      stop("Handle passed to multi_download() but has no URL set")
    return(handle)
  }
  if(is.character(url_or_handle)){
    return(new_handle(url = url_or_handle))
  }
  stop("Argument urls does not contain url or curl handle")
}
R/multi_download.R:201

print_progress untypeabletyped

unbound variable (line 227)
unbound: ifelse — a name the prelude does not declare
error detail
name: ifelse
gradual mode: typed
(((sucvec: any, total: dbl<~@"/", ...>, speed: dbl<~@"/", ...> | vec<@"/", ...>, expected: dbl, finalize: dbl?) -> any)&((sucvec: any, total: dbl<~@"/", ...>, speed: dbl<~@"/", ...> | vec<@"/", ...>, expected: dbl, finalize: ff?) -> null))<>
timing: 0.098 s
source
print_progress <- local({
  last <- 0
  function(sucvec, total, speed, expected, finalize = FALSE){
    throttle <- ifelse(interactive(), 0.1, 5)
    now <- unclass(Sys.time())
    if(isTRUE(finalize) || now - last > throttle){
      last <<- now
      done <- sum(!is.na(sucvec))
      pending <- sum(is.na(sucvec))
      pctstr <- if(!identical(expected, 0.0)){
        sprintf("(%s%%)", ifelse(is.na(expected), "??", as.character(round(100 * total/expected))))
      } else {""}
      speedstr <- if(!finalize){
        sprintf(" (%s/s)", format_size(speed))
      } else {""}
      downloaded <- format_size(total)
      print_stream('\rDownload status: %d done; %d in progress%s. Total size: %s %s...',
                   done, pending, speedstr, downloaded, pctstr)
    }
    if(finalize){
      cat(" done!             \n", file = stderr())
      flush(stderr())
    }
  }
})
R/multi_download.R:224

print_stream untypeable

untypeable application of base::sprintf (line 251)
error detail
argument: @(...: ('_ell, `_ell))
failing call: base::sprintf()
timing: 0.016 s
source
print_stream <- function(...){
  cat(sprintf(...), file = stderr())
}
R/multi_download.R:250

multi_download skipped

error detail
Failure("Invalid left value.")
timing: 0.000 s
source
multi_download <- function(urls, destfiles = NULL, resume = FALSE, progress = TRUE,
                           multi_timeout = Inf, multiplex = TRUE, ...){
  if(inherits(urls, 'curl_handle'))
    urls <- list(urls)
  if(!is.character(urls) && !is.list(urls))
    stop("Argument 'urls' must be a character vector or list of handles")
  handles <- lapply(urls, make_one_handle)
  if(is.null(destfiles)){
    destfiles <- vapply(handles, guess_handle_filename, character(1))
  }
  dupes <- setdiff(destfiles[duplicated(destfiles)], c("/dev/null", "NUL"))
  if(length(dupes)){
    stop("Duplicate destfiles: ", paste(dupes, collapse = ', '))
  }
  stopifnot(length(urls) == length(destfiles))
  destfiles <- normalizePath(destfiles, mustWork = FALSE)
  writers <- rep(list(NULL), length(urls))
  errors <- rep(NA_character_, length(urls))
  success <- rep(NA, length(urls))
  resumefrom <- rep(0, length(urls))
  dlspeed <- rep(0, length(urls))
  expected <- rep(NA, length(urls))
  pool <- new_pool(multiplex = multiplex)
  total <- 0
  lapply(seq_along(urls), function(i){
    dest <- destfiles[i]
    handle <- handles[[i]]
    handle_setopt(handle, ..., noprogress = TRUE)
    if(isTRUE(resume) && file.exists(dest)){
      startsize <- file.info(dest)$size
      handle_setopt(handle, resume_from_large = startsize)
      total <<- total + startsize
      resumefrom[i] <<- startsize
    }
    writer <- file_writer(dest, append = resume)
    multi_add(handle, pool = pool, data = function(buf, final){
      total <<- total + length(buf)
      writer(buf, final)
      if(isTRUE(progress)){
        if(is.na(expected[i])){
          expected[i] <<- handle_clength(handle) + resumefrom[i]
        }
        dlspeed[i] <<- ifelse(final, 0, handle_speed(handle)[1])
        print_progress(success, total, sum(dlspeed), sum(expected))
      }
    }, done = function(req){
      expected[i] <<- handle_received(handle) + resumefrom[i]
      success[i] <<- TRUE
      dlspeed[i] <<- 0
      if(expected[i] == 0 && !file.exists(dest)){
        file.create(dest) #create empty file
      }
      mtime <- handle_mtime(handle)
      if(!is.na(mtime)){
        Sys.setFileTime(dest, handle_mtime(handle))
      }
    }, fail = function(err){
      expected[i] <<- handle_received(handle) + resumefrom[i]
      success[i] <<- FALSE
      errors[i] <<- err
      dlspeed[i] <<- 0
    })
    writers[[i]] <<- writer
    if(isTRUE(progress) && (i %% 100 == 0)){
      print_stream("\rPreparing request %d of %d...", i, length(urls))
    }
  })
  on.exit(lapply(writers, function(writer){
    # fallback to close writer in case the download got interrupted
    writer(raw(0), close = TRUE)
  }))
  tryCatch({
    multi_run(timeout = multi_timeout, pool = pool)
    if(isTRUE(progress)){
      print_progress(success, total, sum(dlspeed), sum(expected), TRUE)
    }
  }, interrupt = function(e){
    message("download interrupted")
  })
  out <- lapply(handles, handle_data)
  results <- data.frame(
    success = success,
    status_code = vapply(out, function(x){x$status_code}, numeric(1)),
    resumefrom = resumefrom,
    url = vapply(out, function(x){x$url}, character(1)),
    destfile = normalizePath(destfiles, mustWork = FALSE),
    error = errors,
    type = vapply(out, function(x){x$type}, character(1)),
    modified = structure(vapply(out, function(x){x$modified}, numeric(1)), class = c("POSIXct", "POSIXt")),
    time = vapply(out, function(x){unname(x$times['total'])}, numeric(1)),
    stringsAsFactors = FALSE
  )
  results$headers <- lapply(out, function(x){parse_headers(x$headers)})
  class(results) <- c("tbl_df", "tbl", "data.frame")
  results
}
R/multi_download.R:104
R/proxy.R

ie_proxy_info typed fuzz ok

(() -> null)<>
timing: 0.003 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
ie_proxy_info <- function(){
  .Call(R_proxy_info)
}
R/proxy.R:16

ie_get_proxy_for_url untypeable

untypeable application of base::$ (line 27)
error detail
argument: @(null, "Proxy"<>)
failing call: base::$(NULL, "Proxy")
timing: 0.130 s
source
ie_get_proxy_for_url <- function(target_url = "http://www.google.com"){
  stopifnot(is.character(target_url))
  info <- ie_proxy_info()
  if(length(info$Proxy)){
    if(isTRUE(grepl("<local>", info$ProxyBypass, fixed = TRUE)) &&
       isTRUE(grepl("(://)[^./]+/", paste0(target_url, "/")))){
      return(NULL)
    } else {
      return(info$Proxy)
    }
  }
  if(isTRUE(info$AutoDetect) || length(info$AutoConfigUrl)){
    out <- .Call(R_get_proxy_for_url, target_url, info$AutoDetect, info$AutoConfigUrl)
    if(isTRUE(out$HasProxy)){
      return(out$Proxy)
    }
  }
  return(NULL);
}
R/proxy.R:24

get_windows_build typed fuzz ok

(() -> null)<>
timing: 0.004 s
fuzzing: 1 inside (1 ok) · 1 outside (1 rejected)
source
get_windows_build <- function(){
  .Call(R_windows_build)
}
R/proxy.R:45
R/nslookup.R

nslookup untypeabletyped

unbound variable (line 25)
unbound: enc2utf8 — a name the prelude does not declare
error detail
name: enc2utf8
gradual mode: typed
((host: CHR, ipv4_only: (vec | null)?, multiple: any?, error: any?) | (host: ~CHR, ipv4_only: (vec | null)?, multiple: any?, error: any?) -> any)<>
timing: 0.110 s
source
nslookup <- function(host, ipv4_only = FALSE, multiple = FALSE, error = TRUE){
  stopifnot(is.character(host))
  host <- enc2utf8(host)
  if(grepl("://", host, fixed = TRUE))
    stop("This looks like a URL, not a hostname")
  out <- .Call(R_nslookup, host[1], as.logical(ipv4_only))
  if(isTRUE(error) && is.null(out))
    stop("Unable to resolve host: ", host)
  if(isTRUE(multiple))
    return(unique(out))
  utils::head(out, 1)
}
R/nslookup.R:23

has_internet untypeable

unbound variable (line 47)
unbound: nslookup — one of the package’s own names, itself untyped
error detail
name: nslookup
timing: 0.073 s
source
has_internet <- local({
  proxy_vars_previous <- NULL
  has_internet_via_proxy <- NULL
  function(){
    # do not wait for nslookup() if we know proxy works
    if(isTRUE(has_internet_via_proxy))
      return(TRUE)

    # Method 1: try DNS lookup. May resolve to 8.8.8.8 or 8.8.4.4
    ip_addr <- nslookup('dns.google.com', multiple = TRUE, error = FALSE, ipv4_only = TRUE)
    if(any(c("8.8.4.4", "8.8.8.8") %in% ip_addr))
      return(TRUE)

    ip_addr <- nslookup('time.cloudflare.com', multiple = TRUE, error = FALSE, ipv4_only = TRUE)
    if(any(c("162.159.200.1", "162.159.200.123") %in% ip_addr))
      return(TRUE)

    # Method 2: look for a proxy server
    proxy_vars <- Sys.getenv(c('ALL_PROXY', 'https_proxy', 'HTTPS_PROXY', 'HTTPS_proxy'), NA)

    # If variables are unchanged, use the cached result
    if(length(has_internet_via_proxy) && identical(proxy_vars, proxy_vars_previous)) {
      return(has_internet_via_proxy)
    } else {
      proxy_vars_previous <<- proxy_vars
    }

    # Try via a proxy (mostly for Windows)
    test_url <- 'http://captive.apple.com/hotspot-detect.html'
    ie_proxy <- ie_get_proxy_for_url(test_url)

    handle <- if(any(!is.na(proxy_vars))){
      cat("Testing for internet connectivity via https_proxy... ", file = stderr())
      new_handle(CONNECTTIMEOUT = 5)
    } else if(length(ie_proxy)){
      cat("Testing for internet connectivity via IE proxy... ", file = stderr())
      new_handle(CONNECTTIMEOUT = 5, proxy = ie_proxy)
    } else {
      # No proxy server found. Do not cache in case user sets one later.
      return(FALSE)
    }
    req <- try(curl_fetch_memory(url = test_url, handle = handle), silent = TRUE)
    has_internet_via_proxy <<- is.list(req) && identical(req$status_code, 200L) &&
      grepl("Success", rawToChar(req$content))
    cat(ifelse(has_internet_via_proxy, "success!\n", "failed.\n"), file = stderr())
    return(has_internet_via_proxy)
  }
})
R/nslookup.R:38
R/onload.R

.onAttach untypeable

untypeable application of base::$ (line 3)
error detail
argument: @({ (CHR | ^LGL1) | null }, "ssl_version"<>)
failing call: base::$(list(), "ssl_version")
timing: 0.094 s
source
.onAttach <- function(libname, pkgname){
  version <- curl_version()
  ssl <- sub("\\(.*\\)\\W*", "", version$ssl_version)
  msg <- paste("Using libcurl", version$version, "with", ssl)
  packageStartupMessage(msg)
  if(grepl("redhat", R.version$platform) && !('smtp' %in% version$protocols)){
    packageStartupMessage(c("Your system runs libcurl-minimal which does not support all protocols: ",
                          "See also https://github.com/jeroen/curl/issues/350"))
  }
  try({
    proxy <- Sys.getenv('ALL_PROXY')
    if(nchar(proxy)){
      proxy_info <- curl::curl_parse_url(proxy)
      packageStartupMessage(sprintf("Using proxy server %s://%s:%s",
        proxy_info$scheme, proxy_info$host, proxy_info$port))
    }
  }, silent = TRUE)
}
R/onload.R:1

set_emscripten_gateway untypeable

unbound variable (line 40)
unbound: new_handle — one of the package’s own names, itself untyped
error detail
name: new_handle
timing: 0.079 s
source
set_emscripten_gateway <- function(){
  proxy <- Sys.getenv('ALL_PROXY')

  # TODO: fix this unfortunate default envvar in webR?
  if(proxy == '' || proxy == "socks5h://localhost:8580"){
    try({
      # Note the websocket runs wss (port 443) but inside we mimic plain http
      # therefore for curl it looks like http:// but on 443. But it is actually
      # https because of the wss:// layer in emscripten.
      h <- new_handle(connecttimeout = 2, noproxy = '*')
      req <- curl_fetch_memory("http://get-ws-proxy.r-universe.dev:443", handle = h)
      wsproxy <- rawToChar(req$content)
      if(req$status == 200 && grepl('^socks5h://', wsproxy)) {
        Sys.setenv(ALL_PROXY = wsproxy)
      }
    }, silent = TRUE)
  }
}
R/onload.R:31

.onLoad untypeabletyped

unbound variable (line 21)
unbound: R.version — a name the prelude does not declare
error detail
name: R.version
gradual mode: typed
((libname: any, pkgname: any) -> any)<>
timing: 0.012 s
source
.onLoad <- function(libname, pkgname){
  if(grepl('emscripten', R.version[['platform']])){
    set_emscripten_gateway()
  }
}
R/onload.R:20
R/upload.R

curl_upload untypeable

unbound variable (line 28)
unbound: on.exit — a name the prelude does not declare
error detail
name: on.exit
timing: 0.448 s
source
curl_upload <- function(file, url, verbose = TRUE, reuse = TRUE, ...) {
  infilesize <- NA
  con <- if(is.character(file)){
    file <- normalizePath(file, mustWork = TRUE)
    infilesize <- file.info(file)$size
    base::file(file, open = 'rb')
  } else if(inherits(file, 'connection')){
    file
  } else {
    stop("Parameter 'file' must be a file path or connection object")
  }
  on.exit(close(con))
  total_bytes <- 0
  h <- new_handle(upload = TRUE, filetime = FALSE, readfunction = function(n) {
    buf <- readBin(con, raw(), n = n)
    total_bytes <<- total_bytes + length(buf)
    if(verbose){
      if(length(buf) == 0 || identical(total_bytes, infilesize)){
        cat(sprintf("\rUploaded %.0f bytes... all done!\n", total_bytes), file = stderr())
      } else {
        cat(sprintf("\rUploaded %.0f bytes...", total_bytes), file = stderr())
      }
    }
    return(buf)
  }, seekfunction = function(offset){
    seek(con, where = offset)
  }, forbid_reuse = !isTRUE(reuse), verbose = verbose, ...)
  if(!is.na(infilesize)){
    handle_setopt(h, infilesize_large = infilesize)
  }
  if(grepl('/$', url) && is.character(file)){
    url <- paste0(url, basename(file))
  }
  curl_fetch_memory(url, handle = h)
}
R/upload.R:17
R/values.R

<statement> typed

timing: 0.000 s
source
NULL
R/values.R:306

CURL_HTTP_VERSION_1_0 typed

1L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_1_0               <- 1L
R/values.R:308

CURL_HTTP_VERSION_1_1 typed

2L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_1_1               <- 2L
R/values.R:309

CURL_HTTP_VERSION_2 typed

3L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_2                 <- 3L
R/values.R:310

CURL_HTTP_VERSION_2_0 typed

3L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_2_0               <- 3L
R/values.R:311

CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE typed

5L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE <- 5L
R/values.R:312

CURL_HTTP_VERSION_2TLS typed

4L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_2TLS              <- 4L
R/values.R:313

CURL_HTTP_VERSION_3 typed

30L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_3                 <- 30L
R/values.R:314

CURL_HTTP_VERSION_3ONLY typed

31L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_3ONLY             <- 31L
R/values.R:315

CURL_HTTP_VERSION_NONE typed

0L<>
timing: 0.002 s
source
CURL_HTTP_VERSION_NONE              <- 0L
R/values.R:316

CURL_IPRESOLVE_V4 typed

1L<>
timing: 0.002 s
source
CURL_IPRESOLVE_V4                   <- 1L
R/values.R:317

CURL_IPRESOLVE_V6 typed

2L<>
timing: 0.002 s
source
CURL_IPRESOLVE_V6                   <- 2L
R/values.R:318

CURL_IPRESOLVE_WHATEVER typed

0L<>
timing: 0.002 s
source
CURL_IPRESOLVE_WHATEVER             <- 0L
R/values.R:319

CURL_NETRC_IGNORED typed

0L<>
timing: 0.002 s
source
CURL_NETRC_IGNORED                  <- 0L
R/values.R:320

CURL_NETRC_OPTIONAL typed

1L<>
timing: 0.002 s
source
CURL_NETRC_OPTIONAL                 <- 1L
R/values.R:321

CURL_NETRC_REQUIRED typed

2L<>
timing: 0.003 s
source
CURL_NETRC_REQUIRED                 <- 2L
R/values.R:322

CURL_REDIR_GET_ALL typed

0L<>
timing: 0.002 s
source
CURL_REDIR_GET_ALL                  <- 0L
R/values.R:323

CURL_REDIR_POST_301 typed

1L<>
timing: 0.002 s
source
CURL_REDIR_POST_301                 <- 1L
R/values.R:324

CURL_REDIR_POST_302 typed

2L<>
timing: 0.002 s
source
CURL_REDIR_POST_302                 <- 2L
R/values.R:325

CURL_REDIR_POST_303 typed

4L<>
timing: 0.002 s
source
CURL_REDIR_POST_303                 <- 4L
R/values.R:326

CURL_REDIR_POST_ALL typed

7L<>
timing: 0.002 s
source
CURL_REDIR_POST_ALL                 <- 7L
R/values.R:327

CURL_SSLVERSION_DEFAULT typed

0L<>
timing: 0.003 s
source
CURL_SSLVERSION_DEFAULT             <- 0L
R/values.R:328

CURL_SSLVERSION_MAX_DEFAULT typed

65536L<>
timing: 0.004 s
source
CURL_SSLVERSION_MAX_DEFAULT         <- 65536L
R/values.R:329

CURL_SSLVERSION_MAX_NONE typed

0L<>
timing: 0.004 s
source
CURL_SSLVERSION_MAX_NONE            <- 0L
R/values.R:330

CURL_SSLVERSION_MAX_TLSv1_0 typed

262144L<>
timing: 0.004 s
source
CURL_SSLVERSION_MAX_TLSv1_0         <- 262144L
R/values.R:331

CURL_SSLVERSION_MAX_TLSv1_1 typed

327680L<>
timing: 0.003 s
source
CURL_SSLVERSION_MAX_TLSv1_1         <- 327680L
R/values.R:332

CURL_SSLVERSION_MAX_TLSv1_2 typed

393216L<>
timing: 0.003 s
source
CURL_SSLVERSION_MAX_TLSv1_2         <- 393216L
R/values.R:333

CURL_SSLVERSION_MAX_TLSv1_3 typed

458752L<>
timing: 0.003 s
source
CURL_SSLVERSION_MAX_TLSv1_3         <- 458752L
R/values.R:334

CURL_SSLVERSION_TLSv1 typed

1L<>
timing: 0.003 s
source
CURL_SSLVERSION_TLSv1               <- 1L
R/values.R:335

CURL_SSLVERSION_TLSv1_0 typed

4L<>
timing: 0.003 s
source
CURL_SSLVERSION_TLSv1_0             <- 4L
R/values.R:336

CURL_SSLVERSION_TLSv1_1 typed

5L<>
timing: 0.003 s
source
CURL_SSLVERSION_TLSv1_1             <- 5L
R/values.R:337

CURL_SSLVERSION_TLSv1_2 typed

6L<>
timing: 0.003 s
source
CURL_SSLVERSION_TLSv1_2             <- 6L
R/values.R:338

CURL_SSLVERSION_TLSv1_3 typed

7L<>
timing: 0.003 s
source
CURL_SSLVERSION_TLSv1_3             <- 7L
R/values.R:339

CURL_TIMECOND_IFMODSINCE typed

1L<>
timing: 0.003 s
source
CURL_TIMECOND_IFMODSINCE            <- 1L
R/values.R:340

CURL_TIMECOND_IFUNMODSINCE typed

2L<>
timing: 0.004 s
source
CURL_TIMECOND_IFUNMODSINCE          <- 2L
R/values.R:341

CURL_TIMECOND_LASTMOD typed

3L<>
timing: 0.004 s
source
CURL_TIMECOND_LASTMOD               <- 3L
R/values.R:342

CURL_TIMECOND_NONE typed

0L<>
timing: 0.003 s
source
CURL_TIMECOND_NONE                  <- 0L
R/values.R:343

CURLALTSVC_H1 typed

8L<>
timing: 0.003 s
source
CURLALTSVC_H1                       <- 8L
R/values.R:344

CURLALTSVC_H2 typed

16L<>
timing: 0.003 s
source
CURLALTSVC_H2                       <- 16L
R/values.R:345

CURLALTSVC_H3 typed

32L<>
timing: 0.003 s
source
CURLALTSVC_H3                       <- 32L
R/values.R:346

CURLALTSVC_READONLYFILE typed

4L<>
timing: 0.003 s
source
CURLALTSVC_READONLYFILE             <- 4L
R/values.R:347

CURLAUTH_ANY typed

4294967279.<>
timing: 0.003 s
source
CURLAUTH_ANY                        <- 4294967279
R/values.R:348

CURLAUTH_ANYSAFE typed

4294967278.<>
timing: 0.003 s
source
CURLAUTH_ANYSAFE                    <- 4294967278
R/values.R:349

CURLAUTH_AWS_SIGV4 typed

128L<>
timing: 0.003 s
source
CURLAUTH_AWS_SIGV4                  <- 128L
R/values.R:350

CURLAUTH_BASIC typed

1L<>
timing: 0.003 s
source
CURLAUTH_BASIC                      <- 1L
R/values.R:351

CURLAUTH_BEARER typed

64L<>
timing: 0.002 s
source
CURLAUTH_BEARER                     <- 64L
R/values.R:352

CURLAUTH_DIGEST typed

2L<>
timing: 0.002 s
source
CURLAUTH_DIGEST                     <- 2L
R/values.R:353

CURLAUTH_DIGEST_IE typed

16L<>
timing: 0.002 s
source
CURLAUTH_DIGEST_IE                  <- 16L
R/values.R:354

CURLAUTH_GSSAPI typed

4L<>
timing: 0.002 s
source
CURLAUTH_GSSAPI                     <- 4L
R/values.R:355

CURLAUTH_NEGOTIATE typed

4L<>
timing: 0.002 s
source
CURLAUTH_NEGOTIATE                  <- 4L
R/values.R:356

CURLAUTH_NONE typed

0L<>
timing: 0.003 s
source
CURLAUTH_NONE                       <- 0L
R/values.R:357

CURLAUTH_NTLM typed

8L<>
timing: 0.002 s
source
CURLAUTH_NTLM                       <- 8L
R/values.R:358

CURLAUTH_ONLY typed

2147483648.<>
timing: 0.003 s
source
CURLAUTH_ONLY                       <- 2147483648
R/values.R:359

CURLFOLLOW_ALL typed

1L<>
timing: 0.002 s
source
CURLFOLLOW_ALL                      <- 1L
R/values.R:360

CURLFOLLOW_FIRSTONLY typed

3L<>
timing: 0.002 s
source
CURLFOLLOW_FIRSTONLY                <- 3L
R/values.R:361

CURLFOLLOW_OBEYCODE typed

2L<>
timing: 0.002 s
source
CURLFOLLOW_OBEYCODE                 <- 2L
R/values.R:362

CURLFTP_CREATE_DIR typed

1L<>
timing: 0.002 s
source
CURLFTP_CREATE_DIR                  <- 1L
R/values.R:363

CURLFTP_CREATE_DIR_NONE typed

0L<>
timing: 0.002 s
source
CURLFTP_CREATE_DIR_NONE             <- 0L
R/values.R:364

CURLFTP_CREATE_DIR_RETRY typed

2L<>
timing: 0.002 s
source
CURLFTP_CREATE_DIR_RETRY            <- 2L
R/values.R:365

CURLFTPAUTH_DEFAULT typed

0L<>
timing: 0.002 s
source
CURLFTPAUTH_DEFAULT                 <- 0L
R/values.R:366

CURLFTPAUTH_SSL typed

1L<>
timing: 0.002 s
source
CURLFTPAUTH_SSL                     <- 1L
R/values.R:367

CURLFTPAUTH_TLS typed

2L<>
timing: 0.002 s
source
CURLFTPAUTH_TLS                     <- 2L
R/values.R:368

CURLFTPMETHOD_DEFAULT typed

0L<>
timing: 0.002 s
source
CURLFTPMETHOD_DEFAULT               <- 0L
R/values.R:369

CURLFTPMETHOD_MULTICWD typed

1L<>
timing: 0.002 s
source
CURLFTPMETHOD_MULTICWD              <- 1L
R/values.R:370

CURLFTPMETHOD_NOCWD typed

2L<>
timing: 0.002 s
source
CURLFTPMETHOD_NOCWD                 <- 2L
R/values.R:371

CURLFTPMETHOD_SINGLECWD typed

3L<>
timing: 0.002 s
source
CURLFTPMETHOD_SINGLECWD             <- 3L
R/values.R:372

CURLFTPSSL_CCC_ACTIVE typed

2L<>
timing: 0.003 s
source
CURLFTPSSL_CCC_ACTIVE               <- 2L
R/values.R:373

CURLFTPSSL_CCC_NONE typed

0L<>
timing: 0.002 s
source
CURLFTPSSL_CCC_NONE                 <- 0L
R/values.R:374

CURLFTPSSL_CCC_PASSIVE typed

1L<>
timing: 0.002 s
source
CURLFTPSSL_CCC_PASSIVE              <- 1L
R/values.R:375

CURLGSSAPI_DELEGATION_FLAG typed

2L<>
timing: 0.002 s
source
CURLGSSAPI_DELEGATION_FLAG          <- 2L
R/values.R:376

CURLGSSAPI_DELEGATION_NONE typed

0L<>
timing: 0.002 s
source
CURLGSSAPI_DELEGATION_NONE          <- 0L
R/values.R:377

CURLGSSAPI_DELEGATION_POLICY_FLAG typed

1L<>
timing: 0.002 s
source
CURLGSSAPI_DELEGATION_POLICY_FLAG   <- 1L
R/values.R:378

CURLHEADER_SEPARATE typed

1L<>
timing: 0.002 s
source
CURLHEADER_SEPARATE                 <- 1L
R/values.R:379

CURLHEADER_UNIFIED typed

0L<>
timing: 0.002 s
source
CURLHEADER_UNIFIED                  <- 0L
R/values.R:380

CURLHSTS_ENABLE typed

1L<>
timing: 0.002 s
source
CURLHSTS_ENABLE                     <- 1L
R/values.R:381

CURLHSTS_READONLYFILE typed

2L<>
timing: 0.002 s
source
CURLHSTS_READONLYFILE               <- 2L
R/values.R:382

CURLMIMEOPT_FORMESCAPE typed

1L<>
timing: 0.002 s
source
CURLMIMEOPT_FORMESCAPE              <- 1L
R/values.R:383

CURLPROXY_HTTP typed

0L<>
timing: 0.002 s
source
CURLPROXY_HTTP                      <- 0L
R/values.R:384

CURLPROXY_HTTP_1_0 typed

1L<>
timing: 0.002 s
source
CURLPROXY_HTTP_1_0                  <- 1L
R/values.R:385

CURLPROXY_HTTPS typed

2L<>
timing: 0.003 s
source
CURLPROXY_HTTPS                     <- 2L
R/values.R:386

CURLPROXY_HTTPS2 typed

3L<>
timing: 0.002 s
source
CURLPROXY_HTTPS2                    <- 3L
R/values.R:387

CURLPROXY_SOCKS4 typed

4L<>
timing: 0.002 s
source
CURLPROXY_SOCKS4                    <- 4L
R/values.R:388

CURLPROXY_SOCKS4A typed

6L<>
timing: 0.002 s
source
CURLPROXY_SOCKS4A                   <- 6L
R/values.R:389

CURLPROXY_SOCKS5 typed

5L<>
timing: 0.002 s
source
CURLPROXY_SOCKS5                    <- 5L
R/values.R:390

CURLPROXY_SOCKS5_HOSTNAME typed

7L<>
timing: 0.002 s
source
CURLPROXY_SOCKS5_HOSTNAME           <- 7L
R/values.R:391

CURLSSH_AUTH_AGENT typed

16L<>
timing: 0.002 s
source
CURLSSH_AUTH_AGENT                  <- 16L
R/values.R:392

CURLSSH_AUTH_ANY typed

4294967295.<>
timing: 0.002 s
source
CURLSSH_AUTH_ANY                    <- 4294967295
R/values.R:393

CURLSSH_AUTH_DEFAULT typed

4294967295.<>
timing: 0.002 s
source
CURLSSH_AUTH_DEFAULT                <- 4294967295
R/values.R:394

CURLSSH_AUTH_GSSAPI typed

32L<>
timing: 0.002 s
source
CURLSSH_AUTH_GSSAPI                 <- 32L
R/values.R:395

CURLSSH_AUTH_HOST typed

4L<>
timing: 0.002 s
source
CURLSSH_AUTH_HOST                   <- 4L
R/values.R:396

CURLSSH_AUTH_KEYBOARD typed

8L<>
timing: 0.002 s
source
CURLSSH_AUTH_KEYBOARD               <- 8L
R/values.R:397

CURLSSH_AUTH_NONE typed

0L<>
timing: 0.002 s
source
CURLSSH_AUTH_NONE                   <- 0L
R/values.R:398

CURLSSH_AUTH_PASSWORD typed

2L<>
timing: 0.002 s
source
CURLSSH_AUTH_PASSWORD               <- 2L
R/values.R:399

CURLSSH_AUTH_PUBLICKEY typed

1L<>
timing: 0.002 s
source
CURLSSH_AUTH_PUBLICKEY              <- 1L
R/values.R:400

CURLSSLOPT_ALLOW_BEAST typed

1L<>
timing: 0.003 s
source
CURLSSLOPT_ALLOW_BEAST              <- 1L
R/values.R:401

CURLSSLOPT_AUTO_CLIENT_CERT typed

32L<>
timing: 0.002 s
source
CURLSSLOPT_AUTO_CLIENT_CERT         <- 32L
R/values.R:402

CURLSSLOPT_NATIVE_CA typed

16L<>
timing: 0.002 s
source
CURLSSLOPT_NATIVE_CA                <- 16L
R/values.R:403

CURLSSLOPT_NO_PARTIALCHAIN typed

4L<>
timing: 0.002 s
source
CURLSSLOPT_NO_PARTIALCHAIN          <- 4L
R/values.R:404

CURLSSLOPT_NO_REVOKE typed

2L<>
timing: 0.002 s
source
CURLSSLOPT_NO_REVOKE                <- 2L
R/values.R:405

CURLSSLOPT_REVOKE_BEST_EFFORT typed

8L<>
timing: 0.002 s
source
CURLSSLOPT_REVOKE_BEST_EFFORT       <- 8L
R/values.R:406

CURLUSESSL_ALL typed

3L<>
timing: 0.002 s
source
CURLUSESSL_ALL                      <- 3L
R/values.R:407

CURLUSESSL_CONTROL typed

2L<>
timing: 0.002 s
source
CURLUSESSL_CONTROL                  <- 2L
R/values.R:408

CURLUSESSL_NONE typed

0L<>
timing: 0.002 s
source
CURLUSESSL_NONE                     <- 0L
R/values.R:409

CURLUSESSL_TRY typed

1L<>
timing: 0.002 s
source
CURLUSESSL_TRY                      <- 1L
R/values.R:410

CURLWS_NOAUTOPONG typed

2L<>
timing: 0.002 s
source
CURLWS_NOAUTOPONG                   <- 2L
R/values.R:411

CURLWS_RAW_MODE typed

1L<>
timing: 0.002 s
source
CURLWS_RAW_MODE                     <- 1L
R/values.R:412