From 4ca84d85a02ed0a003810d891e5c2fa56c6143a0 Mon Sep 17 00:00:00 2001 From: zzy <1377519372@qq.com> Date: Fri, 26 Aug 2022 10:56:07 +0800 Subject: [PATCH] adjust project structure --- README.md | 6 +- lib/Makefile.inc | 2 - lib/ftp.c | 4401 +++ lib/ftp.rs | 7463 ---- lib/ftplistparser.c | 1018 + lib/ftplistparser.rs | 31510 ---------------- lib/http.c | 4382 +++ lib/http.rs | 7269 ---- lib/http_aws_sigv4.c | 394 + lib/http_aws_sigv4.rs | 3071 -- lib/http_chunks.c | 343 + lib/http_chunks.rs | 2584 -- lib/http_digest.c | 183 + lib/http_proxy.c | 1005 + lib/http_proxy.rs | 3275 -- lib/vtls/keylog.c | 156 - rust/Cargo.toml | 5 + rust/rust_ffi/Cargo.toml | 15 + rust/rust_ffi/build.rs | 11 + rust/rust_ffi/lib.rs | 26 + rust/rust_ffi/src/ffi_alias/mod.rs | 1 + .../rust_ffi/src/ffi_alias/type_alias.rs | 2263 +- rust/rust_ffi/src/ffi_fun/fun_call.rs | 70 + rust/rust_ffi/src/ffi_fun/mod.rs | 1 + rust/rust_ffi/src/ffi_struct/mod.rs | 1 + rust/rust_ffi/src/ffi_struct/struct_define.rs | 1531 + rust/rust_project/Cargo.toml | 16 + rust/rust_project/build.rs | 11 + rust/rust_project/lib.rs | 51 + rust/rust_project/src/ftp.rs | 0 rust/rust_project/src/ftplistparser.rs | 0 rust/rust_project/src/http.rs | 0 rust/rust_project/src/http2.rs | 0 rust/rust_project/src/http_aws_sigv4.rs | 0 rust/rust_project/src/http_chunks.rs | 0 rust/rust_project/src/http_digest.rs | 0 rust/rust_project/src/http_negotiate.rs | 0 {lib => rust/rust_project/src}/http_ntlm.rs | 1652 +- rust/rust_project/src/http_proxy.rs | 0 rust/rust_project/src/vtls/bearssl.rs | 0 rust/rust_project/src/vtls/gskit.rs | 0 rust/rust_project/src/vtls/gtls.rs | 0 rust/rust_project/src/vtls/keylog.rs | 209 + rust/rust_project/src/vtls/mbedtls.rs | 0 .../src/vtls/mbedtls_threadlock.rs | 0 rust/rust_project/src/vtls/mesalink.rs | 0 rust/rust_project/src/vtls/nss.rs | 0 rust/rust_project/src/vtls/openssl.rs | 0 rust/rust_project/src/vtls/rustls.rs | 0 rust/rust_project/src/vtls/schannel.rs | 0 rust/rust_project/src/vtls/schannel_verify.rs | 0 rust/rust_project/src/vtls/sectransp.rs | 0 rust/rust_project/src/vtls/vtls.rs | 0 rust/rust_project/src/vtls/wolfssl.rs | 0 54 files changed, 14261 insertions(+), 58664 deletions(-) create mode 100644 lib/ftp.c delete mode 100644 lib/ftp.rs create mode 100644 lib/ftplistparser.c delete mode 100644 lib/ftplistparser.rs create mode 100644 lib/http.c delete mode 100644 lib/http.rs create mode 100644 lib/http_aws_sigv4.c delete mode 100644 lib/http_aws_sigv4.rs create mode 100644 lib/http_chunks.c delete mode 100644 lib/http_chunks.rs create mode 100644 lib/http_digest.c create mode 100644 lib/http_proxy.c delete mode 100644 lib/http_proxy.rs delete mode 100644 lib/vtls/keylog.c create mode 100644 rust/Cargo.toml create mode 100644 rust/rust_ffi/Cargo.toml create mode 100644 rust/rust_ffi/build.rs create mode 100644 rust/rust_ffi/lib.rs create mode 100644 rust/rust_ffi/src/ffi_alias/mod.rs rename lib/http_digest.rs => rust/rust_ffi/src/ffi_alias/type_alias.rs (30%) create mode 100644 rust/rust_ffi/src/ffi_fun/fun_call.rs create mode 100644 rust/rust_ffi/src/ffi_fun/mod.rs create mode 100644 rust/rust_ffi/src/ffi_struct/mod.rs create mode 100644 rust/rust_ffi/src/ffi_struct/struct_define.rs create mode 100644 rust/rust_project/Cargo.toml create mode 100644 rust/rust_project/build.rs create mode 100644 rust/rust_project/lib.rs create mode 100644 rust/rust_project/src/ftp.rs create mode 100644 rust/rust_project/src/ftplistparser.rs create mode 100644 rust/rust_project/src/http.rs create mode 100644 rust/rust_project/src/http2.rs create mode 100644 rust/rust_project/src/http_aws_sigv4.rs create mode 100644 rust/rust_project/src/http_chunks.rs create mode 100644 rust/rust_project/src/http_digest.rs create mode 100644 rust/rust_project/src/http_negotiate.rs rename {lib => rust/rust_project/src}/http_ntlm.rs (44%) create mode 100644 rust/rust_project/src/http_proxy.rs create mode 100644 rust/rust_project/src/vtls/bearssl.rs create mode 100644 rust/rust_project/src/vtls/gskit.rs create mode 100644 rust/rust_project/src/vtls/gtls.rs create mode 100644 rust/rust_project/src/vtls/keylog.rs create mode 100644 rust/rust_project/src/vtls/mbedtls.rs create mode 100644 rust/rust_project/src/vtls/mbedtls_threadlock.rs create mode 100644 rust/rust_project/src/vtls/mesalink.rs create mode 100644 rust/rust_project/src/vtls/nss.rs create mode 100644 rust/rust_project/src/vtls/openssl.rs create mode 100644 rust/rust_project/src/vtls/rustls.rs create mode 100644 rust/rust_project/src/vtls/schannel.rs create mode 100644 rust/rust_project/src/vtls/schannel_verify.rs create mode 100644 rust/rust_project/src/vtls/sectransp.rs create mode 100644 rust/rust_project/src/vtls/vtls.rs create mode 100644 rust/rust_project/src/vtls/wolfssl.rs diff --git a/README.md b/README.md index bf35366..b31f6c2 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ Rewrite memory leak related modules for curl using Rust #### 安装教程 -1. xxxx -2. xxxx -3. xxxx +1. 进入`rust/`目录,执行`cargo build` +2. 在项目根目录下,执行`LDFLAGS="-L./rust/target/debug" LIBS="-lrust_project -ldl" ./configure --disable-shared` +3. 执行`make`完成编译 #### 使用说明 diff --git a/lib/Makefile.inc b/lib/Makefile.inc index 3e9ddec..c551d34 100644 --- a/lib/Makefile.inc +++ b/lib/Makefile.inc @@ -44,7 +44,6 @@ LIB_VTLS_CFILES = \ vtls/bearssl.c \ vtls/gskit.c \ vtls/gtls.c \ - vtls/keylog.c \ vtls/mbedtls.c \ vtls/mbedtls_threadlock.c \ vtls/mesalink.c \ @@ -151,7 +150,6 @@ LIB_CFILES = \ http_chunks.c \ http_digest.c \ http_negotiate.c \ - http_ntlm.c \ http_proxy.c \ http_aws_sigv4.c \ idn_win32.c \ diff --git a/lib/ftp.c b/lib/ftp.c new file mode 100644 index 0000000..0b9c9b7 --- /dev/null +++ b/lib/ftp.c @@ -0,0 +1,4401 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifndef CURL_DISABLE_FTP + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UTSNAME_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef __VMS +#include +#include +#endif + +#if (defined(NETWARE) && defined(__NOVELL_LIBC__)) +#undef in_addr_t +#define in_addr_t unsigned long +#endif + +#include +#include "urldata.h" +#include "sendf.h" +#include "if2ip.h" +#include "hostip.h" +#include "progress.h" +#include "transfer.h" +#include "escape.h" +#include "http.h" /* for HTTP proxy tunnel stuff */ +#include "ftp.h" +#include "fileinfo.h" +#include "ftplistparser.h" +#include "curl_range.h" +#include "curl_krb5.h" +#include "strtoofft.h" +#include "strcase.h" +#include "vtls/vtls.h" +#include "connect.h" +#include "strerror.h" +#include "inet_ntop.h" +#include "inet_pton.h" +#include "select.h" +#include "parsedate.h" /* for the week day and month names */ +#include "sockaddr.h" /* required for Curl_sockaddr_storage */ +#include "multiif.h" +#include "url.h" +#include "strcase.h" +#include "speedcheck.h" +#include "warnless.h" +#include "http_proxy.h" +#include "non-ascii.h" +#include "socks.h" +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" + +#ifndef NI_MAXHOST +#define NI_MAXHOST 1025 +#endif +#ifndef INET_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#endif + +#ifdef CURL_DISABLE_VERBOSE_STRINGS +#define ftp_pasv_verbose(a,b,c,d) Curl_nop_stmt +#endif + +/* Local API functions */ +#ifndef DEBUGBUILD +static void _state(struct Curl_easy *data, + ftpstate newstate); +#define state(x,y) _state(x,y) +#else +static void _state(struct Curl_easy *data, + ftpstate newstate, + int lineno); +#define state(x,y) _state(x,y,__LINE__) +#endif + +static CURLcode ftp_sendquote(struct Curl_easy *data, + struct connectdata *conn, + struct curl_slist *quote); +static CURLcode ftp_quit(struct Curl_easy *data, struct connectdata *conn); +static CURLcode ftp_parse_url_path(struct Curl_easy *data); +static CURLcode ftp_regular_transfer(struct Curl_easy *data, bool *done); +#ifndef CURL_DISABLE_VERBOSE_STRINGS +static void ftp_pasv_verbose(struct Curl_easy *data, + struct Curl_addrinfo *ai, + char *newhost, /* ascii version */ + int port); +#endif +static CURLcode ftp_state_prepare_transfer(struct Curl_easy *data); +static CURLcode ftp_state_mdtm(struct Curl_easy *data); +static CURLcode ftp_state_quote(struct Curl_easy *data, + bool init, ftpstate instate); +static CURLcode ftp_nb_type(struct Curl_easy *data, + struct connectdata *conn, + bool ascii, ftpstate newstate); +static int ftp_need_type(struct connectdata *conn, + bool ascii); +static CURLcode ftp_do(struct Curl_easy *data, bool *done); +static CURLcode ftp_done(struct Curl_easy *data, + CURLcode, bool premature); +static CURLcode ftp_connect(struct Curl_easy *data, bool *done); +static CURLcode ftp_disconnect(struct Curl_easy *data, + struct connectdata *conn, bool dead_connection); +static CURLcode ftp_do_more(struct Curl_easy *data, int *completed); +static CURLcode ftp_multi_statemach(struct Curl_easy *data, bool *done); +static int ftp_getsock(struct Curl_easy *data, struct connectdata *conn, + curl_socket_t *socks); +static int ftp_domore_getsock(struct Curl_easy *data, + struct connectdata *conn, curl_socket_t *socks); +static CURLcode ftp_doing(struct Curl_easy *data, + bool *dophase_done); +static CURLcode ftp_setup_connection(struct Curl_easy *data, + struct connectdata *conn); +static CURLcode init_wc_data(struct Curl_easy *data); +static CURLcode wc_statemach(struct Curl_easy *data); +static void wc_data_dtor(void *ptr); +static CURLcode ftp_state_retr(struct Curl_easy *data, curl_off_t filesize); +static CURLcode ftp_readresp(struct Curl_easy *data, + curl_socket_t sockfd, + struct pingpong *pp, + int *ftpcode, + size_t *size); +static CURLcode ftp_dophase_done(struct Curl_easy *data, + bool connected); + +/* + * FTP protocol handler. + */ + +const struct Curl_handler Curl_handler_ftp = { + "FTP", /* scheme */ + ftp_setup_connection, /* setup_connection */ + ftp_do, /* do_it */ + ftp_done, /* done */ + ftp_do_more, /* do_more */ + ftp_connect, /* connect_it */ + ftp_multi_statemach, /* connecting */ + ftp_doing, /* doing */ + ftp_getsock, /* proto_getsock */ + ftp_getsock, /* doing_getsock */ + ftp_domore_getsock, /* domore_getsock */ + ZERO_NULL, /* perform_getsock */ + ftp_disconnect, /* disconnect */ + ZERO_NULL, /* readwrite */ + ZERO_NULL, /* connection_check */ + ZERO_NULL, /* attach connection */ + PORT_FTP, /* defport */ + CURLPROTO_FTP, /* protocol */ + CURLPROTO_FTP, /* family */ + PROTOPT_DUAL | PROTOPT_CLOSEACTION | PROTOPT_NEEDSPWD | + PROTOPT_NOURLQUERY | PROTOPT_PROXY_AS_HTTP | + PROTOPT_WILDCARD /* flags */ +}; + + +#ifdef USE_SSL +/* + * FTPS protocol handler. + */ + +const struct Curl_handler Curl_handler_ftps = { + "FTPS", /* scheme */ + ftp_setup_connection, /* setup_connection */ + ftp_do, /* do_it */ + ftp_done, /* done */ + ftp_do_more, /* do_more */ + ftp_connect, /* connect_it */ + ftp_multi_statemach, /* connecting */ + ftp_doing, /* doing */ + ftp_getsock, /* proto_getsock */ + ftp_getsock, /* doing_getsock */ + ftp_domore_getsock, /* domore_getsock */ + ZERO_NULL, /* perform_getsock */ + ftp_disconnect, /* disconnect */ + ZERO_NULL, /* readwrite */ + ZERO_NULL, /* connection_check */ + ZERO_NULL, /* attach connection */ + PORT_FTPS, /* defport */ + CURLPROTO_FTPS, /* protocol */ + CURLPROTO_FTP, /* family */ + PROTOPT_SSL | PROTOPT_DUAL | PROTOPT_CLOSEACTION | + PROTOPT_NEEDSPWD | PROTOPT_NOURLQUERY | PROTOPT_WILDCARD /* flags */ +}; +#endif + +static void close_secondarysocket(struct Curl_easy *data, + struct connectdata *conn) +{ + if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) { + Curl_closesocket(data, conn, conn->sock[SECONDARYSOCKET]); + conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; + } + conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE; +#ifndef CURL_DISABLE_PROXY + conn->bits.proxy_ssl_connected[SECONDARYSOCKET] = FALSE; +#endif +} + +/* + * NOTE: back in the old days, we added code in the FTP code that made NOBODY + * requests on files respond with headers passed to the client/stdout that + * looked like HTTP ones. + * + * This approach is not very elegant, it causes confusion and is error-prone. + * It is subject for removal at the next (or at least a future) soname bump. + * Until then you can test the effects of the removal by undefining the + * following define named CURL_FTP_HTTPSTYLE_HEAD. + */ +#define CURL_FTP_HTTPSTYLE_HEAD 1 + +static void freedirs(struct ftp_conn *ftpc) +{ + if(ftpc->dirs) { + int i; + for(i = 0; i < ftpc->dirdepth; i++) { + free(ftpc->dirs[i]); + ftpc->dirs[i] = NULL; + } + free(ftpc->dirs); + ftpc->dirs = NULL; + ftpc->dirdepth = 0; + } + Curl_safefree(ftpc->file); + + /* no longer of any use */ + Curl_safefree(ftpc->newhost); +} + +/*********************************************************************** + * + * AcceptServerConnect() + * + * After connection request is received from the server this function is + * called to accept the connection and close the listening socket + * + */ +static CURLcode AcceptServerConnect(struct Curl_easy *data) +{ + struct connectdata *conn = data->conn; + curl_socket_t sock = conn->sock[SECONDARYSOCKET]; + curl_socket_t s = CURL_SOCKET_BAD; +#ifdef ENABLE_IPV6 + struct Curl_sockaddr_storage add; +#else + struct sockaddr_in add; +#endif + curl_socklen_t size = (curl_socklen_t) sizeof(add); + + if(0 == getsockname(sock, (struct sockaddr *) &add, &size)) { + size = sizeof(add); + + s = accept(sock, (struct sockaddr *) &add, &size); + } + Curl_closesocket(data, conn, sock); /* close the first socket */ + + if(CURL_SOCKET_BAD == s) { + failf(data, "Error accept()ing server connect"); + return CURLE_FTP_PORT_FAILED; + } + infof(data, "Connection accepted from server"); + /* when this happens within the DO state it is important that we mark us as + not needing DO_MORE anymore */ + conn->bits.do_more = FALSE; + + conn->sock[SECONDARYSOCKET] = s; + (void)curlx_nonblock(s, TRUE); /* enable non-blocking */ + conn->bits.sock_accepted = TRUE; + + if(data->set.fsockopt) { + int error = 0; + + /* activate callback for setting socket options */ + Curl_set_in_callback(data, true); + error = data->set.fsockopt(data->set.sockopt_client, + s, + CURLSOCKTYPE_ACCEPT); + Curl_set_in_callback(data, false); + + if(error) { + close_secondarysocket(data, conn); + return CURLE_ABORTED_BY_CALLBACK; + } + } + + return CURLE_OK; + +} + +/* + * ftp_timeleft_accept() returns the amount of milliseconds left allowed for + * waiting server to connect. If the value is negative, the timeout time has + * already elapsed. + * + * The start time is stored in progress.t_acceptdata - as set with + * Curl_pgrsTime(..., TIMER_STARTACCEPT); + * + */ +static timediff_t ftp_timeleft_accept(struct Curl_easy *data) +{ + timediff_t timeout_ms = DEFAULT_ACCEPT_TIMEOUT; + timediff_t other; + struct curltime now; + + if(data->set.accepttimeout > 0) + timeout_ms = data->set.accepttimeout; + + now = Curl_now(); + + /* check if the generic timeout possibly is set shorter */ + other = Curl_timeleft(data, &now, FALSE); + if(other && (other < timeout_ms)) + /* note that this also works fine for when other happens to be negative + due to it already having elapsed */ + timeout_ms = other; + else { + /* subtract elapsed time */ + timeout_ms -= Curl_timediff(now, data->progress.t_acceptdata); + if(!timeout_ms) + /* avoid returning 0 as that means no timeout! */ + return -1; + } + + return timeout_ms; +} + + +/*********************************************************************** + * + * ReceivedServerConnect() + * + * After allowing server to connect to us from data port, this function + * checks both data connection for connection establishment and ctrl + * connection for a negative response regarding a failure in connecting + * + */ +static CURLcode ReceivedServerConnect(struct Curl_easy *data, bool *received) +{ + struct connectdata *conn = data->conn; + curl_socket_t ctrl_sock = conn->sock[FIRSTSOCKET]; + curl_socket_t data_sock = conn->sock[SECONDARYSOCKET]; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + int result; + timediff_t timeout_ms; + ssize_t nread; + int ftpcode; + + *received = FALSE; + + timeout_ms = ftp_timeleft_accept(data); + infof(data, "Checking for server connect"); + if(timeout_ms < 0) { + /* if a timeout was already reached, bail out */ + failf(data, "Accept timeout occurred while waiting server connect"); + return CURLE_FTP_ACCEPT_TIMEOUT; + } + + /* First check whether there is a cached response from server */ + if(pp->cache_size && pp->cache && pp->cache[0] > '3') { + /* Data connection could not be established, let's return */ + infof(data, "There is negative response in cache while serv connect"); + (void)Curl_GetFTPResponse(data, &nread, &ftpcode); + return CURLE_FTP_ACCEPT_FAILED; + } + + result = Curl_socket_check(ctrl_sock, data_sock, CURL_SOCKET_BAD, 0); + + /* see if the connection request is already here */ + switch(result) { + case -1: /* error */ + /* let's die here */ + failf(data, "Error while waiting for server connect"); + return CURLE_FTP_ACCEPT_FAILED; + case 0: /* Server connect is not received yet */ + break; /* loop */ + default: + + if(result & CURL_CSELECT_IN2) { + infof(data, "Ready to accept data connection from server"); + *received = TRUE; + } + else if(result & CURL_CSELECT_IN) { + infof(data, "Ctrl conn has data while waiting for data conn"); + (void)Curl_GetFTPResponse(data, &nread, &ftpcode); + + if(ftpcode/100 > 3) + return CURLE_FTP_ACCEPT_FAILED; + + return CURLE_WEIRD_SERVER_REPLY; + } + + break; + } /* switch() */ + + return CURLE_OK; +} + + +/*********************************************************************** + * + * InitiateTransfer() + * + * After connection from server is accepted this function is called to + * setup transfer parameters and initiate the data transfer. + * + */ +static CURLcode InitiateTransfer(struct Curl_easy *data) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + + if(conn->bits.ftp_use_data_ssl) { + /* since we only have a plaintext TCP connection here, we must now + * do the TLS stuff */ + infof(data, "Doing the SSL/TLS handshake on the data stream"); + result = Curl_ssl_connect(data, conn, SECONDARYSOCKET); + if(result) + return result; + } + + if(conn->proto.ftpc.state_saved == FTP_STOR) { + /* When we know we're uploading a specified file, we can get the file + size prior to the actual upload. */ + Curl_pgrsSetUploadSize(data, data->state.infilesize); + + /* set the SO_SNDBUF for the secondary socket for those who need it */ + Curl_sndbufset(conn->sock[SECONDARYSOCKET]); + + Curl_setup_transfer(data, -1, -1, FALSE, SECONDARYSOCKET); + } + else { + /* FTP download: */ + Curl_setup_transfer(data, SECONDARYSOCKET, + conn->proto.ftpc.retr_size_saved, FALSE, -1); + } + + conn->proto.ftpc.pp.pending_resp = TRUE; /* expect server response */ + state(data, FTP_STOP); + + return CURLE_OK; +} + +/*********************************************************************** + * + * AllowServerConnect() + * + * When we've issue the PORT command, we have told the server to connect to + * us. This function checks whether data connection is established if so it is + * accepted. + * + */ +static CURLcode AllowServerConnect(struct Curl_easy *data, bool *connected) +{ + timediff_t timeout_ms; + CURLcode result = CURLE_OK; + + *connected = FALSE; + infof(data, "Preparing for accepting server on data port"); + + /* Save the time we start accepting server connect */ + Curl_pgrsTime(data, TIMER_STARTACCEPT); + + timeout_ms = ftp_timeleft_accept(data); + if(timeout_ms < 0) { + /* if a timeout was already reached, bail out */ + failf(data, "Accept timeout occurred while waiting server connect"); + return CURLE_FTP_ACCEPT_TIMEOUT; + } + + /* see if the connection request is already here */ + result = ReceivedServerConnect(data, connected); + if(result) + return result; + + if(*connected) { + result = AcceptServerConnect(data); + if(result) + return result; + + result = InitiateTransfer(data); + if(result) + return result; + } + else { + /* Add timeout to multi handle and break out of the loop */ + if(*connected == FALSE) { + Curl_expire(data, data->set.accepttimeout > 0 ? + data->set.accepttimeout: DEFAULT_ACCEPT_TIMEOUT, 0); + } + } + + return result; +} + +/* macro to check for a three-digit ftp status code at the start of the + given string */ +#define STATUSCODE(line) (ISDIGIT(line[0]) && ISDIGIT(line[1]) && \ + ISDIGIT(line[2])) + +/* macro to check for the last line in an FTP server response */ +#define LASTLINE(line) (STATUSCODE(line) && (' ' == line[3])) + +static bool ftp_endofresp(struct Curl_easy *data, struct connectdata *conn, + char *line, size_t len, int *code) +{ + (void)data; + (void)conn; + + if((len > 3) && LASTLINE(line)) { + *code = curlx_sltosi(strtol(line, NULL, 10)); + return TRUE; + } + + return FALSE; +} + +static CURLcode ftp_readresp(struct Curl_easy *data, + curl_socket_t sockfd, + struct pingpong *pp, + int *ftpcode, /* return the ftp-code if done */ + size_t *size) /* size of the response */ +{ + int code; + CURLcode result = Curl_pp_readresp(data, sockfd, pp, &code, size); + +#ifdef HAVE_GSSAPI + { + struct connectdata *conn = data->conn; + char * const buf = data->state.buffer; + + /* handle the security-oriented responses 6xx ***/ + switch(code) { + case 631: + code = Curl_sec_read_msg(data, conn, buf, PROT_SAFE); + break; + case 632: + code = Curl_sec_read_msg(data, conn, buf, PROT_PRIVATE); + break; + case 633: + code = Curl_sec_read_msg(data, conn, buf, PROT_CONFIDENTIAL); + break; + default: + /* normal ftp stuff we pass through! */ + break; + } + } +#endif + + /* store the latest code for later retrieval */ + data->info.httpcode = code; + + if(ftpcode) + *ftpcode = code; + + if(421 == code) { + /* 421 means "Service not available, closing control connection." and FTP + * servers use it to signal that idle session timeout has been exceeded. + * If we ignored the response, it could end up hanging in some cases. + * + * This response code can come at any point so having it treated + * generically is a good idea. + */ + infof(data, "We got a 421 - timeout!"); + state(data, FTP_STOP); + return CURLE_OPERATION_TIMEDOUT; + } + + return result; +} + +/* --- parse FTP server responses --- */ + +/* + * Curl_GetFTPResponse() is a BLOCKING function to read the full response + * from a server after a command. + * + */ + +CURLcode Curl_GetFTPResponse(struct Curl_easy *data, + ssize_t *nreadp, /* return number of bytes read */ + int *ftpcode) /* return the ftp-code */ +{ + /* + * We cannot read just one byte per read() and then go back to select() as + * the OpenSSL read() doesn't grok that properly. + * + * Alas, read as much as possible, split up into lines, use the ending + * line in a response or continue reading. */ + + struct connectdata *conn = data->conn; + curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; + CURLcode result = CURLE_OK; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + size_t nread; + int cache_skip = 0; + int value_to_be_ignored = 0; + + if(ftpcode) + *ftpcode = 0; /* 0 for errors */ + else + /* make the pointer point to something for the rest of this function */ + ftpcode = &value_to_be_ignored; + + *nreadp = 0; + + while(!*ftpcode && !result) { + /* check and reset timeout value every lap */ + timediff_t timeout = Curl_pp_state_timeout(data, pp, FALSE); + timediff_t interval_ms; + + if(timeout <= 0) { + failf(data, "FTP response timeout"); + return CURLE_OPERATION_TIMEDOUT; /* already too little time */ + } + + interval_ms = 1000; /* use 1 second timeout intervals */ + if(timeout < interval_ms) + interval_ms = timeout; + + /* + * Since this function is blocking, we need to wait here for input on the + * connection and only then we call the response reading function. We do + * timeout at least every second to make the timeout check run. + * + * A caution here is that the ftp_readresp() function has a cache that may + * contain pieces of a response from the previous invoke and we need to + * make sure we don't just wait for input while there is unhandled data in + * that cache. But also, if the cache is there, we call ftp_readresp() and + * the cache wasn't good enough to continue we must not just busy-loop + * around this function. + * + */ + + if(pp->cache && (cache_skip < 2)) { + /* + * There's a cache left since before. We then skipping the wait for + * socket action, unless this is the same cache like the previous round + * as then the cache was deemed not enough to act on and we then need to + * wait for more data anyway. + */ + } + else if(!Curl_conn_data_pending(conn, FIRSTSOCKET)) { + switch(SOCKET_READABLE(sockfd, interval_ms)) { + case -1: /* select() error, stop reading */ + failf(data, "FTP response aborted due to select/poll error: %d", + SOCKERRNO); + return CURLE_RECV_ERROR; + + case 0: /* timeout */ + if(Curl_pgrsUpdate(data)) + return CURLE_ABORTED_BY_CALLBACK; + continue; /* just continue in our loop for the timeout duration */ + + default: /* for clarity */ + break; + } + } + result = ftp_readresp(data, sockfd, pp, ftpcode, &nread); + if(result) + break; + + if(!nread && pp->cache) + /* bump cache skip counter as on repeated skips we must wait for more + data */ + cache_skip++; + else + /* when we got data or there is no cache left, we reset the cache skip + counter */ + cache_skip = 0; + + *nreadp += nread; + + } /* while there's buffer left and loop is requested */ + + pp->pending_resp = FALSE; + + return result; +} + +#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS) + /* for debug purposes */ +static const char * const ftp_state_names[]={ + "STOP", + "WAIT220", + "AUTH", + "USER", + "PASS", + "ACCT", + "PBSZ", + "PROT", + "CCC", + "PWD", + "SYST", + "NAMEFMT", + "QUOTE", + "RETR_PREQUOTE", + "STOR_PREQUOTE", + "POSTQUOTE", + "CWD", + "MKD", + "MDTM", + "TYPE", + "LIST_TYPE", + "RETR_TYPE", + "STOR_TYPE", + "SIZE", + "RETR_SIZE", + "STOR_SIZE", + "REST", + "RETR_REST", + "PORT", + "PRET", + "PASV", + "LIST", + "RETR", + "STOR", + "QUIT" +}; +#endif + +/* This is the ONLY way to change FTP state! */ +static void _state(struct Curl_easy *data, + ftpstate newstate +#ifdef DEBUGBUILD + , int lineno +#endif + ) +{ + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + +#if defined(DEBUGBUILD) + +#if defined(CURL_DISABLE_VERBOSE_STRINGS) + (void) lineno; +#else + if(ftpc->state != newstate) + infof(data, "FTP %p (line %d) state change from %s to %s", + (void *)ftpc, lineno, ftp_state_names[ftpc->state], + ftp_state_names[newstate]); +#endif +#endif + + ftpc->state = newstate; +} + +static CURLcode ftp_state_user(struct Curl_easy *data, + struct connectdata *conn) +{ + CURLcode result = Curl_pp_sendf(data, + &conn->proto.ftpc.pp, "USER %s", + conn->user?conn->user:""); + if(!result) { + state(data, FTP_USER); + data->state.ftp_trying_alternative = FALSE; + } + return result; +} + +static CURLcode ftp_state_pwd(struct Curl_easy *data, + struct connectdata *conn) +{ + CURLcode result = Curl_pp_sendf(data, &conn->proto.ftpc.pp, "%s", "PWD"); + if(!result) + state(data, FTP_PWD); + + return result; +} + +/* For the FTP "protocol connect" and "doing" phases only */ +static int ftp_getsock(struct Curl_easy *data, + struct connectdata *conn, + curl_socket_t *socks) +{ + return Curl_pp_getsock(data, &conn->proto.ftpc.pp, socks); +} + +/* For the FTP "DO_MORE" phase only */ +static int ftp_domore_getsock(struct Curl_easy *data, + struct connectdata *conn, curl_socket_t *socks) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + (void)data; + + /* When in DO_MORE state, we could be either waiting for us to connect to a + * remote site, or we could wait for that site to connect to us. Or just + * handle ordinary commands. + */ + + if(SOCKS_STATE(conn->cnnct.state)) + return Curl_SOCKS_getsock(conn, socks, SECONDARYSOCKET); + + if(FTP_STOP == ftpc->state) { + int bits = GETSOCK_READSOCK(0); + bool any = FALSE; + + /* if stopped and still in this state, then we're also waiting for a + connect on the secondary connection */ + socks[0] = conn->sock[FIRSTSOCKET]; + + if(!data->set.ftp_use_port) { + int s; + int i; + /* PORT is used to tell the server to connect to us, and during that we + don't do happy eyeballs, but we do if we connect to the server */ + for(s = 1, i = 0; i<2; i++) { + if(conn->tempsock[i] != CURL_SOCKET_BAD) { + socks[s] = conn->tempsock[i]; + bits |= GETSOCK_WRITESOCK(s++); + any = TRUE; + } + } + } + if(!any) { + socks[1] = conn->sock[SECONDARYSOCKET]; + bits |= GETSOCK_WRITESOCK(1) | GETSOCK_READSOCK(1); + } + + return bits; + } + return Curl_pp_getsock(data, &conn->proto.ftpc.pp, socks); +} + +/* This is called after the FTP_QUOTE state is passed. + + ftp_state_cwd() sends the range of CWD commands to the server to change to + the correct directory. It may also need to send MKD commands to create + missing ones, if that option is enabled. +*/ +static CURLcode ftp_state_cwd(struct Curl_easy *data, + struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if(ftpc->cwddone) + /* already done and fine */ + result = ftp_state_mdtm(data); + else { + /* FTPFILE_NOCWD with full path: expect ftpc->cwddone! */ + DEBUGASSERT((data->set.ftp_filemethod != FTPFILE_NOCWD) || + !(ftpc->dirdepth && ftpc->dirs[0][0] == '/')); + + ftpc->count2 = 0; /* count2 counts failed CWDs */ + + /* count3 is set to allow a MKD to fail once. In the case when first CWD + fails and then MKD fails (due to another session raced it to create the + dir) this then allows for a second try to CWD to it */ + ftpc->count3 = (data->set.ftp_create_missing_dirs == 2)?1:0; + + if(conn->bits.reuse && ftpc->entrypath && + /* no need to go to entrypath when we have an absolute path */ + !(ftpc->dirdepth && ftpc->dirs[0][0] == '/')) { + /* This is a re-used connection. Since we change directory to where the + transfer is taking place, we must first get back to the original dir + where we ended up after login: */ + ftpc->cwdcount = 0; /* we count this as the first path, then we add one + for all upcoming ones in the ftp->dirs[] array */ + result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", ftpc->entrypath); + if(!result) + state(data, FTP_CWD); + } + else { + if(ftpc->dirdepth) { + ftpc->cwdcount = 1; + /* issue the first CWD, the rest is sent when the CWD responses are + received... */ + result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", + ftpc->dirs[ftpc->cwdcount -1]); + if(!result) + state(data, FTP_CWD); + } + else { + /* No CWD necessary */ + result = ftp_state_mdtm(data); + } + } + } + return result; +} + +typedef enum { + EPRT, + PORT, + DONE +} ftpport; + +static CURLcode ftp_state_use_port(struct Curl_easy *data, + ftpport fcmd) /* start with this */ +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + curl_socket_t portsock = CURL_SOCKET_BAD; + char myhost[MAX_IPADR_LEN + 1] = ""; + + struct Curl_sockaddr_storage ss; + struct Curl_addrinfo *res, *ai; + curl_socklen_t sslen; + char hbuf[NI_MAXHOST]; + struct sockaddr *sa = (struct sockaddr *)&ss; + struct sockaddr_in * const sa4 = (void *)sa; +#ifdef ENABLE_IPV6 + struct sockaddr_in6 * const sa6 = (void *)sa; +#endif + static const char mode[][5] = { "EPRT", "PORT" }; + enum resolve_t rc; + int error; + char *host = NULL; + char *string_ftpport = data->set.str[STRING_FTPPORT]; + struct Curl_dns_entry *h = NULL; + unsigned short port_min = 0; + unsigned short port_max = 0; + unsigned short port; + bool possibly_non_local = TRUE; + char buffer[STRERROR_LEN]; + char *addr = NULL; + + /* Step 1, figure out what is requested, + * accepted format : + * (ipv4|ipv6|domain|interface)?(:port(-range)?)? + */ + + if(data->set.str[STRING_FTPPORT] && + (strlen(data->set.str[STRING_FTPPORT]) > 1)) { + +#ifdef ENABLE_IPV6 + size_t addrlen = INET6_ADDRSTRLEN > strlen(string_ftpport) ? + INET6_ADDRSTRLEN : strlen(string_ftpport); +#else + size_t addrlen = INET_ADDRSTRLEN > strlen(string_ftpport) ? + INET_ADDRSTRLEN : strlen(string_ftpport); +#endif + char *ip_start = string_ftpport; + char *ip_end = NULL; + char *port_start = NULL; + char *port_sep = NULL; + + addr = calloc(addrlen + 1, 1); + if(!addr) + return CURLE_OUT_OF_MEMORY; + +#ifdef ENABLE_IPV6 + if(*string_ftpport == '[') { + /* [ipv6]:port(-range) */ + ip_start = string_ftpport + 1; + ip_end = strchr(string_ftpport, ']'); + if(ip_end) + strncpy(addr, ip_start, ip_end - ip_start); + } + else +#endif + if(*string_ftpport == ':') { + /* :port */ + ip_end = string_ftpport; + } + else { + ip_end = strchr(string_ftpport, ':'); + if(ip_end) { + /* either ipv6 or (ipv4|domain|interface):port(-range) */ +#ifdef ENABLE_IPV6 + if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) { + /* ipv6 */ + port_min = port_max = 0; + strcpy(addr, string_ftpport); + ip_end = NULL; /* this got no port ! */ + } + else +#endif + /* (ipv4|domain|interface):port(-range) */ + strncpy(addr, string_ftpport, ip_end - ip_start); + } + else + /* ipv4|interface */ + strcpy(addr, string_ftpport); + } + + /* parse the port */ + if(ip_end != NULL) { + port_start = strchr(ip_end, ':'); + if(port_start) { + port_min = curlx_ultous(strtoul(port_start + 1, NULL, 10)); + port_sep = strchr(port_start, '-'); + if(port_sep) { + port_max = curlx_ultous(strtoul(port_sep + 1, NULL, 10)); + } + else + port_max = port_min; + } + } + + /* correct errors like: + * :1234-1230 + * :-4711, in this case port_min is (unsigned)-1, + * therefore port_min > port_max for all cases + * but port_max = (unsigned)-1 + */ + if(port_min > port_max) + port_min = port_max = 0; + + + if(*addr != '\0') { + /* attempt to get the address of the given interface name */ + switch(Curl_if2ip(conn->ip_addr->ai_family, + Curl_ipv6_scope(conn->ip_addr->ai_addr), + conn->scope_id, addr, hbuf, sizeof(hbuf))) { + case IF2IP_NOT_FOUND: + /* not an interface, use the given string as host name instead */ + host = addr; + break; + case IF2IP_AF_NOT_SUPPORTED: + return CURLE_FTP_PORT_FAILED; + case IF2IP_FOUND: + host = hbuf; /* use the hbuf for host name */ + } + } + else + /* there was only a port(-range) given, default the host */ + host = NULL; + } /* data->set.ftpport */ + + if(!host) { + const char *r; + /* not an interface and not a host name, get default by extracting + the IP from the control connection */ + sslen = sizeof(ss); + if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) { + failf(data, "getsockname() failed: %s", + Curl_strerror(SOCKERRNO, buffer, sizeof(buffer))); + free(addr); + return CURLE_FTP_PORT_FAILED; + } + switch(sa->sa_family) { +#ifdef ENABLE_IPV6 + case AF_INET6: + r = Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf)); + break; +#endif + default: + r = Curl_inet_ntop(sa->sa_family, &sa4->sin_addr, hbuf, sizeof(hbuf)); + break; + } + if(!r) + return CURLE_FTP_PORT_FAILED; + host = hbuf; /* use this host name */ + possibly_non_local = FALSE; /* we know it is local now */ + } + + /* resolv ip/host to ip */ + rc = Curl_resolv(data, host, 0, FALSE, &h); + if(rc == CURLRESOLV_PENDING) + (void)Curl_resolver_wait_resolv(data, &h); + if(h) { + res = h->addr; + /* when we return from this function, we can forget about this entry + to we can unlock it now already */ + Curl_resolv_unlock(data, h); + } /* (h) */ + else + res = NULL; /* failure! */ + + if(!res) { + failf(data, "failed to resolve the address provided to PORT: %s", host); + free(addr); + return CURLE_FTP_PORT_FAILED; + } + + free(addr); + host = NULL; + + /* step 2, create a socket for the requested address */ + + portsock = CURL_SOCKET_BAD; + error = 0; + for(ai = res; ai; ai = ai->ai_next) { + result = Curl_socket(data, ai, NULL, &portsock); + if(result) { + error = SOCKERRNO; + continue; + } + break; + } + if(!ai) { + failf(data, "socket failure: %s", + Curl_strerror(error, buffer, sizeof(buffer))); + return CURLE_FTP_PORT_FAILED; + } + + /* step 3, bind to a suitable local address */ + + memcpy(sa, ai->ai_addr, ai->ai_addrlen); + sslen = ai->ai_addrlen; + + for(port = port_min; port <= port_max;) { + if(sa->sa_family == AF_INET) + sa4->sin_port = htons(port); +#ifdef ENABLE_IPV6 + else + sa6->sin6_port = htons(port); +#endif + /* Try binding the given address. */ + if(bind(portsock, sa, sslen) ) { + /* It failed. */ + error = SOCKERRNO; + if(possibly_non_local && (error == EADDRNOTAVAIL)) { + /* The requested bind address is not local. Use the address used for + * the control connection instead and restart the port loop + */ + infof(data, "bind(port=%hu) on non-local address failed: %s", port, + Curl_strerror(error, buffer, sizeof(buffer))); + + sslen = sizeof(ss); + if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) { + failf(data, "getsockname() failed: %s", + Curl_strerror(SOCKERRNO, buffer, sizeof(buffer))); + Curl_closesocket(data, conn, portsock); + return CURLE_FTP_PORT_FAILED; + } + port = port_min; + possibly_non_local = FALSE; /* don't try this again */ + continue; + } + if(error != EADDRINUSE && error != EACCES) { + failf(data, "bind(port=%hu) failed: %s", port, + Curl_strerror(error, buffer, sizeof(buffer))); + Curl_closesocket(data, conn, portsock); + return CURLE_FTP_PORT_FAILED; + } + } + else + break; + + port++; + } + + /* maybe all ports were in use already*/ + if(port > port_max) { + failf(data, "bind() failed, we ran out of ports!"); + Curl_closesocket(data, conn, portsock); + return CURLE_FTP_PORT_FAILED; + } + + /* get the name again after the bind() so that we can extract the + port number it uses now */ + sslen = sizeof(ss); + if(getsockname(portsock, (struct sockaddr *)sa, &sslen)) { + failf(data, "getsockname() failed: %s", + Curl_strerror(SOCKERRNO, buffer, sizeof(buffer))); + Curl_closesocket(data, conn, portsock); + return CURLE_FTP_PORT_FAILED; + } + + /* step 4, listen on the socket */ + + if(listen(portsock, 1)) { + failf(data, "socket failure: %s", + Curl_strerror(SOCKERRNO, buffer, sizeof(buffer))); + Curl_closesocket(data, conn, portsock); + return CURLE_FTP_PORT_FAILED; + } + + /* step 5, send the proper FTP command */ + + /* get a plain printable version of the numerical address to work with + below */ + Curl_printable_address(ai, myhost, sizeof(myhost)); + +#ifdef ENABLE_IPV6 + if(!conn->bits.ftp_use_eprt && conn->bits.ipv6) + /* EPRT is disabled but we are connected to a IPv6 host, so we ignore the + request and enable EPRT again! */ + conn->bits.ftp_use_eprt = TRUE; +#endif + + for(; fcmd != DONE; fcmd++) { + + if(!conn->bits.ftp_use_eprt && (EPRT == fcmd)) + /* if disabled, goto next */ + continue; + + if((PORT == fcmd) && sa->sa_family != AF_INET) + /* PORT is IPv4 only */ + continue; + + switch(sa->sa_family) { + case AF_INET: + port = ntohs(sa4->sin_port); + break; +#ifdef ENABLE_IPV6 + case AF_INET6: + port = ntohs(sa6->sin6_port); + break; +#endif + default: + continue; /* might as well skip this */ + } + + if(EPRT == fcmd) { + /* + * Two fine examples from RFC2428; + * + * EPRT |1|132.235.1.2|6275| + * + * EPRT |2|1080::8:800:200C:417A|5282| + */ + + result = Curl_pp_sendf(data, &ftpc->pp, "%s |%d|%s|%hu|", mode[fcmd], + sa->sa_family == AF_INET?1:2, + myhost, port); + if(result) { + failf(data, "Failure sending EPRT command: %s", + curl_easy_strerror(result)); + Curl_closesocket(data, conn, portsock); + /* don't retry using PORT */ + ftpc->count1 = PORT; + /* bail out */ + state(data, FTP_STOP); + return result; + } + break; + } + if(PORT == fcmd) { + /* large enough for [IP address],[num],[num] */ + char target[sizeof(myhost) + 20]; + char *source = myhost; + char *dest = target; + + /* translate x.x.x.x to x,x,x,x */ + while(source && *source) { + if(*source == '.') + *dest = ','; + else + *dest = *source; + dest++; + source++; + } + *dest = 0; + msnprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff)); + + result = Curl_pp_sendf(data, &ftpc->pp, "%s %s", mode[fcmd], target); + if(result) { + failf(data, "Failure sending PORT command: %s", + curl_easy_strerror(result)); + Curl_closesocket(data, conn, portsock); + /* bail out */ + state(data, FTP_STOP); + return result; + } + break; + } + } + + /* store which command was sent */ + ftpc->count1 = fcmd; + + close_secondarysocket(data, conn); + + /* we set the secondary socket variable to this for now, it is only so that + the cleanup function will close it in case we fail before the true + secondary stuff is made */ + conn->sock[SECONDARYSOCKET] = portsock; + + /* this tcpconnect assignment below is a hackish work-around to make the + multi interface with active FTP work - as it will not wait for a + (passive) connect in Curl_is_connected(). + + The *proper* fix is to make sure that the active connection from the + server is done in a non-blocking way. Currently, it is still BLOCKING. + */ + conn->bits.tcpconnect[SECONDARYSOCKET] = TRUE; + + state(data, FTP_PORT); + return result; +} + +static CURLcode ftp_state_use_pasv(struct Curl_easy *data, + struct connectdata *conn) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result = CURLE_OK; + /* + Here's the executive summary on what to do: + + PASV is RFC959, expect: + 227 Entering Passive Mode (a1,a2,a3,a4,p1,p2) + + LPSV is RFC1639, expect: + 228 Entering Long Passive Mode (4,4,a1,a2,a3,a4,2,p1,p2) + + EPSV is RFC2428, expect: + 229 Entering Extended Passive Mode (|||port|) + + */ + + static const char mode[][5] = { "EPSV", "PASV" }; + int modeoff; + +#ifdef PF_INET6 + if(!conn->bits.ftp_use_epsv && conn->bits.ipv6) + /* EPSV is disabled but we are connected to a IPv6 host, so we ignore the + request and enable EPSV again! */ + conn->bits.ftp_use_epsv = TRUE; +#endif + + modeoff = conn->bits.ftp_use_epsv?0:1; + + result = Curl_pp_sendf(data, &ftpc->pp, "%s", mode[modeoff]); + if(!result) { + ftpc->count1 = modeoff; + state(data, FTP_PASV); + infof(data, "Connect data stream passively"); + } + return result; +} + +/* + * ftp_state_prepare_transfer() starts PORT, PASV or PRET etc. + * + * REST is the last command in the chain of commands when a "head"-like + * request is made. Thus, if an actual transfer is to be made this is where we + * take off for real. + */ +static CURLcode ftp_state_prepare_transfer(struct Curl_easy *data) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + + if(ftp->transfer != PPTRANSFER_BODY) { + /* doesn't transfer any data */ + + /* still possibly do PRE QUOTE jobs */ + state(data, FTP_RETR_PREQUOTE); + result = ftp_state_quote(data, TRUE, FTP_RETR_PREQUOTE); + } + else if(data->set.ftp_use_port) { + /* We have chosen to use the PORT (or similar) command */ + result = ftp_state_use_port(data, EPRT); + } + else { + /* We have chosen (this is default) to use the PASV (or similar) command */ + if(data->set.ftp_use_pret) { + /* The user has requested that we send a PRET command + to prepare the server for the upcoming PASV */ + struct ftp_conn *ftpc = &conn->proto.ftpc; + if(!conn->proto.ftpc.file) + result = Curl_pp_sendf(data, &ftpc->pp, "PRET %s", + data->set.str[STRING_CUSTOMREQUEST]? + data->set.str[STRING_CUSTOMREQUEST]: + (data->state.list_only?"NLST":"LIST")); + else if(data->set.upload) + result = Curl_pp_sendf(data, &ftpc->pp, "PRET STOR %s", + conn->proto.ftpc.file); + else + result = Curl_pp_sendf(data, &ftpc->pp, "PRET RETR %s", + conn->proto.ftpc.file); + if(!result) + state(data, FTP_PRET); + } + else + result = ftp_state_use_pasv(data, conn); + } + return result; +} + +static CURLcode ftp_state_rest(struct Curl_easy *data, + struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if((ftp->transfer != PPTRANSFER_BODY) && ftpc->file) { + /* if a "head"-like request is being made (on a file) */ + + /* Determine if server can respond to REST command and therefore + whether it supports range */ + result = Curl_pp_sendf(data, &ftpc->pp, "REST %d", 0); + if(!result) + state(data, FTP_REST); + } + else + result = ftp_state_prepare_transfer(data); + + return result; +} + +static CURLcode ftp_state_size(struct Curl_easy *data, + struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if((ftp->transfer == PPTRANSFER_INFO) && ftpc->file) { + /* if a "head"-like request is being made (on a file) */ + + /* we know ftpc->file is a valid pointer to a file name */ + result = Curl_pp_sendf(data, &ftpc->pp, "SIZE %s", ftpc->file); + if(!result) + state(data, FTP_SIZE); + } + else + result = ftp_state_rest(data, conn); + + return result; +} + +static CURLcode ftp_state_list(struct Curl_easy *data) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + + /* If this output is to be machine-parsed, the NLST command might be better + to use, since the LIST command output is not specified or standard in any + way. It has turned out that the NLST list output is not the same on all + servers either... */ + + /* + if FTPFILE_NOCWD was specified, we should add the path + as argument for the LIST / NLST / or custom command. + Whether the server will support this, is uncertain. + + The other ftp_filemethods will CWD into dir/dir/ first and + then just do LIST (in that case: nothing to do here) + */ + char *lstArg = NULL; + char *cmd; + + if((data->set.ftp_filemethod == FTPFILE_NOCWD) && ftp->path) { + /* url-decode before evaluation: e.g. paths starting/ending with %2f */ + const char *slashPos = NULL; + char *rawPath = NULL; + result = Curl_urldecode(data, ftp->path, 0, &rawPath, NULL, REJECT_CTRL); + if(result) + return result; + + slashPos = strrchr(rawPath, '/'); + if(slashPos) { + /* chop off the file part if format is dir/file otherwise remove + the trailing slash for dir/dir/ except for absolute path / */ + size_t n = slashPos - rawPath; + if(n == 0) + ++n; + + lstArg = rawPath; + lstArg[n] = '\0'; + } + else + free(rawPath); + } + + cmd = aprintf("%s%s%s", + data->set.str[STRING_CUSTOMREQUEST]? + data->set.str[STRING_CUSTOMREQUEST]: + (data->state.list_only?"NLST":"LIST"), + lstArg? " ": "", + lstArg? lstArg: ""); + free(lstArg); + + if(!cmd) + return CURLE_OUT_OF_MEMORY; + + result = Curl_pp_sendf(data, &conn->proto.ftpc.pp, "%s", cmd); + free(cmd); + + if(!result) + state(data, FTP_LIST); + + return result; +} + +static CURLcode ftp_state_retr_prequote(struct Curl_easy *data) +{ + /* We've sent the TYPE, now we must send the list of prequote strings */ + return ftp_state_quote(data, TRUE, FTP_RETR_PREQUOTE); +} + +static CURLcode ftp_state_stor_prequote(struct Curl_easy *data) +{ + /* We've sent the TYPE, now we must send the list of prequote strings */ + return ftp_state_quote(data, TRUE, FTP_STOR_PREQUOTE); +} + +static CURLcode ftp_state_type(struct Curl_easy *data) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + /* If we have selected NOBODY and HEADER, it means that we only want file + information. Which in FTP can't be much more than the file size and + date. */ + if(data->set.opt_no_body && ftpc->file && + ftp_need_type(conn, data->state.prefer_ascii)) { + /* The SIZE command is _not_ RFC 959 specified, and therefore many servers + may not support it! It is however the only way we have to get a file's + size! */ + + ftp->transfer = PPTRANSFER_INFO; + /* this means no actual transfer will be made */ + + /* Some servers return different sizes for different modes, and thus we + must set the proper type before we check the size */ + result = ftp_nb_type(data, conn, data->state.prefer_ascii, FTP_TYPE); + if(result) + return result; + } + else + result = ftp_state_size(data, conn); + + return result; +} + +/* This is called after the CWD commands have been done in the beginning of + the DO phase */ +static CURLcode ftp_state_mdtm(struct Curl_easy *data) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + /* Requested time of file or time-depended transfer? */ + if((data->set.get_filetime || data->set.timecondition) && ftpc->file) { + + /* we have requested to get the modified-time of the file, this is a white + spot as the MDTM is not mentioned in RFC959 */ + result = Curl_pp_sendf(data, &ftpc->pp, "MDTM %s", ftpc->file); + + if(!result) + state(data, FTP_MDTM); + } + else + result = ftp_state_type(data); + + return result; +} + + +/* This is called after the TYPE and possible quote commands have been sent */ +static CURLcode ftp_state_ul_setup(struct Curl_easy *data, + bool sizechecked) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + struct FTP *ftp = data->req.p.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + bool append = data->set.remote_append; + + if((data->state.resume_from && !sizechecked) || + ((data->state.resume_from > 0) && sizechecked)) { + /* we're about to continue the uploading of a file */ + /* 1. get already existing file's size. We use the SIZE command for this + which may not exist in the server! The SIZE command is not in + RFC959. */ + + /* 2. This used to set REST. But since we can do append, we + don't another ftp command. We just skip the source file + offset and then we APPEND the rest on the file instead */ + + /* 3. pass file-size number of bytes in the source file */ + /* 4. lower the infilesize counter */ + /* => transfer as usual */ + int seekerr = CURL_SEEKFUNC_OK; + + if(data->state.resume_from < 0) { + /* Got no given size to start from, figure it out */ + result = Curl_pp_sendf(data, &ftpc->pp, "SIZE %s", ftpc->file); + if(!result) + state(data, FTP_STOR_SIZE); + return result; + } + + /* enable append */ + append = TRUE; + + /* Let's read off the proper amount of bytes from the input. */ + if(conn->seek_func) { + Curl_set_in_callback(data, true); + seekerr = conn->seek_func(conn->seek_client, data->state.resume_from, + SEEK_SET); + Curl_set_in_callback(data, false); + } + + if(seekerr != CURL_SEEKFUNC_OK) { + curl_off_t passed = 0; + if(seekerr != CURL_SEEKFUNC_CANTSEEK) { + failf(data, "Could not seek stream"); + return CURLE_FTP_COULDNT_USE_REST; + } + /* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ + do { + size_t readthisamountnow = + (data->state.resume_from - passed > data->set.buffer_size) ? + (size_t)data->set.buffer_size : + curlx_sotouz(data->state.resume_from - passed); + + size_t actuallyread = + data->state.fread_func(data->state.buffer, 1, readthisamountnow, + data->state.in); + + passed += actuallyread; + if((actuallyread == 0) || (actuallyread > readthisamountnow)) { + /* this checks for greater-than only to make sure that the + CURL_READFUNC_ABORT return code still aborts */ + failf(data, "Failed to read data"); + return CURLE_FTP_COULDNT_USE_REST; + } + } while(passed < data->state.resume_from); + } + /* now, decrease the size of the read */ + if(data->state.infilesize>0) { + data->state.infilesize -= data->state.resume_from; + + if(data->state.infilesize <= 0) { + infof(data, "File already completely uploaded"); + + /* no data to transfer */ + Curl_setup_transfer(data, -1, -1, FALSE, -1); + + /* Set ->transfer so that we won't get any error in + * ftp_done() because we didn't transfer anything! */ + ftp->transfer = PPTRANSFER_NONE; + + state(data, FTP_STOP); + return CURLE_OK; + } + } + /* we've passed, proceed as normal */ + } /* resume_from */ + + result = Curl_pp_sendf(data, &ftpc->pp, append?"APPE %s":"STOR %s", + ftpc->file); + if(!result) + state(data, FTP_STOR); + + return result; +} + +static CURLcode ftp_state_quote(struct Curl_easy *data, + bool init, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + bool quote = FALSE; + struct curl_slist *item; + + switch(instate) { + case FTP_QUOTE: + default: + item = data->set.quote; + break; + case FTP_RETR_PREQUOTE: + case FTP_STOR_PREQUOTE: + item = data->set.prequote; + break; + case FTP_POSTQUOTE: + item = data->set.postquote; + break; + } + + /* + * This state uses: + * 'count1' to iterate over the commands to send + * 'count2' to store whether to allow commands to fail + */ + + if(init) + ftpc->count1 = 0; + else + ftpc->count1++; + + if(item) { + int i = 0; + + /* Skip count1 items in the linked list */ + while((i< ftpc->count1) && item) { + item = item->next; + i++; + } + if(item) { + char *cmd = item->data; + if(cmd[0] == '*') { + cmd++; + ftpc->count2 = 1; /* the sent command is allowed to fail */ + } + else + ftpc->count2 = 0; /* failure means cancel operation */ + + result = Curl_pp_sendf(data, &ftpc->pp, "%s", cmd); + if(result) + return result; + state(data, instate); + quote = TRUE; + } + } + + if(!quote) { + /* No more quote to send, continue to ... */ + switch(instate) { + case FTP_QUOTE: + default: + result = ftp_state_cwd(data, conn); + break; + case FTP_RETR_PREQUOTE: + if(ftp->transfer != PPTRANSFER_BODY) + state(data, FTP_STOP); + else { + if(ftpc->known_filesize != -1) { + Curl_pgrsSetDownloadSize(data, ftpc->known_filesize); + result = ftp_state_retr(data, ftpc->known_filesize); + } + else { + if(data->set.ignorecl || data->state.prefer_ascii) { + /* 'ignorecl' is used to support download of growing files. It + prevents the state machine from requesting the file size from + the server. With an unknown file size the download continues + until the server terminates it, otherwise the client stops if + the received byte count exceeds the reported file size. Set + option CURLOPT_IGNORE_CONTENT_LENGTH to 1 to enable this + behavior. + + In addition: asking for the size for 'TYPE A' transfers is not + constructive since servers don't report the converted size. So + skip it. + */ + result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file); + if(!result) + state(data, FTP_RETR); + } + else { + result = Curl_pp_sendf(data, &ftpc->pp, "SIZE %s", ftpc->file); + if(!result) + state(data, FTP_RETR_SIZE); + } + } + } + break; + case FTP_STOR_PREQUOTE: + result = ftp_state_ul_setup(data, FALSE); + break; + case FTP_POSTQUOTE: + break; + } + } + + return result; +} + +/* called from ftp_state_pasv_resp to switch to PASV in case of EPSV + problems */ +static CURLcode ftp_epsv_disable(struct Curl_easy *data, + struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + if(conn->bits.ipv6 +#ifndef CURL_DISABLE_PROXY + && !(conn->bits.tunnel_proxy || conn->bits.socksproxy) +#endif + ) { + /* We can't disable EPSV when doing IPv6, so this is instead a fail */ + failf(data, "Failed EPSV attempt, exiting"); + return CURLE_WEIRD_SERVER_REPLY; + } + + infof(data, "Failed EPSV attempt. Disabling EPSV"); + /* disable it for next transfer */ + conn->bits.ftp_use_epsv = FALSE; + data->state.errorbuf = FALSE; /* allow error message to get + rewritten */ + result = Curl_pp_sendf(data, &conn->proto.ftpc.pp, "%s", "PASV"); + if(!result) { + conn->proto.ftpc.count1++; + /* remain in/go to the FTP_PASV state */ + state(data, FTP_PASV); + } + return result; +} + + +static char *control_address(struct connectdata *conn) +{ + /* Returns the control connection IP address. + If a proxy tunnel is used, returns the original host name instead, because + the effective control connection address is the proxy address, + not the ftp host. */ +#ifndef CURL_DISABLE_PROXY + if(conn->bits.tunnel_proxy || conn->bits.socksproxy) + return conn->host.name; +#endif + return conn->primary_ip; +} + +static CURLcode ftp_state_pasv_resp(struct Curl_easy *data, + int ftpcode) +{ + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result; + struct Curl_dns_entry *addr = NULL; + enum resolve_t rc; + unsigned short connectport; /* the local port connect() should use! */ + char *str = &data->state.buffer[4]; /* start on the first letter */ + + /* if we come here again, make sure the former name is cleared */ + Curl_safefree(ftpc->newhost); + + if((ftpc->count1 == 0) && + (ftpcode == 229)) { + /* positive EPSV response */ + char *ptr = strchr(str, '('); + if(ptr) { + unsigned int num; + char separator[4]; + ptr++; + if(5 == sscanf(ptr, "%c%c%c%u%c", + &separator[0], + &separator[1], + &separator[2], + &num, + &separator[3])) { + const char sep1 = separator[0]; + int i; + + /* The four separators should be identical, or else this is an oddly + formatted reply and we bail out immediately. */ + for(i = 1; i<4; i++) { + if(separator[i] != sep1) { + ptr = NULL; /* set to NULL to signal error */ + break; + } + } + if(num > 0xffff) { + failf(data, "Illegal port number in EPSV reply"); + return CURLE_FTP_WEIRD_PASV_REPLY; + } + if(ptr) { + ftpc->newport = (unsigned short)(num & 0xffff); + ftpc->newhost = strdup(control_address(conn)); + if(!ftpc->newhost) + return CURLE_OUT_OF_MEMORY; + } + } + else + ptr = NULL; + } + if(!ptr) { + failf(data, "Weirdly formatted EPSV reply"); + return CURLE_FTP_WEIRD_PASV_REPLY; + } + } + else if((ftpc->count1 == 1) && + (ftpcode == 227)) { + /* positive PASV response */ + unsigned int ip[4] = {0, 0, 0, 0}; + unsigned int port[2] = {0, 0}; + + /* + * Scan for a sequence of six comma-separated numbers and use them as + * IP+port indicators. + * + * Found reply-strings include: + * "227 Entering Passive Mode (127,0,0,1,4,51)" + * "227 Data transfer will passively listen to 127,0,0,1,4,51" + * "227 Entering passive mode. 127,0,0,1,4,51" + */ + while(*str) { + if(6 == sscanf(str, "%u,%u,%u,%u,%u,%u", + &ip[0], &ip[1], &ip[2], &ip[3], + &port[0], &port[1])) + break; + str++; + } + + if(!*str || (ip[0] > 255) || (ip[1] > 255) || (ip[2] > 255) || + (ip[3] > 255) || (port[0] > 255) || (port[1] > 255) ) { + failf(data, "Couldn't interpret the 227-response"); + return CURLE_FTP_WEIRD_227_FORMAT; + } + + /* we got OK from server */ + if(data->set.ftp_skip_ip) { + /* told to ignore the remotely given IP but instead use the host we used + for the control connection */ + infof(data, "Skip %u.%u.%u.%u for data connection, re-use %s instead", + ip[0], ip[1], ip[2], ip[3], + conn->host.name); + ftpc->newhost = strdup(control_address(conn)); + } + else + ftpc->newhost = aprintf("%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]); + + if(!ftpc->newhost) + return CURLE_OUT_OF_MEMORY; + + ftpc->newport = (unsigned short)(((port[0]<<8) + port[1]) & 0xffff); + } + else if(ftpc->count1 == 0) { + /* EPSV failed, move on to PASV */ + return ftp_epsv_disable(data, conn); + } + else { + failf(data, "Bad PASV/EPSV response: %03d", ftpcode); + return CURLE_FTP_WEIRD_PASV_REPLY; + } + +#ifndef CURL_DISABLE_PROXY + if(conn->bits.proxy) { + /* + * This connection uses a proxy and we need to connect to the proxy again + * here. We don't want to rely on a former host lookup that might've + * expired now, instead we remake the lookup here and now! + */ + const char * const host_name = conn->bits.socksproxy ? + conn->socks_proxy.host.name : conn->http_proxy.host.name; + rc = Curl_resolv(data, host_name, (int)conn->port, FALSE, &addr); + if(rc == CURLRESOLV_PENDING) + /* BLOCKING, ignores the return code but 'addr' will be NULL in + case of failure */ + (void)Curl_resolver_wait_resolv(data, &addr); + + connectport = + (unsigned short)conn->port; /* we connect to the proxy's port */ + + if(!addr) { + failf(data, "Can't resolve proxy host %s:%hu", host_name, connectport); + return CURLE_COULDNT_RESOLVE_PROXY; + } + } + else +#endif + { + /* normal, direct, ftp connection */ + DEBUGASSERT(ftpc->newhost); + + /* postponed address resolution in case of tcp fastopen */ + if(conn->bits.tcp_fastopen && !conn->bits.reuse && !ftpc->newhost[0]) { + Curl_conninfo_remote(data, conn, conn->sock[FIRSTSOCKET]); + Curl_safefree(ftpc->newhost); + ftpc->newhost = strdup(control_address(conn)); + if(!ftpc->newhost) + return CURLE_OUT_OF_MEMORY; + } + + rc = Curl_resolv(data, ftpc->newhost, ftpc->newport, FALSE, &addr); + if(rc == CURLRESOLV_PENDING) + /* BLOCKING */ + (void)Curl_resolver_wait_resolv(data, &addr); + + connectport = ftpc->newport; /* we connect to the remote port */ + + if(!addr) { + failf(data, "Can't resolve new host %s:%hu", ftpc->newhost, connectport); + return CURLE_FTP_CANT_GET_HOST; + } + } + + conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE; + result = Curl_connecthost(data, conn, addr); + + if(result) { + Curl_resolv_unlock(data, addr); /* we're done using this address */ + if(ftpc->count1 == 0 && ftpcode == 229) + return ftp_epsv_disable(data, conn); + + return result; + } + + + /* + * When this is used from the multi interface, this might've returned with + * the 'connected' set to FALSE and thus we are now awaiting a non-blocking + * connect to connect. + */ + + if(data->set.verbose) + /* this just dumps information about this second connection */ + ftp_pasv_verbose(data, addr->addr, ftpc->newhost, connectport); + + Curl_resolv_unlock(data, addr); /* we're done using this address */ + + Curl_safefree(conn->secondaryhostname); + conn->secondary_port = ftpc->newport; + conn->secondaryhostname = strdup(ftpc->newhost); + if(!conn->secondaryhostname) + return CURLE_OUT_OF_MEMORY; + + conn->bits.do_more = TRUE; + state(data, FTP_STOP); /* this phase is completed */ + + return result; +} + +static CURLcode ftp_state_port_resp(struct Curl_easy *data, + int ftpcode) +{ + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + ftpport fcmd = (ftpport)ftpc->count1; + CURLcode result = CURLE_OK; + + /* The FTP spec tells a positive response should have code 200. + Be more permissive here to tolerate deviant servers. */ + if(ftpcode / 100 != 2) { + /* the command failed */ + + if(EPRT == fcmd) { + infof(data, "disabling EPRT usage"); + conn->bits.ftp_use_eprt = FALSE; + } + fcmd++; + + if(fcmd == DONE) { + failf(data, "Failed to do PORT"); + result = CURLE_FTP_PORT_FAILED; + } + else + /* try next */ + result = ftp_state_use_port(data, fcmd); + } + else { + infof(data, "Connect data stream actively"); + state(data, FTP_STOP); /* end of DO phase */ + result = ftp_dophase_done(data, FALSE); + } + + return result; +} + +static CURLcode ftp_state_mdtm_resp(struct Curl_easy *data, + int ftpcode) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + switch(ftpcode) { + case 213: + { + /* we got a time. Format should be: "YYYYMMDDHHMMSS[.sss]" where the + last .sss part is optional and means fractions of a second */ + int year, month, day, hour, minute, second; + if(6 == sscanf(&data->state.buffer[4], "%04d%02d%02d%02d%02d%02d", + &year, &month, &day, &hour, &minute, &second)) { + /* we have a time, reformat it */ + char timebuf[24]; + msnprintf(timebuf, sizeof(timebuf), + "%04d%02d%02d %02d:%02d:%02d GMT", + year, month, day, hour, minute, second); + /* now, convert this into a time() value: */ + data->info.filetime = Curl_getdate_capped(timebuf); + } + +#ifdef CURL_FTP_HTTPSTYLE_HEAD + /* If we asked for a time of the file and we actually got one as well, + we "emulate" a HTTP-style header in our output. */ + + if(data->set.opt_no_body && + ftpc->file && + data->set.get_filetime && + (data->info.filetime >= 0) ) { + char headerbuf[128]; + int headerbuflen; + time_t filetime = data->info.filetime; + struct tm buffer; + const struct tm *tm = &buffer; + + result = Curl_gmtime(filetime, &buffer); + if(result) + return result; + + /* format: "Tue, 15 Nov 1994 12:45:26" */ + headerbuflen = msnprintf(headerbuf, sizeof(headerbuf), + "Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n", + Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], + tm->tm_mday, + Curl_month[tm->tm_mon], + tm->tm_year + 1900, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + result = Curl_client_write(data, CLIENTWRITE_BOTH, headerbuf, + headerbuflen); + if(result) + return result; + } /* end of a ridiculous amount of conditionals */ +#endif + } + break; + default: + infof(data, "unsupported MDTM reply format"); + break; + case 550: /* "No such file or directory" */ + failf(data, "Given file does not exist"); + result = CURLE_REMOTE_FILE_NOT_FOUND; + break; + } + + if(data->set.timecondition) { + if((data->info.filetime > 0) && (data->set.timevalue > 0)) { + switch(data->set.timecondition) { + case CURL_TIMECOND_IFMODSINCE: + default: + if(data->info.filetime <= data->set.timevalue) { + infof(data, "The requested document is not new enough"); + ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */ + data->info.timecond = TRUE; + state(data, FTP_STOP); + return CURLE_OK; + } + break; + case CURL_TIMECOND_IFUNMODSINCE: + if(data->info.filetime > data->set.timevalue) { + infof(data, "The requested document is not old enough"); + ftp->transfer = PPTRANSFER_NONE; /* mark to not transfer data */ + data->info.timecond = TRUE; + state(data, FTP_STOP); + return CURLE_OK; + } + break; + } /* switch */ + } + else { + infof(data, "Skipping time comparison"); + } + } + + if(!result) + result = ftp_state_type(data); + + return result; +} + +static CURLcode ftp_state_type_resp(struct Curl_easy *data, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + + if(ftpcode/100 != 2) { + /* "sasserftpd" and "(u)r(x)bot ftpd" both responds with 226 after a + successful 'TYPE I'. While that is not as RFC959 says, it is still a + positive response code and we allow that. */ + failf(data, "Couldn't set desired mode"); + return CURLE_FTP_COULDNT_SET_TYPE; + } + if(ftpcode != 200) + infof(data, "Got a %03d response code instead of the assumed 200", + ftpcode); + + if(instate == FTP_TYPE) + result = ftp_state_size(data, conn); + else if(instate == FTP_LIST_TYPE) + result = ftp_state_list(data); + else if(instate == FTP_RETR_TYPE) + result = ftp_state_retr_prequote(data); + else if(instate == FTP_STOR_TYPE) + result = ftp_state_stor_prequote(data); + + return result; +} + +static CURLcode ftp_state_retr(struct Curl_easy *data, + curl_off_t filesize) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if(data->set.max_filesize && (filesize > data->set.max_filesize)) { + failf(data, "Maximum file size exceeded"); + return CURLE_FILESIZE_EXCEEDED; + } + ftp->downloadsize = filesize; + + if(data->state.resume_from) { + /* We always (attempt to) get the size of downloads, so it is done before + this even when not doing resumes. */ + if(filesize == -1) { + infof(data, "ftp server doesn't support SIZE"); + /* We couldn't get the size and therefore we can't know if there really + is a part of the file left to get, although the server will just + close the connection when we start the connection so it won't cause + us any harm, just not make us exit as nicely. */ + } + else { + /* We got a file size report, so we check that there actually is a + part of the file left to get, or else we go home. */ + if(data->state.resume_from< 0) { + /* We're supposed to download the last abs(from) bytes */ + if(filesize < -data->state.resume_from) { + failf(data, "Offset (%" CURL_FORMAT_CURL_OFF_T + ") was beyond file size (%" CURL_FORMAT_CURL_OFF_T ")", + data->state.resume_from, filesize); + return CURLE_BAD_DOWNLOAD_RESUME; + } + /* convert to size to download */ + ftp->downloadsize = -data->state.resume_from; + /* download from where? */ + data->state.resume_from = filesize - ftp->downloadsize; + } + else { + if(filesize < data->state.resume_from) { + failf(data, "Offset (%" CURL_FORMAT_CURL_OFF_T + ") was beyond file size (%" CURL_FORMAT_CURL_OFF_T ")", + data->state.resume_from, filesize); + return CURLE_BAD_DOWNLOAD_RESUME; + } + /* Now store the number of bytes we are expected to download */ + ftp->downloadsize = filesize-data->state.resume_from; + } + } + + if(ftp->downloadsize == 0) { + /* no data to transfer */ + Curl_setup_transfer(data, -1, -1, FALSE, -1); + infof(data, "File already completely downloaded"); + + /* Set ->transfer so that we won't get any error in ftp_done() + * because we didn't transfer the any file */ + ftp->transfer = PPTRANSFER_NONE; + state(data, FTP_STOP); + return CURLE_OK; + } + + /* Set resume file transfer offset */ + infof(data, "Instructs server to resume from offset %" + CURL_FORMAT_CURL_OFF_T, data->state.resume_from); + + result = Curl_pp_sendf(data, &ftpc->pp, "REST %" CURL_FORMAT_CURL_OFF_T, + data->state.resume_from); + if(!result) + state(data, FTP_RETR_REST); + } + else { + /* no resume */ + result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file); + if(!result) + state(data, FTP_RETR); + } + + return result; +} + +static CURLcode ftp_state_size_resp(struct Curl_easy *data, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + curl_off_t filesize = -1; + char *buf = data->state.buffer; + + /* get the size from the ascii string: */ + if(ftpcode == 213) { + /* To allow servers to prepend "rubbish" in the response string, we scan + for all the digits at the end of the response and parse only those as a + number. */ + char *start = &buf[4]; + char *fdigit = strchr(start, '\r'); + if(fdigit) { + do + fdigit--; + while(ISDIGIT(*fdigit) && (fdigit > start)); + if(!ISDIGIT(*fdigit)) + fdigit++; + } + else + fdigit = start; + /* ignores parsing errors, which will make the size remain unknown */ + (void)curlx_strtoofft(fdigit, NULL, 0, &filesize); + + } + else if(ftpcode == 550) { /* "No such file or directory" */ + /* allow a SIZE failure for (resumed) uploads, when probing what command + to use */ + if(instate != FTP_STOR_SIZE) { + failf(data, "The file does not exist"); + return CURLE_REMOTE_FILE_NOT_FOUND; + } + } + + if(instate == FTP_SIZE) { +#ifdef CURL_FTP_HTTPSTYLE_HEAD + if(-1 != filesize) { + char clbuf[128]; + int clbuflen = msnprintf(clbuf, sizeof(clbuf), + "Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", filesize); + result = Curl_client_write(data, CLIENTWRITE_BOTH, clbuf, clbuflen); + if(result) + return result; + } +#endif + Curl_pgrsSetDownloadSize(data, filesize); + result = ftp_state_rest(data, data->conn); + } + else if(instate == FTP_RETR_SIZE) { + Curl_pgrsSetDownloadSize(data, filesize); + result = ftp_state_retr(data, filesize); + } + else if(instate == FTP_STOR_SIZE) { + data->state.resume_from = filesize; + result = ftp_state_ul_setup(data, TRUE); + } + + return result; +} + +static CURLcode ftp_state_rest_resp(struct Curl_easy *data, + struct connectdata *conn, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + switch(instate) { + case FTP_REST: + default: +#ifdef CURL_FTP_HTTPSTYLE_HEAD + if(ftpcode == 350) { + char buffer[24]= { "Accept-ranges: bytes\r\n" }; + result = Curl_client_write(data, CLIENTWRITE_BOTH, buffer, + strlen(buffer)); + if(result) + return result; + } +#endif + result = ftp_state_prepare_transfer(data); + break; + + case FTP_RETR_REST: + if(ftpcode != 350) { + failf(data, "Couldn't use REST"); + result = CURLE_FTP_COULDNT_USE_REST; + } + else { + result = Curl_pp_sendf(data, &ftpc->pp, "RETR %s", ftpc->file); + if(!result) + state(data, FTP_RETR); + } + break; + } + + return result; +} + +static CURLcode ftp_state_stor_resp(struct Curl_easy *data, + int ftpcode, ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + + if(ftpcode >= 400) { + failf(data, "Failed FTP upload: %0d", ftpcode); + state(data, FTP_STOP); + /* oops, we never close the sockets! */ + return CURLE_UPLOAD_FAILED; + } + + conn->proto.ftpc.state_saved = instate; + + /* PORT means we are now awaiting the server to connect to us. */ + if(data->set.ftp_use_port) { + bool connected; + + state(data, FTP_STOP); /* no longer in STOR state */ + + result = AllowServerConnect(data, &connected); + if(result) + return result; + + if(!connected) { + struct ftp_conn *ftpc = &conn->proto.ftpc; + infof(data, "Data conn was not available immediately"); + ftpc->wait_data_conn = TRUE; + } + + return CURLE_OK; + } + return InitiateTransfer(data); +} + +/* for LIST and RETR responses */ +static CURLcode ftp_state_get_resp(struct Curl_easy *data, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + + if((ftpcode == 150) || (ftpcode == 125)) { + + /* + A; + 150 Opening BINARY mode data connection for /etc/passwd (2241 + bytes). (ok, the file is being transferred) + + B: + 150 Opening ASCII mode data connection for /bin/ls + + C: + 150 ASCII data connection for /bin/ls (137.167.104.91,37445) (0 bytes). + + D: + 150 Opening ASCII mode data connection for [file] (0.0.0.0,0) (545 bytes) + + E: + 125 Data connection already open; Transfer starting. */ + + curl_off_t size = -1; /* default unknown size */ + + + /* + * It appears that there are FTP-servers that return size 0 for files when + * SIZE is used on the file while being in BINARY mode. To work around + * that (stupid) behavior, we attempt to parse the RETR response even if + * the SIZE returned size zero. + * + * Debugging help from Salvatore Sorrentino on February 26, 2003. + */ + + if((instate != FTP_LIST) && + !data->state.prefer_ascii && + (ftp->downloadsize < 1)) { + /* + * It seems directory listings either don't show the size or very + * often uses size 0 anyway. ASCII transfers may very well turn out + * that the transferred amount of data is not the same as this line + * tells, why using this number in those cases only confuses us. + * + * Example D above makes this parsing a little tricky */ + char *bytes; + char *buf = data->state.buffer; + bytes = strstr(buf, " bytes"); + if(bytes) { + long in = (long)(--bytes-buf); + /* this is a hint there is size information in there! ;-) */ + while(--in) { + /* scan for the left parenthesis and break there */ + if('(' == *bytes) + break; + /* skip only digits */ + if(!ISDIGIT(*bytes)) { + bytes = NULL; + break; + } + /* one more estep backwards */ + bytes--; + } + /* if we have nothing but digits: */ + if(bytes) { + ++bytes; + /* get the number! */ + (void)curlx_strtoofft(bytes, NULL, 0, &size); + } + } + } + else if(ftp->downloadsize > -1) + size = ftp->downloadsize; + + if(size > data->req.maxdownload && data->req.maxdownload > 0) + size = data->req.size = data->req.maxdownload; + else if((instate != FTP_LIST) && (data->state.prefer_ascii)) + size = -1; /* kludge for servers that understate ASCII mode file size */ + + infof(data, "Maxdownload = %" CURL_FORMAT_CURL_OFF_T, + data->req.maxdownload); + + if(instate != FTP_LIST) + infof(data, "Getting file with size: %" CURL_FORMAT_CURL_OFF_T, + size); + + /* FTP download: */ + conn->proto.ftpc.state_saved = instate; + conn->proto.ftpc.retr_size_saved = size; + + if(data->set.ftp_use_port) { + bool connected; + + result = AllowServerConnect(data, &connected); + if(result) + return result; + + if(!connected) { + struct ftp_conn *ftpc = &conn->proto.ftpc; + infof(data, "Data conn was not available immediately"); + state(data, FTP_STOP); + ftpc->wait_data_conn = TRUE; + } + } + else + return InitiateTransfer(data); + } + else { + if((instate == FTP_LIST) && (ftpcode == 450)) { + /* simply no matching files in the dir listing */ + ftp->transfer = PPTRANSFER_NONE; /* don't download anything */ + state(data, FTP_STOP); /* this phase is over */ + } + else { + failf(data, "RETR response: %03d", ftpcode); + return instate == FTP_RETR && ftpcode == 550? + CURLE_REMOTE_FILE_NOT_FOUND: + CURLE_FTP_COULDNT_RETR_FILE; + } + } + + return result; +} + +/* after USER, PASS and ACCT */ +static CURLcode ftp_state_loggedin(struct Curl_easy *data) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + + if(conn->bits.ftp_use_control_ssl) { + /* PBSZ = PROTECTION BUFFER SIZE. + + The 'draft-murray-auth-ftp-ssl' (draft 12, page 7) says: + + Specifically, the PROT command MUST be preceded by a PBSZ + command and a PBSZ command MUST be preceded by a successful + security data exchange (the TLS negotiation in this case) + + ... (and on page 8): + + Thus the PBSZ command must still be issued, but must have a + parameter of '0' to indicate that no buffering is taking place + and the data connection should not be encapsulated. + */ + result = Curl_pp_sendf(data, &conn->proto.ftpc.pp, "PBSZ %d", 0); + if(!result) + state(data, FTP_PBSZ); + } + else { + result = ftp_state_pwd(data, conn); + } + return result; +} + +/* for USER and PASS responses */ +static CURLcode ftp_state_user_resp(struct Curl_easy *data, + int ftpcode, + ftpstate instate) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + (void)instate; /* no use for this yet */ + + /* some need password anyway, and others just return 2xx ignored */ + if((ftpcode == 331) && (ftpc->state == FTP_USER)) { + /* 331 Password required for ... + (the server requires to send the user's password too) */ + result = Curl_pp_sendf(data, &ftpc->pp, "PASS %s", + conn->passwd?conn->passwd:""); + if(!result) + state(data, FTP_PASS); + } + else if(ftpcode/100 == 2) { + /* 230 User ... logged in. + (the user logged in with or without password) */ + result = ftp_state_loggedin(data); + } + else if(ftpcode == 332) { + if(data->set.str[STRING_FTP_ACCOUNT]) { + result = Curl_pp_sendf(data, &ftpc->pp, "ACCT %s", + data->set.str[STRING_FTP_ACCOUNT]); + if(!result) + state(data, FTP_ACCT); + } + else { + failf(data, "ACCT requested but none available"); + result = CURLE_LOGIN_DENIED; + } + } + else { + /* All other response codes, like: + + 530 User ... access denied + (the server denies to log the specified user) */ + + if(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER] && + !data->state.ftp_trying_alternative) { + /* Ok, USER failed. Let's try the supplied command. */ + result = + Curl_pp_sendf(data, &ftpc->pp, "%s", + data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]); + if(!result) { + data->state.ftp_trying_alternative = TRUE; + state(data, FTP_USER); + } + } + else { + failf(data, "Access denied: %03d", ftpcode); + result = CURLE_LOGIN_DENIED; + } + } + return result; +} + +/* for ACCT response */ +static CURLcode ftp_state_acct_resp(struct Curl_easy *data, + int ftpcode) +{ + CURLcode result = CURLE_OK; + if(ftpcode != 230) { + failf(data, "ACCT rejected by server: %03d", ftpcode); + result = CURLE_FTP_WEIRD_PASS_REPLY; /* FIX */ + } + else + result = ftp_state_loggedin(data); + + return result; +} + + +static CURLcode ftp_statemachine(struct Curl_easy *data, + struct connectdata *conn) +{ + CURLcode result; + curl_socket_t sock = conn->sock[FIRSTSOCKET]; + int ftpcode; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + static const char ftpauth[][4] = { "SSL", "TLS" }; + size_t nread = 0; + + if(pp->sendleft) + return Curl_pp_flushsend(data, pp); + + result = ftp_readresp(data, sock, pp, &ftpcode, &nread); + if(result) + return result; + + if(ftpcode) { + /* we have now received a full FTP server response */ + switch(ftpc->state) { + case FTP_WAIT220: + if(ftpcode == 230) { + /* 230 User logged in - already! Take as 220 if TLS required. */ + if(data->set.use_ssl <= CURLUSESSL_TRY || + conn->bits.ftp_use_control_ssl) + return ftp_state_user_resp(data, ftpcode, ftpc->state); + } + else if(ftpcode != 220) { + failf(data, "Got a %03d ftp-server response when 220 was expected", + ftpcode); + return CURLE_WEIRD_SERVER_REPLY; + } + + /* We have received a 220 response fine, now we proceed. */ +#ifdef HAVE_GSSAPI + if(data->set.krb) { + /* If not anonymous login, try a secure login. Note that this + procedure is still BLOCKING. */ + + Curl_sec_request_prot(conn, "private"); + /* We set private first as default, in case the line below fails to + set a valid level */ + Curl_sec_request_prot(conn, data->set.str[STRING_KRB_LEVEL]); + + if(Curl_sec_login(data, conn)) + infof(data, "Logging in with password in cleartext!"); + else + infof(data, "Authentication successful"); + } +#endif + + if(data->set.use_ssl && !conn->bits.ftp_use_control_ssl) { + /* We don't have a SSL/TLS control connection yet, but FTPS is + requested. Try a FTPS connection now */ + + ftpc->count3 = 0; + switch(data->set.ftpsslauth) { + case CURLFTPAUTH_DEFAULT: + case CURLFTPAUTH_SSL: + ftpc->count2 = 1; /* add one to get next */ + ftpc->count1 = 0; + break; + case CURLFTPAUTH_TLS: + ftpc->count2 = -1; /* subtract one to get next */ + ftpc->count1 = 1; + break; + default: + failf(data, "unsupported parameter to CURLOPT_FTPSSLAUTH: %d", + (int)data->set.ftpsslauth); + return CURLE_UNKNOWN_OPTION; /* we don't know what to do */ + } + result = Curl_pp_sendf(data, &ftpc->pp, "AUTH %s", + ftpauth[ftpc->count1]); + if(!result) + state(data, FTP_AUTH); + } + else + result = ftp_state_user(data, conn); + break; + + case FTP_AUTH: + /* we have gotten the response to a previous AUTH command */ + + if(pp->cache_size) + return CURLE_WEIRD_SERVER_REPLY; /* Forbid pipelining in response. */ + + /* RFC2228 (page 5) says: + * + * If the server is willing to accept the named security mechanism, + * and does not require any security data, it must respond with + * reply code 234/334. + */ + + if((ftpcode == 234) || (ftpcode == 334)) { + /* Curl_ssl_connect is BLOCKING */ + result = Curl_ssl_connect(data, conn, FIRSTSOCKET); + if(!result) { + conn->bits.ftp_use_data_ssl = FALSE; /* clear-text data */ + conn->bits.ftp_use_control_ssl = TRUE; /* SSL on control */ + result = ftp_state_user(data, conn); + } + } + else if(ftpc->count3 < 1) { + ftpc->count3++; + ftpc->count1 += ftpc->count2; /* get next attempt */ + result = Curl_pp_sendf(data, &ftpc->pp, "AUTH %s", + ftpauth[ftpc->count1]); + /* remain in this same state */ + } + else { + if(data->set.use_ssl > CURLUSESSL_TRY) + /* we failed and CURLUSESSL_CONTROL or CURLUSESSL_ALL is set */ + result = CURLE_USE_SSL_FAILED; + else + /* ignore the failure and continue */ + result = ftp_state_user(data, conn); + } + break; + + case FTP_USER: + case FTP_PASS: + result = ftp_state_user_resp(data, ftpcode, ftpc->state); + break; + + case FTP_ACCT: + result = ftp_state_acct_resp(data, ftpcode); + break; + + case FTP_PBSZ: + result = + Curl_pp_sendf(data, &ftpc->pp, "PROT %c", + data->set.use_ssl == CURLUSESSL_CONTROL ? 'C' : 'P'); + if(!result) + state(data, FTP_PROT); + break; + + case FTP_PROT: + if(ftpcode/100 == 2) + /* We have enabled SSL for the data connection! */ + conn->bits.ftp_use_data_ssl = + (data->set.use_ssl != CURLUSESSL_CONTROL) ? TRUE : FALSE; + /* FTP servers typically responds with 500 if they decide to reject + our 'P' request */ + else if(data->set.use_ssl > CURLUSESSL_CONTROL) + /* we failed and bails out */ + return CURLE_USE_SSL_FAILED; + + if(data->set.ftp_ccc) { + /* CCC - Clear Command Channel + */ + result = Curl_pp_sendf(data, &ftpc->pp, "%s", "CCC"); + if(!result) + state(data, FTP_CCC); + } + else + result = ftp_state_pwd(data, conn); + break; + + case FTP_CCC: + if(ftpcode < 500) { + /* First shut down the SSL layer (note: this call will block) */ + result = Curl_ssl_shutdown(data, conn, FIRSTSOCKET); + + if(result) + failf(data, "Failed to clear the command channel (CCC)"); + } + if(!result) + /* Then continue as normal */ + result = ftp_state_pwd(data, conn); + break; + + case FTP_PWD: + if(ftpcode == 257) { + char *ptr = &data->state.buffer[4]; /* start on the first letter */ + const size_t buf_size = data->set.buffer_size; + char *dir; + bool entry_extracted = FALSE; + + dir = malloc(nread + 1); + if(!dir) + return CURLE_OUT_OF_MEMORY; + + /* Reply format is like + 257[rubbish]"" and the + RFC959 says + + The directory name can contain any character; embedded + double-quotes should be escaped by double-quotes (the + "quote-doubling" convention). + */ + + /* scan for the first double-quote for non-standard responses */ + while(ptr < &data->state.buffer[buf_size] + && *ptr != '\n' && *ptr != '\0' && *ptr != '"') + ptr++; + + if('\"' == *ptr) { + /* it started good */ + char *store; + ptr++; + for(store = dir; *ptr;) { + if('\"' == *ptr) { + if('\"' == ptr[1]) { + /* "quote-doubling" */ + *store = ptr[1]; + ptr++; + } + else { + /* end of path */ + entry_extracted = TRUE; + break; /* get out of this loop */ + } + } + else + *store = *ptr; + store++; + ptr++; + } + *store = '\0'; /* null-terminate */ + } + if(entry_extracted) { + /* If the path name does not look like an absolute path (i.e.: it + does not start with a '/'), we probably need some server-dependent + adjustments. For example, this is the case when connecting to + an OS400 FTP server: this server supports two name syntaxes, + the default one being incompatible with standard paths. In + addition, this server switches automatically to the regular path + syntax when one is encountered in a command: this results in + having an entrypath in the wrong syntax when later used in CWD. + The method used here is to check the server OS: we do it only + if the path name looks strange to minimize overhead on other + systems. */ + + if(!ftpc->server_os && dir[0] != '/') { + result = Curl_pp_sendf(data, &ftpc->pp, "%s", "SYST"); + if(result) { + free(dir); + return result; + } + Curl_safefree(ftpc->entrypath); + ftpc->entrypath = dir; /* remember this */ + infof(data, "Entry path is '%s'", ftpc->entrypath); + /* also save it where getinfo can access it: */ + data->state.most_recent_ftp_entrypath = ftpc->entrypath; + state(data, FTP_SYST); + break; + } + + Curl_safefree(ftpc->entrypath); + ftpc->entrypath = dir; /* remember this */ + infof(data, "Entry path is '%s'", ftpc->entrypath); + /* also save it where getinfo can access it: */ + data->state.most_recent_ftp_entrypath = ftpc->entrypath; + } + else { + /* couldn't get the path */ + free(dir); + infof(data, "Failed to figure out path"); + } + } + state(data, FTP_STOP); /* we are done with the CONNECT phase! */ + DEBUGF(infof(data, "protocol connect phase DONE")); + break; + + case FTP_SYST: + if(ftpcode == 215) { + char *ptr = &data->state.buffer[4]; /* start on the first letter */ + char *os; + char *store; + + os = malloc(nread + 1); + if(!os) + return CURLE_OUT_OF_MEMORY; + + /* Reply format is like + 215 + */ + while(*ptr == ' ') + ptr++; + for(store = os; *ptr && *ptr != ' ';) + *store++ = *ptr++; + *store = '\0'; /* null-terminate */ + + /* Check for special servers here. */ + + if(strcasecompare(os, "OS/400")) { + /* Force OS400 name format 1. */ + result = Curl_pp_sendf(data, &ftpc->pp, "%s", "SITE NAMEFMT 1"); + if(result) { + free(os); + return result; + } + /* remember target server OS */ + Curl_safefree(ftpc->server_os); + ftpc->server_os = os; + state(data, FTP_NAMEFMT); + break; + } + /* Nothing special for the target server. */ + /* remember target server OS */ + Curl_safefree(ftpc->server_os); + ftpc->server_os = os; + } + else { + /* Cannot identify server OS. Continue anyway and cross fingers. */ + } + + state(data, FTP_STOP); /* we are done with the CONNECT phase! */ + DEBUGF(infof(data, "protocol connect phase DONE")); + break; + + case FTP_NAMEFMT: + if(ftpcode == 250) { + /* Name format change successful: reload initial path. */ + ftp_state_pwd(data, conn); + break; + } + + state(data, FTP_STOP); /* we are done with the CONNECT phase! */ + DEBUGF(infof(data, "protocol connect phase DONE")); + break; + + case FTP_QUOTE: + case FTP_POSTQUOTE: + case FTP_RETR_PREQUOTE: + case FTP_STOR_PREQUOTE: + if((ftpcode >= 400) && !ftpc->count2) { + /* failure response code, and not allowed to fail */ + failf(data, "QUOT command failed with %03d", ftpcode); + result = CURLE_QUOTE_ERROR; + } + else + result = ftp_state_quote(data, FALSE, ftpc->state); + break; + + case FTP_CWD: + if(ftpcode/100 != 2) { + /* failure to CWD there */ + if(data->set.ftp_create_missing_dirs && + ftpc->cwdcount && !ftpc->count2) { + /* try making it */ + ftpc->count2++; /* counter to prevent CWD-MKD loops */ + result = Curl_pp_sendf(data, &ftpc->pp, "MKD %s", + ftpc->dirs[ftpc->cwdcount - 1]); + if(!result) + state(data, FTP_MKD); + } + else { + /* return failure */ + failf(data, "Server denied you to change to the given directory"); + ftpc->cwdfail = TRUE; /* don't remember this path as we failed + to enter it */ + result = CURLE_REMOTE_ACCESS_DENIED; + } + } + else { + /* success */ + ftpc->count2 = 0; + if(++ftpc->cwdcount <= ftpc->dirdepth) + /* send next CWD */ + result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", + ftpc->dirs[ftpc->cwdcount - 1]); + else + result = ftp_state_mdtm(data); + } + break; + + case FTP_MKD: + if((ftpcode/100 != 2) && !ftpc->count3--) { + /* failure to MKD the dir */ + failf(data, "Failed to MKD dir: %03d", ftpcode); + result = CURLE_REMOTE_ACCESS_DENIED; + } + else { + state(data, FTP_CWD); + /* send CWD */ + result = Curl_pp_sendf(data, &ftpc->pp, "CWD %s", + ftpc->dirs[ftpc->cwdcount - 1]); + } + break; + + case FTP_MDTM: + result = ftp_state_mdtm_resp(data, ftpcode); + break; + + case FTP_TYPE: + case FTP_LIST_TYPE: + case FTP_RETR_TYPE: + case FTP_STOR_TYPE: + result = ftp_state_type_resp(data, ftpcode, ftpc->state); + break; + + case FTP_SIZE: + case FTP_RETR_SIZE: + case FTP_STOR_SIZE: + result = ftp_state_size_resp(data, ftpcode, ftpc->state); + break; + + case FTP_REST: + case FTP_RETR_REST: + result = ftp_state_rest_resp(data, conn, ftpcode, ftpc->state); + break; + + case FTP_PRET: + if(ftpcode != 200) { + /* there only is this one standard OK return code. */ + failf(data, "PRET command not accepted: %03d", ftpcode); + return CURLE_FTP_PRET_FAILED; + } + result = ftp_state_use_pasv(data, conn); + break; + + case FTP_PASV: + result = ftp_state_pasv_resp(data, ftpcode); + break; + + case FTP_PORT: + result = ftp_state_port_resp(data, ftpcode); + break; + + case FTP_LIST: + case FTP_RETR: + result = ftp_state_get_resp(data, ftpcode, ftpc->state); + break; + + case FTP_STOR: + result = ftp_state_stor_resp(data, ftpcode, ftpc->state); + break; + + case FTP_QUIT: + /* fallthrough, just stop! */ + default: + /* internal error */ + state(data, FTP_STOP); + break; + } + } /* if(ftpcode) */ + + return result; +} + + +/* called repeatedly until done from multi.c */ +static CURLcode ftp_multi_statemach(struct Curl_easy *data, + bool *done) +{ + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result = Curl_pp_statemach(data, &ftpc->pp, FALSE, FALSE); + + /* Check for the state outside of the Curl_socket_check() return code checks + since at times we are in fact already in this state when this function + gets called. */ + *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE; + + return result; +} + +static CURLcode ftp_block_statemach(struct Curl_easy *data, + struct connectdata *conn) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + CURLcode result = CURLE_OK; + + while(ftpc->state != FTP_STOP) { + result = Curl_pp_statemach(data, pp, TRUE, TRUE /* disconnecting */); + if(result) + break; + } + + return result; +} + +/* + * ftp_connect() should do everything that is to be considered a part of + * the connection phase. + * + * The variable 'done' points to will be TRUE if the protocol-layer connect + * phase is done when this function returns, or FALSE if not. + * + */ +static CURLcode ftp_connect(struct Curl_easy *data, + bool *done) /* see description above */ +{ + CURLcode result; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + + *done = FALSE; /* default to not done yet */ + + /* We always support persistent connections on ftp */ + connkeep(conn, "FTP default"); + + PINGPONG_SETUP(pp, ftp_statemachine, ftp_endofresp); + + if(conn->handler->flags & PROTOPT_SSL) { + /* BLOCKING */ + result = Curl_ssl_connect(data, conn, FIRSTSOCKET); + if(result) + return result; + conn->bits.ftp_use_control_ssl = TRUE; + } + + Curl_pp_setup(pp); /* once per transfer */ + Curl_pp_init(data, pp); /* init the generic pingpong data */ + + /* When we connect, we start in the state where we await the 220 + response */ + state(data, FTP_WAIT220); + + result = ftp_multi_statemach(data, done); + + return result; +} + +/*********************************************************************** + * + * ftp_done() + * + * The DONE function. This does what needs to be done after a single DO has + * performed. + * + * Input argument is already checked for validity. + */ +static CURLcode ftp_done(struct Curl_easy *data, CURLcode status, + bool premature) +{ + struct connectdata *conn = data->conn; + struct FTP *ftp = data->req.p.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + ssize_t nread; + int ftpcode; + CURLcode result = CURLE_OK; + char *rawPath = NULL; + size_t pathLen = 0; + + if(!ftp) + return CURLE_OK; + + switch(status) { + case CURLE_BAD_DOWNLOAD_RESUME: + case CURLE_FTP_WEIRD_PASV_REPLY: + case CURLE_FTP_PORT_FAILED: + case CURLE_FTP_ACCEPT_FAILED: + case CURLE_FTP_ACCEPT_TIMEOUT: + case CURLE_FTP_COULDNT_SET_TYPE: + case CURLE_FTP_COULDNT_RETR_FILE: + case CURLE_PARTIAL_FILE: + case CURLE_UPLOAD_FAILED: + case CURLE_REMOTE_ACCESS_DENIED: + case CURLE_FILESIZE_EXCEEDED: + case CURLE_REMOTE_FILE_NOT_FOUND: + case CURLE_WRITE_ERROR: + /* the connection stays alive fine even though this happened */ + /* fall-through */ + case CURLE_OK: /* doesn't affect the control connection's status */ + if(!premature) + break; + + /* until we cope better with prematurely ended requests, let them + * fallback as if in complete failure */ + /* FALLTHROUGH */ + default: /* by default, an error means the control connection is + wedged and should not be used anymore */ + ftpc->ctl_valid = FALSE; + ftpc->cwdfail = TRUE; /* set this TRUE to prevent us to remember the + current path, as this connection is going */ + connclose(conn, "FTP ended with bad error code"); + result = status; /* use the already set error code */ + break; + } + + if(data->state.wildcardmatch) { + if(data->set.chunk_end && ftpc->file) { + Curl_set_in_callback(data, true); + data->set.chunk_end(data->wildcard.customptr); + Curl_set_in_callback(data, false); + } + ftpc->known_filesize = -1; + } + + if(!result) + /* get the url-decoded "raw" path */ + result = Curl_urldecode(data, ftp->path, 0, &rawPath, &pathLen, + REJECT_CTRL); + if(result) { + /* We can limp along anyway (and should try to since we may already be in + * the error path) */ + ftpc->ctl_valid = FALSE; /* mark control connection as bad */ + connclose(conn, "FTP: out of memory!"); /* mark for connection closure */ + free(ftpc->prevpath); + ftpc->prevpath = NULL; /* no path remembering */ + } + else { /* remember working directory for connection reuse */ + if((data->set.ftp_filemethod == FTPFILE_NOCWD) && (rawPath[0] == '/')) + free(rawPath); /* full path => no CWDs happened => keep ftpc->prevpath */ + else { + free(ftpc->prevpath); + + if(!ftpc->cwdfail) { + if(data->set.ftp_filemethod == FTPFILE_NOCWD) + pathLen = 0; /* relative path => working directory is FTP home */ + else + pathLen -= ftpc->file?strlen(ftpc->file):0; /* file is url-decoded */ + + rawPath[pathLen] = '\0'; + ftpc->prevpath = rawPath; + } + else { + free(rawPath); + ftpc->prevpath = NULL; /* no path */ + } + } + + if(ftpc->prevpath) + infof(data, "Remembering we are in dir \"%s\"", ftpc->prevpath); + } + + /* free the dir tree and file parts */ + freedirs(ftpc); + + /* shut down the socket to inform the server we're done */ + +#ifdef _WIN32_WCE + shutdown(conn->sock[SECONDARYSOCKET], 2); /* SD_BOTH */ +#endif + + if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) { + if(!result && ftpc->dont_check && data->req.maxdownload > 0) { + /* partial download completed */ + result = Curl_pp_sendf(data, pp, "%s", "ABOR"); + if(result) { + failf(data, "Failure sending ABOR command: %s", + curl_easy_strerror(result)); + ftpc->ctl_valid = FALSE; /* mark control connection as bad */ + connclose(conn, "ABOR command failed"); /* connection closure */ + } + } + + if(conn->ssl[SECONDARYSOCKET].use) { + /* The secondary socket is using SSL so we must close down that part + first before we close the socket for real */ + Curl_ssl_close(data, conn, SECONDARYSOCKET); + + /* Note that we keep "use" set to TRUE since that (next) connection is + still requested to use SSL */ + } + close_secondarysocket(data, conn); + } + + if(!result && (ftp->transfer == PPTRANSFER_BODY) && ftpc->ctl_valid && + pp->pending_resp && !premature) { + /* + * Let's see what the server says about the transfer we just performed, + * but lower the timeout as sometimes this connection has died while the + * data has been transferred. This happens when doing through NATs etc that + * abandon old silent connections. + */ + timediff_t old_time = pp->response_time; + + pp->response_time = 60*1000; /* give it only a minute for now */ + pp->response = Curl_now(); /* timeout relative now */ + + result = Curl_GetFTPResponse(data, &nread, &ftpcode); + + pp->response_time = old_time; /* set this back to previous value */ + + if(!nread && (CURLE_OPERATION_TIMEDOUT == result)) { + failf(data, "control connection looks dead"); + ftpc->ctl_valid = FALSE; /* mark control connection as bad */ + connclose(conn, "Timeout or similar in FTP DONE operation"); /* close */ + } + + if(result) { + Curl_safefree(ftp->pathalloc); + return result; + } + + if(ftpc->dont_check && data->req.maxdownload > 0) { + /* we have just sent ABOR and there is no reliable way to check if it was + * successful or not; we have to close the connection now */ + infof(data, "partial download completed, closing connection"); + connclose(conn, "Partial download with no ability to check"); + return result; + } + + if(!ftpc->dont_check) { + /* 226 Transfer complete, 250 Requested file action okay, completed. */ + switch(ftpcode) { + case 226: + case 250: + break; + case 552: + failf(data, "Exceeded storage allocation"); + result = CURLE_REMOTE_DISK_FULL; + break; + default: + failf(data, "server did not report OK, got %d", ftpcode); + result = CURLE_PARTIAL_FILE; + break; + } + } + } + + if(result || premature) + /* the response code from the transfer showed an error already so no + use checking further */ + ; + else if(data->set.upload) { + if((-1 != data->state.infilesize) && + (data->state.infilesize != data->req.writebytecount) && + !data->set.crlf && + (ftp->transfer == PPTRANSFER_BODY)) { + failf(data, "Uploaded unaligned file size (%" CURL_FORMAT_CURL_OFF_T + " out of %" CURL_FORMAT_CURL_OFF_T " bytes)", + data->req.bytecount, data->state.infilesize); + result = CURLE_PARTIAL_FILE; + } + } + else { + if((-1 != data->req.size) && + (data->req.size != data->req.bytecount) && +#ifdef CURL_DO_LINEEND_CONV + /* Most FTP servers don't adjust their file SIZE response for CRLFs, so + * we'll check to see if the discrepancy can be explained by the number + * of CRLFs we've changed to LFs. + */ + ((data->req.size + data->state.crlf_conversions) != + data->req.bytecount) && +#endif /* CURL_DO_LINEEND_CONV */ + (data->req.maxdownload != data->req.bytecount)) { + failf(data, "Received only partial file: %" CURL_FORMAT_CURL_OFF_T + " bytes", data->req.bytecount); + result = CURLE_PARTIAL_FILE; + } + else if(!ftpc->dont_check && + !data->req.bytecount && + (data->req.size>0)) { + failf(data, "No data was received!"); + result = CURLE_FTP_COULDNT_RETR_FILE; + } + } + + /* clear these for next connection */ + ftp->transfer = PPTRANSFER_BODY; + ftpc->dont_check = FALSE; + + /* Send any post-transfer QUOTE strings? */ + if(!status && !result && !premature && data->set.postquote) + result = ftp_sendquote(data, conn, data->set.postquote); + Curl_safefree(ftp->pathalloc); + return result; +} + +/*********************************************************************** + * + * ftp_sendquote() + * + * Where a 'quote' means a list of custom commands to send to the server. + * The quote list is passed as an argument. + * + * BLOCKING + */ + +static +CURLcode ftp_sendquote(struct Curl_easy *data, + struct connectdata *conn, struct curl_slist *quote) +{ + struct curl_slist *item; + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + + item = quote; + while(item) { + if(item->data) { + ssize_t nread; + char *cmd = item->data; + bool acceptfail = FALSE; + CURLcode result; + int ftpcode = 0; + + /* if a command starts with an asterisk, which a legal FTP command never + can, the command will be allowed to fail without it causing any + aborts or cancels etc. It will cause libcurl to act as if the command + is successful, whatever the server reponds. */ + + if(cmd[0] == '*') { + cmd++; + acceptfail = TRUE; + } + + result = Curl_pp_sendf(data, &ftpc->pp, "%s", cmd); + if(!result) { + pp->response = Curl_now(); /* timeout relative now */ + result = Curl_GetFTPResponse(data, &nread, &ftpcode); + } + if(result) + return result; + + if(!acceptfail && (ftpcode >= 400)) { + failf(data, "QUOT string not accepted: %s", cmd); + return CURLE_QUOTE_ERROR; + } + } + + item = item->next; + } + + return CURLE_OK; +} + +/*********************************************************************** + * + * ftp_need_type() + * + * Returns TRUE if we in the current situation should send TYPE + */ +static int ftp_need_type(struct connectdata *conn, + bool ascii_wanted) +{ + return conn->proto.ftpc.transfertype != (ascii_wanted?'A':'I'); +} + +/*********************************************************************** + * + * ftp_nb_type() + * + * Set TYPE. We only deal with ASCII or BINARY so this function + * sets one of them. + * If the transfer type is not sent, simulate on OK response in newstate + */ +static CURLcode ftp_nb_type(struct Curl_easy *data, + struct connectdata *conn, + bool ascii, ftpstate newstate) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result; + char want = (char)(ascii?'A':'I'); + + if(ftpc->transfertype == want) { + state(data, newstate); + return ftp_state_type_resp(data, 200, newstate); + } + + result = Curl_pp_sendf(data, &ftpc->pp, "TYPE %c", want); + if(!result) { + state(data, newstate); + + /* keep track of our current transfer type */ + ftpc->transfertype = want; + } + return result; +} + +/*************************************************************************** + * + * ftp_pasv_verbose() + * + * This function only outputs some informationals about this second connection + * when we've issued a PASV command before and thus we have connected to a + * possibly new IP address. + * + */ +#ifndef CURL_DISABLE_VERBOSE_STRINGS +static void +ftp_pasv_verbose(struct Curl_easy *data, + struct Curl_addrinfo *ai, + char *newhost, /* ascii version */ + int port) +{ + char buf[256]; + Curl_printable_address(ai, buf, sizeof(buf)); + infof(data, "Connecting to %s (%s) port %d", newhost, buf, port); +} +#endif + +/* + * ftp_do_more() + * + * This function shall be called when the second FTP (data) connection is + * connected. + * + * 'complete' can return 0 for incomplete, 1 for done and -1 for go back + * (which basically is only for when PASV is being sent to retry a failed + * EPSV). + */ + +static CURLcode ftp_do_more(struct Curl_easy *data, int *completep) +{ + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + CURLcode result = CURLE_OK; + bool connected = FALSE; + bool complete = FALSE; + + /* the ftp struct is inited in ftp_connect() */ + struct FTP *ftp = data->req.p.ftp; + + /* if the second connection isn't done yet, wait for it */ + if(!conn->bits.tcpconnect[SECONDARYSOCKET]) { + if(Curl_connect_ongoing(conn)) { + /* As we're in TUNNEL_CONNECT state now, we know the proxy name and port + aren't used so we blank their arguments. */ + result = Curl_proxyCONNECT(data, SECONDARYSOCKET, NULL, 0); + + return result; + } + + result = Curl_is_connected(data, conn, SECONDARYSOCKET, &connected); + + /* Ready to do more? */ + if(connected) { + DEBUGF(infof(data, "DO-MORE connected phase starts")); + } + else { + if(result && (ftpc->count1 == 0)) { + *completep = -1; /* go back to DOING please */ + /* this is a EPSV connect failing, try PASV instead */ + return ftp_epsv_disable(data, conn); + } + return result; + } + } + +#ifndef CURL_DISABLE_PROXY + result = Curl_proxy_connect(data, SECONDARYSOCKET); + if(result) + return result; + + if(CONNECT_SECONDARYSOCKET_PROXY_SSL()) + return result; + + if(conn->bits.tunnel_proxy && conn->bits.httpproxy && + Curl_connect_ongoing(conn)) + return result; +#endif + + if(ftpc->state) { + /* already in a state so skip the initial commands. + They are only done to kickstart the do_more state */ + result = ftp_multi_statemach(data, &complete); + + *completep = (int)complete; + + /* if we got an error or if we don't wait for a data connection return + immediately */ + if(result || !ftpc->wait_data_conn) + return result; + + /* if we reach the end of the FTP state machine here, *complete will be + TRUE but so is ftpc->wait_data_conn, which says we need to wait for the + data connection and therefore we're not actually complete */ + *completep = 0; + } + + if(ftp->transfer <= PPTRANSFER_INFO) { + /* a transfer is about to take place, or if not a file name was given + so we'll do a SIZE on it later and then we need the right TYPE first */ + + if(ftpc->wait_data_conn == TRUE) { + bool serv_conned; + + result = ReceivedServerConnect(data, &serv_conned); + if(result) + return result; /* Failed to accept data connection */ + + if(serv_conned) { + /* It looks data connection is established */ + result = AcceptServerConnect(data); + ftpc->wait_data_conn = FALSE; + if(!result) + result = InitiateTransfer(data); + + if(result) + return result; + + *completep = 1; /* this state is now complete when the server has + connected back to us */ + } + } + else if(data->set.upload) { + result = ftp_nb_type(data, conn, data->state.prefer_ascii, + FTP_STOR_TYPE); + if(result) + return result; + + result = ftp_multi_statemach(data, &complete); + if(ftpc->wait_data_conn) + /* if we reach the end of the FTP state machine here, *complete will be + TRUE but so is ftpc->wait_data_conn, which says we need to wait for + the data connection and therefore we're not actually complete */ + *completep = 0; + else + *completep = (int)complete; + } + else { + /* download */ + ftp->downloadsize = -1; /* unknown as of yet */ + + result = Curl_range(data); + + if(result == CURLE_OK && data->req.maxdownload >= 0) { + /* Don't check for successful transfer */ + ftpc->dont_check = TRUE; + } + + if(result) + ; + else if(data->state.list_only || !ftpc->file) { + /* The specified path ends with a slash, and therefore we think this + is a directory that is requested, use LIST. But before that we + need to set ASCII transfer mode. */ + + /* But only if a body transfer was requested. */ + if(ftp->transfer == PPTRANSFER_BODY) { + result = ftp_nb_type(data, conn, TRUE, FTP_LIST_TYPE); + if(result) + return result; + } + /* otherwise just fall through */ + } + else { + result = ftp_nb_type(data, conn, data->state.prefer_ascii, + FTP_RETR_TYPE); + if(result) + return result; + } + + result = ftp_multi_statemach(data, &complete); + *completep = (int)complete; + } + return result; + } + + /* no data to transfer */ + Curl_setup_transfer(data, -1, -1, FALSE, -1); + + if(!ftpc->wait_data_conn) { + /* no waiting for the data connection so this is now complete */ + *completep = 1; + DEBUGF(infof(data, "DO-MORE phase ends with %d", (int)result)); + } + + return result; +} + + + +/*********************************************************************** + * + * ftp_perform() + * + * This is the actual DO function for FTP. Get a file/directory according to + * the options previously setup. + */ + +static +CURLcode ftp_perform(struct Curl_easy *data, + bool *connected, /* connect status after PASV / PORT */ + bool *dophase_done) +{ + /* this is FTP and no proxy */ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + + DEBUGF(infof(data, "DO phase starts")); + + if(data->set.opt_no_body) { + /* requested no body means no transfer... */ + struct FTP *ftp = data->req.p.ftp; + ftp->transfer = PPTRANSFER_INFO; + } + + *dophase_done = FALSE; /* not done yet */ + + /* start the first command in the DO phase */ + result = ftp_state_quote(data, TRUE, FTP_QUOTE); + if(result) + return result; + + /* run the state-machine */ + result = ftp_multi_statemach(data, dophase_done); + + *connected = conn->bits.tcpconnect[SECONDARYSOCKET]; + + infof(data, "ftp_perform ends with SECONDARY: %d", *connected); + + if(*dophase_done) + DEBUGF(infof(data, "DO phase is complete1")); + + return result; +} + +static void wc_data_dtor(void *ptr) +{ + struct ftp_wc *ftpwc = ptr; + if(ftpwc && ftpwc->parser) + Curl_ftp_parselist_data_free(&ftpwc->parser); + free(ftpwc); +} + +static CURLcode init_wc_data(struct Curl_easy *data) +{ + char *last_slash; + struct FTP *ftp = data->req.p.ftp; + char *path = ftp->path; + struct WildcardData *wildcard = &(data->wildcard); + CURLcode result = CURLE_OK; + struct ftp_wc *ftpwc = NULL; + + last_slash = strrchr(ftp->path, '/'); + if(last_slash) { + last_slash++; + if(last_slash[0] == '\0') { + wildcard->state = CURLWC_CLEAN; + result = ftp_parse_url_path(data); + return result; + } + wildcard->pattern = strdup(last_slash); + if(!wildcard->pattern) + return CURLE_OUT_OF_MEMORY; + last_slash[0] = '\0'; /* cut file from path */ + } + else { /* there is only 'wildcard pattern' or nothing */ + if(path[0]) { + wildcard->pattern = strdup(path); + if(!wildcard->pattern) + return CURLE_OUT_OF_MEMORY; + path[0] = '\0'; + } + else { /* only list */ + wildcard->state = CURLWC_CLEAN; + result = ftp_parse_url_path(data); + return result; + } + } + + /* program continues only if URL is not ending with slash, allocate needed + resources for wildcard transfer */ + + /* allocate ftp protocol specific wildcard data */ + ftpwc = calloc(1, sizeof(struct ftp_wc)); + if(!ftpwc) { + result = CURLE_OUT_OF_MEMORY; + goto fail; + } + + /* INITIALIZE parselist structure */ + ftpwc->parser = Curl_ftp_parselist_data_alloc(); + if(!ftpwc->parser) { + result = CURLE_OUT_OF_MEMORY; + goto fail; + } + + wildcard->protdata = ftpwc; /* put it to the WildcardData tmp pointer */ + wildcard->dtor = wc_data_dtor; + + /* wildcard does not support NOCWD option (assert it?) */ + if(data->set.ftp_filemethod == FTPFILE_NOCWD) + data->set.ftp_filemethod = FTPFILE_MULTICWD; + + /* try to parse ftp url */ + result = ftp_parse_url_path(data); + if(result) { + goto fail; + } + + wildcard->path = strdup(ftp->path); + if(!wildcard->path) { + result = CURLE_OUT_OF_MEMORY; + goto fail; + } + + /* backup old write_function */ + ftpwc->backup.write_function = data->set.fwrite_func; + /* parsing write function */ + data->set.fwrite_func = Curl_ftp_parselist; + /* backup old file descriptor */ + ftpwc->backup.file_descriptor = data->set.out; + /* let the writefunc callback know the transfer */ + data->set.out = data; + + infof(data, "Wildcard - Parsing started"); + return CURLE_OK; + + fail: + if(ftpwc) { + Curl_ftp_parselist_data_free(&ftpwc->parser); + free(ftpwc); + } + Curl_safefree(wildcard->pattern); + wildcard->dtor = ZERO_NULL; + wildcard->protdata = NULL; + return result; +} + +static CURLcode wc_statemach(struct Curl_easy *data) +{ + struct WildcardData * const wildcard = &(data->wildcard); + struct connectdata *conn = data->conn; + CURLcode result = CURLE_OK; + + for(;;) { + switch(wildcard->state) { + case CURLWC_INIT: + result = init_wc_data(data); + if(wildcard->state == CURLWC_CLEAN) + /* only listing! */ + return result; + wildcard->state = result ? CURLWC_ERROR : CURLWC_MATCHING; + return result; + + case CURLWC_MATCHING: { + /* In this state is LIST response successfully parsed, so lets restore + previous WRITEFUNCTION callback and WRITEDATA pointer */ + struct ftp_wc *ftpwc = wildcard->protdata; + data->set.fwrite_func = ftpwc->backup.write_function; + data->set.out = ftpwc->backup.file_descriptor; + ftpwc->backup.write_function = ZERO_NULL; + ftpwc->backup.file_descriptor = NULL; + wildcard->state = CURLWC_DOWNLOADING; + + if(Curl_ftp_parselist_geterror(ftpwc->parser)) { + /* error found in LIST parsing */ + wildcard->state = CURLWC_CLEAN; + continue; + } + if(wildcard->filelist.size == 0) { + /* no corresponding file */ + wildcard->state = CURLWC_CLEAN; + return CURLE_REMOTE_FILE_NOT_FOUND; + } + continue; + } + + case CURLWC_DOWNLOADING: { + /* filelist has at least one file, lets get first one */ + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct curl_fileinfo *finfo = wildcard->filelist.head->ptr; + struct FTP *ftp = data->req.p.ftp; + + char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename); + if(!tmp_path) + return CURLE_OUT_OF_MEMORY; + + /* switch default ftp->path and tmp_path */ + free(ftp->pathalloc); + ftp->pathalloc = ftp->path = tmp_path; + + infof(data, "Wildcard - START of \"%s\"", finfo->filename); + if(data->set.chunk_bgn) { + long userresponse; + Curl_set_in_callback(data, true); + userresponse = data->set.chunk_bgn( + finfo, wildcard->customptr, (int)wildcard->filelist.size); + Curl_set_in_callback(data, false); + switch(userresponse) { + case CURL_CHUNK_BGN_FUNC_SKIP: + infof(data, "Wildcard - \"%s\" skipped by user", + finfo->filename); + wildcard->state = CURLWC_SKIP; + continue; + case CURL_CHUNK_BGN_FUNC_FAIL: + return CURLE_CHUNK_FAILED; + } + } + + if(finfo->filetype != CURLFILETYPE_FILE) { + wildcard->state = CURLWC_SKIP; + continue; + } + + if(finfo->flags & CURLFINFOFLAG_KNOWN_SIZE) + ftpc->known_filesize = finfo->size; + + result = ftp_parse_url_path(data); + if(result) + return result; + + /* we don't need the Curl_fileinfo of first file anymore */ + Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL); + + if(wildcard->filelist.size == 0) { /* remains only one file to down. */ + wildcard->state = CURLWC_CLEAN; + /* after that will be ftp_do called once again and no transfer + will be done because of CURLWC_CLEAN state */ + return CURLE_OK; + } + return result; + } + + case CURLWC_SKIP: { + if(data->set.chunk_end) { + Curl_set_in_callback(data, true); + data->set.chunk_end(data->wildcard.customptr); + Curl_set_in_callback(data, false); + } + Curl_llist_remove(&wildcard->filelist, wildcard->filelist.head, NULL); + wildcard->state = (wildcard->filelist.size == 0) ? + CURLWC_CLEAN : CURLWC_DOWNLOADING; + continue; + } + + case CURLWC_CLEAN: { + struct ftp_wc *ftpwc = wildcard->protdata; + result = CURLE_OK; + if(ftpwc) + result = Curl_ftp_parselist_geterror(ftpwc->parser); + + wildcard->state = result ? CURLWC_ERROR : CURLWC_DONE; + return result; + } + + case CURLWC_DONE: + case CURLWC_ERROR: + case CURLWC_CLEAR: + if(wildcard->dtor) + wildcard->dtor(wildcard->protdata); + return result; + } + } + /* UNREACHABLE */ +} + +/*********************************************************************** + * + * ftp_do() + * + * This function is registered as 'curl_do' function. It decodes the path + * parts etc as a wrapper to the actual DO function (ftp_perform). + * + * The input argument is already checked for validity. + */ +static CURLcode ftp_do(struct Curl_easy *data, bool *done) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + *done = FALSE; /* default to false */ + ftpc->wait_data_conn = FALSE; /* default to no such wait */ + + if(data->state.wildcardmatch) { + result = wc_statemach(data); + if(data->wildcard.state == CURLWC_SKIP || + data->wildcard.state == CURLWC_DONE) { + /* do not call ftp_regular_transfer */ + return CURLE_OK; + } + if(result) /* error, loop or skipping the file */ + return result; + } + else { /* no wildcard FSM needed */ + result = ftp_parse_url_path(data); + if(result) + return result; + } + + result = ftp_regular_transfer(data, done); + + return result; +} + +/*********************************************************************** + * + * ftp_quit() + * + * This should be called before calling sclose() on an ftp control connection + * (not data connections). We should then wait for the response from the + * server before returning. The calling code should then try to close the + * connection. + * + */ +static CURLcode ftp_quit(struct Curl_easy *data, struct connectdata *conn) +{ + CURLcode result = CURLE_OK; + + if(conn->proto.ftpc.ctl_valid) { + result = Curl_pp_sendf(data, &conn->proto.ftpc.pp, "%s", "QUIT"); + if(result) { + failf(data, "Failure sending QUIT command: %s", + curl_easy_strerror(result)); + conn->proto.ftpc.ctl_valid = FALSE; /* mark control connection as bad */ + connclose(conn, "QUIT command failed"); /* mark for connection closure */ + state(data, FTP_STOP); + return result; + } + + state(data, FTP_QUIT); + + result = ftp_block_statemach(data, conn); + } + + return result; +} + +/*********************************************************************** + * + * ftp_disconnect() + * + * Disconnect from an FTP server. Cleanup protocol-specific per-connection + * resources. BLOCKING. + */ +static CURLcode ftp_disconnect(struct Curl_easy *data, + struct connectdata *conn, + bool dead_connection) +{ + struct ftp_conn *ftpc = &conn->proto.ftpc; + struct pingpong *pp = &ftpc->pp; + + /* We cannot send quit unconditionally. If this connection is stale or + bad in any way, sending quit and waiting around here will make the + disconnect wait in vain and cause more problems than we need to. + + ftp_quit() will check the state of ftp->ctl_valid. If it's ok it + will try to send the QUIT command, otherwise it will just return. + */ + if(dead_connection) + ftpc->ctl_valid = FALSE; + + /* The FTP session may or may not have been allocated/setup at this point! */ + (void)ftp_quit(data, conn); /* ignore errors on the QUIT */ + + if(ftpc->entrypath) { + if(data->state.most_recent_ftp_entrypath == ftpc->entrypath) { + data->state.most_recent_ftp_entrypath = NULL; + } + Curl_safefree(ftpc->entrypath); + } + + freedirs(ftpc); + Curl_safefree(ftpc->prevpath); + Curl_safefree(ftpc->server_os); + Curl_pp_disconnect(pp); + Curl_sec_end(conn); + return CURLE_OK; +} + +/*********************************************************************** + * + * ftp_parse_url_path() + * + * Parse the URL path into separate path components. + * + */ +static +CURLcode ftp_parse_url_path(struct Curl_easy *data) +{ + /* the ftp struct is already inited in ftp_connect() */ + struct FTP *ftp = data->req.p.ftp; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + const char *slashPos = NULL; + const char *fileName = NULL; + CURLcode result = CURLE_OK; + char *rawPath = NULL; /* url-decoded "raw" path */ + size_t pathLen = 0; + + ftpc->ctl_valid = FALSE; + ftpc->cwdfail = FALSE; + + /* url-decode ftp path before further evaluation */ + result = Curl_urldecode(data, ftp->path, 0, &rawPath, &pathLen, REJECT_CTRL); + if(result) + return result; + + switch(data->set.ftp_filemethod) { + case FTPFILE_NOCWD: /* fastest, but less standard-compliant */ + + if((pathLen > 0) && (rawPath[pathLen - 1] != '/')) + fileName = rawPath; /* this is a full file path */ + /* + else: ftpc->file is not used anywhere other than for operations on + a file. In other words, never for directory operations. + So we can safely leave filename as NULL here and use it as a + argument in dir/file decisions. + */ + break; + + case FTPFILE_SINGLECWD: + slashPos = strrchr(rawPath, '/'); + if(slashPos) { + /* get path before last slash, except for / */ + size_t dirlen = slashPos - rawPath; + if(dirlen == 0) + dirlen++; + + ftpc->dirs = calloc(1, sizeof(ftpc->dirs[0])); + if(!ftpc->dirs) { + free(rawPath); + return CURLE_OUT_OF_MEMORY; + } + + ftpc->dirs[0] = calloc(1, dirlen + 1); + if(!ftpc->dirs[0]) { + free(rawPath); + return CURLE_OUT_OF_MEMORY; + } + + strncpy(ftpc->dirs[0], rawPath, dirlen); + ftpc->dirdepth = 1; /* we consider it to be a single dir */ + fileName = slashPos + 1; /* rest is file name */ + } + else + fileName = rawPath; /* file name only (or empty) */ + break; + + default: /* allow pretty much anything */ + case FTPFILE_MULTICWD: { + /* current position: begin of next path component */ + const char *curPos = rawPath; + + int dirAlloc = 0; /* number of entries allocated for the 'dirs' array */ + const char *str = rawPath; + for(; *str != 0; ++str) + if (*str == '/') + ++dirAlloc; + + if(dirAlloc > 0) { + ftpc->dirs = calloc(dirAlloc, sizeof(ftpc->dirs[0])); + if(!ftpc->dirs) { + free(rawPath); + return CURLE_OUT_OF_MEMORY; + } + + /* parse the URL path into separate path components */ + while((slashPos = strchr(curPos, '/')) != NULL) { + size_t compLen = slashPos - curPos; + + /* path starts with a slash: add that as a directory */ + if((compLen == 0) && (ftpc->dirdepth == 0)) + ++compLen; + + /* we skip empty path components, like "x//y" since the FTP command + CWD requires a parameter and a non-existent parameter a) doesn't + work on many servers and b) has no effect on the others. */ + if(compLen > 0) { + char *comp = calloc(1, compLen + 1); + if(!comp) { + free(rawPath); + return CURLE_OUT_OF_MEMORY; + } + strncpy(comp, curPos, compLen); + ftpc->dirs[ftpc->dirdepth++] = comp; + } + curPos = slashPos + 1; + } + } + DEBUGASSERT(ftpc->dirdepth <= dirAlloc); + fileName = curPos; /* the rest is the file name (or empty) */ + } + break; + } /* switch */ + + if(fileName && *fileName) + ftpc->file = strdup(fileName); + else + ftpc->file = NULL; /* instead of point to a zero byte, + we make it a NULL pointer */ + + if(data->set.upload && !ftpc->file && (ftp->transfer == PPTRANSFER_BODY)) { + /* We need a file name when uploading. Return error! */ + failf(data, "Uploading to a URL without a file name!"); + free(rawPath); + return CURLE_URL_MALFORMAT; + } + + ftpc->cwddone = FALSE; /* default to not done */ + + if((data->set.ftp_filemethod == FTPFILE_NOCWD) && (rawPath[0] == '/')) + ftpc->cwddone = TRUE; /* skip CWD for absolute paths */ + else { /* newly created FTP connections are already in entry path */ + const char *oldPath = conn->bits.reuse ? ftpc->prevpath : ""; + if(oldPath) { + size_t n = pathLen; + if(data->set.ftp_filemethod == FTPFILE_NOCWD) + n = 0; /* CWD to entry for relative paths */ + else + n -= ftpc->file?strlen(ftpc->file):0; + + if((strlen(oldPath) == n) && !strncmp(rawPath, oldPath, n)) { + infof(data, "Request has same path as previous transfer"); + ftpc->cwddone = TRUE; + } + } + } + + free(rawPath); + return CURLE_OK; +} + +/* call this when the DO phase has completed */ +static CURLcode ftp_dophase_done(struct Curl_easy *data, bool connected) +{ + struct connectdata *conn = data->conn; + struct FTP *ftp = data->req.p.ftp; + struct ftp_conn *ftpc = &conn->proto.ftpc; + + if(connected) { + int completed; + CURLcode result = ftp_do_more(data, &completed); + + if(result) { + close_secondarysocket(data, conn); + return result; + } + } + + if(ftp->transfer != PPTRANSFER_BODY) + /* no data to transfer */ + Curl_setup_transfer(data, -1, -1, FALSE, -1); + else if(!connected) + /* since we didn't connect now, we want do_more to get called */ + conn->bits.do_more = TRUE; + + ftpc->ctl_valid = TRUE; /* seems good */ + + return CURLE_OK; +} + +/* called from multi.c while DOing */ +static CURLcode ftp_doing(struct Curl_easy *data, + bool *dophase_done) +{ + CURLcode result = ftp_multi_statemach(data, dophase_done); + + if(result) + DEBUGF(infof(data, "DO phase failed")); + else if(*dophase_done) { + result = ftp_dophase_done(data, FALSE /* not connected */); + + DEBUGF(infof(data, "DO phase is complete2")); + } + return result; +} + +/*********************************************************************** + * + * ftp_regular_transfer() + * + * The input argument is already checked for validity. + * + * Performs all commands done before a regular transfer between a local and a + * remote host. + * + * ftp->ctl_valid starts out as FALSE, and gets set to TRUE if we reach the + * ftp_done() function without finding any major problem. + */ +static +CURLcode ftp_regular_transfer(struct Curl_easy *data, + bool *dophase_done) +{ + CURLcode result = CURLE_OK; + bool connected = FALSE; + struct connectdata *conn = data->conn; + struct ftp_conn *ftpc = &conn->proto.ftpc; + data->req.size = -1; /* make sure this is unknown at this point */ + + Curl_pgrsSetUploadCounter(data, 0); + Curl_pgrsSetDownloadCounter(data, 0); + Curl_pgrsSetUploadSize(data, -1); + Curl_pgrsSetDownloadSize(data, -1); + + ftpc->ctl_valid = TRUE; /* starts good */ + + result = ftp_perform(data, + &connected, /* have we connected after PASV/PORT */ + dophase_done); /* all commands in the DO-phase done? */ + + if(!result) { + + if(!*dophase_done) + /* the DO phase has not completed yet */ + return CURLE_OK; + + result = ftp_dophase_done(data, connected); + + if(result) + return result; + } + else + freedirs(ftpc); + + return result; +} + +static CURLcode ftp_setup_connection(struct Curl_easy *data, + struct connectdata *conn) +{ + char *type; + struct FTP *ftp; + + data->req.p.ftp = ftp = calloc(sizeof(struct FTP), 1); + if(NULL == ftp) + return CURLE_OUT_OF_MEMORY; + + ftp->path = &data->state.up.path[1]; /* don't include the initial slash */ + + /* FTP URLs support an extension like ";type=" that + * we'll try to get now! */ + type = strstr(ftp->path, ";type="); + + if(!type) + type = strstr(conn->host.rawalloc, ";type="); + + if(type) { + char command; + *type = 0; /* it was in the middle of the hostname */ + command = Curl_raw_toupper(type[6]); + + switch(command) { + case 'A': /* ASCII mode */ + data->state.prefer_ascii = TRUE; + break; + + case 'D': /* directory mode */ + data->state.list_only = TRUE; + break; + + case 'I': /* binary mode */ + default: + /* switch off ASCII */ + data->state.prefer_ascii = FALSE; + break; + } + } + + /* get some initial data into the ftp struct */ + ftp->transfer = PPTRANSFER_BODY; + ftp->downloadsize = 0; + conn->proto.ftpc.known_filesize = -1; /* unknown size for now */ + + return CURLE_OK; +} + +#endif /* CURL_DISABLE_FTP */ diff --git a/lib/ftp.rs b/lib/ftp.rs deleted file mode 100644 index 145b971..0000000 --- a/lib/ftp.rs +++ /dev/null @@ -1,7463 +0,0 @@ -use ::libc; -use ::c2rust_bitfields; -extern "C" { - pub type _IO_wide_data; - pub type _IO_codecvt; - pub type _IO_marker; - pub type Curl_URL; - pub type thread_data; - pub type altsvcinfo; - pub type hsts; - pub type TELNET; - pub type smb_request; - pub type ldapreqinfo; - pub type contenc_writer; - pub type Curl_share; - pub type curl_pushheaders; - pub type ldapconninfo; - pub type tftp_state_data; - pub type ssl_backend_data; - pub type ftp_parselist_data; - fn bind(__fd: libc::c_int, __addr: *const sockaddr, __len: socklen_t) -> libc::c_int; - fn getsockname( - __fd: libc::c_int, - __addr: *mut sockaddr, - __len: *mut socklen_t, - ) -> libc::c_int; - fn listen(__fd: libc::c_int, __n: libc::c_int) -> libc::c_int; - fn accept( - __fd: libc::c_int, - __addr: *mut sockaddr, - __addr_len: *mut socklen_t, - ) -> libc::c_int; - fn sscanf(_: *const libc::c_char, _: *const libc::c_char, _: ...) -> libc::c_int; - fn Curl_isdigit(c: libc::c_int) -> libc::c_int; - fn curl_easy_strerror(_: CURLcode) -> *const libc::c_char; - fn strtol( - _: *const libc::c_char, - _: *mut *mut libc::c_char, - _: libc::c_int, - ) -> libc::c_long; - fn strtoul( - _: *const libc::c_char, - _: *mut *mut libc::c_char, - _: libc::c_int, - ) -> libc::c_ulong; - fn memcpy( - _: *mut libc::c_void, - _: *const libc::c_void, - _: libc::c_ulong, - ) -> *mut libc::c_void; - fn strcpy(_: *mut libc::c_char, _: *const libc::c_char) -> *mut libc::c_char; - fn strncpy( - _: *mut libc::c_char, - _: *const libc::c_char, - _: libc::c_ulong, - ) -> *mut libc::c_char; - fn strncmp( - _: *const libc::c_char, - _: *const libc::c_char, - _: libc::c_ulong, - ) -> libc::c_int; - fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; - fn strrchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; - fn strstr(_: *const libc::c_char, _: *const libc::c_char) -> *mut libc::c_char; - fn strlen(_: *const libc::c_char) -> libc::c_ulong; - fn __errno_location() -> *mut libc::c_int; - fn inet_pton( - __af: libc::c_int, - __cp: *const libc::c_char, - __buf: *mut libc::c_void, - ) -> libc::c_int; - fn inet_ntop( - __af: libc::c_int, - __cp: *const libc::c_void, - __buf: *mut libc::c_char, - __len: socklen_t, - ) -> *const libc::c_char; - fn Curl_resolv( - data: *mut Curl_easy, - hostname: *const libc::c_char, - port: libc::c_int, - allowDOH: bool, - dnsentry: *mut *mut Curl_dns_entry, - ) -> resolve_t; - fn Curl_resolv_unlock(data: *mut Curl_easy, dns: *mut Curl_dns_entry); - fn Curl_now() -> curltime; - fn Curl_timediff(t1: curltime, t2: curltime) -> timediff_t; - fn Curl_llist_remove( - _: *mut Curl_llist, - _: *mut Curl_llist_element, - _: *mut libc::c_void, - ); - fn Curl_resolver_wait_resolv( - data: *mut Curl_easy, - dnsentry: *mut *mut Curl_dns_entry, - ) -> CURLcode; - fn Curl_printable_address( - ip: *const Curl_addrinfo, - buf: *mut libc::c_char, - bufsize: size_t, - ); - fn Curl_pp_statemach( - data: *mut Curl_easy, - pp: *mut pingpong, - block: bool, - disconnecting: bool, - ) -> CURLcode; - fn Curl_pp_init(data: *mut Curl_easy, pp: *mut pingpong); - fn Curl_pp_setup(pp: *mut pingpong); - fn Curl_pp_state_timeout( - data: *mut Curl_easy, - pp: *mut pingpong, - disconnecting: bool, - ) -> timediff_t; - fn Curl_pp_sendf( - data: *mut Curl_easy, - pp: *mut pingpong, - fmt: *const libc::c_char, - _: ... - ) -> CURLcode; - fn Curl_pp_readresp( - data: *mut Curl_easy, - sockfd: curl_socket_t, - pp: *mut pingpong, - code: *mut libc::c_int, - size: *mut size_t, - ) -> CURLcode; - fn Curl_pp_flushsend(data: *mut Curl_easy, pp: *mut pingpong) -> CURLcode; - fn Curl_pp_disconnect(pp: *mut pingpong) -> CURLcode; - fn Curl_pp_getsock( - data: *mut Curl_easy, - pp: *mut pingpong, - socks: *mut curl_socket_t, - ) -> libc::c_int; - fn Curl_infof(_: *mut Curl_easy, fmt: *const libc::c_char, _: ...); - fn Curl_failf(_: *mut Curl_easy, fmt: *const libc::c_char, _: ...); - fn Curl_client_write( - data: *mut Curl_easy, - type_0: libc::c_int, - ptr: *mut libc::c_char, - len: size_t, - ) -> CURLcode; - fn Curl_ipv6_scope(sa: *const sockaddr) -> libc::c_uint; - fn Curl_if2ip( - af: libc::c_int, - remote_scope: libc::c_uint, - local_scope_id: libc::c_uint, - interf: *const libc::c_char, - buf: *mut libc::c_char, - buf_size: libc::c_int, - ) -> if2ip_result_t; - fn Curl_pgrsSetDownloadSize(data: *mut Curl_easy, size: curl_off_t); - fn Curl_pgrsSetUploadSize(data: *mut Curl_easy, size: curl_off_t); - fn Curl_pgrsSetDownloadCounter(data: *mut Curl_easy, size: curl_off_t); - fn Curl_pgrsSetUploadCounter(data: *mut Curl_easy, size: curl_off_t); - fn Curl_pgrsUpdate(data: *mut Curl_easy) -> libc::c_int; - fn Curl_pgrsTime(data: *mut Curl_easy, timer: timerid) -> curltime; - fn Curl_setup_transfer( - data: *mut Curl_easy, - sockindex: libc::c_int, - size: curl_off_t, - getheader: bool, - writesockindex: libc::c_int, - ); - fn Curl_urldecode( - data: *mut Curl_easy, - string: *const libc::c_char, - length: size_t, - ostring: *mut *mut libc::c_char, - olen: *mut size_t, - ctrl: urlreject, - ) -> CURLcode; - fn Curl_ftp_parselist( - buffer: *mut libc::c_char, - size: size_t, - nmemb: size_t, - connptr: *mut libc::c_void, - ) -> size_t; - fn Curl_ftp_parselist_geterror(pl_data: *mut ftp_parselist_data) -> CURLcode; - fn Curl_ftp_parselist_data_alloc() -> *mut ftp_parselist_data; - fn Curl_ftp_parselist_data_free(pl_data: *mut *mut ftp_parselist_data); - fn Curl_range(data: *mut Curl_easy) -> CURLcode; - fn curlx_strtoofft( - str: *const libc::c_char, - endp: *mut *mut libc::c_char, - base: libc::c_int, - num: *mut curl_off_t, - ) -> CURLofft; - fn Curl_strcasecompare( - first: *const libc::c_char, - second: *const libc::c_char, - ) -> libc::c_int; - fn Curl_raw_toupper(in_0: libc::c_char) -> libc::c_char; - fn Curl_ssl_close( - data: *mut Curl_easy, - conn: *mut connectdata, - sockindex: libc::c_int, - ); - fn Curl_ssl_shutdown( - data: *mut Curl_easy, - conn: *mut connectdata, - sockindex: libc::c_int, - ) -> CURLcode; - fn Curl_ssl_connect( - data: *mut Curl_easy, - conn: *mut connectdata, - sockindex: libc::c_int, - ) -> CURLcode; - fn Curl_is_connected( - data: *mut Curl_easy, - conn: *mut connectdata, - sockindex: libc::c_int, - connected: *mut bool, - ) -> CURLcode; - fn Curl_connecthost( - data: *mut Curl_easy, - conn: *mut connectdata, - host: *const Curl_dns_entry, - ) -> CURLcode; - fn Curl_timeleft( - data: *mut Curl_easy, - nowp: *mut curltime, - duringconnect: bool, - ) -> timediff_t; - fn Curl_conninfo_remote( - data: *mut Curl_easy, - conn: *mut connectdata, - sockfd: curl_socket_t, - ); - fn Curl_closesocket( - data: *mut Curl_easy, - conn: *mut connectdata, - sock: curl_socket_t, - ) -> libc::c_int; - fn Curl_socket( - data: *mut Curl_easy, - ai: *const Curl_addrinfo, - addr: *mut Curl_sockaddr_ex, - sockfd: *mut curl_socket_t, - ) -> CURLcode; - fn Curl_conn_data_pending(conn: *mut connectdata, sockindex: libc::c_int) -> bool; - fn curlx_nonblock(sockfd: curl_socket_t, nonblock: libc::c_int) -> libc::c_int; - fn Curl_conncontrol(conn: *mut connectdata, closeit: libc::c_int); - fn Curl_strerror( - err: libc::c_int, - buf: *mut libc::c_char, - buflen: size_t, - ) -> *const libc::c_char; - fn Curl_socket_check( - readfd: curl_socket_t, - readfd2: curl_socket_t, - writefd: curl_socket_t, - timeout_ms: timediff_t, - ) -> libc::c_int; - static Curl_wkday: [*const libc::c_char; 7]; - static Curl_month: [*const libc::c_char; 12]; - fn Curl_gmtime(intime: time_t, store: *mut tm) -> CURLcode; - fn Curl_getdate_capped(p: *const libc::c_char) -> time_t; - fn Curl_expire(data: *mut Curl_easy, milli: timediff_t, _: expire_id); - fn Curl_set_in_callback(data: *mut Curl_easy, value: bool); - fn curlx_ultous(ulnum: libc::c_ulong) -> libc::c_ushort; - fn curlx_sltosi(slnum: libc::c_long) -> libc::c_int; - fn curlx_sotouz(sonum: curl_off_t) -> size_t; - fn Curl_proxyCONNECT( - data: *mut Curl_easy, - tunnelsocket: libc::c_int, - hostname: *const libc::c_char, - remote_port: libc::c_int, - ) -> CURLcode; - fn Curl_proxy_connect(data: *mut Curl_easy, sockindex: libc::c_int) -> CURLcode; - fn Curl_connect_ongoing(conn: *mut connectdata) -> bool; - fn Curl_SOCKS_getsock( - conn: *mut connectdata, - sock: *mut curl_socket_t, - sockindex: libc::c_int, - ) -> libc::c_int; - fn curl_msnprintf( - buffer: *mut libc::c_char, - maxlength: size_t, - format: *const libc::c_char, - _: ... - ) -> libc::c_int; - fn curl_maprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char; - static mut Curl_cmalloc: curl_malloc_callback; - static mut Curl_cfree: curl_free_callback; - static mut Curl_cstrdup: curl_strdup_callback; - static mut Curl_ccalloc: curl_calloc_callback; -} -pub type __uint8_t = libc::c_uchar; -pub type __uint16_t = libc::c_ushort; -pub type __uint32_t = libc::c_uint; -pub type __off_t = libc::c_long; -pub type __off64_t = libc::c_long; -pub type __pid_t = libc::c_int; -pub type __time_t = libc::c_long; -pub type __ssize_t = libc::c_long; -pub type __socklen_t = libc::c_uint; -pub type pid_t = __pid_t; -pub type ssize_t = __ssize_t; -pub type time_t = __time_t; -pub type size_t = libc::c_ulong; -pub type socklen_t = __socklen_t; -pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr_storage { - pub ss_family: sa_family_t, - pub __ss_padding: [libc::c_char; 118], - pub __ss_align: libc::c_ulong, -} -pub type curl_socklen_t = socklen_t; -pub type curl_off_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _IO_FILE { - pub _flags: libc::c_int, - pub _IO_read_ptr: *mut libc::c_char, - pub _IO_read_end: *mut libc::c_char, - pub _IO_read_base: *mut libc::c_char, - pub _IO_write_base: *mut libc::c_char, - pub _IO_write_ptr: *mut libc::c_char, - pub _IO_write_end: *mut libc::c_char, - pub _IO_buf_base: *mut libc::c_char, - pub _IO_buf_end: *mut libc::c_char, - pub _IO_save_base: *mut libc::c_char, - pub _IO_backup_base: *mut libc::c_char, - pub _IO_save_end: *mut libc::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: libc::c_int, - pub _flags2: libc::c_int, - pub _old_offset: __off_t, - pub _cur_column: libc::c_ushort, - pub _vtable_offset: libc::c_schar, - pub _shortbuf: [libc::c_char; 1], - pub _lock: *mut libc::c_void, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut libc::c_void, - pub __pad5: size_t, - pub _mode: libc::c_int, - pub _unused2: [libc::c_char; 20], -} -pub type _IO_lock_t = (); -pub type FILE = _IO_FILE; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tm { - pub tm_sec: libc::c_int, - pub tm_min: libc::c_int, - pub tm_hour: libc::c_int, - pub tm_mday: libc::c_int, - pub tm_mon: libc::c_int, - pub tm_year: libc::c_int, - pub tm_wday: libc::c_int, - pub tm_yday: libc::c_int, - pub tm_isdst: libc::c_int, - pub tm_gmtoff: libc::c_long, - pub tm_zone: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_easy { - pub magic: libc::c_uint, - pub next: *mut Curl_easy, - pub prev: *mut Curl_easy, - pub conn: *mut connectdata, - pub connect_queue: Curl_llist_element, - pub conn_queue: Curl_llist_element, - pub mstate: CURLMstate, - pub result: CURLcode, - pub msg: Curl_message, - pub sockets: [curl_socket_t; 5], - pub actions: [libc::c_uchar; 5], - pub numsocks: libc::c_int, - pub dns: Names, - pub multi: *mut Curl_multi, - pub multi_easy: *mut Curl_multi, - pub share: *mut Curl_share, - pub req: SingleRequest, - pub set: UserDefined, - pub cookies: *mut CookieInfo, - pub hsts: *mut hsts, - pub asi: *mut altsvcinfo, - pub progress: Progress, - pub state: UrlState, - pub wildcard: WildcardData, - pub info: PureInfo, - pub tsi: curl_tlssessioninfo, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} -pub type curl_sslbackend = libc::c_uint; -pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; -pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; -pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; -pub const CURLSSLBACKEND_MBEDTLS: curl_sslbackend = 11; -pub const CURLSSLBACKEND_AXTLS: curl_sslbackend = 10; -pub const CURLSSLBACKEND_SECURETRANSPORT: curl_sslbackend = 9; -pub const CURLSSLBACKEND_SCHANNEL: curl_sslbackend = 8; -pub const CURLSSLBACKEND_WOLFSSL: curl_sslbackend = 7; -pub const CURLSSLBACKEND_POLARSSL: curl_sslbackend = 6; -pub const CURLSSLBACKEND_GSKIT: curl_sslbackend = 5; -pub const CURLSSLBACKEND_OBSOLETE4: curl_sslbackend = 4; -pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; -pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; -pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; -pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; -pub const CURLPX_LAST: CURLproxycode = 34; -pub const CURLPX_USER_REJECTED: CURLproxycode = 33; -pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; -pub const CURLPX_UNKNOWN_FAIL: CURLproxycode = 31; -pub const CURLPX_SEND_REQUEST: CURLproxycode = 30; -pub const CURLPX_SEND_CONNECT: CURLproxycode = 29; -pub const CURLPX_SEND_AUTH: CURLproxycode = 28; -pub const CURLPX_RESOLVE_HOST: CURLproxycode = 27; -pub const CURLPX_REQUEST_FAILED: CURLproxycode = 26; -pub const CURLPX_REPLY_UNASSIGNED: CURLproxycode = 25; -pub const CURLPX_REPLY_TTL_EXPIRED: CURLproxycode = 24; -pub const CURLPX_REPLY_NOT_ALLOWED: CURLproxycode = 23; -pub const CURLPX_REPLY_NETWORK_UNREACHABLE: CURLproxycode = 22; -pub const CURLPX_REPLY_HOST_UNREACHABLE: CURLproxycode = 21; -pub const CURLPX_REPLY_GENERAL_SERVER_FAILURE: CURLproxycode = 20; -pub const CURLPX_REPLY_CONNECTION_REFUSED: CURLproxycode = 19; -pub const CURLPX_REPLY_COMMAND_NOT_SUPPORTED: CURLproxycode = 18; -pub const CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED: CURLproxycode = 17; -pub const CURLPX_RECV_REQACK: CURLproxycode = 16; -pub const CURLPX_RECV_CONNECT: CURLproxycode = 15; -pub const CURLPX_RECV_AUTH: CURLproxycode = 14; -pub const CURLPX_RECV_ADDRESS: CURLproxycode = 13; -pub const CURLPX_NO_AUTH: CURLproxycode = 12; -pub const CURLPX_LONG_USER: CURLproxycode = 11; -pub const CURLPX_LONG_PASSWD: CURLproxycode = 10; -pub const CURLPX_LONG_HOSTNAME: CURLproxycode = 9; -pub const CURLPX_IDENTD_DIFFER: CURLproxycode = 8; -pub const CURLPX_IDENTD: CURLproxycode = 7; -pub const CURLPX_GSSAPI_PROTECTION: CURLproxycode = 6; -pub const CURLPX_GSSAPI_PERMSG: CURLproxycode = 5; -pub const CURLPX_GSSAPI: CURLproxycode = 4; -pub const CURLPX_CLOSED: CURLproxycode = 3; -pub const CURLPX_BAD_VERSION: CURLproxycode = 2; -pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; -pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option:: ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option::< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> (), ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; -pub const CURLWC_DONE: wildcard_states = 7; -pub const CURLWC_ERROR: wildcard_states = 6; -pub const CURLWC_SKIP: wildcard_states = 5; -pub const CURLWC_CLEAN: wildcard_states = 4; -pub const CURLWC_DOWNLOADING: wildcard_states = 3; -pub const CURLWC_MATCHING: wildcard_states = 2; -pub const CURLWC_INIT: wildcard_states = 1; -pub const CURLWC_CLEAR: wildcard_states = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UrlState { - pub conn_cache: *mut conncache, - pub keeps_speed: curltime, - pub lastconnect_id: libc::c_long, - pub headerb: dynbuf, - pub buffer: *mut libc::c_char, - pub ulbuf: *mut libc::c_char, - pub current_speed: curl_off_t, - pub first_host: *mut libc::c_char, - pub retrycount: libc::c_int, - pub first_remote_port: libc::c_int, - pub session: *mut Curl_ssl_session, - pub sessionage: libc::c_long, - pub tempwrite: [tempbuf; 3], - pub tempcount: libc::c_uint, - pub os_errno: libc::c_int, - pub scratch: *mut libc::c_char, - pub followlocation: libc::c_long, - pub prev_signal: Option:: ()>, - pub digest: digestdata, - pub proxydigest: digestdata, - pub authhost: auth, - pub authproxy: auth, - pub async_0: Curl_async, - pub engine: *mut libc::c_void, - pub expiretime: curltime, - pub timenode: Curl_tree, - pub timeoutlist: Curl_llist, - pub expires: [time_node; 13], - pub most_recent_ftp_entrypath: *mut libc::c_char, - pub httpwant: libc::c_uchar, - pub httpversion: libc::c_uchar, - #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] - pub prev_block_had_trailing_cr: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 5], - pub crlf_conversions: curl_off_t, - pub range: *mut libc::c_char, - pub resume_from: curl_off_t, - pub rtsp_next_client_CSeq: libc::c_long, - pub rtsp_next_server_CSeq: libc::c_long, - pub rtsp_CSeq_recv: libc::c_long, - pub infilesize: curl_off_t, - pub drain: size_t, - pub fread_func: curl_read_callback, - pub in_0: *mut libc::c_void, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub uh: *mut CURLU, - pub up: urlpieces, - pub httpreq: Curl_HttpReq, - pub url: *mut libc::c_char, - pub referer: *mut libc::c_char, - pub cookielist: *mut curl_slist, - pub resolve: *mut curl_slist, - pub trailers_bytes_sent: size_t, - pub trailers_buf: dynbuf, - pub trailers_state: trailers_state, - pub aptr: dynamically_allocated_data, - #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] - #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] - #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] - #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] - #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] - #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] - #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] - #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] - #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] - #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] - #[bitfield(name = "done", ty = "bit", bits = "12..=12")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] - #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] - #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] - #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] - #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] - #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] - #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: [u8; 3], - #[bitfield(padding)] - pub c2rust_padding_0: [u8; 5], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; -pub const TRAILERS_DONE: trailers_state = 3; -pub const TRAILERS_SENDING: trailers_state = 2; -pub const TRAILERS_INITIALIZED: trailers_state = 1; -pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; -pub const HTTPREQ_HEAD: Curl_HttpReq = 5; -pub const HTTPREQ_PUT: Curl_HttpReq = 4; -pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; -pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; -pub const HTTPREQ_POST: Curl_HttpReq = 1; -pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} -pub type CURLU = Curl_URL; -pub type curl_read_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; -pub const EXPIRE_LAST: expire_id = 13; -pub const EXPIRE_QUIC: expire_id = 12; -pub const EXPIRE_TOOFAST: expire_id = 11; -pub const EXPIRE_TIMEOUT: expire_id = 10; -pub const EXPIRE_SPEEDCHECK: expire_id = 9; -pub const EXPIRE_RUN_NOW: expire_id = 8; -pub const EXPIRE_MULTI_PENDING: expire_id = 7; -pub const EXPIRE_HAPPY_EYEBALLS: expire_id = 6; -pub const EXPIRE_HAPPY_EYEBALLS_DNS: expire_id = 5; -pub const EXPIRE_DNS_PER_NAME2: expire_id = 4; -pub const EXPIRE_DNS_PER_NAME: expire_id = 3; -pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; -pub const EXPIRE_ASYNC_NAME: expire_id = 1; -pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Curl_async { - pub hostname: *mut libc::c_char, - pub dns: *mut Curl_dns_entry, - pub tdata: *mut thread_data, - pub resolver: *mut libc::c_void, - pub port: libc::c_int, - pub status: libc::c_int, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - pub done: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl_session { - pub name: *mut libc::c_char, - pub conn_to_host: *mut libc::c_char, - pub scheme: *const libc::c_char, - pub sessionid: *mut libc::c_void, - pub idsize: size_t, - pub age: libc::c_long, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub ssl_config: ssl_primary_config, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_primary_config { - pub version: libc::c_long, - pub version_max: libc::c_long, - pub CApath: *mut libc::c_char, - pub CAfile: *mut libc::c_char, - pub issuercert: *mut libc::c_char, - pub clientcert: *mut libc::c_char, - pub random_file: *mut libc::c_char, - pub egdsocket: *mut libc::c_char, - pub cipher_list: *mut libc::c_char, - pub cipher_list13: *mut libc::c_char, - pub pinned_key: *mut libc::c_char, - pub cert_blob: *mut curl_blob, - pub ca_info_blob: *mut curl_blob, - pub issuercert_blob: *mut curl_blob, - pub curves: *mut libc::c_char, - #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] - #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] - #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] - #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] - pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct conncache { - pub hash: Curl_hash, - pub num_conn: size_t, - pub next_connection_id: libc::c_long, - pub last_cleanup: curltime, - pub closure_handle: *mut Curl_easy, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option:: ()>; -pub type comp_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, *mut libc::c_void, size_t) -> size_t, ->; -pub type hash_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, size_t) -> size_t, ->; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UserDefined { - pub err: *mut FILE, - pub debugdata: *mut libc::c_void, - pub errorbuffer: *mut libc::c_char, - pub proxyport: libc::c_long, - pub out: *mut libc::c_void, - pub in_set: *mut libc::c_void, - pub writeheader: *mut libc::c_void, - pub rtp_out: *mut libc::c_void, - pub use_port: libc::c_long, - pub httpauth: libc::c_ulong, - pub proxyauth: libc::c_ulong, - pub socks5auth: libc::c_ulong, - pub maxredirs: libc::c_long, - pub keep_post: libc::c_int, - pub postfields: *mut libc::c_void, - pub seek_func: curl_seek_callback, - pub postfieldsize: curl_off_t, - pub localport: libc::c_ushort, - pub localportrange: libc::c_int, - pub fwrite_func: curl_write_callback, - pub fwrite_header: curl_write_callback, - pub fwrite_rtp: curl_write_callback, - pub fread_func_set: curl_read_callback, - pub fprogress: curl_progress_callback, - pub fxferinfo: curl_xferinfo_callback, - pub fdebug: curl_debug_callback, - pub ioctl_func: curl_ioctl_callback, - pub fsockopt: curl_sockopt_callback, - pub sockopt_client: *mut libc::c_void, - pub fopensocket: curl_opensocket_callback, - pub opensocket_client: *mut libc::c_void, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub seek_client: *mut libc::c_void, - pub convfromnetwork: curl_conv_callback, - pub convtonetwork: curl_conv_callback, - pub convfromutf8: curl_conv_callback, - pub hsts_read: curl_hstsread_callback, - pub hsts_read_userp: *mut libc::c_void, - pub hsts_write: curl_hstswrite_callback, - pub hsts_write_userp: *mut libc::c_void, - pub progress_client: *mut libc::c_void, - pub ioctl_client: *mut libc::c_void, - pub timeout: libc::c_long, - pub connecttimeout: libc::c_long, - pub accepttimeout: libc::c_long, - pub happy_eyeballs_timeout: libc::c_long, - pub server_response_timeout: libc::c_long, - pub maxage_conn: libc::c_long, - pub tftp_blksize: libc::c_long, - pub filesize: curl_off_t, - pub low_speed_limit: libc::c_long, - pub low_speed_time: libc::c_long, - pub max_send_speed: curl_off_t, - pub max_recv_speed: curl_off_t, - pub set_resume_from: curl_off_t, - pub headers: *mut curl_slist, - pub proxyheaders: *mut curl_slist, - pub httppost: *mut curl_httppost, - pub mimepost: curl_mimepart, - pub quote: *mut curl_slist, - pub postquote: *mut curl_slist, - pub prequote: *mut curl_slist, - pub source_quote: *mut curl_slist, - pub source_prequote: *mut curl_slist, - pub source_postquote: *mut curl_slist, - pub telnet_options: *mut curl_slist, - pub resolve: *mut curl_slist, - pub connect_to: *mut curl_slist, - pub timecondition: curl_TimeCond, - pub proxytype: curl_proxytype, - pub timevalue: time_t, - pub method: Curl_HttpReq, - pub httpwant: libc::c_uchar, - pub ssl: ssl_config_data, - pub proxy_ssl: ssl_config_data, - pub general_ssl: ssl_general_config, - pub dns_cache_timeout: libc::c_long, - pub buffer_size: libc::c_long, - pub upload_buffer_size: libc::c_uint, - pub private_data: *mut libc::c_void, - pub http200aliases: *mut curl_slist, - pub ipver: libc::c_uchar, - pub max_filesize: curl_off_t, - pub ftp_filemethod: curl_ftpfile, - pub ftpsslauth: curl_ftpauth, - pub ftp_ccc: curl_ftpccc, - pub ftp_create_missing_dirs: libc::c_int, - pub ssh_keyfunc: curl_sshkeycallback, - pub ssh_keyfunc_userp: *mut libc::c_void, - pub use_netrc: CURL_NETRC_OPTION, - pub use_ssl: curl_usessl, - pub new_file_perms: libc::c_long, - pub new_directory_perms: libc::c_long, - pub ssh_auth_types: libc::c_long, - pub str_0: [*mut libc::c_char; 80], - pub blobs: [*mut curl_blob; 8], - pub scope_id: libc::c_uint, - pub allowed_protocols: libc::c_long, - pub redir_protocols: libc::c_long, - pub mail_rcpt: *mut curl_slist, - pub rtspreq: Curl_RtspReq, - pub rtspversion: libc::c_long, - pub chunk_bgn: curl_chunk_bgn_callback, - pub chunk_end: curl_chunk_end_callback, - pub fnmatch: curl_fnmatch_callback, - pub fnmatch_data: *mut libc::c_void, - pub gssapi_delegation: libc::c_long, - pub tcp_keepidle: libc::c_long, - pub tcp_keepintvl: libc::c_long, - pub maxconnects: size_t, - pub expect_100_timeout: libc::c_long, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub stream_dependents: *mut Curl_http2_dep, - pub resolver_start: curl_resolver_start_callback, - pub resolver_start_client: *mut libc::c_void, - pub upkeep_interval_ms: libc::c_long, - pub fmultidone: multidone_func, - pub dohfor: *mut Curl_easy, - pub uh: *mut CURLU, - pub trailer_data: *mut libc::c_void, - pub trailer_callback: curl_trailer_callback, - #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] - #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] - #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] - #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] - #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] - #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] - #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] - #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] - #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] - #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] - #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] - #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] - #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] - #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] - #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] - #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] - #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] - #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] - #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] - #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] - #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] - #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] - #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] - #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] - #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] - #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] - #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] - #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] - #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] - #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] - #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] - #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] - #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] - #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] - #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] - #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] - #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] - #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] - #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] - #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] - #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] - #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] - #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] - #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] - #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] - #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] - #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] - #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] - #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] - #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] - #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] - #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] - #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] - #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: [u8; 8], -} -pub type curl_trailer_callback = Option::< - unsafe extern "C" fn(*mut *mut curl_slist, *mut libc::c_void) -> libc::c_int, ->; -pub type multidone_func = Option::< - unsafe extern "C" fn(*mut Curl_easy, CURLcode) -> libc::c_int, ->; -pub type CURLcode = libc::c_uint; -pub const CURL_LAST: CURLcode = 99; -pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; -pub const CURLE_PROXY: CURLcode = 97; -pub const CURLE_QUIC_CONNECT_ERROR: CURLcode = 96; -pub const CURLE_HTTP3: CURLcode = 95; -pub const CURLE_AUTH_ERROR: CURLcode = 94; -pub const CURLE_RECURSIVE_API_CALL: CURLcode = 93; -pub const CURLE_HTTP2_STREAM: CURLcode = 92; -pub const CURLE_SSL_INVALIDCERTSTATUS: CURLcode = 91; -pub const CURLE_SSL_PINNEDPUBKEYNOTMATCH: CURLcode = 90; -pub const CURLE_NO_CONNECTION_AVAILABLE: CURLcode = 89; -pub const CURLE_CHUNK_FAILED: CURLcode = 88; -pub const CURLE_FTP_BAD_FILE_LIST: CURLcode = 87; -pub const CURLE_RTSP_SESSION_ERROR: CURLcode = 86; -pub const CURLE_RTSP_CSEQ_ERROR: CURLcode = 85; -pub const CURLE_FTP_PRET_FAILED: CURLcode = 84; -pub const CURLE_SSL_ISSUER_ERROR: CURLcode = 83; -pub const CURLE_SSL_CRL_BADFILE: CURLcode = 82; -pub const CURLE_AGAIN: CURLcode = 81; -pub const CURLE_SSL_SHUTDOWN_FAILED: CURLcode = 80; -pub const CURLE_SSH: CURLcode = 79; -pub const CURLE_REMOTE_FILE_NOT_FOUND: CURLcode = 78; -pub const CURLE_SSL_CACERT_BADFILE: CURLcode = 77; -pub const CURLE_CONV_REQD: CURLcode = 76; -pub const CURLE_CONV_FAILED: CURLcode = 75; -pub const CURLE_TFTP_NOSUCHUSER: CURLcode = 74; -pub const CURLE_REMOTE_FILE_EXISTS: CURLcode = 73; -pub const CURLE_TFTP_UNKNOWNID: CURLcode = 72; -pub const CURLE_TFTP_ILLEGAL: CURLcode = 71; -pub const CURLE_REMOTE_DISK_FULL: CURLcode = 70; -pub const CURLE_TFTP_PERM: CURLcode = 69; -pub const CURLE_TFTP_NOTFOUND: CURLcode = 68; -pub const CURLE_LOGIN_DENIED: CURLcode = 67; -pub const CURLE_SSL_ENGINE_INITFAILED: CURLcode = 66; -pub const CURLE_SEND_FAIL_REWIND: CURLcode = 65; -pub const CURLE_USE_SSL_FAILED: CURLcode = 64; -pub const CURLE_FILESIZE_EXCEEDED: CURLcode = 63; -pub const CURLE_LDAP_INVALID_URL: CURLcode = 62; -pub const CURLE_BAD_CONTENT_ENCODING: CURLcode = 61; -pub const CURLE_PEER_FAILED_VERIFICATION: CURLcode = 60; -pub const CURLE_SSL_CIPHER: CURLcode = 59; -pub const CURLE_SSL_CERTPROBLEM: CURLcode = 58; -pub const CURLE_OBSOLETE57: CURLcode = 57; -pub const CURLE_RECV_ERROR: CURLcode = 56; -pub const CURLE_SEND_ERROR: CURLcode = 55; -pub const CURLE_SSL_ENGINE_SETFAILED: CURLcode = 54; -pub const CURLE_SSL_ENGINE_NOTFOUND: CURLcode = 53; -pub const CURLE_GOT_NOTHING: CURLcode = 52; -pub const CURLE_OBSOLETE51: CURLcode = 51; -pub const CURLE_OBSOLETE50: CURLcode = 50; -pub const CURLE_SETOPT_OPTION_SYNTAX: CURLcode = 49; -pub const CURLE_UNKNOWN_OPTION: CURLcode = 48; -pub const CURLE_TOO_MANY_REDIRECTS: CURLcode = 47; -pub const CURLE_OBSOLETE46: CURLcode = 46; -pub const CURLE_INTERFACE_FAILED: CURLcode = 45; -pub const CURLE_OBSOLETE44: CURLcode = 44; -pub const CURLE_BAD_FUNCTION_ARGUMENT: CURLcode = 43; -pub const CURLE_ABORTED_BY_CALLBACK: CURLcode = 42; -pub const CURLE_FUNCTION_NOT_FOUND: CURLcode = 41; -pub const CURLE_OBSOLETE40: CURLcode = 40; -pub const CURLE_LDAP_SEARCH_FAILED: CURLcode = 39; -pub const CURLE_LDAP_CANNOT_BIND: CURLcode = 38; -pub const CURLE_FILE_COULDNT_READ_FILE: CURLcode = 37; -pub const CURLE_BAD_DOWNLOAD_RESUME: CURLcode = 36; -pub const CURLE_SSL_CONNECT_ERROR: CURLcode = 35; -pub const CURLE_HTTP_POST_ERROR: CURLcode = 34; -pub const CURLE_RANGE_ERROR: CURLcode = 33; -pub const CURLE_OBSOLETE32: CURLcode = 32; -pub const CURLE_FTP_COULDNT_USE_REST: CURLcode = 31; -pub const CURLE_FTP_PORT_FAILED: CURLcode = 30; -pub const CURLE_OBSOLETE29: CURLcode = 29; -pub const CURLE_OPERATION_TIMEDOUT: CURLcode = 28; -pub const CURLE_OUT_OF_MEMORY: CURLcode = 27; -pub const CURLE_READ_ERROR: CURLcode = 26; -pub const CURLE_UPLOAD_FAILED: CURLcode = 25; -pub const CURLE_OBSOLETE24: CURLcode = 24; -pub const CURLE_WRITE_ERROR: CURLcode = 23; -pub const CURLE_HTTP_RETURNED_ERROR: CURLcode = 22; -pub const CURLE_QUOTE_ERROR: CURLcode = 21; -pub const CURLE_OBSOLETE20: CURLcode = 20; -pub const CURLE_FTP_COULDNT_RETR_FILE: CURLcode = 19; -pub const CURLE_PARTIAL_FILE: CURLcode = 18; -pub const CURLE_FTP_COULDNT_SET_TYPE: CURLcode = 17; -pub const CURLE_HTTP2: CURLcode = 16; -pub const CURLE_FTP_CANT_GET_HOST: CURLcode = 15; -pub const CURLE_FTP_WEIRD_227_FORMAT: CURLcode = 14; -pub const CURLE_FTP_WEIRD_PASV_REPLY: CURLcode = 13; -pub const CURLE_FTP_ACCEPT_TIMEOUT: CURLcode = 12; -pub const CURLE_FTP_WEIRD_PASS_REPLY: CURLcode = 11; -pub const CURLE_FTP_ACCEPT_FAILED: CURLcode = 10; -pub const CURLE_REMOTE_ACCESS_DENIED: CURLcode = 9; -pub const CURLE_WEIRD_SERVER_REPLY: CURLcode = 8; -pub const CURLE_COULDNT_CONNECT: CURLcode = 7; -pub const CURLE_COULDNT_RESOLVE_HOST: CURLcode = 6; -pub const CURLE_COULDNT_RESOLVE_PROXY: CURLcode = 5; -pub const CURLE_NOT_BUILT_IN: CURLcode = 4; -pub const CURLE_URL_MALFORMAT: CURLcode = 3; -pub const CURLE_FAILED_INIT: CURLcode = 2; -pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; -pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_http2_dep { - pub next: *mut Curl_http2_dep, - pub data: *mut Curl_easy, -} -pub type curl_fnmatch_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void) -> libc::c_long, ->; -pub type curl_chunk_bgn_callback = Option::< - unsafe extern "C" fn( - *const libc::c_void, - *mut libc::c_void, - libc::c_int, - ) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; -pub const RTSPREQ_LAST: Curl_RtspReq = 12; -pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; -pub const RTSPREQ_RECORD: Curl_RtspReq = 10; -pub const RTSPREQ_SET_PARAMETER: Curl_RtspReq = 9; -pub const RTSPREQ_GET_PARAMETER: Curl_RtspReq = 8; -pub const RTSPREQ_TEARDOWN: Curl_RtspReq = 7; -pub const RTSPREQ_PAUSE: Curl_RtspReq = 6; -pub const RTSPREQ_PLAY: Curl_RtspReq = 5; -pub const RTSPREQ_SETUP: Curl_RtspReq = 4; -pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; -pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; -pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; -pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; -pub const CURLUSESSL_LAST: curl_usessl = 4; -pub const CURLUSESSL_ALL: curl_usessl = 3; -pub const CURLUSESSL_CONTROL: curl_usessl = 2; -pub const CURLUSESSL_TRY: curl_usessl = 1; -pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; -pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; -pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; -pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; -pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option::< - unsafe extern "C" fn( - *mut CURL, - *const curl_khkey, - *const curl_khkey, - curl_khmatch, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_khmatch = libc::c_uint; -pub const CURLKHMATCH_LAST: curl_khmatch = 3; -pub const CURLKHMATCH_MISSING: curl_khmatch = 2; -pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; -pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; -pub const CURLKHTYPE_ED25519: curl_khtype = 5; -pub const CURLKHTYPE_ECDSA: curl_khtype = 4; -pub const CURLKHTYPE_DSS: curl_khtype = 3; -pub const CURLKHTYPE_RSA: curl_khtype = 2; -pub const CURLKHTYPE_RSA1: curl_khtype = 1; -pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; -pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; -pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; -pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; -pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; -pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; -pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; -pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; -pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; -pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; -pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; -pub const FTPFILE_NOCWD: curl_ftpfile = 2; -pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_config_data { - pub primary: ssl_primary_config, - pub certverifyresult: libc::c_long, - pub CRLfile: *mut libc::c_char, - pub fsslctx: curl_ssl_ctx_callback, - pub fsslctxp: *mut libc::c_void, - pub cert_type: *mut libc::c_char, - pub key: *mut libc::c_char, - pub key_blob: *mut curl_blob, - pub key_type: *mut libc::c_char, - pub key_passwd: *mut libc::c_char, - pub username: *mut libc::c_char, - pub password: *mut libc::c_char, - pub authtype: CURL_TLSAUTH, - #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] - #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] - #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] - #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] - #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] - #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] - #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] - #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type CURL_TLSAUTH = libc::c_uint; -pub const CURL_TLSAUTH_LAST: CURL_TLSAUTH = 2; -pub const CURL_TLSAUTH_SRP: CURL_TLSAUTH = 1; -pub const CURL_TLSAUTH_NONE: CURL_TLSAUTH = 0; -pub type curl_ssl_ctx_callback = Option::< - unsafe extern "C" fn(*mut CURL, *mut libc::c_void, *mut libc::c_void) -> CURLcode, ->; -pub type curl_proxytype = libc::c_uint; -pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; -pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; -pub const CURLPROXY_SOCKS5: curl_proxytype = 5; -pub const CURLPROXY_SOCKS4: curl_proxytype = 4; -pub const CURLPROXY_HTTPS: curl_proxytype = 2; -pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; -pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; -pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; -pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; -pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; -pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; -pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mimepart { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mime, - pub nextpart: *mut curl_mimepart, - pub kind: mimekind, - pub flags: libc::c_uint, - pub data: *mut libc::c_char, - pub readfunc: curl_read_callback, - pub seekfunc: curl_seek_callback, - pub freefunc: curl_free_callback, - pub arg: *mut libc::c_void, - pub fp: *mut FILE, - pub curlheaders: *mut curl_slist, - pub userheaders: *mut curl_slist, - pub mimetype: *mut libc::c_char, - pub filename: *mut libc::c_char, - pub name: *mut libc::c_char, - pub datasize: curl_off_t, - pub state: mime_state, - pub encoder: *const mime_encoder, - pub encstate: mime_encoder_state, - pub lastreadstatus: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder { - pub name: *const libc::c_char, - pub encodefunc: Option::< - unsafe extern "C" fn( - *mut libc::c_char, - size_t, - bool, - *mut curl_mimepart, - ) -> size_t, - >, - pub sizefunc: Option:: curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, -} -pub type mimestate = libc::c_uint; -pub const MIMESTATE_LAST: mimestate = 9; -pub const MIMESTATE_END: mimestate = 8; -pub const MIMESTATE_CONTENT: mimestate = 7; -pub const MIMESTATE_BOUNDARY2: mimestate = 6; -pub const MIMESTATE_BOUNDARY1: mimestate = 5; -pub const MIMESTATE_BODY: mimestate = 4; -pub const MIMESTATE_EOH: mimestate = 3; -pub const MIMESTATE_USERHEADERS: mimestate = 2; -pub const MIMESTATE_CURLHEADERS: mimestate = 1; -pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option:: ()>; -pub type curl_seek_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_off_t, libc::c_int) -> libc::c_int, ->; -pub type mimekind = libc::c_uint; -pub const MIMEKIND_LAST: mimekind = 5; -pub const MIMEKIND_MULTIPART: mimekind = 4; -pub const MIMEKIND_CALLBACK: mimekind = 3; -pub const MIMEKIND_FILE: mimekind = 2; -pub const MIMEKIND_DATA: mimekind = 1; -pub const MIMEKIND_NONE: mimekind = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mime { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mimepart, - pub firstpart: *mut curl_mimepart, - pub lastpart: *mut curl_mimepart, - pub boundary: [libc::c_char; 41], - pub state: mime_state, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut curl_index, - *mut libc::c_void, - ) -> CURLSTScode, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; -pub const CURLSTS_FAIL: CURLSTScode = 2; -pub const CURLSTS_DONE: CURLSTScode = 1; -pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut libc::c_void, - ) -> CURLSTScode, ->; -pub type curl_conv_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t) -> CURLcode, ->; -pub type curl_closesocket_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t) -> libc::c_int, ->; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - curlsocktype, - *mut curl_sockaddr, - ) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; -pub const CURLSOCKTYPE_LAST: curlsocktype = 2; -pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; -pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t, curlsocktype) -> libc::c_int, ->; -pub type curl_ioctl_callback = Option::< - unsafe extern "C" fn(*mut CURL, libc::c_int, *mut libc::c_void) -> curlioerr, ->; -pub type curlioerr = libc::c_uint; -pub const CURLIOE_LAST: curlioerr = 3; -pub const CURLIOE_FAILRESTART: curlioerr = 2; -pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; -pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_infotype = libc::c_uint; -pub const CURLINFO_END: curl_infotype = 7; -pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; -pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; -pub const CURLINFO_DATA_OUT: curl_infotype = 4; -pub const CURLINFO_DATA_IN: curl_infotype = 3; -pub const CURLINFO_HEADER_OUT: curl_infotype = 2; -pub const CURLINFO_HEADER_IN: curl_infotype = 1; -pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, ->; -pub type curl_progress_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, - ) -> libc::c_int, ->; -pub type curl_write_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct SingleRequest { - pub size: curl_off_t, - pub maxdownload: curl_off_t, - pub bytecount: curl_off_t, - pub writebytecount: curl_off_t, - pub headerbytecount: curl_off_t, - pub deductheadercount: curl_off_t, - pub pendingheader: curl_off_t, - pub start: curltime, - pub now: curltime, - pub badheader: C2RustUnnamed_1, - pub headerline: libc::c_int, - pub str_0: *mut libc::c_char, - pub offset: curl_off_t, - pub httpcode: libc::c_int, - pub keepon: libc::c_int, - pub start100: curltime, - pub exp100: expect100, - pub upgr101: upgrade101, - pub writer_stack: *mut contenc_writer, - pub timeofdoc: time_t, - pub bodywrites: libc::c_long, - pub location: *mut libc::c_char, - pub newurl: *mut libc::c_char, - pub upload_present: ssize_t, - pub upload_fromhere: *mut libc::c_char, - pub p: C2RustUnnamed, - pub doh: *mut dohdata, - #[bitfield(name = "header", ty = "bit", bits = "0..=0")] - #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] - #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] - #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] - #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] - #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] - #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] - #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] - #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: [u8; 2], - #[bitfield(padding)] - pub c2rust_padding: [u8; 6], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dohdata { - pub headers: *mut curl_slist, - pub probe: [dnsprobe; 2], - pub pending: libc::c_uint, - pub port: libc::c_int, - pub host: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dnsprobe { - pub easy: *mut CURL, - pub dnstype: libc::c_int, - pub dohbuffer: [libc::c_uchar; 512], - pub dohlen: size_t, - pub serverdoh: dynbuf, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed { - pub file: *mut FILEPROTO, - pub ftp: *mut FTP, - pub http: *mut HTTP, - pub imap: *mut IMAP, - pub ldap: *mut ldapreqinfo, - pub mqtt: *mut MQTT, - pub pop3: *mut POP3, - pub rtsp: *mut RTSP, - pub smb: *mut smb_request, - pub smtp: *mut SMTP, - pub ssh: *mut SSHPROTO, - pub telnet: *mut TELNET, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; -pub const PPTRANSFER_NONE: curl_pp_transfer = 2; -pub const PPTRANSFER_INFO: curl_pp_transfer = 1; -pub const PPTRANSFER_BODY: curl_pp_transfer = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct RTSP { - pub http_wrapper: HTTP, - pub CSeq_sent: libc::c_long, - pub CSeq_recv: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HTTP { - pub sendit: *mut curl_mimepart, - pub postsize: curl_off_t, - pub postdata: *const libc::c_char, - pub p_pragma: *const libc::c_char, - pub form: curl_mimepart, - pub backup: back, - pub sending: C2RustUnnamed_0, - pub send_buffer: dynbuf, -} -pub type C2RustUnnamed_0 = libc::c_uint; -pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; -pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; -pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -pub type upgrade101 = libc::c_uint; -pub const UPGR101_WORKING: upgrade101 = 3; -pub const UPGR101_RECEIVED: upgrade101 = 2; -pub const UPGR101_REQUESTED: upgrade101 = 1; -pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; -pub const EXP100_FAILED: expect100 = 3; -pub const EXP100_SENDING_REQUEST: expect100 = 2; -pub const EXP100_AWAITING_CONTINUE: expect100 = 1; -pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; -pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; -pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; -pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_multi { - pub magic: libc::c_uint, - pub easyp: *mut Curl_easy, - pub easylp: *mut Curl_easy, - pub num_easy: libc::c_int, - pub num_alive: libc::c_int, - pub msglist: Curl_llist, - pub pending: Curl_llist, - pub socket_cb: curl_socket_callback, - pub socket_userp: *mut libc::c_void, - pub push_cb: curl_push_callback, - pub push_userp: *mut libc::c_void, - pub hostcache: Curl_hash, - pub timetree: *mut Curl_tree, - pub sockhash: Curl_hash, - pub conn_cache: conncache, - pub maxconnects: libc::c_long, - pub max_host_connections: libc::c_long, - pub max_total_connections: libc::c_long, - pub timer_cb: curl_multi_timer_callback, - pub timer_userp: *mut libc::c_void, - pub timer_lastcall: curltime, - pub max_concurrent_streams: libc::c_uint, - pub wakeup_pair: [curl_socket_t; 2], - pub multiplexing: bool, - pub recheckstate: bool, - pub in_callback: bool, - pub ipv6_works: bool, - pub ssl_seeded: bool, -} -pub type curl_multi_timer_callback = Option::< - unsafe extern "C" fn(*mut CURLM, libc::c_long, *mut libc::c_void) -> libc::c_int, ->; -pub type CURLM = Curl_multi; -pub type curl_push_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut CURL, - size_t, - *mut curl_pushheaders, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_socket_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_socket_t, - libc::c_int, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; -pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; -pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; -pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_message { - pub list: Curl_llist_element, - pub extmsg: CURLMsg, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CURLMsg { - pub msg: CURLMSG, - pub easy_handle: *mut CURL, - pub data: C2RustUnnamed_3, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_3 { - pub whatever: *mut libc::c_void, - pub result: CURLcode, -} -pub type CURLMSG = libc::c_uint; -pub const CURLMSG_LAST: CURLMSG = 2; -pub const CURLMSG_DONE: CURLMSG = 1; -pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; -pub const MSTATE_LAST: CURLMstate = 17; -pub const MSTATE_MSGSENT: CURLMstate = 16; -pub const MSTATE_COMPLETED: CURLMstate = 15; -pub const MSTATE_DONE: CURLMstate = 14; -pub const MSTATE_RATELIMITING: CURLMstate = 13; -pub const MSTATE_PERFORMING: CURLMstate = 12; -pub const MSTATE_DID: CURLMstate = 11; -pub const MSTATE_DOING_MORE: CURLMstate = 10; -pub const MSTATE_DOING: CURLMstate = 9; -pub const MSTATE_DO: CURLMstate = 8; -pub const MSTATE_PROTOCONNECTING: CURLMstate = 7; -pub const MSTATE_PROTOCONNECT: CURLMstate = 6; -pub const MSTATE_TUNNELING: CURLMstate = 5; -pub const MSTATE_CONNECTING: CURLMstate = 4; -pub const MSTATE_RESOLVING: CURLMstate = 3; -pub const MSTATE_CONNECT: CURLMstate = 2; -pub const MSTATE_PENDING: CURLMstate = 1; -pub const MSTATE_INIT: CURLMstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectdata { - pub cnnct: connstate, - pub bundle_node: Curl_llist_element, - pub chunk: Curl_chunker, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub connection_id: libc::c_long, - pub dns_entry: *mut Curl_dns_entry, - pub ip_addr: *mut Curl_addrinfo, - pub tempaddr: [*mut Curl_addrinfo; 2], - pub scope_id: libc::c_uint, - pub transport: C2RustUnnamed_6, - pub host: hostname, - pub hostname_resolve: *mut libc::c_char, - pub secondaryhostname: *mut libc::c_char, - pub conn_to_host: hostname, - pub socks_proxy: proxy_info, - pub http_proxy: proxy_info, - pub port: libc::c_int, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub secondary_port: libc::c_ushort, - pub primary_ip: [libc::c_char; 46], - pub ip_version: libc::c_uchar, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub options: *mut libc::c_char, - pub sasl_authzid: *mut libc::c_char, - pub httpversion: libc::c_uchar, - pub now: curltime, - pub created: curltime, - pub lastused: curltime, - pub sock: [curl_socket_t; 2], - pub tempsock: [curl_socket_t; 2], - pub tempfamily: [libc::c_int; 2], - pub recv: [Option::; 2], - pub send: [Option::; 2], - pub ssl: [ssl_connect_data; 2], - pub proxy_ssl: [ssl_connect_data; 2], - pub ssl_extra: *mut libc::c_void, - pub ssl_config: ssl_primary_config, - pub proxy_ssl_config: ssl_primary_config, - pub bits: ConnectBits, - pub num_addr: libc::c_int, - pub connecttime: curltime, - pub timeoutms_per_addr: [timediff_t; 2], - pub handler: *const Curl_handler, - pub given: *const Curl_handler, - pub keepalive: curltime, - pub sockfd: curl_socket_t, - pub writesockfd: curl_socket_t, - pub easyq: Curl_llist, - pub seek_func: curl_seek_callback, - pub seek_client: *mut libc::c_void, - pub http_ntlm_state: curlntlm, - pub proxy_ntlm_state: curlntlm, - pub ntlm: ntlmdata, - pub proxyntlm: ntlmdata, - pub trailer: dynbuf, - pub proto: C2RustUnnamed_5, - pub connect_state: *mut http_connect_state, - pub bundle: *mut connectbundle, - pub unix_domain_socket: *mut libc::c_char, - pub localdev: *mut libc::c_char, - pub localportrange: libc::c_int, - pub cselect_bits: libc::c_int, - pub waitfor: libc::c_int, - pub negnpn: libc::c_int, - pub localport: libc::c_ushort, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct http_connect_state { - pub http_proxy: HTTP, - pub prot_save: *mut HTTP, - pub rcvbuf: dynbuf, - pub req: dynbuf, - pub nsend: size_t, - pub keepon: keeponval, - pub cl: curl_off_t, - pub tunnel_state: C2RustUnnamed_4, - #[bitfield(name = "chunked_encoding", ty = "bit", bits = "0..=0")] - #[bitfield(name = "close_connection", ty = "bit", bits = "1..=1")] - pub chunked_encoding_close_connection: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type C2RustUnnamed_4 = libc::c_uint; -pub const TUNNEL_EXIT: C2RustUnnamed_4 = 3; -pub const TUNNEL_COMPLETE: C2RustUnnamed_4 = 2; -pub const TUNNEL_CONNECT: C2RustUnnamed_4 = 1; -pub const TUNNEL_INIT: C2RustUnnamed_4 = 0; -pub type keeponval = libc::c_uint; -pub const KEEPON_IGNORE: keeponval = 2; -pub const KEEPON_CONNECT: keeponval = 1; -pub const KEEPON_DONE: keeponval = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_5 { - pub ftpc: ftp_conn, - pub httpc: http_conn, - pub sshc: ssh_conn, - pub tftpc: *mut tftp_state_data, - pub imapc: imap_conn, - pub pop3c: pop3_conn, - pub smtpc: smtp_conn, - pub rtspc: rtsp_conn, - pub smbc: smb_conn, - pub rtmp: *mut libc::c_void, - pub ldapc: *mut ldapconninfo, - pub mqtt: mqtt_conn, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; -pub const MQTT_NOSTATE: mqttstate = 7; -pub const MQTT_PUB_REMAIN: mqttstate = 6; -pub const MQTT_PUBWAIT: mqttstate = 5; -pub const MQTT_SUBACK_COMING: mqttstate = 4; -pub const MQTT_SUBACK: mqttstate = 3; -pub const MQTT_CONNACK: mqttstate = 2; -pub const MQTT_REMAINING_LENGTH: mqttstate = 1; -pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; -pub const SMB_CONNECTED: smb_conn_state = 4; -pub const SMB_SETUP: smb_conn_state = 3; -pub const SMB_NEGOTIATE: smb_conn_state = 2; -pub const SMB_CONNECTING: smb_conn_state = 1; -pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smtp_conn { - pub pp: pingpong, - pub state: smtpstate, - pub ssldone: bool, - pub domain: *mut libc::c_char, - pub sasl: SASL, - pub tls_supported: bool, - pub size_supported: bool, - pub utf8_supported: bool, - pub auth_supported: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASL { - pub params: *const SASLproto, - pub state: saslstate, - pub authmechs: libc::c_ushort, - pub prefmech: libc::c_ushort, - pub authused: libc::c_ushort, - pub resetprefs: bool, - pub mutual_auth: bool, - pub force_ir: bool, -} -pub type saslstate = libc::c_uint; -pub const SASL_FINAL: saslstate = 17; -pub const SASL_CANCEL: saslstate = 16; -pub const SASL_GSASL: saslstate = 15; -pub const SASL_OAUTH2_RESP: saslstate = 14; -pub const SASL_OAUTH2: saslstate = 13; -pub const SASL_GSSAPI_NO_DATA: saslstate = 12; -pub const SASL_GSSAPI_TOKEN: saslstate = 11; -pub const SASL_GSSAPI: saslstate = 10; -pub const SASL_NTLM_TYPE2MSG: saslstate = 9; -pub const SASL_NTLM: saslstate = 8; -pub const SASL_DIGESTMD5_RESP: saslstate = 7; -pub const SASL_DIGESTMD5: saslstate = 6; -pub const SASL_CRAMMD5: saslstate = 5; -pub const SASL_EXTERNAL: saslstate = 4; -pub const SASL_LOGIN_PASSWD: saslstate = 3; -pub const SASL_LOGIN: saslstate = 2; -pub const SASL_PLAIN: saslstate = 1; -pub const SASL_STOP: saslstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASLproto { - pub service: *const libc::c_char, - pub contcode: libc::c_int, - pub finalcode: libc::c_int, - pub maxirlen: size_t, - pub sendauth: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - *const libc::c_char, - ) -> CURLcode, - >, - pub sendcont: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - ) -> CURLcode, - >, - pub getmessage: Option::< - unsafe extern "C" fn(*mut libc::c_char, *mut *mut libc::c_char) -> (), - >, -} -pub type smtpstate = libc::c_uint; -pub const SMTP_LAST: smtpstate = 13; -pub const SMTP_QUIT: smtpstate = 12; -pub const SMTP_POSTDATA: smtpstate = 11; -pub const SMTP_DATA: smtpstate = 10; -pub const SMTP_RCPT: smtpstate = 9; -pub const SMTP_MAIL: smtpstate = 8; -pub const SMTP_COMMAND: smtpstate = 7; -pub const SMTP_AUTH: smtpstate = 6; -pub const SMTP_UPGRADETLS: smtpstate = 5; -pub const SMTP_STARTTLS: smtpstate = 4; -pub const SMTP_HELO: smtpstate = 3; -pub const SMTP_EHLO: smtpstate = 2; -pub const SMTP_SERVERGREET: smtpstate = 1; -pub const SMTP_STOP: smtpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pingpong { - pub cache: *mut libc::c_char, - pub cache_size: size_t, - pub nread_resp: size_t, - pub linestart_resp: *mut libc::c_char, - pub pending_resp: bool, - pub sendthis: *mut libc::c_char, - pub sendleft: size_t, - pub sendsize: size_t, - pub response: curltime, - pub response_time: timediff_t, - pub sendbuf: dynbuf, - pub statemachine: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub endofresp: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - >, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pop3_conn { - pub pp: pingpong, - pub state: pop3state, - pub ssldone: bool, - pub tls_supported: bool, - pub eob: size_t, - pub strip: size_t, - pub sasl: SASL, - pub authtypes: libc::c_uint, - pub preftype: libc::c_uint, - pub apoptimestamp: *mut libc::c_char, -} -pub type pop3state = libc::c_uint; -pub const POP3_LAST: pop3state = 11; -pub const POP3_QUIT: pop3state = 10; -pub const POP3_COMMAND: pop3state = 9; -pub const POP3_PASS: pop3state = 8; -pub const POP3_USER: pop3state = 7; -pub const POP3_APOP: pop3state = 6; -pub const POP3_AUTH: pop3state = 5; -pub const POP3_UPGRADETLS: pop3state = 4; -pub const POP3_STARTTLS: pop3state = 3; -pub const POP3_CAPA: pop3state = 2; -pub const POP3_SERVERGREET: pop3state = 1; -pub const POP3_STOP: pop3state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct imap_conn { - pub pp: pingpong, - pub state: imapstate, - pub ssldone: bool, - pub preauth: bool, - pub sasl: SASL, - pub preftype: libc::c_uint, - pub cmdid: libc::c_uint, - pub resptag: [libc::c_char; 5], - pub tls_supported: bool, - pub login_disabled: bool, - pub ir_supported: bool, - pub mailbox: *mut libc::c_char, - pub mailbox_uidvalidity: *mut libc::c_char, - pub dyn_0: dynbuf, -} -pub type imapstate = libc::c_uint; -pub const IMAP_LAST: imapstate = 15; -pub const IMAP_LOGOUT: imapstate = 14; -pub const IMAP_SEARCH: imapstate = 13; -pub const IMAP_APPEND_FINAL: imapstate = 12; -pub const IMAP_APPEND: imapstate = 11; -pub const IMAP_FETCH_FINAL: imapstate = 10; -pub const IMAP_FETCH: imapstate = 9; -pub const IMAP_SELECT: imapstate = 8; -pub const IMAP_LIST: imapstate = 7; -pub const IMAP_LOGIN: imapstate = 6; -pub const IMAP_AUTHENTICATE: imapstate = 5; -pub const IMAP_UPGRADETLS: imapstate = 4; -pub const IMAP_STARTTLS: imapstate = 3; -pub const IMAP_CAPABILITY: imapstate = 2; -pub const IMAP_SERVERGREET: imapstate = 1; -pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; -pub const SSH_LAST: sshstate = 60; -pub const SSH_QUIT: sshstate = 59; -pub const SSH_SESSION_FREE: sshstate = 58; -pub const SSH_SESSION_DISCONNECT: sshstate = 57; -pub const SSH_SCP_CHANNEL_FREE: sshstate = 56; -pub const SSH_SCP_WAIT_CLOSE: sshstate = 55; -pub const SSH_SCP_WAIT_EOF: sshstate = 54; -pub const SSH_SCP_SEND_EOF: sshstate = 53; -pub const SSH_SCP_DONE: sshstate = 52; -pub const SSH_SCP_DOWNLOAD: sshstate = 51; -pub const SSH_SCP_DOWNLOAD_INIT: sshstate = 50; -pub const SSH_SCP_UPLOAD_INIT: sshstate = 49; -pub const SSH_SCP_TRANS_INIT: sshstate = 48; -pub const SSH_SFTP_SHUTDOWN: sshstate = 47; -pub const SSH_SFTP_CLOSE: sshstate = 46; -pub const SSH_SFTP_DOWNLOAD_STAT: sshstate = 45; -pub const SSH_SFTP_DOWNLOAD_INIT: sshstate = 44; -pub const SSH_SFTP_READDIR_DONE: sshstate = 43; -pub const SSH_SFTP_READDIR_BOTTOM: sshstate = 42; -pub const SSH_SFTP_READDIR_LINK: sshstate = 41; -pub const SSH_SFTP_READDIR: sshstate = 40; -pub const SSH_SFTP_READDIR_INIT: sshstate = 39; -pub const SSH_SFTP_CREATE_DIRS_MKDIR: sshstate = 38; -pub const SSH_SFTP_CREATE_DIRS: sshstate = 37; -pub const SSH_SFTP_CREATE_DIRS_INIT: sshstate = 36; -pub const SSH_SFTP_UPLOAD_INIT: sshstate = 35; -pub const SSH_SFTP_TRANS_INIT: sshstate = 34; -pub const SSH_SFTP_FILETIME: sshstate = 33; -pub const SSH_SFTP_GETINFO: sshstate = 32; -pub const SSH_SFTP_QUOTE_STATVFS: sshstate = 31; -pub const SSH_SFTP_QUOTE_UNLINK: sshstate = 30; -pub const SSH_SFTP_QUOTE_RMDIR: sshstate = 29; -pub const SSH_SFTP_QUOTE_RENAME: sshstate = 28; -pub const SSH_SFTP_QUOTE_MKDIR: sshstate = 27; -pub const SSH_SFTP_QUOTE_SYMLINK: sshstate = 26; -pub const SSH_SFTP_QUOTE_SETSTAT: sshstate = 25; -pub const SSH_SFTP_QUOTE_STAT: sshstate = 24; -pub const SSH_SFTP_NEXT_QUOTE: sshstate = 23; -pub const SSH_SFTP_QUOTE: sshstate = 22; -pub const SSH_SFTP_POSTQUOTE_INIT: sshstate = 21; -pub const SSH_SFTP_QUOTE_INIT: sshstate = 20; -pub const SSH_SFTP_REALPATH: sshstate = 19; -pub const SSH_SFTP_INIT: sshstate = 18; -pub const SSH_AUTH_DONE: sshstate = 17; -pub const SSH_AUTH_GSSAPI: sshstate = 16; -pub const SSH_AUTH_KEY: sshstate = 15; -pub const SSH_AUTH_KEY_INIT: sshstate = 14; -pub const SSH_AUTH_HOST: sshstate = 13; -pub const SSH_AUTH_HOST_INIT: sshstate = 12; -pub const SSH_AUTH_AGENT: sshstate = 11; -pub const SSH_AUTH_AGENT_LIST: sshstate = 10; -pub const SSH_AUTH_AGENT_INIT: sshstate = 9; -pub const SSH_AUTH_PASS: sshstate = 8; -pub const SSH_AUTH_PASS_INIT: sshstate = 7; -pub const SSH_AUTH_PKEY: sshstate = 6; -pub const SSH_AUTH_PKEY_INIT: sshstate = 5; -pub const SSH_AUTHLIST: sshstate = 4; -pub const SSH_HOSTKEY: sshstate = 3; -pub const SSH_S_STARTUP: sshstate = 2; -pub const SSH_INIT: sshstate = 1; -pub const SSH_STOP: sshstate = 0; -pub const SSH_NO_STATE: sshstate = -1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct http_conn { - pub unused: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_conn { - pub pp: pingpong, - pub entrypath: *mut libc::c_char, - pub file: *mut libc::c_char, - pub dirs: *mut *mut libc::c_char, - pub dirdepth: libc::c_int, - pub dont_check: bool, - pub ctl_valid: bool, - pub cwddone: bool, - pub cwdcount: libc::c_int, - pub cwdfail: bool, - pub wait_data_conn: bool, - pub newport: libc::c_ushort, - pub newhost: *mut libc::c_char, - pub prevpath: *mut libc::c_char, - pub transfertype: libc::c_char, - pub count1: libc::c_int, - pub count2: libc::c_int, - pub count3: libc::c_int, - pub state: ftpstate, - pub state_saved: ftpstate, - pub retr_size_saved: curl_off_t, - pub server_os: *mut libc::c_char, - pub known_filesize: curl_off_t, -} -pub type ftpstate = libc::c_uint; -pub const FTP_LAST: ftpstate = 35; -pub const FTP_QUIT: ftpstate = 34; -pub const FTP_STOR: ftpstate = 33; -pub const FTP_RETR: ftpstate = 32; -pub const FTP_LIST: ftpstate = 31; -pub const FTP_PASV: ftpstate = 30; -pub const FTP_PRET: ftpstate = 29; -pub const FTP_PORT: ftpstate = 28; -pub const FTP_RETR_REST: ftpstate = 27; -pub const FTP_REST: ftpstate = 26; -pub const FTP_STOR_SIZE: ftpstate = 25; -pub const FTP_RETR_SIZE: ftpstate = 24; -pub const FTP_SIZE: ftpstate = 23; -pub const FTP_STOR_TYPE: ftpstate = 22; -pub const FTP_RETR_TYPE: ftpstate = 21; -pub const FTP_LIST_TYPE: ftpstate = 20; -pub const FTP_TYPE: ftpstate = 19; -pub const FTP_MDTM: ftpstate = 18; -pub const FTP_MKD: ftpstate = 17; -pub const FTP_CWD: ftpstate = 16; -pub const FTP_POSTQUOTE: ftpstate = 15; -pub const FTP_STOR_PREQUOTE: ftpstate = 14; -pub const FTP_RETR_PREQUOTE: ftpstate = 13; -pub const FTP_QUOTE: ftpstate = 12; -pub const FTP_NAMEFMT: ftpstate = 11; -pub const FTP_SYST: ftpstate = 10; -pub const FTP_PWD: ftpstate = 9; -pub const FTP_CCC: ftpstate = 8; -pub const FTP_PROT: ftpstate = 7; -pub const FTP_PBSZ: ftpstate = 6; -pub const FTP_ACCT: ftpstate = 5; -pub const FTP_PASS: ftpstate = 4; -pub const FTP_USER: ftpstate = 3; -pub const FTP_AUTH: ftpstate = 2; -pub const FTP_WAIT220: ftpstate = 1; -pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ntlmdata { - pub flags: libc::c_uint, - pub nonce: [libc::c_uchar; 8], - pub target_info_len: libc::c_uint, - pub target_info: *mut libc::c_void, - pub ntlm_auth_hlpr_socket: curl_socket_t, - pub ntlm_auth_hlpr_pid: pid_t, - pub challenge: *mut libc::c_char, - pub response: *mut libc::c_char, -} -pub type curlntlm = libc::c_uint; -pub const NTLMSTATE_LAST: curlntlm = 4; -pub const NTLMSTATE_TYPE3: curlntlm = 3; -pub const NTLMSTATE_TYPE2: curlntlm = 2; -pub const NTLMSTATE_TYPE1: curlntlm = 1; -pub const NTLMSTATE_NONE: curlntlm = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_handler { - pub scheme: *const libc::c_char, - pub setup_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub do_it: Option:: CURLcode>, - pub done: Option:: CURLcode>, - pub do_more: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, - >, - pub connect_it: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - >, - pub connecting: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - >, - pub doing: Option:: CURLcode>, - pub proto_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub doing_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub domore_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub perform_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub disconnect: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, bool) -> CURLcode, - >, - pub readwrite: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut ssize_t, - *mut bool, - ) -> CURLcode, - >, - pub connection_check: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_uint, - ) -> libc::c_uint, - >, - pub attach: Option:: ()>, - pub defport: libc::c_int, - pub protocol: libc::c_uint, - pub family: libc::c_uint, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_connect_data { - pub state: ssl_connection_state, - pub connecting_state: ssl_connect_state, - pub backend: *mut ssl_backend_data, - #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] - pub use_0: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type ssl_connect_state = libc::c_uint; -pub const ssl_connect_done: ssl_connect_state = 5; -pub const ssl_connect_3: ssl_connect_state = 4; -pub const ssl_connect_2_writing: ssl_connect_state = 3; -pub const ssl_connect_2_reading: ssl_connect_state = 2; -pub const ssl_connect_2: ssl_connect_state = 1; -pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; -pub const ssl_connection_complete: ssl_connection_state = 2; -pub const ssl_connection_negotiating: ssl_connection_state = 1; -pub const ssl_connection_none: ssl_connection_state = 0; -pub type Curl_send = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *const libc::c_void, - size_t, - *mut CURLcode, -) -> ssize_t; -pub type Curl_recv = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *mut libc::c_char, - size_t, - *mut CURLcode, -) -> ssize_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_6 = libc::c_uint; -pub const TRNSPRT_QUIC: C2RustUnnamed_6 = 5; -pub const TRNSPRT_UDP: C2RustUnnamed_6 = 4; -pub const TRNSPRT_TCP: C2RustUnnamed_6 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; -pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; -pub const CHUNK_TRAILER_CR: ChunkyState = 6; -pub const CHUNK_TRAILER: ChunkyState = 5; -pub const CHUNK_STOP: ChunkyState = 4; -pub const CHUNK_POSTLF: ChunkyState = 3; -pub const CHUNK_DATA: ChunkyState = 2; -pub const CHUNK_LF: ChunkyState = 1; -pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; -pub const CONNECT_DONE: connect_t = 17; -pub const CONNECT_REQ_READ_MORE: connect_t = 16; -pub const CONNECT_REQ_READ: connect_t = 15; -pub const CONNECT_REQ_SENDING: connect_t = 14; -pub const CONNECT_REQ_SEND: connect_t = 13; -pub const CONNECT_RESOLVE_REMOTE: connect_t = 12; -pub const CONNECT_RESOLVED: connect_t = 11; -pub const CONNECT_RESOLVING: connect_t = 10; -pub const CONNECT_REQ_INIT: connect_t = 9; -pub const CONNECT_AUTH_READ: connect_t = 8; -pub const CONNECT_AUTH_SEND: connect_t = 7; -pub const CONNECT_AUTH_INIT: connect_t = 6; -pub const CONNECT_GSSAPI_INIT: connect_t = 5; -pub const CONNECT_SOCKS_READ: connect_t = 4; -pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; -pub const CONNECT_SOCKS_SEND: connect_t = 2; -pub const CONNECT_SOCKS_INIT: connect_t = 1; -pub const CONNECT_INIT: connect_t = 0; -pub type curlfiletype = libc::c_uint; -pub const CURLFILETYPE_UNKNOWN: curlfiletype = 8; -pub const CURLFILETYPE_DOOR: curlfiletype = 7; -pub const CURLFILETYPE_SOCKET: curlfiletype = 6; -pub const CURLFILETYPE_NAMEDPIPE: curlfiletype = 5; -pub const CURLFILETYPE_DEVICE_CHAR: curlfiletype = 4; -pub const CURLFILETYPE_DEVICE_BLOCK: curlfiletype = 3; -pub const CURLFILETYPE_SYMLINK: curlfiletype = 2; -pub const CURLFILETYPE_DIRECTORY: curlfiletype = 1; -pub const CURLFILETYPE_FILE: curlfiletype = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_fileinfo { - pub filename: *mut libc::c_char, - pub filetype: curlfiletype, - pub time: time_t, - pub perm: libc::c_uint, - pub uid: libc::c_int, - pub gid: libc::c_int, - pub size: curl_off_t, - pub hardlinks: libc::c_long, - pub strings: C2RustUnnamed_7, - pub flags: libc::c_uint, - pub b_data: *mut libc::c_char, - pub b_size: size_t, - pub b_used: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct C2RustUnnamed_7 { - pub time: *mut libc::c_char, - pub perm: *mut libc::c_char, - pub user: *mut libc::c_char, - pub group: *mut libc::c_char, - pub target: *mut libc::c_char, -} -pub type curl_malloc_callback = Option::< - unsafe extern "C" fn(size_t) -> *mut libc::c_void, ->; -pub type curl_strdup_callback = Option::< - unsafe extern "C" fn(*const libc::c_char) -> *mut libc::c_char, ->; -pub type curl_calloc_callback = Option::< - unsafe extern "C" fn(size_t, size_t) -> *mut libc::c_void, ->; -pub type uint8_t = __uint8_t; -pub type uint16_t = __uint16_t; -pub type uint32_t = __uint32_t; -pub type in_addr_t = uint32_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct in_addr { - pub s_addr: in_addr_t, -} -pub type in_port_t = uint16_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct in6_addr { - pub __in6_u: C2RustUnnamed_8, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_8 { - pub __u6_addr8: [uint8_t; 16], - pub __u6_addr16: [uint16_t; 8], - pub __u6_addr32: [uint32_t; 4], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr_in { - pub sin_family: sa_family_t, - pub sin_port: in_port_t, - pub sin_addr: in_addr, - pub sin_zero: [libc::c_uchar; 8], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr_in6 { - pub sin6_family: sa_family_t, - pub sin6_port: in_port_t, - pub sin6_flowinfo: uint32_t, - pub sin6_addr: in6_addr, - pub sin6_scope_id: uint32_t, -} -pub type resolve_t = libc::c_int; -pub const CURLRESOLV_PENDING: resolve_t = 1; -pub const CURLRESOLV_RESOLVED: resolve_t = 0; -pub const CURLRESOLV_ERROR: resolve_t = -1; -pub const CURLRESOLV_TIMEDOUT: resolve_t = -2; -pub const STRING_CUSTOMREQUEST: dupstring = 6; -pub type ftpport = libc::c_uint; -pub const DONE: ftpport = 2; -pub const PORT: ftpport = 1; -pub const EPRT: ftpport = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_sockaddr_storage { - pub buffer: C2RustUnnamed_9, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_9 { - pub sa: sockaddr, - pub sa_in: sockaddr_in, - pub sa_in6: sockaddr_in6, - pub sa_stor: sockaddr_storage, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_sockaddr_ex { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub _sa_ex_u: C2RustUnnamed_10, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_10 { - pub addr: sockaddr, - pub buff: Curl_sockaddr_storage, -} -pub const IF2IP_FOUND: if2ip_result_t = 2; -pub const IF2IP_AF_NOT_SUPPORTED: if2ip_result_t = 1; -pub const IF2IP_NOT_FOUND: if2ip_result_t = 0; -pub type if2ip_result_t = libc::c_uint; -pub const STRING_FTPPORT: dupstring = 12; -pub type urlreject = libc::c_uint; -pub const REJECT_ZERO: urlreject = 4; -pub const REJECT_CTRL: urlreject = 3; -pub const REJECT_NADA: urlreject = 2; -pub type timerid = libc::c_uint; -pub const TIMER_LAST: timerid = 11; -pub const TIMER_REDIRECT: timerid = 10; -pub const TIMER_STARTACCEPT: timerid = 9; -pub const TIMER_POSTRANSFER: timerid = 8; -pub const TIMER_STARTTRANSFER: timerid = 7; -pub const TIMER_PRETRANSFER: timerid = 6; -pub const TIMER_APPCONNECT: timerid = 5; -pub const TIMER_CONNECT: timerid = 4; -pub const TIMER_NAMELOOKUP: timerid = 3; -pub const TIMER_STARTSINGLE: timerid = 2; -pub const TIMER_STARTOP: timerid = 1; -pub const TIMER_NONE: timerid = 0; -pub type CURLofft = libc::c_uint; -pub const CURL_OFFT_INVAL: CURLofft = 2; -pub const CURL_OFFT_FLOW: CURLofft = 1; -pub const CURL_OFFT_OK: CURLofft = 0; -pub const STRING_FTP_ALTERNATIVE_TO_USER: dupstring = 11; -pub const STRING_FTP_ACCOUNT: dupstring = 10; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_wc { - pub parser: *mut ftp_parselist_data, - pub backup: C2RustUnnamed_11, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct C2RustUnnamed_11 { - pub write_function: curl_write_callback, - pub file_descriptor: *mut FILE, -} -pub type dupstring = libc::c_uint; -pub const STRING_LAST: dupstring = 80; -pub const STRING_AWS_SIGV4: dupstring = 79; -pub const STRING_COPYPOSTFIELDS: dupstring = 78; -pub const STRING_LASTZEROTERMINATED: dupstring = 77; -pub const STRING_SSL_EC_CURVES: dupstring = 76; -pub const STRING_DNS_LOCAL_IP6: dupstring = 75; -pub const STRING_DNS_LOCAL_IP4: dupstring = 74; -pub const STRING_DNS_INTERFACE: dupstring = 73; -pub const STRING_DNS_SERVERS: dupstring = 72; -pub const STRING_SASL_AUTHZID: dupstring = 71; -pub const STRING_HSTS: dupstring = 70; -pub const STRING_ALTSVC: dupstring = 69; -pub const STRING_DOH: dupstring = 68; -pub const STRING_TARGET: dupstring = 67; -pub const STRING_UNIX_SOCKET_PATH: dupstring = 66; -pub const STRING_BEARER: dupstring = 65; -pub const STRING_TLSAUTH_PASSWORD_PROXY: dupstring = 64; -pub const STRING_TLSAUTH_PASSWORD: dupstring = 63; -pub const STRING_TLSAUTH_USERNAME_PROXY: dupstring = 62; -pub const STRING_TLSAUTH_USERNAME: dupstring = 61; -pub const STRING_MAIL_AUTH: dupstring = 60; -pub const STRING_MAIL_FROM: dupstring = 59; -pub const STRING_SERVICE_NAME: dupstring = 58; -pub const STRING_PROXY_SERVICE_NAME: dupstring = 57; -pub const STRING_SSH_KNOWNHOSTS: dupstring = 56; -pub const STRING_SSH_HOST_PUBLIC_KEY_MD5: dupstring = 55; -pub const STRING_SSH_PUBLIC_KEY: dupstring = 54; -pub const STRING_SSH_PRIVATE_KEY: dupstring = 53; -pub const STRING_RTSP_TRANSPORT: dupstring = 52; -pub const STRING_RTSP_STREAM_URI: dupstring = 51; -pub const STRING_RTSP_SESSION_ID: dupstring = 50; -pub const STRING_NOPROXY: dupstring = 49; -pub const STRING_PROXYPASSWORD: dupstring = 48; -pub const STRING_PROXYUSERNAME: dupstring = 47; -pub const STRING_OPTIONS: dupstring = 46; -pub const STRING_PASSWORD: dupstring = 45; -pub const STRING_USERNAME: dupstring = 44; -pub const STRING_SSL_ENGINE: dupstring = 43; -pub const STRING_SSL_ISSUERCERT_PROXY: dupstring = 42; -pub const STRING_SSL_ISSUERCERT: dupstring = 41; -pub const STRING_SSL_CRLFILE_PROXY: dupstring = 40; -pub const STRING_SSL_CRLFILE: dupstring = 39; -pub const STRING_USERAGENT: dupstring = 38; -pub const STRING_SSL_RANDOM_FILE: dupstring = 37; -pub const STRING_SSL_EGDSOCKET: dupstring = 36; -pub const STRING_SSL_CIPHER13_LIST_PROXY: dupstring = 35; -pub const STRING_SSL_CIPHER13_LIST: dupstring = 34; -pub const STRING_SSL_CIPHER_LIST_PROXY: dupstring = 33; -pub const STRING_SSL_CIPHER_LIST: dupstring = 32; -pub const STRING_SSL_PINNEDPUBLICKEY_PROXY: dupstring = 31; -pub const STRING_SSL_PINNEDPUBLICKEY: dupstring = 30; -pub const STRING_SSL_CAFILE_PROXY: dupstring = 29; -pub const STRING_SSL_CAFILE: dupstring = 28; -pub const STRING_SSL_CAPATH_PROXY: dupstring = 27; -pub const STRING_SSL_CAPATH: dupstring = 26; -pub const STRING_SET_URL: dupstring = 25; -pub const STRING_SET_REFERER: dupstring = 24; -pub const STRING_SET_RANGE: dupstring = 23; -pub const STRING_PRE_PROXY: dupstring = 22; -pub const STRING_PROXY: dupstring = 21; -pub const STRING_NETRC_FILE: dupstring = 20; -pub const STRING_KRB_LEVEL: dupstring = 19; -pub const STRING_KEY_TYPE_PROXY: dupstring = 18; -pub const STRING_KEY_TYPE: dupstring = 17; -pub const STRING_KEY_PASSWD_PROXY: dupstring = 16; -pub const STRING_KEY_PASSWD: dupstring = 15; -pub const STRING_KEY_PROXY: dupstring = 14; -pub const STRING_KEY: dupstring = 13; -pub const STRING_ENCODING: dupstring = 9; -pub const STRING_DEVICE: dupstring = 8; -pub const STRING_DEFAULT_PROTOCOL: dupstring = 7; -pub const STRING_COOKIEJAR: dupstring = 5; -pub const STRING_COOKIE: dupstring = 4; -pub const STRING_CERT_TYPE_PROXY: dupstring = 3; -pub const STRING_CERT_TYPE: dupstring = 2; -pub const STRING_CERT_PROXY: dupstring = 1; -pub const STRING_CERT: dupstring = 0; -#[inline] -unsafe extern "C" fn __bswap_16(mut __bsx: __uint16_t) -> __uint16_t { - return (__bsx as libc::c_int >> 8 as libc::c_int & 0xff as libc::c_int - | (__bsx as libc::c_int & 0xff as libc::c_int) << 8 as libc::c_int) - as __uint16_t; -} -#[no_mangle] -pub static mut Curl_handler_ftp: Curl_handler = unsafe { - { - let mut init = Curl_handler { - scheme: b"FTP\0" as *const u8 as *const libc::c_char, - setup_connection: Some( - ftp_setup_connection - as unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - ), - do_it: Some( - ftp_do as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - done: Some( - ftp_done - as unsafe extern "C" fn(*mut Curl_easy, CURLcode, bool) -> CURLcode, - ), - do_more: Some( - ftp_do_more - as unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, - ), - connect_it: Some( - ftp_connect - as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - connecting: Some( - ftp_multi_statemach - as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - doing: Some( - ftp_doing as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - proto_getsock: Some( - ftp_getsock - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - doing_getsock: Some( - ftp_getsock - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - domore_getsock: Some( - ftp_domore_getsock - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - perform_getsock: None, - disconnect: Some( - ftp_disconnect - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - bool, - ) -> CURLcode, - ), - readwrite: None, - connection_check: None, - attach: None, - defport: 21 as libc::c_int, - protocol: ((1 as libc::c_int) << 2 as libc::c_int) as libc::c_uint, - family: ((1 as libc::c_int) << 2 as libc::c_int) as libc::c_uint, - flags: ((1 as libc::c_int) << 1 as libc::c_int - | (1 as libc::c_int) << 2 as libc::c_int - | (1 as libc::c_int) << 5 as libc::c_int - | (1 as libc::c_int) << 6 as libc::c_int - | (1 as libc::c_int) << 11 as libc::c_int - | (1 as libc::c_int) << 12 as libc::c_int) as libc::c_uint, - }; - init - } -}; -#[no_mangle] -pub static mut Curl_handler_ftps: Curl_handler = unsafe { - { - let mut init = Curl_handler { - scheme: b"FTPS\0" as *const u8 as *const libc::c_char, - setup_connection: Some( - ftp_setup_connection - as unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - ), - do_it: Some( - ftp_do as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - done: Some( - ftp_done - as unsafe extern "C" fn(*mut Curl_easy, CURLcode, bool) -> CURLcode, - ), - do_more: Some( - ftp_do_more - as unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, - ), - connect_it: Some( - ftp_connect - as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - connecting: Some( - ftp_multi_statemach - as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - doing: Some( - ftp_doing as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - proto_getsock: Some( - ftp_getsock - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - doing_getsock: Some( - ftp_getsock - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - domore_getsock: Some( - ftp_domore_getsock - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - perform_getsock: None, - disconnect: Some( - ftp_disconnect - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - bool, - ) -> CURLcode, - ), - readwrite: None, - connection_check: None, - attach: None, - defport: 990 as libc::c_int, - protocol: ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint, - family: ((1 as libc::c_int) << 2 as libc::c_int) as libc::c_uint, - flags: ((1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int - | (1 as libc::c_int) << 2 as libc::c_int - | (1 as libc::c_int) << 5 as libc::c_int - | (1 as libc::c_int) << 6 as libc::c_int - | (1 as libc::c_int) << 12 as libc::c_int) as libc::c_uint, - }; - init - } -}; -unsafe extern "C" fn close_secondarysocket( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) { - if -(1 as libc::c_int) != (*conn).sock[1 as libc::c_int as usize] { - Curl_closesocket(data, conn, (*conn).sock[1 as libc::c_int as usize]); - (*conn).sock[1 as libc::c_int as usize] = -(1 as libc::c_int); - } - (*conn).bits.tcpconnect[1 as libc::c_int as usize] = 0 as libc::c_int != 0; - (*conn).bits.proxy_ssl_connected[1 as libc::c_int as usize] = 0 as libc::c_int != 0; -} -unsafe extern "C" fn freedirs(mut ftpc: *mut ftp_conn) { - if !((*ftpc).dirs).is_null() { - let mut i: libc::c_int = 0; - i = 0 as libc::c_int; - while i < (*ftpc).dirdepth { - Curl_cfree - .expect( - "non-null function pointer", - )(*((*ftpc).dirs).offset(i as isize) as *mut libc::c_void); - let ref mut fresh0 = *((*ftpc).dirs).offset(i as isize); - *fresh0 = 0 as *mut libc::c_char; - i += 1; - } - Curl_cfree - .expect("non-null function pointer")((*ftpc).dirs as *mut libc::c_void); - let ref mut fresh1 = (*ftpc).dirs; - *fresh1 = 0 as *mut *mut libc::c_char; - (*ftpc).dirdepth = 0 as libc::c_int; - } - Curl_cfree.expect("non-null function pointer")((*ftpc).file as *mut libc::c_void); - let ref mut fresh2 = (*ftpc).file; - *fresh2 = 0 as *mut libc::c_char; - Curl_cfree.expect("non-null function pointer")((*ftpc).newhost as *mut libc::c_void); - let ref mut fresh3 = (*ftpc).newhost; - *fresh3 = 0 as *mut libc::c_char; -} -unsafe extern "C" fn AcceptServerConnect(mut data: *mut Curl_easy) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut sock: curl_socket_t = (*conn).sock[1 as libc::c_int as usize]; - let mut s: curl_socket_t = -(1 as libc::c_int); - let mut add: Curl_sockaddr_storage = Curl_sockaddr_storage { - buffer: C2RustUnnamed_9 { - sa: sockaddr { - sa_family: 0, - sa_data: [0; 14], - }, - }, - }; - let mut size: curl_socklen_t = ::std::mem::size_of::() - as libc::c_ulong as curl_socklen_t; - if 0 as libc::c_int - == getsockname( - sock, - &mut add as *mut Curl_sockaddr_storage as *mut sockaddr, - &mut size, - ) - { - size = ::std::mem::size_of::() as libc::c_ulong - as curl_socklen_t; - s = accept( - sock, - &mut add as *mut Curl_sockaddr_storage as *mut sockaddr, - &mut size, - ); - } - Curl_closesocket(data, conn, sock); - if -(1 as libc::c_int) == s { - Curl_failf( - data, - b"Error accept()ing server connect\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FTP_PORT_FAILED; - } - Curl_infof( - data, - b"Connection accepted from server\0" as *const u8 as *const libc::c_char, - ); - let ref mut fresh4 = (*conn).bits; - (*fresh4).set_do_more(0 as libc::c_int as bit); - (*conn).sock[1 as libc::c_int as usize] = s; - curlx_nonblock(s, 1 as libc::c_int); - let ref mut fresh5 = (*conn).bits; - (*fresh5).set_sock_accepted(1 as libc::c_int as bit); - if ((*data).set.fsockopt).is_some() { - let mut error: libc::c_int = 0 as libc::c_int; - Curl_set_in_callback(data, 1 as libc::c_int != 0); - error = ((*data).set.fsockopt) - .expect( - "non-null function pointer", - )((*data).set.sockopt_client, s, CURLSOCKTYPE_ACCEPT); - Curl_set_in_callback(data, 0 as libc::c_int != 0); - if error != 0 { - close_secondarysocket(data, conn); - return CURLE_ABORTED_BY_CALLBACK; - } - } - return CURLE_OK; -} -unsafe extern "C" fn ftp_timeleft_accept(mut data: *mut Curl_easy) -> timediff_t { - let mut timeout_ms: timediff_t = 60000 as libc::c_int as timediff_t; - let mut other: timediff_t = 0; - let mut now: curltime = curltime { tv_sec: 0, tv_usec: 0 }; - if (*data).set.accepttimeout > 0 as libc::c_int as libc::c_long { - timeout_ms = (*data).set.accepttimeout; - } - now = Curl_now(); - other = Curl_timeleft(data, &mut now, 0 as libc::c_int != 0); - if other != 0 && other < timeout_ms { - timeout_ms = other; - } else { - timeout_ms -= Curl_timediff(now, (*data).progress.t_acceptdata); - if timeout_ms == 0 { - return -(1 as libc::c_int) as timediff_t; - } - } - return timeout_ms; -} -unsafe extern "C" fn ReceivedServerConnect( - mut data: *mut Curl_easy, - mut received: *mut bool, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ctrl_sock: curl_socket_t = (*conn).sock[0 as libc::c_int as usize]; - let mut data_sock: curl_socket_t = (*conn).sock[1 as libc::c_int as usize]; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - let mut result: libc::c_int = 0; - let mut timeout_ms: timediff_t = 0; - let mut nread: ssize_t = 0; - let mut ftpcode: libc::c_int = 0; - *received = 0 as libc::c_int != 0; - timeout_ms = ftp_timeleft_accept(data); - Curl_infof( - data, - b"Checking for server connect\0" as *const u8 as *const libc::c_char, - ); - if timeout_ms < 0 as libc::c_int as libc::c_long { - Curl_failf( - data, - b"Accept timeout occurred while waiting server connect\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_FTP_ACCEPT_TIMEOUT; - } - if (*pp).cache_size != 0 && !((*pp).cache).is_null() - && *((*pp).cache).offset(0 as libc::c_int as isize) as libc::c_int > '3' as i32 - { - Curl_infof( - data, - b"There is negative response in cache while serv connect\0" as *const u8 - as *const libc::c_char, - ); - Curl_GetFTPResponse(data, &mut nread, &mut ftpcode); - return CURLE_FTP_ACCEPT_FAILED; - } - result = Curl_socket_check( - ctrl_sock, - data_sock, - -(1 as libc::c_int), - 0 as libc::c_int as timediff_t, - ); - match result { - -1 => { - Curl_failf( - data, - b"Error while waiting for server connect\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_FTP_ACCEPT_FAILED; - } - 0 => {} - _ => { - if result & (0x4 as libc::c_int) << 1 as libc::c_int != 0 { - Curl_infof( - data, - b"Ready to accept data connection from server\0" as *const u8 - as *const libc::c_char, - ); - *received = 1 as libc::c_int != 0; - } else if result & 0x1 as libc::c_int != 0 { - Curl_infof( - data, - b"Ctrl conn has data while waiting for data conn\0" as *const u8 - as *const libc::c_char, - ); - Curl_GetFTPResponse(data, &mut nread, &mut ftpcode); - if ftpcode / 100 as libc::c_int > 3 as libc::c_int { - return CURLE_FTP_ACCEPT_FAILED; - } - return CURLE_WEIRD_SERVER_REPLY; - } - } - } - return CURLE_OK; -} -unsafe extern "C" fn InitiateTransfer(mut data: *mut Curl_easy) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - if ((*conn).bits).ftp_use_data_ssl() != 0 { - Curl_infof( - data, - b"Doing the SSL/TLS handshake on the data stream\0" as *const u8 - as *const libc::c_char, - ); - result = Curl_ssl_connect(data, conn, 1 as libc::c_int); - if result as u64 != 0 { - return result; - } - } - if (*conn).proto.ftpc.state_saved as libc::c_uint - == FTP_STOR as libc::c_int as libc::c_uint - { - Curl_pgrsSetUploadSize(data, (*data).state.infilesize); - Curl_setup_transfer( - data, - -(1 as libc::c_int), - -(1 as libc::c_int) as curl_off_t, - 0 as libc::c_int != 0, - 1 as libc::c_int, - ); - } else { - Curl_setup_transfer( - data, - 1 as libc::c_int, - (*conn).proto.ftpc.retr_size_saved, - 0 as libc::c_int != 0, - -(1 as libc::c_int), - ); - } - (*conn).proto.ftpc.pp.pending_resp = 1 as libc::c_int != 0; - _state(data, FTP_STOP); - return CURLE_OK; -} -unsafe extern "C" fn AllowServerConnect( - mut data: *mut Curl_easy, - mut connected: *mut bool, -) -> CURLcode { - let mut timeout_ms: timediff_t = 0; - let mut result: CURLcode = CURLE_OK; - *connected = 0 as libc::c_int != 0; - Curl_infof( - data, - b"Preparing for accepting server on data port\0" as *const u8 - as *const libc::c_char, - ); - Curl_pgrsTime(data, TIMER_STARTACCEPT); - timeout_ms = ftp_timeleft_accept(data); - if timeout_ms < 0 as libc::c_int as libc::c_long { - Curl_failf( - data, - b"Accept timeout occurred while waiting server connect\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_FTP_ACCEPT_TIMEOUT; - } - result = ReceivedServerConnect(data, connected); - if result as u64 != 0 { - return result; - } - if *connected { - result = AcceptServerConnect(data); - if result as u64 != 0 { - return result; - } - result = InitiateTransfer(data); - if result as u64 != 0 { - return result; - } - } else if *connected as libc::c_int == 0 as libc::c_int { - Curl_expire( - data, - if (*data).set.accepttimeout > 0 as libc::c_int as libc::c_long { - (*data).set.accepttimeout - } else { - 60000 as libc::c_int as libc::c_long - }, - EXPIRE_100_TIMEOUT, - ); - } - return result; -} -unsafe extern "C" fn ftp_endofresp( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut line: *mut libc::c_char, - mut len: size_t, - mut code: *mut libc::c_int, -) -> bool { - if len > 3 as libc::c_int as libc::c_ulong - && (Curl_isdigit( - *line.offset(0 as libc::c_int as isize) as libc::c_uchar as libc::c_int, - ) != 0 - && Curl_isdigit( - *line.offset(1 as libc::c_int as isize) as libc::c_uchar as libc::c_int, - ) != 0 - && Curl_isdigit( - *line.offset(2 as libc::c_int as isize) as libc::c_uchar as libc::c_int, - ) != 0 - && ' ' as i32 == *line.offset(3 as libc::c_int as isize) as libc::c_int) - { - *code = curlx_sltosi( - strtol(line, 0 as *mut *mut libc::c_char, 10 as libc::c_int), - ); - return 1 as libc::c_int != 0; - } - return 0 as libc::c_int != 0; -} -unsafe extern "C" fn ftp_readresp( - mut data: *mut Curl_easy, - mut sockfd: curl_socket_t, - mut pp: *mut pingpong, - mut ftpcode: *mut libc::c_int, - mut size: *mut size_t, -) -> CURLcode { - let mut code: libc::c_int = 0; - let mut result: CURLcode = Curl_pp_readresp(data, sockfd, pp, &mut code, size); - (*data).info.httpcode = code; - if !ftpcode.is_null() { - *ftpcode = code; - } - if 421 as libc::c_int == code { - Curl_infof( - data, - b"We got a 421 - timeout!\0" as *const u8 as *const libc::c_char, - ); - _state(data, FTP_STOP); - return CURLE_OPERATION_TIMEDOUT; - } - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_GetFTPResponse( - mut data: *mut Curl_easy, - mut nreadp: *mut ssize_t, - mut ftpcode: *mut libc::c_int, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut sockfd: curl_socket_t = (*conn).sock[0 as libc::c_int as usize]; - let mut result: CURLcode = CURLE_OK; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - let mut nread: size_t = 0; - let mut cache_skip: libc::c_int = 0 as libc::c_int; - let mut value_to_be_ignored: libc::c_int = 0 as libc::c_int; - if !ftpcode.is_null() { - *ftpcode = 0 as libc::c_int; - } else { - ftpcode = &mut value_to_be_ignored; - } - *nreadp = 0 as libc::c_int as ssize_t; - let mut current_block_20: u64; - while *ftpcode == 0 && result as u64 == 0 { - let mut timeout: timediff_t = Curl_pp_state_timeout( - data, - pp, - 0 as libc::c_int != 0, - ); - let mut interval_ms: timediff_t = 0; - if timeout <= 0 as libc::c_int as libc::c_long { - Curl_failf( - data, - b"FTP response timeout\0" as *const u8 as *const libc::c_char, - ); - return CURLE_OPERATION_TIMEDOUT; - } - interval_ms = 1000 as libc::c_int as timediff_t; - if timeout < interval_ms { - interval_ms = timeout; - } - if !(!((*pp).cache).is_null() && cache_skip < 2 as libc::c_int) { - if !Curl_conn_data_pending(conn, 0 as libc::c_int) { - match Curl_socket_check( - sockfd, - -(1 as libc::c_int), - -(1 as libc::c_int), - interval_ms, - ) { - -1 => { - current_block_20 = 30138434020917367; - match current_block_20 { - 30138434020917367 => { - Curl_failf( - data, - b"FTP response aborted due to select/poll error: %d\0" - as *const u8 as *const libc::c_char, - *__errno_location(), - ); - return CURLE_RECV_ERROR; - } - _ => { - if Curl_pgrsUpdate(data) != 0 { - return CURLE_ABORTED_BY_CALLBACK; - } - continue; - } - } - } - 0 => { - current_block_20 = 4838030885599732913; - match current_block_20 { - 30138434020917367 => { - Curl_failf( - data, - b"FTP response aborted due to select/poll error: %d\0" - as *const u8 as *const libc::c_char, - *__errno_location(), - ); - return CURLE_RECV_ERROR; - } - _ => { - if Curl_pgrsUpdate(data) != 0 { - return CURLE_ABORTED_BY_CALLBACK; - } - continue; - } - } - } - _ => {} - } - } - } - result = ftp_readresp(data, sockfd, pp, ftpcode, &mut nread); - if result as u64 != 0 { - break; - } - if nread == 0 && !((*pp).cache).is_null() { - cache_skip += 1; - } else { - cache_skip = 0 as libc::c_int; - } - *nreadp = (*nreadp as libc::c_ulong).wrapping_add(nread) as ssize_t as ssize_t; - } - (*pp).pending_resp = 0 as libc::c_int != 0; - return result; -} -unsafe extern "C" fn _state(mut data: *mut Curl_easy, mut newstate: ftpstate) { - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - (*ftpc).state = newstate; -} -unsafe extern "C" fn ftp_state_user( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = Curl_pp_sendf( - data, - &mut (*conn).proto.ftpc.pp as *mut pingpong, - b"USER %s\0" as *const u8 as *const libc::c_char, - if !((*conn).user).is_null() { - (*conn).user as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - if result as u64 == 0 { - _state(data, FTP_USER); - let ref mut fresh6 = (*data).state; - (*fresh6).set_ftp_trying_alternative(0 as libc::c_int as bit); - } - return result; -} -unsafe extern "C" fn ftp_state_pwd( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = Curl_pp_sendf( - data, - &mut (*conn).proto.ftpc.pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - b"PWD\0" as *const u8 as *const libc::c_char, - ); - if result as u64 == 0 { - _state(data, FTP_PWD); - } - return result; -} -unsafe extern "C" fn ftp_getsock( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut socks: *mut curl_socket_t, -) -> libc::c_int { - return Curl_pp_getsock(data, &mut (*conn).proto.ftpc.pp, socks); -} -unsafe extern "C" fn ftp_domore_getsock( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut socks: *mut curl_socket_t, -) -> libc::c_int { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if (*conn).cnnct.state as libc::c_uint - >= CONNECT_SOCKS_INIT as libc::c_int as libc::c_uint - && ((*conn).cnnct.state as libc::c_uint) - < CONNECT_DONE as libc::c_int as libc::c_uint - { - return Curl_SOCKS_getsock(conn, socks, 1 as libc::c_int); - } - if FTP_STOP as libc::c_int as libc::c_uint == (*ftpc).state as libc::c_uint { - let mut bits: libc::c_int = (1 as libc::c_int) << 0 as libc::c_int; - let mut any: bool = 0 as libc::c_int != 0; - *socks - .offset(0 as libc::c_int as isize) = (*conn).sock[0 as libc::c_int as usize]; - if ((*data).set).ftp_use_port() == 0 { - let mut s: libc::c_int = 0; - let mut i: libc::c_int = 0; - s = 1 as libc::c_int; - i = 0 as libc::c_int; - while i < 2 as libc::c_int { - if (*conn).tempsock[i as usize] != -(1 as libc::c_int) { - *socks.offset(s as isize) = (*conn).tempsock[i as usize]; - let fresh7 = s; - s = s + 1; - bits |= (1 as libc::c_int) << 16 as libc::c_int + fresh7; - any = 1 as libc::c_int != 0; - } - i += 1; - } - } - if !any { - *socks - .offset( - 1 as libc::c_int as isize, - ) = (*conn).sock[1 as libc::c_int as usize]; - bits - |= (1 as libc::c_int) << 16 as libc::c_int + 1 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int; - } - return bits; - } - return Curl_pp_getsock(data, &mut (*conn).proto.ftpc.pp, socks); -} -unsafe extern "C" fn ftp_state_cwd( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if (*ftpc).cwddone { - result = ftp_state_mdtm(data); - } else { - (*ftpc).count2 = 0 as libc::c_int; - (*ftpc) - .count3 = if (*data).set.ftp_create_missing_dirs == 2 as libc::c_int { - 1 as libc::c_int - } else { - 0 as libc::c_int - }; - if ((*conn).bits).reuse() as libc::c_int != 0 && !((*ftpc).entrypath).is_null() - && !((*ftpc).dirdepth != 0 - && *(*((*ftpc).dirs).offset(0 as libc::c_int as isize)) - .offset(0 as libc::c_int as isize) as libc::c_int == '/' as i32) - { - (*ftpc).cwdcount = 0 as libc::c_int; - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"CWD %s\0" as *const u8 as *const libc::c_char, - (*ftpc).entrypath, - ); - if result as u64 == 0 { - _state(data, FTP_CWD); - } - } else if (*ftpc).dirdepth != 0 { - (*ftpc).cwdcount = 1 as libc::c_int; - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"CWD %s\0" as *const u8 as *const libc::c_char, - *((*ftpc).dirs).offset(((*ftpc).cwdcount - 1 as libc::c_int) as isize), - ); - if result as u64 == 0 { - _state(data, FTP_CWD); - } - } else { - result = ftp_state_mdtm(data); - } - } - return result; -} -unsafe extern "C" fn ftp_state_use_port( - mut data: *mut Curl_easy, - mut fcmd: ftpport, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut portsock: curl_socket_t = -(1 as libc::c_int); - let mut myhost: [libc::c_char; 47] = *::std::mem::transmute::< - &[u8; 47], - &mut [libc::c_char; 47], - >( - b"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", - ); - let mut ss: Curl_sockaddr_storage = Curl_sockaddr_storage { - buffer: C2RustUnnamed_9 { - sa: sockaddr { - sa_family: 0, - sa_data: [0; 14], - }, - }, - }; - let mut res: *mut Curl_addrinfo = 0 as *mut Curl_addrinfo; - let mut ai: *mut Curl_addrinfo = 0 as *mut Curl_addrinfo; - let mut sslen: curl_socklen_t = 0; - let mut hbuf: [libc::c_char; 1025] = [0; 1025]; - let mut sa: *mut sockaddr = &mut ss as *mut Curl_sockaddr_storage as *mut sockaddr; - let sa4: *mut sockaddr_in = sa as *mut libc::c_void as *mut sockaddr_in; - let sa6: *mut sockaddr_in6 = sa as *mut libc::c_void as *mut sockaddr_in6; - static mut mode: [[libc::c_char; 5]; 2] = unsafe { - [ - *::std::mem::transmute::<&[u8; 5], &[libc::c_char; 5]>(b"EPRT\0"), - *::std::mem::transmute::<&[u8; 5], &[libc::c_char; 5]>(b"PORT\0"), - ] - }; - let mut rc: resolve_t = CURLRESOLV_RESOLVED; - let mut error: libc::c_int = 0; - let mut host: *mut libc::c_char = 0 as *mut libc::c_char; - let mut string_ftpport: *mut libc::c_char = (*data) - .set - .str_0[STRING_FTPPORT as libc::c_int as usize]; - let mut h: *mut Curl_dns_entry = 0 as *mut Curl_dns_entry; - let mut port_min: libc::c_ushort = 0 as libc::c_int as libc::c_ushort; - let mut port_max: libc::c_ushort = 0 as libc::c_int as libc::c_ushort; - let mut port: libc::c_ushort = 0; - let mut possibly_non_local: bool = 1 as libc::c_int != 0; - let mut buffer: [libc::c_char; 256] = [0; 256]; - let mut addr: *mut libc::c_char = 0 as *mut libc::c_char; - if !((*data).set.str_0[STRING_FTPPORT as libc::c_int as usize]).is_null() - && strlen((*data).set.str_0[STRING_FTPPORT as libc::c_int as usize]) - > 1 as libc::c_int as libc::c_ulong - { - let mut addrlen: size_t = if 46 as libc::c_int as libc::c_ulong - > strlen(string_ftpport) - { - 46 as libc::c_int as libc::c_ulong - } else { - strlen(string_ftpport) - }; - let mut ip_start: *mut libc::c_char = string_ftpport; - let mut ip_end: *mut libc::c_char = 0 as *mut libc::c_char; - let mut port_start: *mut libc::c_char = 0 as *mut libc::c_char; - let mut port_sep: *mut libc::c_char = 0 as *mut libc::c_char; - addr = Curl_ccalloc - .expect( - "non-null function pointer", - )( - addrlen.wrapping_add(1 as libc::c_int as libc::c_ulong), - 1 as libc::c_int as size_t, - ) as *mut libc::c_char; - if addr.is_null() { - return CURLE_OUT_OF_MEMORY; - } - if *string_ftpport as libc::c_int == '[' as i32 { - ip_start = string_ftpport.offset(1 as libc::c_int as isize); - ip_end = strchr(string_ftpport, ']' as i32); - if !ip_end.is_null() { - strncpy( - addr, - ip_start, - ip_end.offset_from(ip_start) as libc::c_long as libc::c_ulong, - ); - } - } else if *string_ftpport as libc::c_int == ':' as i32 { - ip_end = string_ftpport; - } else { - ip_end = strchr(string_ftpport, ':' as i32); - if !ip_end.is_null() { - if inet_pton(10 as libc::c_int, string_ftpport, sa6 as *mut libc::c_void) - == 1 as libc::c_int - { - port_max = 0 as libc::c_int as libc::c_ushort; - port_min = port_max; - strcpy(addr, string_ftpport); - ip_end = 0 as *mut libc::c_char; - } else { - strncpy( - addr, - string_ftpport, - ip_end.offset_from(ip_start) as libc::c_long as libc::c_ulong, - ); - } - } else { - strcpy(addr, string_ftpport); - } - } - if !ip_end.is_null() { - port_start = strchr(ip_end, ':' as i32); - if !port_start.is_null() { - port_min = curlx_ultous( - strtoul( - port_start.offset(1 as libc::c_int as isize), - 0 as *mut *mut libc::c_char, - 10 as libc::c_int, - ), - ); - port_sep = strchr(port_start, '-' as i32); - if !port_sep.is_null() { - port_max = curlx_ultous( - strtoul( - port_sep.offset(1 as libc::c_int as isize), - 0 as *mut *mut libc::c_char, - 10 as libc::c_int, - ), - ); - } else { - port_max = port_min; - } - } - } - if port_min as libc::c_int > port_max as libc::c_int { - port_max = 0 as libc::c_int as libc::c_ushort; - port_min = port_max; - } - if *addr as libc::c_int != '\u{0}' as i32 { - match Curl_if2ip( - (*(*conn).ip_addr).ai_family, - Curl_ipv6_scope((*(*conn).ip_addr).ai_addr), - (*conn).scope_id, - addr, - hbuf.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 1025]>() as libc::c_ulong - as libc::c_int, - ) as libc::c_uint - { - 0 => { - host = addr; - } - 1 => return CURLE_FTP_PORT_FAILED, - 2 => { - host = hbuf.as_mut_ptr(); - } - _ => {} - } - } else { - host = 0 as *mut libc::c_char; - } - } - if host.is_null() { - let mut r: *const libc::c_char = 0 as *const libc::c_char; - sslen = ::std::mem::size_of::() as libc::c_ulong - as curl_socklen_t; - if getsockname((*conn).sock[0 as libc::c_int as usize], sa, &mut sslen) != 0 { - Curl_failf( - data, - b"getsockname() failed: %s\0" as *const u8 as *const libc::c_char, - Curl_strerror( - *__errno_location(), - buffer.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ), - ); - Curl_cfree.expect("non-null function pointer")(addr as *mut libc::c_void); - return CURLE_FTP_PORT_FAILED; - } - match (*sa).sa_family as libc::c_int { - 10 => { - r = inet_ntop( - (*sa).sa_family as libc::c_int, - &mut (*sa6).sin6_addr as *mut in6_addr as *const libc::c_void, - hbuf.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 1025]>() as libc::c_ulong - as curl_socklen_t, - ); - } - _ => { - r = inet_ntop( - (*sa).sa_family as libc::c_int, - &mut (*sa4).sin_addr as *mut in_addr as *const libc::c_void, - hbuf.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 1025]>() as libc::c_ulong - as curl_socklen_t, - ); - } - } - if r.is_null() { - return CURLE_FTP_PORT_FAILED; - } - host = hbuf.as_mut_ptr(); - possibly_non_local = 0 as libc::c_int != 0; - } - rc = Curl_resolv(data, host, 0 as libc::c_int, 0 as libc::c_int != 0, &mut h); - if rc as libc::c_int == CURLRESOLV_PENDING as libc::c_int { - Curl_resolver_wait_resolv(data, &mut h); - } - if !h.is_null() { - res = (*h).addr; - Curl_resolv_unlock(data, h); - } else { - res = 0 as *mut Curl_addrinfo; - } - if res.is_null() { - Curl_failf( - data, - b"failed to resolve the address provided to PORT: %s\0" as *const u8 - as *const libc::c_char, - host, - ); - Curl_cfree.expect("non-null function pointer")(addr as *mut libc::c_void); - return CURLE_FTP_PORT_FAILED; - } - Curl_cfree.expect("non-null function pointer")(addr as *mut libc::c_void); - host = 0 as *mut libc::c_char; - portsock = -(1 as libc::c_int); - error = 0 as libc::c_int; - ai = res; - while !ai.is_null() { - result = Curl_socket(data, ai, 0 as *mut Curl_sockaddr_ex, &mut portsock); - if !(result as u64 != 0) { - break; - } - error = *__errno_location(); - ai = (*ai).ai_next; - } - if ai.is_null() { - Curl_failf( - data, - b"socket failure: %s\0" as *const u8 as *const libc::c_char, - Curl_strerror( - error, - buffer.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ), - ); - return CURLE_FTP_PORT_FAILED; - } - memcpy( - sa as *mut libc::c_void, - (*ai).ai_addr as *const libc::c_void, - (*ai).ai_addrlen as libc::c_ulong, - ); - sslen = (*ai).ai_addrlen; - port = port_min; - while port as libc::c_int <= port_max as libc::c_int { - if (*sa).sa_family as libc::c_int == 2 as libc::c_int { - (*sa4).sin_port = __bswap_16(port); - } else { - (*sa6).sin6_port = __bswap_16(port); - } - if !(bind(portsock, sa, sslen) != 0) { - break; - } - error = *__errno_location(); - if possibly_non_local as libc::c_int != 0 && error == 99 as libc::c_int { - Curl_infof( - data, - b"bind(port=%hu) on non-local address failed: %s\0" as *const u8 - as *const libc::c_char, - port as libc::c_int, - Curl_strerror( - error, - buffer.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ), - ); - sslen = ::std::mem::size_of::() as libc::c_ulong - as curl_socklen_t; - if getsockname((*conn).sock[0 as libc::c_int as usize], sa, &mut sslen) != 0 - { - Curl_failf( - data, - b"getsockname() failed: %s\0" as *const u8 as *const libc::c_char, - Curl_strerror( - *__errno_location(), - buffer.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ), - ); - Curl_closesocket(data, conn, portsock); - return CURLE_FTP_PORT_FAILED; - } - port = port_min; - possibly_non_local = 0 as libc::c_int != 0; - } else { - if error != 98 as libc::c_int && error != 13 as libc::c_int { - Curl_failf( - data, - b"bind(port=%hu) failed: %s\0" as *const u8 as *const libc::c_char, - port as libc::c_int, - Curl_strerror( - error, - buffer.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ), - ); - Curl_closesocket(data, conn, portsock); - return CURLE_FTP_PORT_FAILED; - } - port = port.wrapping_add(1); - } - } - if port as libc::c_int > port_max as libc::c_int { - Curl_failf( - data, - b"bind() failed, we ran out of ports!\0" as *const u8 as *const libc::c_char, - ); - Curl_closesocket(data, conn, portsock); - return CURLE_FTP_PORT_FAILED; - } - sslen = ::std::mem::size_of::() as libc::c_ulong - as curl_socklen_t; - if getsockname(portsock, sa, &mut sslen) != 0 { - Curl_failf( - data, - b"getsockname() failed: %s\0" as *const u8 as *const libc::c_char, - Curl_strerror( - *__errno_location(), - buffer.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ), - ); - Curl_closesocket(data, conn, portsock); - return CURLE_FTP_PORT_FAILED; - } - if listen(portsock, 1 as libc::c_int) != 0 { - Curl_failf( - data, - b"socket failure: %s\0" as *const u8 as *const libc::c_char, - Curl_strerror( - *__errno_location(), - buffer.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ), - ); - Curl_closesocket(data, conn, portsock); - return CURLE_FTP_PORT_FAILED; - } - Curl_printable_address( - ai, - myhost.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 47]>() as libc::c_ulong, - ); - if ((*conn).bits).ftp_use_eprt() == 0 && ((*conn).bits).ipv6() as libc::c_int != 0 { - let ref mut fresh8 = (*conn).bits; - (*fresh8).set_ftp_use_eprt(1 as libc::c_int as bit); - } - let mut current_block_152: u64; - while fcmd as libc::c_uint != DONE as libc::c_int as libc::c_uint { - if !(((*conn).bits).ftp_use_eprt() == 0 - && EPRT as libc::c_int as libc::c_uint == fcmd as libc::c_uint) - { - if !(PORT as libc::c_int as libc::c_uint == fcmd as libc::c_uint - && (*sa).sa_family as libc::c_int != 2 as libc::c_int) - { - match (*sa).sa_family as libc::c_int { - 2 => { - current_block_152 = 5173505947521674114; - match current_block_152 { - 6897641277760232815 => { - port = __bswap_16((*sa6).sin6_port); - } - _ => { - port = __bswap_16((*sa4).sin_port); - } - } - if EPRT as libc::c_int as libc::c_uint == fcmd as libc::c_uint { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s |%d|%s|%hu|\0" as *const u8 as *const libc::c_char, - (mode[fcmd as usize]).as_ptr(), - if (*sa).sa_family as libc::c_int == 2 as libc::c_int { - 1 as libc::c_int - } else { - 2 as libc::c_int - }, - myhost.as_mut_ptr(), - port as libc::c_int, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failure sending EPRT command: %s\0" as *const u8 - as *const libc::c_char, - curl_easy_strerror(result), - ); - Curl_closesocket(data, conn, portsock); - (*ftpc).count1 = PORT as libc::c_int; - _state(data, FTP_STOP); - return result; - } - break; - } else if PORT as libc::c_int as libc::c_uint - == fcmd as libc::c_uint - { - let mut target: [libc::c_char; 67] = [0; 67]; - let mut source: *mut libc::c_char = myhost.as_mut_ptr(); - let mut dest: *mut libc::c_char = target.as_mut_ptr(); - while !source.is_null() && *source as libc::c_int != 0 { - if *source as libc::c_int == '.' as i32 { - *dest = ',' as i32 as libc::c_char; - } else { - *dest = *source; - } - dest = dest.offset(1); - source = source.offset(1); - } - *dest = 0 as libc::c_int as libc::c_char; - curl_msnprintf( - dest, - 20 as libc::c_int as size_t, - b",%d,%d\0" as *const u8 as *const libc::c_char, - port as libc::c_int >> 8 as libc::c_int, - port as libc::c_int & 0xff as libc::c_int, - ); - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s %s\0" as *const u8 as *const libc::c_char, - (mode[fcmd as usize]).as_ptr(), - target.as_mut_ptr(), - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failure sending PORT command: %s\0" as *const u8 - as *const libc::c_char, - curl_easy_strerror(result), - ); - Curl_closesocket(data, conn, portsock); - _state(data, FTP_STOP); - return result; - } - break; - } - } - 10 => { - current_block_152 = 6897641277760232815; - match current_block_152 { - 6897641277760232815 => { - port = __bswap_16((*sa6).sin6_port); - } - _ => { - port = __bswap_16((*sa4).sin_port); - } - } - if EPRT as libc::c_int as libc::c_uint == fcmd as libc::c_uint { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s |%d|%s|%hu|\0" as *const u8 as *const libc::c_char, - (mode[fcmd as usize]).as_ptr(), - if (*sa).sa_family as libc::c_int == 2 as libc::c_int { - 1 as libc::c_int - } else { - 2 as libc::c_int - }, - myhost.as_mut_ptr(), - port as libc::c_int, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failure sending EPRT command: %s\0" as *const u8 - as *const libc::c_char, - curl_easy_strerror(result), - ); - Curl_closesocket(data, conn, portsock); - (*ftpc).count1 = PORT as libc::c_int; - _state(data, FTP_STOP); - return result; - } - break; - } else if PORT as libc::c_int as libc::c_uint - == fcmd as libc::c_uint - { - let mut target: [libc::c_char; 67] = [0; 67]; - let mut source: *mut libc::c_char = myhost.as_mut_ptr(); - let mut dest: *mut libc::c_char = target.as_mut_ptr(); - while !source.is_null() && *source as libc::c_int != 0 { - if *source as libc::c_int == '.' as i32 { - *dest = ',' as i32 as libc::c_char; - } else { - *dest = *source; - } - dest = dest.offset(1); - source = source.offset(1); - } - *dest = 0 as libc::c_int as libc::c_char; - curl_msnprintf( - dest, - 20 as libc::c_int as size_t, - b",%d,%d\0" as *const u8 as *const libc::c_char, - port as libc::c_int >> 8 as libc::c_int, - port as libc::c_int & 0xff as libc::c_int, - ); - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s %s\0" as *const u8 as *const libc::c_char, - (mode[fcmd as usize]).as_ptr(), - target.as_mut_ptr(), - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failure sending PORT command: %s\0" as *const u8 - as *const libc::c_char, - curl_easy_strerror(result), - ); - Curl_closesocket(data, conn, portsock); - _state(data, FTP_STOP); - return result; - } - break; - } - } - _ => {} - } - } - } - fcmd += 1; - } - (*ftpc).count1 = fcmd as libc::c_int; - close_secondarysocket(data, conn); - (*conn).sock[1 as libc::c_int as usize] = portsock; - (*conn).bits.tcpconnect[1 as libc::c_int as usize] = 1 as libc::c_int != 0; - _state(data, FTP_PORT); - return result; -} -unsafe extern "C" fn ftp_state_use_pasv( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut result: CURLcode = CURLE_OK; - static mut mode: [[libc::c_char; 5]; 2] = unsafe { - [ - *::std::mem::transmute::<&[u8; 5], &[libc::c_char; 5]>(b"EPSV\0"), - *::std::mem::transmute::<&[u8; 5], &[libc::c_char; 5]>(b"PASV\0"), - ] - }; - let mut modeoff: libc::c_int = 0; - if ((*conn).bits).ftp_use_epsv() == 0 && ((*conn).bits).ipv6() as libc::c_int != 0 { - let ref mut fresh9 = (*conn).bits; - (*fresh9).set_ftp_use_epsv(1 as libc::c_int as bit); - } - modeoff = if ((*conn).bits).ftp_use_epsv() as libc::c_int != 0 { - 0 as libc::c_int - } else { - 1 as libc::c_int - }; - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - (mode[modeoff as usize]).as_ptr(), - ); - if result as u64 == 0 { - (*ftpc).count1 = modeoff; - _state(data, FTP_PASV); - Curl_infof( - data, - b"Connect data stream passively\0" as *const u8 as *const libc::c_char, - ); - } - return result; -} -unsafe extern "C" fn ftp_state_prepare_transfer(mut data: *mut Curl_easy) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - if (*ftp).transfer as libc::c_uint != PPTRANSFER_BODY as libc::c_int as libc::c_uint - { - _state(data, FTP_RETR_PREQUOTE); - result = ftp_state_quote(data, 1 as libc::c_int != 0, FTP_RETR_PREQUOTE); - } else if ((*data).set).ftp_use_port() != 0 { - result = ftp_state_use_port(data, EPRT); - } else if ((*data).set).ftp_use_pret() != 0 { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if ((*conn).proto.ftpc.file).is_null() { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"PRET %s\0" as *const u8 as *const libc::c_char, - if !((*data).set.str_0[STRING_CUSTOMREQUEST as libc::c_int as usize]) - .is_null() - { - (*data).set.str_0[STRING_CUSTOMREQUEST as libc::c_int as usize] - as *const libc::c_char - } else if ((*data).state).list_only() as libc::c_int != 0 { - b"NLST\0" as *const u8 as *const libc::c_char - } else { - b"LIST\0" as *const u8 as *const libc::c_char - }, - ); - } else if ((*data).set).upload() != 0 { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"PRET STOR %s\0" as *const u8 as *const libc::c_char, - (*conn).proto.ftpc.file, - ); - } else { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"PRET RETR %s\0" as *const u8 as *const libc::c_char, - (*conn).proto.ftpc.file, - ); - } - if result as u64 == 0 { - _state(data, FTP_PRET); - } - } else { - result = ftp_state_use_pasv(data, conn); - } - return result; -} -unsafe extern "C" fn ftp_state_rest( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if (*ftp).transfer as libc::c_uint != PPTRANSFER_BODY as libc::c_int as libc::c_uint - && !((*ftpc).file).is_null() - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"REST %d\0" as *const u8 as *const libc::c_char, - 0 as libc::c_int, - ); - if result as u64 == 0 { - _state(data, FTP_REST); - } - } else { - result = ftp_state_prepare_transfer(data); - } - return result; -} -unsafe extern "C" fn ftp_state_size( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if (*ftp).transfer as libc::c_uint == PPTRANSFER_INFO as libc::c_int as libc::c_uint - && !((*ftpc).file).is_null() - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"SIZE %s\0" as *const u8 as *const libc::c_char, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_SIZE); - } - } else { - result = ftp_state_rest(data, conn); - } - return result; -} -unsafe extern "C" fn ftp_state_list(mut data: *mut Curl_easy) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - let mut lstArg: *mut libc::c_char = 0 as *mut libc::c_char; - let mut cmd: *mut libc::c_char = 0 as *mut libc::c_char; - if (*data).set.ftp_filemethod as libc::c_uint - == FTPFILE_NOCWD as libc::c_int as libc::c_uint && !((*ftp).path).is_null() - { - let mut slashPos: *const libc::c_char = 0 as *const libc::c_char; - let mut rawPath: *mut libc::c_char = 0 as *mut libc::c_char; - result = Curl_urldecode( - data, - (*ftp).path, - 0 as libc::c_int as size_t, - &mut rawPath, - 0 as *mut size_t, - REJECT_CTRL, - ); - if result as u64 != 0 { - return result; - } - slashPos = strrchr(rawPath, '/' as i32); - if !slashPos.is_null() { - let mut n: size_t = slashPos.offset_from(rawPath) as libc::c_long as size_t; - if n == 0 as libc::c_int as libc::c_ulong { - n = n.wrapping_add(1); - } - lstArg = rawPath; - *lstArg.offset(n as isize) = '\u{0}' as i32 as libc::c_char; - } else { - Curl_cfree.expect("non-null function pointer")(rawPath as *mut libc::c_void); - } - } - cmd = curl_maprintf( - b"%s%s%s\0" as *const u8 as *const libc::c_char, - if !((*data).set.str_0[STRING_CUSTOMREQUEST as libc::c_int as usize]).is_null() { - (*data).set.str_0[STRING_CUSTOMREQUEST as libc::c_int as usize] - as *const libc::c_char - } else if ((*data).state).list_only() as libc::c_int != 0 { - b"NLST\0" as *const u8 as *const libc::c_char - } else { - b"LIST\0" as *const u8 as *const libc::c_char - }, - if !lstArg.is_null() { - b" \0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !lstArg.is_null() { - lstArg as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - Curl_cfree.expect("non-null function pointer")(lstArg as *mut libc::c_void); - if cmd.is_null() { - return CURLE_OUT_OF_MEMORY; - } - result = Curl_pp_sendf( - data, - &mut (*conn).proto.ftpc.pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - cmd, - ); - Curl_cfree.expect("non-null function pointer")(cmd as *mut libc::c_void); - if result as u64 == 0 { - _state(data, FTP_LIST); - } - return result; -} -unsafe extern "C" fn ftp_state_retr_prequote(mut data: *mut Curl_easy) -> CURLcode { - return ftp_state_quote(data, 1 as libc::c_int != 0, FTP_RETR_PREQUOTE); -} -unsafe extern "C" fn ftp_state_stor_prequote(mut data: *mut Curl_easy) -> CURLcode { - return ftp_state_quote(data, 1 as libc::c_int != 0, FTP_STOR_PREQUOTE); -} -unsafe extern "C" fn ftp_state_type(mut data: *mut Curl_easy) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if ((*data).set).opt_no_body() as libc::c_int != 0 && !((*ftpc).file).is_null() - && ftp_need_type(conn, ((*data).state).prefer_ascii() != 0) != 0 - { - (*ftp).transfer = PPTRANSFER_INFO; - result = ftp_nb_type(data, conn, ((*data).state).prefer_ascii() != 0, FTP_TYPE); - if result as u64 != 0 { - return result; - } - } else { - result = ftp_state_size(data, conn); - } - return result; -} -unsafe extern "C" fn ftp_state_mdtm(mut data: *mut Curl_easy) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if (((*data).set).get_filetime() as libc::c_int != 0 - || (*data).set.timecondition as libc::c_uint != 0) && !((*ftpc).file).is_null() - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"MDTM %s\0" as *const u8 as *const libc::c_char, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_MDTM); - } - } else { - result = ftp_state_type(data); - } - return result; -} -unsafe extern "C" fn ftp_state_ul_setup( - mut data: *mut Curl_easy, - mut sizechecked: bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut append: bool = ((*data).set).remote_append() != 0; - if (*data).state.resume_from != 0 && !sizechecked - || (*data).state.resume_from > 0 as libc::c_int as libc::c_long - && sizechecked as libc::c_int != 0 - { - let mut seekerr: libc::c_int = 0 as libc::c_int; - if (*data).state.resume_from < 0 as libc::c_int as libc::c_long { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"SIZE %s\0" as *const u8 as *const libc::c_char, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_STOR_SIZE); - } - return result; - } - append = 1 as libc::c_int != 0; - if ((*conn).seek_func).is_some() { - Curl_set_in_callback(data, 1 as libc::c_int != 0); - seekerr = ((*conn).seek_func) - .expect( - "non-null function pointer", - )((*conn).seek_client, (*data).state.resume_from, 0 as libc::c_int); - Curl_set_in_callback(data, 0 as libc::c_int != 0); - } - if seekerr != 0 as libc::c_int { - let mut passed: curl_off_t = 0 as libc::c_int as curl_off_t; - if seekerr != 2 as libc::c_int { - Curl_failf( - data, - b"Could not seek stream\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FTP_COULDNT_USE_REST; - } - loop { - let mut readthisamountnow: size_t = if (*data).state.resume_from - passed - > (*data).set.buffer_size - { - (*data).set.buffer_size as size_t - } else { - curlx_sotouz((*data).state.resume_from - passed) - }; - let mut actuallyread: size_t = ((*data).state.fread_func) - .expect( - "non-null function pointer", - )( - (*data).state.buffer, - 1 as libc::c_int as size_t, - readthisamountnow, - (*data).state.in_0, - ); - passed = (passed as libc::c_ulong).wrapping_add(actuallyread) - as curl_off_t as curl_off_t; - if actuallyread == 0 as libc::c_int as libc::c_ulong - || actuallyread > readthisamountnow - { - Curl_failf( - data, - b"Failed to read data\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FTP_COULDNT_USE_REST; - } - if !(passed < (*data).state.resume_from) { - break; - } - } - } - if (*data).state.infilesize > 0 as libc::c_int as libc::c_long { - let ref mut fresh10 = (*data).state.infilesize; - *fresh10 -= (*data).state.resume_from; - if (*data).state.infilesize <= 0 as libc::c_int as libc::c_long { - Curl_infof( - data, - b"File already completely uploaded\0" as *const u8 - as *const libc::c_char, - ); - Curl_setup_transfer( - data, - -(1 as libc::c_int), - -(1 as libc::c_int) as curl_off_t, - 0 as libc::c_int != 0, - -(1 as libc::c_int), - ); - (*ftp).transfer = PPTRANSFER_NONE; - _state(data, FTP_STOP); - return CURLE_OK; - } - } - } - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - if append as libc::c_int != 0 { - b"APPE %s\0" as *const u8 as *const libc::c_char - } else { - b"STOR %s\0" as *const u8 as *const libc::c_char - }, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_STOR); - } - return result; -} -unsafe extern "C" fn ftp_state_quote( - mut data: *mut Curl_easy, - mut init: bool, - mut instate: ftpstate, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut quote: bool = 0 as libc::c_int != 0; - let mut item: *mut curl_slist = 0 as *mut curl_slist; - match instate as libc::c_uint { - 13 | 14 => { - item = (*data).set.prequote; - } - 15 => { - item = (*data).set.postquote; - } - 12 | _ => { - item = (*data).set.quote; - } - } - if init { - (*ftpc).count1 = 0 as libc::c_int; - } else { - let ref mut fresh11 = (*ftpc).count1; - *fresh11 += 1; - } - if !item.is_null() { - let mut i: libc::c_int = 0 as libc::c_int; - while i < (*ftpc).count1 && !item.is_null() { - item = (*item).next; - i += 1; - } - if !item.is_null() { - let mut cmd: *mut libc::c_char = (*item).data; - if *cmd.offset(0 as libc::c_int as isize) as libc::c_int == '*' as i32 { - cmd = cmd.offset(1); - (*ftpc).count2 = 1 as libc::c_int; - } else { - (*ftpc).count2 = 0 as libc::c_int; - } - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - cmd, - ); - if result as u64 != 0 { - return result; - } - _state(data, instate); - quote = 1 as libc::c_int != 0; - } - } - if !quote { - match instate as libc::c_uint { - 13 => { - if (*ftp).transfer as libc::c_uint - != PPTRANSFER_BODY as libc::c_int as libc::c_uint - { - _state(data, FTP_STOP); - } else if (*ftpc).known_filesize != -(1 as libc::c_int) as libc::c_long { - Curl_pgrsSetDownloadSize(data, (*ftpc).known_filesize); - result = ftp_state_retr(data, (*ftpc).known_filesize); - } else if ((*data).set).ignorecl() as libc::c_int != 0 - || ((*data).state).prefer_ascii() as libc::c_int != 0 - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"RETR %s\0" as *const u8 as *const libc::c_char, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_RETR); - } - } else { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"SIZE %s\0" as *const u8 as *const libc::c_char, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_RETR_SIZE); - } - } - } - 14 => { - result = ftp_state_ul_setup(data, 0 as libc::c_int != 0); - } - 15 => {} - 12 | _ => { - result = ftp_state_cwd(data, conn); - } - } - } - return result; -} -unsafe extern "C" fn ftp_epsv_disable( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - if ((*conn).bits).ipv6() as libc::c_int != 0 - && !(((*conn).bits).tunnel_proxy() as libc::c_int != 0 - || ((*conn).bits).socksproxy() as libc::c_int != 0) - { - Curl_failf( - data, - b"Failed EPSV attempt, exiting\0" as *const u8 as *const libc::c_char, - ); - return CURLE_WEIRD_SERVER_REPLY; - } - Curl_infof( - data, - b"Failed EPSV attempt. Disabling EPSV\0" as *const u8 as *const libc::c_char, - ); - let ref mut fresh12 = (*conn).bits; - (*fresh12).set_ftp_use_epsv(0 as libc::c_int as bit); - let ref mut fresh13 = (*data).state; - (*fresh13).set_errorbuf(0 as libc::c_int as bit); - result = Curl_pp_sendf( - data, - &mut (*conn).proto.ftpc.pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - b"PASV\0" as *const u8 as *const libc::c_char, - ); - if result as u64 == 0 { - let ref mut fresh14 = (*conn).proto.ftpc.count1; - *fresh14 += 1; - _state(data, FTP_PASV); - } - return result; -} -unsafe extern "C" fn control_address(mut conn: *mut connectdata) -> *mut libc::c_char { - if ((*conn).bits).tunnel_proxy() as libc::c_int != 0 - || ((*conn).bits).socksproxy() as libc::c_int != 0 - { - return (*conn).host.name; - } - return ((*conn).primary_ip).as_mut_ptr(); -} -unsafe extern "C" fn ftp_state_pasv_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut result: CURLcode = CURLE_OK; - let mut addr: *mut Curl_dns_entry = 0 as *mut Curl_dns_entry; - let mut rc: resolve_t = CURLRESOLV_RESOLVED; - let mut connectport: libc::c_ushort = 0; - let mut str: *mut libc::c_char = &mut *((*data).state.buffer) - .offset(4 as libc::c_int as isize) as *mut libc::c_char; - Curl_cfree.expect("non-null function pointer")((*ftpc).newhost as *mut libc::c_void); - let ref mut fresh15 = (*ftpc).newhost; - *fresh15 = 0 as *mut libc::c_char; - if (*ftpc).count1 == 0 as libc::c_int && ftpcode == 229 as libc::c_int { - let mut ptr: *mut libc::c_char = strchr(str, '(' as i32); - if !ptr.is_null() { - let mut num: libc::c_uint = 0; - let mut separator: [libc::c_char; 4] = [0; 4]; - ptr = ptr.offset(1); - if 5 as libc::c_int - == sscanf( - ptr, - b"%c%c%c%u%c\0" as *const u8 as *const libc::c_char, - &mut *separator.as_mut_ptr().offset(0 as libc::c_int as isize) - as *mut libc::c_char, - &mut *separator.as_mut_ptr().offset(1 as libc::c_int as isize) - as *mut libc::c_char, - &mut *separator.as_mut_ptr().offset(2 as libc::c_int as isize) - as *mut libc::c_char, - &mut num as *mut libc::c_uint, - &mut *separator.as_mut_ptr().offset(3 as libc::c_int as isize) - as *mut libc::c_char, - ) - { - let sep1: libc::c_char = separator[0 as libc::c_int as usize]; - let mut i: libc::c_int = 0; - i = 1 as libc::c_int; - while i < 4 as libc::c_int { - if separator[i as usize] as libc::c_int != sep1 as libc::c_int { - ptr = 0 as *mut libc::c_char; - break; - } else { - i += 1; - } - } - if num > 0xffff as libc::c_int as libc::c_uint { - Curl_failf( - data, - b"Illegal port number in EPSV reply\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_FTP_WEIRD_PASV_REPLY; - } - if !ptr.is_null() { - (*ftpc) - .newport = (num & 0xffff as libc::c_int as libc::c_uint) - as libc::c_ushort; - let ref mut fresh16 = (*ftpc).newhost; - *fresh16 = Curl_cstrdup - .expect("non-null function pointer")(control_address(conn)); - if ((*ftpc).newhost).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - } else { - ptr = 0 as *mut libc::c_char; - } - } - if ptr.is_null() { - Curl_failf( - data, - b"Weirdly formatted EPSV reply\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FTP_WEIRD_PASV_REPLY; - } - } else if (*ftpc).count1 == 1 as libc::c_int && ftpcode == 227 as libc::c_int { - let mut ip: [libc::c_uint; 4] = [ - 0 as libc::c_int as libc::c_uint, - 0 as libc::c_int as libc::c_uint, - 0 as libc::c_int as libc::c_uint, - 0 as libc::c_int as libc::c_uint, - ]; - let mut port: [libc::c_uint; 2] = [ - 0 as libc::c_int as libc::c_uint, - 0 as libc::c_int as libc::c_uint, - ]; - while *str != 0 { - if 6 as libc::c_int - == sscanf( - str, - b"%u,%u,%u,%u,%u,%u\0" as *const u8 as *const libc::c_char, - &mut *ip.as_mut_ptr().offset(0 as libc::c_int as isize) - as *mut libc::c_uint, - &mut *ip.as_mut_ptr().offset(1 as libc::c_int as isize) - as *mut libc::c_uint, - &mut *ip.as_mut_ptr().offset(2 as libc::c_int as isize) - as *mut libc::c_uint, - &mut *ip.as_mut_ptr().offset(3 as libc::c_int as isize) - as *mut libc::c_uint, - &mut *port.as_mut_ptr().offset(0 as libc::c_int as isize) - as *mut libc::c_uint, - &mut *port.as_mut_ptr().offset(1 as libc::c_int as isize) - as *mut libc::c_uint, - ) - { - break; - } - str = str.offset(1); - } - if *str == 0 - || ip[0 as libc::c_int as usize] > 255 as libc::c_int as libc::c_uint - || ip[1 as libc::c_int as usize] > 255 as libc::c_int as libc::c_uint - || ip[2 as libc::c_int as usize] > 255 as libc::c_int as libc::c_uint - || ip[3 as libc::c_int as usize] > 255 as libc::c_int as libc::c_uint - || port[0 as libc::c_int as usize] > 255 as libc::c_int as libc::c_uint - || port[1 as libc::c_int as usize] > 255 as libc::c_int as libc::c_uint - { - Curl_failf( - data, - b"Couldn't interpret the 227-response\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_FTP_WEIRD_227_FORMAT; - } - if ((*data).set).ftp_skip_ip() != 0 { - Curl_infof( - data, - b"Skip %u.%u.%u.%u for data connection, re-use %s instead\0" as *const u8 - as *const libc::c_char, - ip[0 as libc::c_int as usize], - ip[1 as libc::c_int as usize], - ip[2 as libc::c_int as usize], - ip[3 as libc::c_int as usize], - (*conn).host.name, - ); - let ref mut fresh17 = (*ftpc).newhost; - *fresh17 = Curl_cstrdup - .expect("non-null function pointer")(control_address(conn)); - } else { - let ref mut fresh18 = (*ftpc).newhost; - *fresh18 = curl_maprintf( - b"%u.%u.%u.%u\0" as *const u8 as *const libc::c_char, - ip[0 as libc::c_int as usize], - ip[1 as libc::c_int as usize], - ip[2 as libc::c_int as usize], - ip[3 as libc::c_int as usize], - ); - } - if ((*ftpc).newhost).is_null() { - return CURLE_OUT_OF_MEMORY; - } - (*ftpc) - .newport = ((port[0 as libc::c_int as usize] << 8 as libc::c_int) - .wrapping_add(port[1 as libc::c_int as usize]) - & 0xffff as libc::c_int as libc::c_uint) as libc::c_ushort; - } else if (*ftpc).count1 == 0 as libc::c_int { - return ftp_epsv_disable(data, conn) - } else { - Curl_failf( - data, - b"Bad PASV/EPSV response: %03d\0" as *const u8 as *const libc::c_char, - ftpcode, - ); - return CURLE_FTP_WEIRD_PASV_REPLY; - } - if ((*conn).bits).proxy() != 0 { - let host_name: *const libc::c_char = if ((*conn).bits).socksproxy() - as libc::c_int != 0 - { - (*conn).socks_proxy.host.name - } else { - (*conn).http_proxy.host.name - }; - rc = Curl_resolv( - data, - host_name, - (*conn).port, - 0 as libc::c_int != 0, - &mut addr, - ); - if rc as libc::c_int == CURLRESOLV_PENDING as libc::c_int { - Curl_resolver_wait_resolv(data, &mut addr); - } - connectport = (*conn).port as libc::c_ushort; - if addr.is_null() { - Curl_failf( - data, - b"Can't resolve proxy host %s:%hu\0" as *const u8 as *const libc::c_char, - host_name, - connectport as libc::c_int, - ); - return CURLE_COULDNT_RESOLVE_PROXY; - } - } else { - if ((*conn).bits).tcp_fastopen() as libc::c_int != 0 - && ((*conn).bits).reuse() == 0 - && *((*ftpc).newhost).offset(0 as libc::c_int as isize) == 0 - { - Curl_conninfo_remote(data, conn, (*conn).sock[0 as libc::c_int as usize]); - Curl_cfree - .expect( - "non-null function pointer", - )((*ftpc).newhost as *mut libc::c_void); - let ref mut fresh19 = (*ftpc).newhost; - *fresh19 = 0 as *mut libc::c_char; - let ref mut fresh20 = (*ftpc).newhost; - *fresh20 = Curl_cstrdup - .expect("non-null function pointer")(control_address(conn)); - if ((*ftpc).newhost).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - rc = Curl_resolv( - data, - (*ftpc).newhost, - (*ftpc).newport as libc::c_int, - 0 as libc::c_int != 0, - &mut addr, - ); - if rc as libc::c_int == CURLRESOLV_PENDING as libc::c_int { - Curl_resolver_wait_resolv(data, &mut addr); - } - connectport = (*ftpc).newport; - if addr.is_null() { - Curl_failf( - data, - b"Can't resolve new host %s:%hu\0" as *const u8 as *const libc::c_char, - (*ftpc).newhost, - connectport as libc::c_int, - ); - return CURLE_FTP_CANT_GET_HOST; - } - } - (*conn).bits.tcpconnect[1 as libc::c_int as usize] = 0 as libc::c_int != 0; - result = Curl_connecthost(data, conn, addr); - if result as u64 != 0 { - Curl_resolv_unlock(data, addr); - if (*ftpc).count1 == 0 as libc::c_int && ftpcode == 229 as libc::c_int { - return ftp_epsv_disable(data, conn); - } - return result; - } - if ((*data).set).verbose() != 0 { - ftp_pasv_verbose( - data, - (*addr).addr, - (*ftpc).newhost, - connectport as libc::c_int, - ); - } - Curl_resolv_unlock(data, addr); - Curl_cfree - .expect( - "non-null function pointer", - )((*conn).secondaryhostname as *mut libc::c_void); - let ref mut fresh21 = (*conn).secondaryhostname; - *fresh21 = 0 as *mut libc::c_char; - (*conn).secondary_port = (*ftpc).newport; - let ref mut fresh22 = (*conn).secondaryhostname; - *fresh22 = Curl_cstrdup.expect("non-null function pointer")((*ftpc).newhost); - if ((*conn).secondaryhostname).is_null() { - return CURLE_OUT_OF_MEMORY; - } - let ref mut fresh23 = (*conn).bits; - (*fresh23).set_do_more(1 as libc::c_int as bit); - _state(data, FTP_STOP); - return result; -} -unsafe extern "C" fn ftp_state_port_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut fcmd: ftpport = (*ftpc).count1 as ftpport; - let mut result: CURLcode = CURLE_OK; - if ftpcode / 100 as libc::c_int != 2 as libc::c_int { - if EPRT as libc::c_int as libc::c_uint == fcmd as libc::c_uint { - Curl_infof( - data, - b"disabling EPRT usage\0" as *const u8 as *const libc::c_char, - ); - let ref mut fresh24 = (*conn).bits; - (*fresh24).set_ftp_use_eprt(0 as libc::c_int as bit); - } - fcmd += 1; - if fcmd as libc::c_uint == DONE as libc::c_int as libc::c_uint { - Curl_failf(data, b"Failed to do PORT\0" as *const u8 as *const libc::c_char); - result = CURLE_FTP_PORT_FAILED; - } else { - result = ftp_state_use_port(data, fcmd); - } - } else { - Curl_infof( - data, - b"Connect data stream actively\0" as *const u8 as *const libc::c_char, - ); - _state(data, FTP_STOP); - result = ftp_dophase_done(data, 0 as libc::c_int != 0); - } - return result; -} -unsafe extern "C" fn ftp_state_mdtm_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - match ftpcode { - 213 => { - let mut year: libc::c_int = 0; - let mut month: libc::c_int = 0; - let mut day: libc::c_int = 0; - let mut hour: libc::c_int = 0; - let mut minute: libc::c_int = 0; - let mut second: libc::c_int = 0; - if 6 as libc::c_int - == sscanf( - &mut *((*data).state.buffer).offset(4 as libc::c_int as isize) - as *mut libc::c_char, - b"%04d%02d%02d%02d%02d%02d\0" as *const u8 as *const libc::c_char, - &mut year as *mut libc::c_int, - &mut month as *mut libc::c_int, - &mut day as *mut libc::c_int, - &mut hour as *mut libc::c_int, - &mut minute as *mut libc::c_int, - &mut second as *mut libc::c_int, - ) - { - let mut timebuf: [libc::c_char; 24] = [0; 24]; - curl_msnprintf( - timebuf.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 24]>() as libc::c_ulong, - b"%04d%02d%02d %02d:%02d:%02d GMT\0" as *const u8 - as *const libc::c_char, - year, - month, - day, - hour, - minute, - second, - ); - (*data).info.filetime = Curl_getdate_capped(timebuf.as_mut_ptr()); - } - if ((*data).set).opt_no_body() as libc::c_int != 0 - && !((*ftpc).file).is_null() - && ((*data).set).get_filetime() as libc::c_int != 0 - && (*data).info.filetime >= 0 as libc::c_int as libc::c_long - { - let mut headerbuf: [libc::c_char; 128] = [0; 128]; - let mut headerbuflen: libc::c_int = 0; - let mut filetime: time_t = (*data).info.filetime; - let mut buffer: tm = tm { - tm_sec: 0, - tm_min: 0, - tm_hour: 0, - tm_mday: 0, - tm_mon: 0, - tm_year: 0, - tm_wday: 0, - tm_yday: 0, - tm_isdst: 0, - tm_gmtoff: 0, - tm_zone: 0 as *const libc::c_char, - }; - let mut tm: *const tm = &mut buffer; - result = Curl_gmtime(filetime, &mut buffer); - if result as u64 != 0 { - return result; - } - headerbuflen = curl_msnprintf( - headerbuf.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong, - b"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n\0" - as *const u8 as *const libc::c_char, - Curl_wkday[(if (*tm).tm_wday != 0 { - (*tm).tm_wday - 1 as libc::c_int - } else { - 6 as libc::c_int - }) as usize], - (*tm).tm_mday, - Curl_month[(*tm).tm_mon as usize], - (*tm).tm_year + 1900 as libc::c_int, - (*tm).tm_hour, - (*tm).tm_min, - (*tm).tm_sec, - ); - result = Curl_client_write( - data, - (1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int, - headerbuf.as_mut_ptr(), - headerbuflen as size_t, - ); - if result as u64 != 0 { - return result; - } - } - } - 550 => { - Curl_failf( - data, - b"Given file does not exist\0" as *const u8 as *const libc::c_char, - ); - result = CURLE_REMOTE_FILE_NOT_FOUND; - } - _ => { - Curl_infof( - data, - b"unsupported MDTM reply format\0" as *const u8 as *const libc::c_char, - ); - } - } - if (*data).set.timecondition as u64 != 0 { - if (*data).info.filetime > 0 as libc::c_int as libc::c_long - && (*data).set.timevalue > 0 as libc::c_int as libc::c_long - { - match (*data).set.timecondition as libc::c_uint { - 2 => { - if (*data).info.filetime > (*data).set.timevalue { - Curl_infof( - data, - b"The requested document is not old enough\0" as *const u8 - as *const libc::c_char, - ); - (*ftp).transfer = PPTRANSFER_NONE; - let ref mut fresh26 = (*data).info; - (*fresh26).set_timecond(1 as libc::c_int as bit); - _state(data, FTP_STOP); - return CURLE_OK; - } - } - 1 | _ => { - if (*data).info.filetime <= (*data).set.timevalue { - Curl_infof( - data, - b"The requested document is not new enough\0" as *const u8 - as *const libc::c_char, - ); - (*ftp).transfer = PPTRANSFER_NONE; - let ref mut fresh25 = (*data).info; - (*fresh25).set_timecond(1 as libc::c_int as bit); - _state(data, FTP_STOP); - return CURLE_OK; - } - } - } - } else { - Curl_infof( - data, - b"Skipping time comparison\0" as *const u8 as *const libc::c_char, - ); - } - } - if result as u64 == 0 { - result = ftp_state_type(data); - } - return result; -} -unsafe extern "C" fn ftp_state_type_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, - mut instate: ftpstate, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - if ftpcode / 100 as libc::c_int != 2 as libc::c_int { - Curl_failf( - data, - b"Couldn't set desired mode\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FTP_COULDNT_SET_TYPE; - } - if ftpcode != 200 as libc::c_int { - Curl_infof( - data, - b"Got a %03d response code instead of the assumed 200\0" as *const u8 - as *const libc::c_char, - ftpcode, - ); - } - if instate as libc::c_uint == FTP_TYPE as libc::c_int as libc::c_uint { - result = ftp_state_size(data, conn); - } else if instate as libc::c_uint == FTP_LIST_TYPE as libc::c_int as libc::c_uint { - result = ftp_state_list(data); - } else if instate as libc::c_uint == FTP_RETR_TYPE as libc::c_int as libc::c_uint { - result = ftp_state_retr_prequote(data); - } else if instate as libc::c_uint == FTP_STOR_TYPE as libc::c_int as libc::c_uint { - result = ftp_state_stor_prequote(data); - } - return result; -} -unsafe extern "C" fn ftp_state_retr( - mut data: *mut Curl_easy, - mut filesize: curl_off_t, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if (*data).set.max_filesize != 0 && filesize > (*data).set.max_filesize { - Curl_failf( - data, - b"Maximum file size exceeded\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FILESIZE_EXCEEDED; - } - (*ftp).downloadsize = filesize; - if (*data).state.resume_from != 0 { - if filesize == -(1 as libc::c_int) as libc::c_long { - Curl_infof( - data, - b"ftp server doesn't support SIZE\0" as *const u8 as *const libc::c_char, - ); - } else if (*data).state.resume_from < 0 as libc::c_int as libc::c_long { - if filesize < -(*data).state.resume_from { - Curl_failf( - data, - b"Offset (%ld) was beyond file size (%ld)\0" as *const u8 - as *const libc::c_char, - (*data).state.resume_from, - filesize, - ); - return CURLE_BAD_DOWNLOAD_RESUME; - } - (*ftp).downloadsize = -(*data).state.resume_from; - (*data).state.resume_from = filesize - (*ftp).downloadsize; - } else { - if filesize < (*data).state.resume_from { - Curl_failf( - data, - b"Offset (%ld) was beyond file size (%ld)\0" as *const u8 - as *const libc::c_char, - (*data).state.resume_from, - filesize, - ); - return CURLE_BAD_DOWNLOAD_RESUME; - } - (*ftp).downloadsize = filesize - (*data).state.resume_from; - } - if (*ftp).downloadsize == 0 as libc::c_int as libc::c_long { - Curl_setup_transfer( - data, - -(1 as libc::c_int), - -(1 as libc::c_int) as curl_off_t, - 0 as libc::c_int != 0, - -(1 as libc::c_int), - ); - Curl_infof( - data, - b"File already completely downloaded\0" as *const u8 - as *const libc::c_char, - ); - (*ftp).transfer = PPTRANSFER_NONE; - _state(data, FTP_STOP); - return CURLE_OK; - } - Curl_infof( - data, - b"Instructs server to resume from offset %ld\0" as *const u8 - as *const libc::c_char, - (*data).state.resume_from, - ); - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"REST %ld\0" as *const u8 as *const libc::c_char, - (*data).state.resume_from, - ); - if result as u64 == 0 { - _state(data, FTP_RETR_REST); - } - } else { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"RETR %s\0" as *const u8 as *const libc::c_char, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_RETR); - } - } - return result; -} -unsafe extern "C" fn ftp_state_size_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, - mut instate: ftpstate, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut filesize: curl_off_t = -(1 as libc::c_int) as curl_off_t; - let mut buf: *mut libc::c_char = (*data).state.buffer; - if ftpcode == 213 as libc::c_int { - let mut start: *mut libc::c_char = &mut *buf.offset(4 as libc::c_int as isize) - as *mut libc::c_char; - let mut fdigit: *mut libc::c_char = strchr(start, '\r' as i32); - if !fdigit.is_null() { - loop { - fdigit = fdigit.offset(-1); - if !(Curl_isdigit(*fdigit as libc::c_uchar as libc::c_int) != 0 - && fdigit > start) - { - break; - } - } - if Curl_isdigit(*fdigit as libc::c_uchar as libc::c_int) == 0 { - fdigit = fdigit.offset(1); - } - } else { - fdigit = start; - } - curlx_strtoofft( - fdigit, - 0 as *mut *mut libc::c_char, - 0 as libc::c_int, - &mut filesize, - ); - } else if ftpcode == 550 as libc::c_int { - if instate as libc::c_uint != FTP_STOR_SIZE as libc::c_int as libc::c_uint { - Curl_failf( - data, - b"The file does not exist\0" as *const u8 as *const libc::c_char, - ); - return CURLE_REMOTE_FILE_NOT_FOUND; - } - } - if instate as libc::c_uint == FTP_SIZE as libc::c_int as libc::c_uint { - if -(1 as libc::c_int) as libc::c_long != filesize { - let mut clbuf: [libc::c_char; 128] = [0; 128]; - let mut clbuflen: libc::c_int = curl_msnprintf( - clbuf.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 128]>() as libc::c_ulong, - b"Content-Length: %ld\r\n\0" as *const u8 as *const libc::c_char, - filesize, - ); - result = Curl_client_write( - data, - (1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int, - clbuf.as_mut_ptr(), - clbuflen as size_t, - ); - if result as u64 != 0 { - return result; - } - } - Curl_pgrsSetDownloadSize(data, filesize); - result = ftp_state_rest(data, (*data).conn); - } else if instate as libc::c_uint == FTP_RETR_SIZE as libc::c_int as libc::c_uint { - Curl_pgrsSetDownloadSize(data, filesize); - result = ftp_state_retr(data, filesize); - } else if instate as libc::c_uint == FTP_STOR_SIZE as libc::c_int as libc::c_uint { - (*data).state.resume_from = filesize; - result = ftp_state_ul_setup(data, 1 as libc::c_int != 0); - } - return result; -} -unsafe extern "C" fn ftp_state_rest_resp( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut ftpcode: libc::c_int, - mut instate: ftpstate, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - match instate as libc::c_uint { - 27 => { - if ftpcode != 350 as libc::c_int { - Curl_failf( - data, - b"Couldn't use REST\0" as *const u8 as *const libc::c_char, - ); - result = CURLE_FTP_COULDNT_USE_REST; - } else { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"RETR %s\0" as *const u8 as *const libc::c_char, - (*ftpc).file, - ); - if result as u64 == 0 { - _state(data, FTP_RETR); - } - } - } - 26 | _ => { - if ftpcode == 350 as libc::c_int { - let mut buffer: [libc::c_char; 24] = *::std::mem::transmute::< - &[u8; 24], - &mut [libc::c_char; 24], - >(b"Accept-ranges: bytes\r\n\0\0"); - result = Curl_client_write( - data, - (1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int, - buffer.as_mut_ptr(), - strlen(buffer.as_mut_ptr()), - ); - if result as u64 != 0 { - return result; - } - } - result = ftp_state_prepare_transfer(data); - } - } - return result; -} -unsafe extern "C" fn ftp_state_stor_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, - mut instate: ftpstate, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - if ftpcode >= 400 as libc::c_int { - Curl_failf( - data, - b"Failed FTP upload: %0d\0" as *const u8 as *const libc::c_char, - ftpcode, - ); - _state(data, FTP_STOP); - return CURLE_UPLOAD_FAILED; - } - (*conn).proto.ftpc.state_saved = instate; - if ((*data).set).ftp_use_port() != 0 { - let mut connected: bool = false; - _state(data, FTP_STOP); - result = AllowServerConnect(data, &mut connected); - if result as u64 != 0 { - return result; - } - if !connected { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - Curl_infof( - data, - b"Data conn was not available immediately\0" as *const u8 - as *const libc::c_char, - ); - (*ftpc).wait_data_conn = 1 as libc::c_int != 0; - } - return CURLE_OK; - } - return InitiateTransfer(data); -} -unsafe extern "C" fn ftp_state_get_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, - mut instate: ftpstate, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - if ftpcode == 150 as libc::c_int || ftpcode == 125 as libc::c_int { - let mut size: curl_off_t = -(1 as libc::c_int) as curl_off_t; - if instate as libc::c_uint != FTP_LIST as libc::c_int as libc::c_uint - && ((*data).state).prefer_ascii() == 0 - && (*ftp).downloadsize < 1 as libc::c_int as libc::c_long - { - let mut bytes: *mut libc::c_char = 0 as *mut libc::c_char; - let mut buf: *mut libc::c_char = (*data).state.buffer; - bytes = strstr(buf, b" bytes\0" as *const u8 as *const libc::c_char); - if !bytes.is_null() { - bytes = bytes.offset(-1); - let mut in_0: libc::c_long = bytes.offset_from(buf) as libc::c_long; - loop { - in_0 -= 1; - if !(in_0 != 0) { - break; - } - if '(' as i32 == *bytes as libc::c_int { - break; - } - if Curl_isdigit(*bytes as libc::c_uchar as libc::c_int) == 0 { - bytes = 0 as *mut libc::c_char; - break; - } else { - bytes = bytes.offset(-1); - } - } - if !bytes.is_null() { - bytes = bytes.offset(1); - curlx_strtoofft( - bytes, - 0 as *mut *mut libc::c_char, - 0 as libc::c_int, - &mut size, - ); - } - } - } else if (*ftp).downloadsize > -(1 as libc::c_int) as libc::c_long { - size = (*ftp).downloadsize; - } - if size > (*data).req.maxdownload - && (*data).req.maxdownload > 0 as libc::c_int as libc::c_long - { - let ref mut fresh27 = (*data).req.size; - *fresh27 = (*data).req.maxdownload; - size = *fresh27; - } else if instate as libc::c_uint != FTP_LIST as libc::c_int as libc::c_uint - && ((*data).state).prefer_ascii() as libc::c_int != 0 - { - size = -(1 as libc::c_int) as curl_off_t; - } - Curl_infof( - data, - b"Maxdownload = %ld\0" as *const u8 as *const libc::c_char, - (*data).req.maxdownload, - ); - if instate as libc::c_uint != FTP_LIST as libc::c_int as libc::c_uint { - Curl_infof( - data, - b"Getting file with size: %ld\0" as *const u8 as *const libc::c_char, - size, - ); - } - (*conn).proto.ftpc.state_saved = instate; - (*conn).proto.ftpc.retr_size_saved = size; - if ((*data).set).ftp_use_port() != 0 { - let mut connected: bool = false; - result = AllowServerConnect(data, &mut connected); - if result as u64 != 0 { - return result; - } - if !connected { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - Curl_infof( - data, - b"Data conn was not available immediately\0" as *const u8 - as *const libc::c_char, - ); - _state(data, FTP_STOP); - (*ftpc).wait_data_conn = 1 as libc::c_int != 0; - } - } else { - return InitiateTransfer(data) - } - } else if instate as libc::c_uint == FTP_LIST as libc::c_int as libc::c_uint - && ftpcode == 450 as libc::c_int - { - (*ftp).transfer = PPTRANSFER_NONE; - _state(data, FTP_STOP); - } else { - Curl_failf( - data, - b"RETR response: %03d\0" as *const u8 as *const libc::c_char, - ftpcode, - ); - return (if instate as libc::c_uint == FTP_RETR as libc::c_int as libc::c_uint - && ftpcode == 550 as libc::c_int - { - CURLE_REMOTE_FILE_NOT_FOUND as libc::c_int - } else { - CURLE_FTP_COULDNT_RETR_FILE as libc::c_int - }) as CURLcode; - } - return result; -} -unsafe extern "C" fn ftp_state_loggedin(mut data: *mut Curl_easy) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - if ((*conn).bits).ftp_use_control_ssl() != 0 { - result = Curl_pp_sendf( - data, - &mut (*conn).proto.ftpc.pp as *mut pingpong, - b"PBSZ %d\0" as *const u8 as *const libc::c_char, - 0 as libc::c_int, - ); - if result as u64 == 0 { - _state(data, FTP_PBSZ); - } - } else { - result = ftp_state_pwd(data, conn); - } - return result; -} -unsafe extern "C" fn ftp_state_user_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, - mut instate: ftpstate, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if ftpcode == 331 as libc::c_int - && (*ftpc).state as libc::c_uint == FTP_USER as libc::c_int as libc::c_uint - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"PASS %s\0" as *const u8 as *const libc::c_char, - if !((*conn).passwd).is_null() { - (*conn).passwd as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - if result as u64 == 0 { - _state(data, FTP_PASS); - } - } else if ftpcode / 100 as libc::c_int == 2 as libc::c_int { - result = ftp_state_loggedin(data); - } else if ftpcode == 332 as libc::c_int { - if !((*data).set.str_0[STRING_FTP_ACCOUNT as libc::c_int as usize]).is_null() { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"ACCT %s\0" as *const u8 as *const libc::c_char, - (*data).set.str_0[STRING_FTP_ACCOUNT as libc::c_int as usize], - ); - if result as u64 == 0 { - _state(data, FTP_ACCT); - } - } else { - Curl_failf( - data, - b"ACCT requested but none available\0" as *const u8 - as *const libc::c_char, - ); - result = CURLE_LOGIN_DENIED; - } - } else if !((*data) - .set - .str_0[STRING_FTP_ALTERNATIVE_TO_USER as libc::c_int as usize]) - .is_null() && ((*data).state).ftp_trying_alternative() == 0 - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - (*data).set.str_0[STRING_FTP_ALTERNATIVE_TO_USER as libc::c_int as usize], - ); - if result as u64 == 0 { - let ref mut fresh28 = (*data).state; - (*fresh28).set_ftp_trying_alternative(1 as libc::c_int as bit); - _state(data, FTP_USER); - } - } else { - Curl_failf( - data, - b"Access denied: %03d\0" as *const u8 as *const libc::c_char, - ftpcode, - ); - result = CURLE_LOGIN_DENIED; - } - return result; -} -unsafe extern "C" fn ftp_state_acct_resp( - mut data: *mut Curl_easy, - mut ftpcode: libc::c_int, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - if ftpcode != 230 as libc::c_int { - Curl_failf( - data, - b"ACCT rejected by server: %03d\0" as *const u8 as *const libc::c_char, - ftpcode, - ); - result = CURLE_FTP_WEIRD_PASS_REPLY; - } else { - result = ftp_state_loggedin(data); - } - return result; -} -unsafe extern "C" fn ftp_statemachine( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut sock: curl_socket_t = (*conn).sock[0 as libc::c_int as usize]; - let mut ftpcode: libc::c_int = 0; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - static mut ftpauth: [[libc::c_char; 4]; 2] = unsafe { - [ - *::std::mem::transmute::<&[u8; 4], &[libc::c_char; 4]>(b"SSL\0"), - *::std::mem::transmute::<&[u8; 4], &[libc::c_char; 4]>(b"TLS\0"), - ] - }; - let mut nread: size_t = 0 as libc::c_int as size_t; - if (*pp).sendleft != 0 { - return Curl_pp_flushsend(data, pp); - } - result = ftp_readresp(data, sock, pp, &mut ftpcode, &mut nread); - if result as u64 != 0 { - return result; - } - if ftpcode != 0 { - let mut current_block_187: u64; - match (*ftpc).state as libc::c_uint { - 1 => { - if ftpcode == 230 as libc::c_int { - if (*data).set.use_ssl as libc::c_uint - <= CURLUSESSL_TRY as libc::c_int as libc::c_uint - || ((*conn).bits).ftp_use_control_ssl() as libc::c_int != 0 - { - return ftp_state_user_resp(data, ftpcode, (*ftpc).state); - } - } else if ftpcode != 220 as libc::c_int { - Curl_failf( - data, - b"Got a %03d ftp-server response when 220 was expected\0" - as *const u8 as *const libc::c_char, - ftpcode, - ); - return CURLE_WEIRD_SERVER_REPLY; - } - if (*data).set.use_ssl as libc::c_uint != 0 - && ((*conn).bits).ftp_use_control_ssl() == 0 - { - (*ftpc).count3 = 0 as libc::c_int; - match (*data).set.ftpsslauth as libc::c_uint { - 0 | 1 => { - (*ftpc).count2 = 1 as libc::c_int; - (*ftpc).count1 = 0 as libc::c_int; - } - 2 => { - (*ftpc).count2 = -(1 as libc::c_int); - (*ftpc).count1 = 1 as libc::c_int; - } - _ => { - Curl_failf( - data, - b"unsupported parameter to CURLOPT_FTPSSLAUTH: %d\0" - as *const u8 as *const libc::c_char, - (*data).set.ftpsslauth as libc::c_int, - ); - return CURLE_UNKNOWN_OPTION; - } - } - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"AUTH %s\0" as *const u8 as *const libc::c_char, - (ftpauth[(*ftpc).count1 as usize]).as_ptr(), - ); - if result as u64 == 0 { - _state(data, FTP_AUTH); - } - } else { - result = ftp_state_user(data, conn); - } - } - 2 => { - if (*pp).cache_size != 0 { - return CURLE_WEIRD_SERVER_REPLY; - } - if ftpcode == 234 as libc::c_int || ftpcode == 334 as libc::c_int { - result = Curl_ssl_connect(data, conn, 0 as libc::c_int); - if result as u64 == 0 { - let ref mut fresh29 = (*conn).bits; - (*fresh29).set_ftp_use_data_ssl(0 as libc::c_int as bit); - let ref mut fresh30 = (*conn).bits; - (*fresh30).set_ftp_use_control_ssl(1 as libc::c_int as bit); - result = ftp_state_user(data, conn); - } - } else if (*ftpc).count3 < 1 as libc::c_int { - let ref mut fresh31 = (*ftpc).count3; - *fresh31 += 1; - (*ftpc).count1 += (*ftpc).count2; - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"AUTH %s\0" as *const u8 as *const libc::c_char, - (ftpauth[(*ftpc).count1 as usize]).as_ptr(), - ); - } else if (*data).set.use_ssl as libc::c_uint - > CURLUSESSL_TRY as libc::c_int as libc::c_uint - { - result = CURLE_USE_SSL_FAILED; - } else { - result = ftp_state_user(data, conn); - } - } - 3 | 4 => { - result = ftp_state_user_resp(data, ftpcode, (*ftpc).state); - } - 5 => { - result = ftp_state_acct_resp(data, ftpcode); - } - 6 => { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"PROT %c\0" as *const u8 as *const libc::c_char, - if (*data).set.use_ssl as libc::c_uint - == CURLUSESSL_CONTROL as libc::c_int as libc::c_uint - { - 'C' as i32 - } else { - 'P' as i32 - }, - ); - if result as u64 == 0 { - _state(data, FTP_PROT); - } - } - 7 => { - if ftpcode / 100 as libc::c_int == 2 as libc::c_int { - let ref mut fresh32 = (*conn).bits; - (*fresh32) - .set_ftp_use_data_ssl( - (if (*data).set.use_ssl as libc::c_uint - != CURLUSESSL_CONTROL as libc::c_int as libc::c_uint - { - 1 as libc::c_int - } else { - 0 as libc::c_int - }) as bit, - ); - } else if (*data).set.use_ssl as libc::c_uint - > CURLUSESSL_CONTROL as libc::c_int as libc::c_uint - { - return CURLE_USE_SSL_FAILED - } - if (*data).set.ftp_ccc as u64 != 0 { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - b"CCC\0" as *const u8 as *const libc::c_char, - ); - if result as u64 == 0 { - _state(data, FTP_CCC); - } - } else { - result = ftp_state_pwd(data, conn); - } - } - 8 => { - if ftpcode < 500 as libc::c_int { - result = Curl_ssl_shutdown(data, conn, 0 as libc::c_int); - if result as u64 != 0 { - Curl_failf( - data, - b"Failed to clear the command channel (CCC)\0" as *const u8 - as *const libc::c_char, - ); - } - } - if result as u64 == 0 { - result = ftp_state_pwd(data, conn); - } - } - 9 => { - if ftpcode == 257 as libc::c_int { - let mut ptr: *mut libc::c_char = &mut *((*data).state.buffer) - .offset(4 as libc::c_int as isize) as *mut libc::c_char; - let buf_size: size_t = (*data).set.buffer_size as size_t; - let mut dir: *mut libc::c_char = 0 as *mut libc::c_char; - let mut entry_extracted: bool = 0 as libc::c_int != 0; - dir = Curl_cmalloc - .expect( - "non-null function pointer", - )(nread.wrapping_add(1 as libc::c_int as libc::c_ulong)) - as *mut libc::c_char; - if dir.is_null() { - return CURLE_OUT_OF_MEMORY; - } - while ptr - < &mut *((*data).state.buffer).offset(buf_size as isize) - as *mut libc::c_char && *ptr as libc::c_int != '\n' as i32 - && *ptr as libc::c_int != '\u{0}' as i32 - && *ptr as libc::c_int != '"' as i32 - { - ptr = ptr.offset(1); - } - if '"' as i32 == *ptr as libc::c_int { - let mut store: *mut libc::c_char = 0 as *mut libc::c_char; - ptr = ptr.offset(1); - store = dir; - while *ptr != 0 { - if '"' as i32 == *ptr as libc::c_int { - if '"' as i32 - == *ptr.offset(1 as libc::c_int as isize) as libc::c_int - { - *store = *ptr.offset(1 as libc::c_int as isize); - ptr = ptr.offset(1); - } else { - entry_extracted = 1 as libc::c_int != 0; - break; - } - } else { - *store = *ptr; - } - store = store.offset(1); - ptr = ptr.offset(1); - } - *store = '\u{0}' as i32 as libc::c_char; - } - if entry_extracted { - if ((*ftpc).server_os).is_null() - && *dir.offset(0 as libc::c_int as isize) as libc::c_int - != '/' as i32 - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - b"SYST\0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - Curl_cfree - .expect( - "non-null function pointer", - )(dir as *mut libc::c_void); - return result; - } - Curl_cfree - .expect( - "non-null function pointer", - )((*ftpc).entrypath as *mut libc::c_void); - let ref mut fresh33 = (*ftpc).entrypath; - *fresh33 = 0 as *mut libc::c_char; - let ref mut fresh34 = (*ftpc).entrypath; - *fresh34 = dir; - Curl_infof( - data, - b"Entry path is '%s'\0" as *const u8 as *const libc::c_char, - (*ftpc).entrypath, - ); - let ref mut fresh35 = (*data) - .state - .most_recent_ftp_entrypath; - *fresh35 = (*ftpc).entrypath; - _state(data, FTP_SYST); - current_block_187 = 10490607306284298299; - } else { - Curl_cfree - .expect( - "non-null function pointer", - )((*ftpc).entrypath as *mut libc::c_void); - let ref mut fresh36 = (*ftpc).entrypath; - *fresh36 = 0 as *mut libc::c_char; - let ref mut fresh37 = (*ftpc).entrypath; - *fresh37 = dir; - Curl_infof( - data, - b"Entry path is '%s'\0" as *const u8 as *const libc::c_char, - (*ftpc).entrypath, - ); - let ref mut fresh38 = (*data) - .state - .most_recent_ftp_entrypath; - *fresh38 = (*ftpc).entrypath; - current_block_187 = 17917672080766325409; - } - } else { - Curl_cfree - .expect( - "non-null function pointer", - )(dir as *mut libc::c_void); - Curl_infof( - data, - b"Failed to figure out path\0" as *const u8 - as *const libc::c_char, - ); - current_block_187 = 17917672080766325409; - } - } else { - current_block_187 = 17917672080766325409; - } - match current_block_187 { - 10490607306284298299 => {} - _ => { - _state(data, FTP_STOP); - } - } - } - 10 => { - if ftpcode == 215 as libc::c_int { - let mut ptr_0: *mut libc::c_char = &mut *((*data).state.buffer) - .offset(4 as libc::c_int as isize) as *mut libc::c_char; - let mut os: *mut libc::c_char = 0 as *mut libc::c_char; - let mut store_0: *mut libc::c_char = 0 as *mut libc::c_char; - os = Curl_cmalloc - .expect( - "non-null function pointer", - )(nread.wrapping_add(1 as libc::c_int as libc::c_ulong)) - as *mut libc::c_char; - if os.is_null() { - return CURLE_OUT_OF_MEMORY; - } - while *ptr_0 as libc::c_int == ' ' as i32 { - ptr_0 = ptr_0.offset(1); - } - store_0 = os; - while *ptr_0 as libc::c_int != 0 - && *ptr_0 as libc::c_int != ' ' as i32 - { - let fresh39 = ptr_0; - ptr_0 = ptr_0.offset(1); - let fresh40 = store_0; - store_0 = store_0.offset(1); - *fresh40 = *fresh39; - } - *store_0 = '\u{0}' as i32 as libc::c_char; - if Curl_strcasecompare( - os, - b"OS/400\0" as *const u8 as *const libc::c_char, - ) != 0 - { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - b"SITE NAMEFMT 1\0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - Curl_cfree - .expect( - "non-null function pointer", - )(os as *mut libc::c_void); - return result; - } - Curl_cfree - .expect( - "non-null function pointer", - )((*ftpc).server_os as *mut libc::c_void); - let ref mut fresh41 = (*ftpc).server_os; - *fresh41 = 0 as *mut libc::c_char; - let ref mut fresh42 = (*ftpc).server_os; - *fresh42 = os; - _state(data, FTP_NAMEFMT); - current_block_187 = 10490607306284298299; - } else { - Curl_cfree - .expect( - "non-null function pointer", - )((*ftpc).server_os as *mut libc::c_void); - let ref mut fresh43 = (*ftpc).server_os; - *fresh43 = 0 as *mut libc::c_char; - let ref mut fresh44 = (*ftpc).server_os; - *fresh44 = os; - current_block_187 = 6938158527927677584; - } - } else { - current_block_187 = 6938158527927677584; - } - match current_block_187 { - 10490607306284298299 => {} - _ => { - _state(data, FTP_STOP); - } - } - } - 11 => { - if ftpcode == 250 as libc::c_int { - ftp_state_pwd(data, conn); - } else { - _state(data, FTP_STOP); - } - } - 12 | 15 | 13 | 14 => { - if ftpcode >= 400 as libc::c_int && (*ftpc).count2 == 0 { - Curl_failf( - data, - b"QUOT command failed with %03d\0" as *const u8 - as *const libc::c_char, - ftpcode, - ); - result = CURLE_QUOTE_ERROR; - } else { - result = ftp_state_quote(data, 0 as libc::c_int != 0, (*ftpc).state); - } - } - 16 => { - if ftpcode / 100 as libc::c_int != 2 as libc::c_int { - if (*data).set.ftp_create_missing_dirs != 0 && (*ftpc).cwdcount != 0 - && (*ftpc).count2 == 0 - { - let ref mut fresh45 = (*ftpc).count2; - *fresh45 += 1; - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"MKD %s\0" as *const u8 as *const libc::c_char, - *((*ftpc).dirs) - .offset(((*ftpc).cwdcount - 1 as libc::c_int) as isize), - ); - if result as u64 == 0 { - _state(data, FTP_MKD); - } - } else { - Curl_failf( - data, - b"Server denied you to change to the given directory\0" - as *const u8 as *const libc::c_char, - ); - (*ftpc).cwdfail = 1 as libc::c_int != 0; - result = CURLE_REMOTE_ACCESS_DENIED; - } - } else { - (*ftpc).count2 = 0 as libc::c_int; - let ref mut fresh46 = (*ftpc).cwdcount; - *fresh46 += 1; - if *fresh46 <= (*ftpc).dirdepth { - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"CWD %s\0" as *const u8 as *const libc::c_char, - *((*ftpc).dirs) - .offset(((*ftpc).cwdcount - 1 as libc::c_int) as isize), - ); - } else { - result = ftp_state_mdtm(data); - } - } - } - 17 => { - if ftpcode / 100 as libc::c_int != 2 as libc::c_int - && { - let ref mut fresh47 = (*ftpc).count3; - let fresh48 = *fresh47; - *fresh47 = *fresh47 - 1; - fresh48 == 0 - } - { - Curl_failf( - data, - b"Failed to MKD dir: %03d\0" as *const u8 as *const libc::c_char, - ftpcode, - ); - result = CURLE_REMOTE_ACCESS_DENIED; - } else { - _state(data, FTP_CWD); - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"CWD %s\0" as *const u8 as *const libc::c_char, - *((*ftpc).dirs) - .offset(((*ftpc).cwdcount - 1 as libc::c_int) as isize), - ); - } - } - 18 => { - result = ftp_state_mdtm_resp(data, ftpcode); - } - 19 | 20 | 21 | 22 => { - result = ftp_state_type_resp(data, ftpcode, (*ftpc).state); - } - 23 | 24 | 25 => { - result = ftp_state_size_resp(data, ftpcode, (*ftpc).state); - } - 26 | 27 => { - result = ftp_state_rest_resp(data, conn, ftpcode, (*ftpc).state); - } - 29 => { - if ftpcode != 200 as libc::c_int { - Curl_failf( - data, - b"PRET command not accepted: %03d\0" as *const u8 - as *const libc::c_char, - ftpcode, - ); - return CURLE_FTP_PRET_FAILED; - } - result = ftp_state_use_pasv(data, conn); - } - 30 => { - result = ftp_state_pasv_resp(data, ftpcode); - } - 28 => { - result = ftp_state_port_resp(data, ftpcode); - } - 31 | 32 => { - result = ftp_state_get_resp(data, ftpcode, (*ftpc).state); - } - 33 => { - result = ftp_state_stor_resp(data, ftpcode, (*ftpc).state); - } - 34 | _ => { - _state(data, FTP_STOP); - } - } - } - return result; -} -unsafe extern "C" fn ftp_multi_statemach( - mut data: *mut Curl_easy, - mut done: *mut bool, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut result: CURLcode = Curl_pp_statemach( - data, - &mut (*ftpc).pp, - 0 as libc::c_int != 0, - 0 as libc::c_int != 0, - ); - *done = if (*ftpc).state as libc::c_uint == FTP_STOP as libc::c_int as libc::c_uint { - 1 as libc::c_int - } else { - 0 as libc::c_int - } != 0; - return result; -} -unsafe extern "C" fn ftp_block_statemach( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - let mut result: CURLcode = CURLE_OK; - while (*ftpc).state as libc::c_uint != FTP_STOP as libc::c_int as libc::c_uint { - result = Curl_pp_statemach( - data, - pp, - 1 as libc::c_int != 0, - 1 as libc::c_int != 0, - ); - if result as u64 != 0 { - break; - } - } - return result; -} -unsafe extern "C" fn ftp_connect( - mut data: *mut Curl_easy, - mut done: *mut bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - *done = 0 as libc::c_int != 0; - Curl_conncontrol(conn, 0 as libc::c_int); - (*pp).response_time = (120 as libc::c_int * 1000 as libc::c_int) as timediff_t; - let ref mut fresh49 = (*pp).statemachine; - *fresh49 = Some( - ftp_statemachine - as unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - ); - let ref mut fresh50 = (*pp).endofresp; - *fresh50 = Some( - ftp_endofresp - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - ); - if (*(*conn).handler).flags - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint != 0 - { - result = Curl_ssl_connect(data, conn, 0 as libc::c_int); - if result as u64 != 0 { - return result; - } - let ref mut fresh51 = (*conn).bits; - (*fresh51).set_ftp_use_control_ssl(1 as libc::c_int as bit); - } - Curl_pp_setup(pp); - Curl_pp_init(data, pp); - _state(data, FTP_WAIT220); - result = ftp_multi_statemach(data, done); - return result; -} -unsafe extern "C" fn ftp_done( - mut data: *mut Curl_easy, - mut status: CURLcode, - mut premature: bool, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - let mut nread: ssize_t = 0; - let mut ftpcode: libc::c_int = 0; - let mut result: CURLcode = CURLE_OK; - let mut rawPath: *mut libc::c_char = 0 as *mut libc::c_char; - let mut pathLen: size_t = 0 as libc::c_int as size_t; - if ftp.is_null() { - return CURLE_OK; - } - let mut current_block_5: u64; - match status as libc::c_uint { - 23 => { - current_block_5 = 16918468366916868703; - } - 36 | 13 | 30 | 10 | 12 | 17 | 19 | 18 | 25 | 9 | 63 | 78 | 0 => { - current_block_5 = 16918468366916868703; - } - _ => { - current_block_5 = 7406589960681110508; - } - } - match current_block_5 { - 16918468366916868703 => { - if !premature { - current_block_5 = 6057473163062296781; - } else { - current_block_5 = 7406589960681110508; - } - } - _ => {} - } - match current_block_5 { - 7406589960681110508 => { - (*ftpc).ctl_valid = 0 as libc::c_int != 0; - (*ftpc).cwdfail = 1 as libc::c_int != 0; - Curl_conncontrol(conn, 1 as libc::c_int); - result = status; - } - _ => {} - } - if ((*data).state).wildcardmatch() != 0 { - if ((*data).set.chunk_end).is_some() && !((*ftpc).file).is_null() { - Curl_set_in_callback(data, 1 as libc::c_int != 0); - ((*data).set.chunk_end) - .expect("non-null function pointer")((*data).wildcard.customptr); - Curl_set_in_callback(data, 0 as libc::c_int != 0); - } - (*ftpc).known_filesize = -(1 as libc::c_int) as curl_off_t; - } - if result as u64 == 0 { - result = Curl_urldecode( - data, - (*ftp).path, - 0 as libc::c_int as size_t, - &mut rawPath, - &mut pathLen, - REJECT_CTRL, - ); - } - if result as u64 != 0 { - (*ftpc).ctl_valid = 0 as libc::c_int != 0; - Curl_conncontrol(conn, 1 as libc::c_int); - Curl_cfree - .expect("non-null function pointer")((*ftpc).prevpath as *mut libc::c_void); - let ref mut fresh52 = (*ftpc).prevpath; - *fresh52 = 0 as *mut libc::c_char; - } else { - if (*data).set.ftp_filemethod as libc::c_uint - == FTPFILE_NOCWD as libc::c_int as libc::c_uint - && *rawPath.offset(0 as libc::c_int as isize) as libc::c_int == '/' as i32 - { - Curl_cfree.expect("non-null function pointer")(rawPath as *mut libc::c_void); - } else { - Curl_cfree - .expect( - "non-null function pointer", - )((*ftpc).prevpath as *mut libc::c_void); - if !(*ftpc).cwdfail { - if (*data).set.ftp_filemethod as libc::c_uint - == FTPFILE_NOCWD as libc::c_int as libc::c_uint - { - pathLen = 0 as libc::c_int as size_t; - } else { - pathLen = (pathLen as libc::c_ulong) - .wrapping_sub( - if !((*ftpc).file).is_null() { - strlen((*ftpc).file) - } else { - 0 as libc::c_int as libc::c_ulong - }, - ) as size_t as size_t; - } - *rawPath.offset(pathLen as isize) = '\u{0}' as i32 as libc::c_char; - let ref mut fresh53 = (*ftpc).prevpath; - *fresh53 = rawPath; - } else { - Curl_cfree - .expect("non-null function pointer")(rawPath as *mut libc::c_void); - let ref mut fresh54 = (*ftpc).prevpath; - *fresh54 = 0 as *mut libc::c_char; - } - } - if !((*ftpc).prevpath).is_null() { - Curl_infof( - data, - b"Remembering we are in dir \"%s\"\0" as *const u8 - as *const libc::c_char, - (*ftpc).prevpath, - ); - } - } - freedirs(ftpc); - if (*conn).sock[1 as libc::c_int as usize] != -(1 as libc::c_int) { - if result as u64 == 0 && (*ftpc).dont_check as libc::c_int != 0 - && (*data).req.maxdownload > 0 as libc::c_int as libc::c_long - { - result = Curl_pp_sendf( - data, - pp, - b"%s\0" as *const u8 as *const libc::c_char, - b"ABOR\0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failure sending ABOR command: %s\0" as *const u8 - as *const libc::c_char, - curl_easy_strerror(result), - ); - (*ftpc).ctl_valid = 0 as libc::c_int != 0; - Curl_conncontrol(conn, 1 as libc::c_int); - } - } - if ((*conn).ssl[1 as libc::c_int as usize]).use_0() != 0 { - Curl_ssl_close(data, conn, 1 as libc::c_int); - } - close_secondarysocket(data, conn); - } - if result as u64 == 0 - && (*ftp).transfer as libc::c_uint - == PPTRANSFER_BODY as libc::c_int as libc::c_uint - && (*ftpc).ctl_valid as libc::c_int != 0 - && (*pp).pending_resp as libc::c_int != 0 && !premature - { - let mut old_time: timediff_t = (*pp).response_time; - (*pp).response_time = (60 as libc::c_int * 1000 as libc::c_int) as timediff_t; - (*pp).response = Curl_now(); - result = Curl_GetFTPResponse(data, &mut nread, &mut ftpcode); - (*pp).response_time = old_time; - if nread == 0 - && CURLE_OPERATION_TIMEDOUT as libc::c_int as libc::c_uint - == result as libc::c_uint - { - Curl_failf( - data, - b"control connection looks dead\0" as *const u8 as *const libc::c_char, - ); - (*ftpc).ctl_valid = 0 as libc::c_int != 0; - Curl_conncontrol(conn, 1 as libc::c_int); - } - if result as u64 != 0 { - Curl_cfree - .expect( - "non-null function pointer", - )((*ftp).pathalloc as *mut libc::c_void); - let ref mut fresh55 = (*ftp).pathalloc; - *fresh55 = 0 as *mut libc::c_char; - return result; - } - if (*ftpc).dont_check as libc::c_int != 0 - && (*data).req.maxdownload > 0 as libc::c_int as libc::c_long - { - Curl_infof( - data, - b"partial download completed, closing connection\0" as *const u8 - as *const libc::c_char, - ); - Curl_conncontrol(conn, 1 as libc::c_int); - return result; - } - if !(*ftpc).dont_check { - match ftpcode { - 226 | 250 => {} - 552 => { - Curl_failf( - data, - b"Exceeded storage allocation\0" as *const u8 - as *const libc::c_char, - ); - result = CURLE_REMOTE_DISK_FULL; - } - _ => { - Curl_failf( - data, - b"server did not report OK, got %d\0" as *const u8 - as *const libc::c_char, - ftpcode, - ); - result = CURLE_PARTIAL_FILE; - } - } - } - } - if !(result as libc::c_uint != 0 || premature as libc::c_int != 0) { - if ((*data).set).upload() != 0 { - if -(1 as libc::c_int) as libc::c_long != (*data).state.infilesize - && (*data).state.infilesize != (*data).req.writebytecount - && ((*data).set).crlf() == 0 - && (*ftp).transfer as libc::c_uint - == PPTRANSFER_BODY as libc::c_int as libc::c_uint - { - Curl_failf( - data, - b"Uploaded unaligned file size (%ld out of %ld bytes)\0" as *const u8 - as *const libc::c_char, - (*data).req.bytecount, - (*data).state.infilesize, - ); - result = CURLE_PARTIAL_FILE; - } - } else if -(1 as libc::c_int) as libc::c_long != (*data).req.size - && (*data).req.size != (*data).req.bytecount - && (*data).req.size + (*data).state.crlf_conversions - != (*data).req.bytecount - && (*data).req.maxdownload != (*data).req.bytecount - { - Curl_failf( - data, - b"Received only partial file: %ld bytes\0" as *const u8 - as *const libc::c_char, - (*data).req.bytecount, - ); - result = CURLE_PARTIAL_FILE; - } else if !(*ftpc).dont_check && (*data).req.bytecount == 0 - && (*data).req.size > 0 as libc::c_int as libc::c_long - { - Curl_failf( - data, - b"No data was received!\0" as *const u8 as *const libc::c_char, - ); - result = CURLE_FTP_COULDNT_RETR_FILE; - } - } - (*ftp).transfer = PPTRANSFER_BODY; - (*ftpc).dont_check = 0 as libc::c_int != 0; - if status as u64 == 0 && result as u64 == 0 && !premature - && !((*data).set.postquote).is_null() - { - result = ftp_sendquote(data, conn, (*data).set.postquote); - } - Curl_cfree - .expect("non-null function pointer")((*ftp).pathalloc as *mut libc::c_void); - let ref mut fresh56 = (*ftp).pathalloc; - *fresh56 = 0 as *mut libc::c_char; - return result; -} -unsafe extern "C" fn ftp_sendquote( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut quote: *mut curl_slist, -) -> CURLcode { - let mut item: *mut curl_slist = 0 as *mut curl_slist; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - item = quote; - while !item.is_null() { - if !((*item).data).is_null() { - let mut nread: ssize_t = 0; - let mut cmd: *mut libc::c_char = (*item).data; - let mut acceptfail: bool = 0 as libc::c_int != 0; - let mut result: CURLcode = CURLE_OK; - let mut ftpcode: libc::c_int = 0 as libc::c_int; - if *cmd.offset(0 as libc::c_int as isize) as libc::c_int == '*' as i32 { - cmd = cmd.offset(1); - acceptfail = 1 as libc::c_int != 0; - } - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - cmd, - ); - if result as u64 == 0 { - (*pp).response = Curl_now(); - result = Curl_GetFTPResponse(data, &mut nread, &mut ftpcode); - } - if result as u64 != 0 { - return result; - } - if !acceptfail && ftpcode >= 400 as libc::c_int { - Curl_failf( - data, - b"QUOT string not accepted: %s\0" as *const u8 - as *const libc::c_char, - cmd, - ); - return CURLE_QUOTE_ERROR; - } - } - item = (*item).next; - } - return CURLE_OK; -} -unsafe extern "C" fn ftp_need_type( - mut conn: *mut connectdata, - mut ascii_wanted: bool, -) -> libc::c_int { - return ((*conn).proto.ftpc.transfertype as libc::c_int - != (if ascii_wanted as libc::c_int != 0 { 'A' as i32 } else { 'I' as i32 })) - as libc::c_int; -} -unsafe extern "C" fn ftp_nb_type( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut ascii: bool, - mut newstate: ftpstate, -) -> CURLcode { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut result: CURLcode = CURLE_OK; - let mut want: libc::c_char = (if ascii as libc::c_int != 0 { - 'A' as i32 - } else { - 'I' as i32 - }) as libc::c_char; - if (*ftpc).transfertype as libc::c_int == want as libc::c_int { - _state(data, newstate); - return ftp_state_type_resp(data, 200 as libc::c_int, newstate); - } - result = Curl_pp_sendf( - data, - &mut (*ftpc).pp as *mut pingpong, - b"TYPE %c\0" as *const u8 as *const libc::c_char, - want as libc::c_int, - ); - if result as u64 == 0 { - _state(data, newstate); - (*ftpc).transfertype = want; - } - return result; -} -unsafe extern "C" fn ftp_pasv_verbose( - mut data: *mut Curl_easy, - mut ai: *mut Curl_addrinfo, - mut newhost: *mut libc::c_char, - mut port: libc::c_int, -) { - let mut buf: [libc::c_char; 256] = [0; 256]; - Curl_printable_address( - ai, - buf.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong, - ); - Curl_infof( - data, - b"Connecting to %s (%s) port %d\0" as *const u8 as *const libc::c_char, - newhost, - buf.as_mut_ptr(), - port, - ); -} -unsafe extern "C" fn ftp_do_more( - mut data: *mut Curl_easy, - mut completep: *mut libc::c_int, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut result: CURLcode = CURLE_OK; - let mut connected: bool = 0 as libc::c_int != 0; - let mut complete: bool = 0 as libc::c_int != 0; - let mut ftp: *mut FTP = (*data).req.p.ftp; - if !(*conn).bits.tcpconnect[1 as libc::c_int as usize] { - if Curl_connect_ongoing(conn) { - result = Curl_proxyCONNECT( - data, - 1 as libc::c_int, - 0 as *const libc::c_char, - 0 as libc::c_int, - ); - return result; - } - result = Curl_is_connected(data, conn, 1 as libc::c_int, &mut connected); - if connected {} else { - if result as libc::c_uint != 0 && (*ftpc).count1 == 0 as libc::c_int { - *completep = -(1 as libc::c_int); - return ftp_epsv_disable(data, conn); - } - return result; - } - } - result = Curl_proxy_connect(data, 1 as libc::c_int); - if result as u64 != 0 { - return result; - } - if (*conn).http_proxy.proxytype as libc::c_uint - == CURLPROXY_HTTPS as libc::c_int as libc::c_uint - && !(*conn).bits.proxy_ssl_connected[1 as libc::c_int as usize] - { - return result; - } - if ((*conn).bits).tunnel_proxy() as libc::c_int != 0 - && ((*conn).bits).httpproxy() as libc::c_int != 0 - && Curl_connect_ongoing(conn) as libc::c_int != 0 - { - return result; - } - if (*ftpc).state as u64 != 0 { - result = ftp_multi_statemach(data, &mut complete); - *completep = complete as libc::c_int; - if result as libc::c_uint != 0 || !(*ftpc).wait_data_conn { - return result; - } - *completep = 0 as libc::c_int; - } - if (*ftp).transfer as libc::c_uint <= PPTRANSFER_INFO as libc::c_int as libc::c_uint - { - if (*ftpc).wait_data_conn as libc::c_int == 1 as libc::c_int { - let mut serv_conned: bool = false; - result = ReceivedServerConnect(data, &mut serv_conned); - if result as u64 != 0 { - return result; - } - if serv_conned { - result = AcceptServerConnect(data); - (*ftpc).wait_data_conn = 0 as libc::c_int != 0; - if result as u64 == 0 { - result = InitiateTransfer(data); - } - if result as u64 != 0 { - return result; - } - *completep = 1 as libc::c_int; - } - } else if ((*data).set).upload() != 0 { - result = ftp_nb_type( - data, - conn, - ((*data).state).prefer_ascii() != 0, - FTP_STOR_TYPE, - ); - if result as u64 != 0 { - return result; - } - result = ftp_multi_statemach(data, &mut complete); - if (*ftpc).wait_data_conn { - *completep = 0 as libc::c_int; - } else { - *completep = complete as libc::c_int; - } - } else { - (*ftp).downloadsize = -(1 as libc::c_int) as curl_off_t; - result = Curl_range(data); - if result as libc::c_uint == CURLE_OK as libc::c_int as libc::c_uint - && (*data).req.maxdownload >= 0 as libc::c_int as libc::c_long - { - (*ftpc).dont_check = 1 as libc::c_int != 0; - } - if !(result as u64 != 0) { - if ((*data).state).list_only() as libc::c_int != 0 - || ((*ftpc).file).is_null() - { - if (*ftp).transfer as libc::c_uint - == PPTRANSFER_BODY as libc::c_int as libc::c_uint - { - result = ftp_nb_type( - data, - conn, - 1 as libc::c_int != 0, - FTP_LIST_TYPE, - ); - if result as u64 != 0 { - return result; - } - } - } else { - result = ftp_nb_type( - data, - conn, - ((*data).state).prefer_ascii() != 0, - FTP_RETR_TYPE, - ); - if result as u64 != 0 { - return result; - } - } - } - result = ftp_multi_statemach(data, &mut complete); - *completep = complete as libc::c_int; - } - return result; - } - Curl_setup_transfer( - data, - -(1 as libc::c_int), - -(1 as libc::c_int) as curl_off_t, - 0 as libc::c_int != 0, - -(1 as libc::c_int), - ); - if !(*ftpc).wait_data_conn { - *completep = 1 as libc::c_int; - } - return result; -} -unsafe extern "C" fn ftp_perform( - mut data: *mut Curl_easy, - mut connected: *mut bool, - mut dophase_done: *mut bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - if ((*data).set).opt_no_body() != 0 { - let mut ftp: *mut FTP = (*data).req.p.ftp; - (*ftp).transfer = PPTRANSFER_INFO; - } - *dophase_done = 0 as libc::c_int != 0; - result = ftp_state_quote(data, 1 as libc::c_int != 0, FTP_QUOTE); - if result as u64 != 0 { - return result; - } - result = ftp_multi_statemach(data, dophase_done); - *connected = (*conn).bits.tcpconnect[1 as libc::c_int as usize]; - Curl_infof( - data, - b"ftp_perform ends with SECONDARY: %d\0" as *const u8 as *const libc::c_char, - *connected as libc::c_int, - ); - *dophase_done; - return result; -} -unsafe extern "C" fn wc_data_dtor(mut ptr: *mut libc::c_void) { - let mut ftpwc: *mut ftp_wc = ptr as *mut ftp_wc; - if !ftpwc.is_null() && !((*ftpwc).parser).is_null() { - Curl_ftp_parselist_data_free(&mut (*ftpwc).parser); - } - Curl_cfree.expect("non-null function pointer")(ftpwc as *mut libc::c_void); -} -unsafe extern "C" fn init_wc_data(mut data: *mut Curl_easy) -> CURLcode { - let mut last_slash: *mut libc::c_char = 0 as *mut libc::c_char; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut path: *mut libc::c_char = (*ftp).path; - let mut wildcard: *mut WildcardData = &mut (*data).wildcard; - let mut result: CURLcode = CURLE_OK; - let mut ftpwc: *mut ftp_wc = 0 as *mut ftp_wc; - last_slash = strrchr((*ftp).path, '/' as i32); - if !last_slash.is_null() { - last_slash = last_slash.offset(1); - if *last_slash.offset(0 as libc::c_int as isize) as libc::c_int == '\u{0}' as i32 - { - (*wildcard).state = CURLWC_CLEAN; - result = ftp_parse_url_path(data); - return result; - } - let ref mut fresh57 = (*wildcard).pattern; - *fresh57 = Curl_cstrdup.expect("non-null function pointer")(last_slash); - if ((*wildcard).pattern).is_null() { - return CURLE_OUT_OF_MEMORY; - } - *last_slash.offset(0 as libc::c_int as isize) = '\u{0}' as i32 as libc::c_char; - } else if *path.offset(0 as libc::c_int as isize) != 0 { - let ref mut fresh58 = (*wildcard).pattern; - *fresh58 = Curl_cstrdup.expect("non-null function pointer")(path); - if ((*wildcard).pattern).is_null() { - return CURLE_OUT_OF_MEMORY; - } - *path.offset(0 as libc::c_int as isize) = '\u{0}' as i32 as libc::c_char; - } else { - (*wildcard).state = CURLWC_CLEAN; - result = ftp_parse_url_path(data); - return result; - } - ftpwc = Curl_ccalloc - .expect( - "non-null function pointer", - )(1 as libc::c_int as size_t, ::std::mem::size_of::() as libc::c_ulong) - as *mut ftp_wc; - if ftpwc.is_null() { - result = CURLE_OUT_OF_MEMORY; - } else { - let ref mut fresh59 = (*ftpwc).parser; - *fresh59 = Curl_ftp_parselist_data_alloc(); - if ((*ftpwc).parser).is_null() { - result = CURLE_OUT_OF_MEMORY; - } else { - let ref mut fresh60 = (*wildcard).protdata; - *fresh60 = ftpwc as *mut libc::c_void; - let ref mut fresh61 = (*wildcard).dtor; - *fresh61 = Some( - wc_data_dtor as unsafe extern "C" fn(*mut libc::c_void) -> (), - ); - if (*data).set.ftp_filemethod as libc::c_uint - == FTPFILE_NOCWD as libc::c_int as libc::c_uint - { - (*data).set.ftp_filemethod = FTPFILE_MULTICWD; - } - result = ftp_parse_url_path(data); - if !(result as u64 != 0) { - let ref mut fresh62 = (*wildcard).path; - *fresh62 = Curl_cstrdup.expect("non-null function pointer")((*ftp).path); - if ((*wildcard).path).is_null() { - result = CURLE_OUT_OF_MEMORY; - } else { - let ref mut fresh63 = (*ftpwc).backup.write_function; - *fresh63 = (*data).set.fwrite_func; - let ref mut fresh64 = (*data).set.fwrite_func; - *fresh64 = Some( - Curl_ftp_parselist - as unsafe extern "C" fn( - *mut libc::c_char, - size_t, - size_t, - *mut libc::c_void, - ) -> size_t, - ); - let ref mut fresh65 = (*ftpwc).backup.file_descriptor; - *fresh65 = (*data).set.out as *mut FILE; - let ref mut fresh66 = (*data).set.out; - *fresh66 = data as *mut libc::c_void; - Curl_infof( - data, - b"Wildcard - Parsing started\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_OK; - } - } - } - } - if !ftpwc.is_null() { - Curl_ftp_parselist_data_free(&mut (*ftpwc).parser); - Curl_cfree.expect("non-null function pointer")(ftpwc as *mut libc::c_void); - } - Curl_cfree - .expect("non-null function pointer")((*wildcard).pattern as *mut libc::c_void); - let ref mut fresh67 = (*wildcard).pattern; - *fresh67 = 0 as *mut libc::c_char; - let ref mut fresh68 = (*wildcard).dtor; - *fresh68 = None; - let ref mut fresh69 = (*wildcard).protdata; - *fresh69 = 0 as *mut libc::c_void; - return result; -} -unsafe extern "C" fn wc_statemach(mut data: *mut Curl_easy) -> CURLcode { - let wildcard: *mut WildcardData = &mut (*data).wildcard; - let mut conn: *mut connectdata = (*data).conn; - let mut result: CURLcode = CURLE_OK; - let mut current_block_53: u64; - loop { - match (*wildcard).state as libc::c_uint { - 1 => { - result = init_wc_data(data); - if (*wildcard).state as libc::c_uint - == CURLWC_CLEAN as libc::c_int as libc::c_uint - { - return result; - } - (*wildcard) - .state = (if result as libc::c_uint != 0 { - CURLWC_ERROR as libc::c_int - } else { - CURLWC_MATCHING as libc::c_int - }) as wildcard_states; - return result; - } - 2 => { - let mut ftpwc: *mut ftp_wc = (*wildcard).protdata as *mut ftp_wc; - let ref mut fresh70 = (*data).set.fwrite_func; - *fresh70 = (*ftpwc).backup.write_function; - let ref mut fresh71 = (*data).set.out; - *fresh71 = (*ftpwc).backup.file_descriptor as *mut libc::c_void; - let ref mut fresh72 = (*ftpwc).backup.write_function; - *fresh72 = None; - let ref mut fresh73 = (*ftpwc).backup.file_descriptor; - *fresh73 = 0 as *mut FILE; - (*wildcard).state = CURLWC_DOWNLOADING; - if Curl_ftp_parselist_geterror((*ftpwc).parser) as u64 != 0 { - (*wildcard).state = CURLWC_CLEAN; - } else if (*wildcard).filelist.size == 0 as libc::c_int as libc::c_ulong - { - (*wildcard).state = CURLWC_CLEAN; - return CURLE_REMOTE_FILE_NOT_FOUND; - } - } - 3 => { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut finfo: *mut curl_fileinfo = (*(*wildcard).filelist.head).ptr - as *mut curl_fileinfo; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut tmp_path: *mut libc::c_char = curl_maprintf( - b"%s%s\0" as *const u8 as *const libc::c_char, - (*wildcard).path, - (*finfo).filename, - ); - if tmp_path.is_null() { - return CURLE_OUT_OF_MEMORY; - } - Curl_cfree - .expect( - "non-null function pointer", - )((*ftp).pathalloc as *mut libc::c_void); - let ref mut fresh74 = (*ftp).path; - *fresh74 = tmp_path; - let ref mut fresh75 = (*ftp).pathalloc; - *fresh75 = *fresh74; - Curl_infof( - data, - b"Wildcard - START of \"%s\"\0" as *const u8 as *const libc::c_char, - (*finfo).filename, - ); - if ((*data).set.chunk_bgn).is_some() { - let mut userresponse: libc::c_long = 0; - Curl_set_in_callback(data, 1 as libc::c_int != 0); - userresponse = ((*data).set.chunk_bgn) - .expect( - "non-null function pointer", - )( - finfo as *const libc::c_void, - (*wildcard).customptr, - (*wildcard).filelist.size as libc::c_int, - ); - Curl_set_in_callback(data, 0 as libc::c_int != 0); - match userresponse { - 2 => { - current_block_53 = 1971663154222422012; - match current_block_53 { - 13600473290859035008 => return CURLE_CHUNK_FAILED, - _ => { - Curl_infof( - data, - b"Wildcard - \"%s\" skipped by user\0" as *const u8 - as *const libc::c_char, - (*finfo).filename, - ); - (*wildcard).state = CURLWC_SKIP; - continue; - } - } - } - 1 => { - current_block_53 = 13600473290859035008; - match current_block_53 { - 13600473290859035008 => return CURLE_CHUNK_FAILED, - _ => { - Curl_infof( - data, - b"Wildcard - \"%s\" skipped by user\0" as *const u8 - as *const libc::c_char, - (*finfo).filename, - ); - (*wildcard).state = CURLWC_SKIP; - continue; - } - } - } - _ => {} - } - } - if (*finfo).filetype as libc::c_uint - != CURLFILETYPE_FILE as libc::c_int as libc::c_uint - { - (*wildcard).state = CURLWC_SKIP; - } else { - if (*finfo).flags - & ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint != 0 - { - (*ftpc).known_filesize = (*finfo).size; - } - result = ftp_parse_url_path(data); - if result as u64 != 0 { - return result; - } - Curl_llist_remove( - &mut (*wildcard).filelist, - (*wildcard).filelist.head, - 0 as *mut libc::c_void, - ); - if (*wildcard).filelist.size == 0 as libc::c_int as libc::c_ulong { - (*wildcard).state = CURLWC_CLEAN; - return CURLE_OK; - } - return result; - } - } - 5 => { - if ((*data).set.chunk_end).is_some() { - Curl_set_in_callback(data, 1 as libc::c_int != 0); - ((*data).set.chunk_end) - .expect("non-null function pointer")((*data).wildcard.customptr); - Curl_set_in_callback(data, 0 as libc::c_int != 0); - } - Curl_llist_remove( - &mut (*wildcard).filelist, - (*wildcard).filelist.head, - 0 as *mut libc::c_void, - ); - (*wildcard) - .state = (if (*wildcard).filelist.size - == 0 as libc::c_int as libc::c_ulong - { - CURLWC_CLEAN as libc::c_int - } else { - CURLWC_DOWNLOADING as libc::c_int - }) as wildcard_states; - } - 4 => { - let mut ftpwc_0: *mut ftp_wc = (*wildcard).protdata as *mut ftp_wc; - result = CURLE_OK; - if !ftpwc_0.is_null() { - result = Curl_ftp_parselist_geterror((*ftpwc_0).parser); - } - (*wildcard) - .state = (if result as libc::c_uint != 0 { - CURLWC_ERROR as libc::c_int - } else { - CURLWC_DONE as libc::c_int - }) as wildcard_states; - return result; - } - 7 | 6 | 0 => { - if ((*wildcard).dtor).is_some() { - ((*wildcard).dtor) - .expect("non-null function pointer")((*wildcard).protdata); - } - return result; - } - _ => {} - } - }; -} -unsafe extern "C" fn ftp_do(mut data: *mut Curl_easy, mut done: *mut bool) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - *done = 0 as libc::c_int != 0; - (*ftpc).wait_data_conn = 0 as libc::c_int != 0; - if ((*data).state).wildcardmatch() != 0 { - result = wc_statemach(data); - if (*data).wildcard.state as libc::c_uint - == CURLWC_SKIP as libc::c_int as libc::c_uint - || (*data).wildcard.state as libc::c_uint - == CURLWC_DONE as libc::c_int as libc::c_uint - { - return CURLE_OK; - } - if result as u64 != 0 { - return result; - } - } else { - result = ftp_parse_url_path(data); - if result as u64 != 0 { - return result; - } - } - result = ftp_regular_transfer(data, done); - return result; -} -unsafe extern "C" fn ftp_quit( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - if (*conn).proto.ftpc.ctl_valid { - result = Curl_pp_sendf( - data, - &mut (*conn).proto.ftpc.pp as *mut pingpong, - b"%s\0" as *const u8 as *const libc::c_char, - b"QUIT\0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failure sending QUIT command: %s\0" as *const u8 - as *const libc::c_char, - curl_easy_strerror(result), - ); - (*conn).proto.ftpc.ctl_valid = 0 as libc::c_int != 0; - Curl_conncontrol(conn, 1 as libc::c_int); - _state(data, FTP_STOP); - return result; - } - _state(data, FTP_QUIT); - result = ftp_block_statemach(data, conn); - } - return result; -} -unsafe extern "C" fn ftp_disconnect( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut dead_connection: bool, -) -> CURLcode { - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut pp: *mut pingpong = &mut (*ftpc).pp; - if dead_connection { - (*ftpc).ctl_valid = 0 as libc::c_int != 0; - } - ftp_quit(data, conn); - if !((*ftpc).entrypath).is_null() { - if (*data).state.most_recent_ftp_entrypath == (*ftpc).entrypath { - let ref mut fresh76 = (*data).state.most_recent_ftp_entrypath; - *fresh76 = 0 as *mut libc::c_char; - } - Curl_cfree - .expect("non-null function pointer")((*ftpc).entrypath as *mut libc::c_void); - let ref mut fresh77 = (*ftpc).entrypath; - *fresh77 = 0 as *mut libc::c_char; - } - freedirs(ftpc); - Curl_cfree - .expect("non-null function pointer")((*ftpc).prevpath as *mut libc::c_void); - let ref mut fresh78 = (*ftpc).prevpath; - *fresh78 = 0 as *mut libc::c_char; - Curl_cfree - .expect("non-null function pointer")((*ftpc).server_os as *mut libc::c_void); - let ref mut fresh79 = (*ftpc).server_os; - *fresh79 = 0 as *mut libc::c_char; - Curl_pp_disconnect(pp); - return CURLE_OK; -} -unsafe extern "C" fn ftp_parse_url_path(mut data: *mut Curl_easy) -> CURLcode { - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - let mut slashPos: *const libc::c_char = 0 as *const libc::c_char; - let mut fileName: *const libc::c_char = 0 as *const libc::c_char; - let mut result: CURLcode = CURLE_OK; - let mut rawPath: *mut libc::c_char = 0 as *mut libc::c_char; - let mut pathLen: size_t = 0 as libc::c_int as size_t; - (*ftpc).ctl_valid = 0 as libc::c_int != 0; - (*ftpc).cwdfail = 0 as libc::c_int != 0; - result = Curl_urldecode( - data, - (*ftp).path, - 0 as libc::c_int as size_t, - &mut rawPath, - &mut pathLen, - REJECT_CTRL, - ); - if result as u64 != 0 { - return result; - } - match (*data).set.ftp_filemethod as libc::c_uint { - 2 => { - if pathLen > 0 as libc::c_int as libc::c_ulong - && *rawPath - .offset( - pathLen.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) as libc::c_int != '/' as i32 - { - fileName = rawPath; - } - } - 3 => { - slashPos = strrchr(rawPath, '/' as i32); - if !slashPos.is_null() { - let mut dirlen: size_t = slashPos.offset_from(rawPath) as libc::c_long - as size_t; - if dirlen == 0 as libc::c_int as libc::c_ulong { - dirlen = dirlen.wrapping_add(1); - } - let ref mut fresh80 = (*ftpc).dirs; - *fresh80 = Curl_ccalloc - .expect( - "non-null function pointer", - )( - 1 as libc::c_int as size_t, - ::std::mem::size_of::<*mut libc::c_char>() as libc::c_ulong, - ) as *mut *mut libc::c_char; - if ((*ftpc).dirs).is_null() { - Curl_cfree - .expect( - "non-null function pointer", - )(rawPath as *mut libc::c_void); - return CURLE_OUT_OF_MEMORY; - } - let ref mut fresh81 = *((*ftpc).dirs).offset(0 as libc::c_int as isize); - *fresh81 = Curl_ccalloc - .expect( - "non-null function pointer", - )( - 1 as libc::c_int as size_t, - dirlen.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if (*((*ftpc).dirs).offset(0 as libc::c_int as isize)).is_null() { - Curl_cfree - .expect( - "non-null function pointer", - )(rawPath as *mut libc::c_void); - return CURLE_OUT_OF_MEMORY; - } - strncpy( - *((*ftpc).dirs).offset(0 as libc::c_int as isize), - rawPath, - dirlen, - ); - (*ftpc).dirdepth = 1 as libc::c_int; - fileName = slashPos.offset(1 as libc::c_int as isize); - } else { - fileName = rawPath; - } - } - 1 | _ => { - let mut curPos: *const libc::c_char = rawPath; - let mut dirAlloc: libc::c_int = 0 as libc::c_int; - let mut str: *const libc::c_char = rawPath; - while *str as libc::c_int != 0 as libc::c_int { - if *str as libc::c_int == '/' as i32 { - dirAlloc += 1; - } - str = str.offset(1); - } - if dirAlloc > 0 as libc::c_int { - let ref mut fresh82 = (*ftpc).dirs; - *fresh82 = Curl_ccalloc - .expect( - "non-null function pointer", - )( - dirAlloc as size_t, - ::std::mem::size_of::<*mut libc::c_char>() as libc::c_ulong, - ) as *mut *mut libc::c_char; - if ((*ftpc).dirs).is_null() { - Curl_cfree - .expect( - "non-null function pointer", - )(rawPath as *mut libc::c_void); - return CURLE_OUT_OF_MEMORY; - } - loop { - slashPos = strchr(curPos, '/' as i32); - if slashPos.is_null() { - break; - } - let mut compLen: size_t = slashPos.offset_from(curPos) - as libc::c_long as size_t; - if compLen == 0 as libc::c_int as libc::c_ulong - && (*ftpc).dirdepth == 0 as libc::c_int - { - compLen = compLen.wrapping_add(1); - } - if compLen > 0 as libc::c_int as libc::c_ulong { - let mut comp: *mut libc::c_char = Curl_ccalloc - .expect( - "non-null function pointer", - )( - 1 as libc::c_int as size_t, - compLen.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if comp.is_null() { - Curl_cfree - .expect( - "non-null function pointer", - )(rawPath as *mut libc::c_void); - return CURLE_OUT_OF_MEMORY; - } - strncpy(comp, curPos, compLen); - let ref mut fresh83 = (*ftpc).dirdepth; - let fresh84 = *fresh83; - *fresh83 = *fresh83 + 1; - let ref mut fresh85 = *((*ftpc).dirs).offset(fresh84 as isize); - *fresh85 = comp; - } - curPos = slashPos.offset(1 as libc::c_int as isize); - } - } - fileName = curPos; - } - } - if !fileName.is_null() && *fileName as libc::c_int != 0 { - let ref mut fresh86 = (*ftpc).file; - *fresh86 = Curl_cstrdup.expect("non-null function pointer")(fileName); - } else { - let ref mut fresh87 = (*ftpc).file; - *fresh87 = 0 as *mut libc::c_char; - } - if ((*data).set).upload() as libc::c_int != 0 && ((*ftpc).file).is_null() - && (*ftp).transfer as libc::c_uint - == PPTRANSFER_BODY as libc::c_int as libc::c_uint - { - Curl_failf( - data, - b"Uploading to a URL without a file name!\0" as *const u8 - as *const libc::c_char, - ); - Curl_cfree.expect("non-null function pointer")(rawPath as *mut libc::c_void); - return CURLE_URL_MALFORMAT; - } - (*ftpc).cwddone = 0 as libc::c_int != 0; - if (*data).set.ftp_filemethod as libc::c_uint - == FTPFILE_NOCWD as libc::c_int as libc::c_uint - && *rawPath.offset(0 as libc::c_int as isize) as libc::c_int == '/' as i32 - { - (*ftpc).cwddone = 1 as libc::c_int != 0; - } else { - let mut oldPath: *const libc::c_char = if ((*conn).bits).reuse() as libc::c_int - != 0 - { - (*ftpc).prevpath as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }; - if !oldPath.is_null() { - let mut n: size_t = pathLen; - if (*data).set.ftp_filemethod as libc::c_uint - == FTPFILE_NOCWD as libc::c_int as libc::c_uint - { - n = 0 as libc::c_int as size_t; - } else { - n = (n as libc::c_ulong) - .wrapping_sub( - if !((*ftpc).file).is_null() { - strlen((*ftpc).file) - } else { - 0 as libc::c_int as libc::c_ulong - }, - ) as size_t as size_t; - } - if strlen(oldPath) == n && strncmp(rawPath, oldPath, n) == 0 { - Curl_infof( - data, - b"Request has same path as previous transfer\0" as *const u8 - as *const libc::c_char, - ); - (*ftpc).cwddone = 1 as libc::c_int != 0; - } - } - } - Curl_cfree.expect("non-null function pointer")(rawPath as *mut libc::c_void); - return CURLE_OK; -} -unsafe extern "C" fn ftp_dophase_done( - mut data: *mut Curl_easy, - mut connected: bool, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ftp: *mut FTP = (*data).req.p.ftp; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - if connected { - let mut completed: libc::c_int = 0; - let mut result: CURLcode = ftp_do_more(data, &mut completed); - if result as u64 != 0 { - close_secondarysocket(data, conn); - return result; - } - } - if (*ftp).transfer as libc::c_uint != PPTRANSFER_BODY as libc::c_int as libc::c_uint - { - Curl_setup_transfer( - data, - -(1 as libc::c_int), - -(1 as libc::c_int) as curl_off_t, - 0 as libc::c_int != 0, - -(1 as libc::c_int), - ); - } else if !connected { - let ref mut fresh88 = (*conn).bits; - (*fresh88).set_do_more(1 as libc::c_int as bit); - } - (*ftpc).ctl_valid = 1 as libc::c_int != 0; - return CURLE_OK; -} -unsafe extern "C" fn ftp_doing( - mut data: *mut Curl_easy, - mut dophase_done: *mut bool, -) -> CURLcode { - let mut result: CURLcode = ftp_multi_statemach(data, dophase_done); - if !(result as u64 != 0) { - if *dophase_done { - result = ftp_dophase_done(data, 0 as libc::c_int != 0); - } - } - return result; -} -unsafe extern "C" fn ftp_regular_transfer( - mut data: *mut Curl_easy, - mut dophase_done: *mut bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut connected: bool = 0 as libc::c_int != 0; - let mut conn: *mut connectdata = (*data).conn; - let mut ftpc: *mut ftp_conn = &mut (*conn).proto.ftpc; - (*data).req.size = -(1 as libc::c_int) as curl_off_t; - Curl_pgrsSetUploadCounter(data, 0 as libc::c_int as curl_off_t); - Curl_pgrsSetDownloadCounter(data, 0 as libc::c_int as curl_off_t); - Curl_pgrsSetUploadSize(data, -(1 as libc::c_int) as curl_off_t); - Curl_pgrsSetDownloadSize(data, -(1 as libc::c_int) as curl_off_t); - (*ftpc).ctl_valid = 1 as libc::c_int != 0; - result = ftp_perform(data, &mut connected, dophase_done); - if result as u64 == 0 { - if !*dophase_done { - return CURLE_OK; - } - result = ftp_dophase_done(data, connected); - if result as u64 != 0 { - return result; - } - } else { - freedirs(ftpc); - } - return result; -} -unsafe extern "C" fn ftp_setup_connection( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut type_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut ftp: *mut FTP = 0 as *mut FTP; - ftp = Curl_ccalloc - .expect( - "non-null function pointer", - )(::std::mem::size_of::() as libc::c_ulong, 1 as libc::c_int as size_t) - as *mut FTP; - let ref mut fresh89 = (*data).req.p.ftp; - *fresh89 = ftp; - if ftp.is_null() { - return CURLE_OUT_OF_MEMORY; - } - let ref mut fresh90 = (*ftp).path; - *fresh90 = &mut *((*data).state.up.path).offset(1 as libc::c_int as isize) - as *mut libc::c_char; - type_0 = strstr((*ftp).path, b";type=\0" as *const u8 as *const libc::c_char); - if type_0.is_null() { - type_0 = strstr( - (*conn).host.rawalloc, - b";type=\0" as *const u8 as *const libc::c_char, - ); - } - if !type_0.is_null() { - let mut command: libc::c_char = 0; - *type_0 = 0 as libc::c_int as libc::c_char; - command = Curl_raw_toupper(*type_0.offset(6 as libc::c_int as isize)); - match command as libc::c_int { - 65 => { - let ref mut fresh91 = (*data).state; - (*fresh91).set_prefer_ascii(1 as libc::c_int as bit); - } - 68 => { - let ref mut fresh92 = (*data).state; - (*fresh92).set_list_only(1 as libc::c_int as bit); - } - 73 | _ => { - let ref mut fresh93 = (*data).state; - (*fresh93).set_prefer_ascii(0 as libc::c_int as bit); - } - } - } - (*ftp).transfer = PPTRANSFER_BODY; - (*ftp).downloadsize = 0 as libc::c_int as curl_off_t; - (*conn).proto.ftpc.known_filesize = -(1 as libc::c_int) as curl_off_t; - return CURLE_OK; -} diff --git a/lib/ftplistparser.c b/lib/ftplistparser.c new file mode 100644 index 0000000..716ff38 --- /dev/null +++ b/lib/ftplistparser.c @@ -0,0 +1,1018 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +/** + * Now implemented: + * + * 1) Unix version 1 + * drwxr-xr-x 1 user01 ftp 512 Jan 29 23:32 prog + * 2) Unix version 2 + * drwxr-xr-x 1 user01 ftp 512 Jan 29 1997 prog + * 3) Unix version 3 + * drwxr-xr-x 1 1 1 512 Jan 29 23:32 prog + * 4) Unix symlink + * lrwxr-xr-x 1 user01 ftp 512 Jan 29 23:32 prog -> prog2000 + * 5) DOS style + * 01-29-97 11:32PM prog + */ + +#include "curl_setup.h" + +#ifndef CURL_DISABLE_FTP + +#include + +#include "urldata.h" +#include "fileinfo.h" +#include "llist.h" +#include "strtoofft.h" +#include "ftp.h" +#include "ftplistparser.h" +#include "curl_fnmatch.h" +#include "curl_memory.h" +#include "multiif.h" +/* The last #include file should be: */ +#include "memdebug.h" + +/* allocs buffer which will contain one line of LIST command response */ +#define FTP_BUFFER_ALLOCSIZE 160 + +typedef enum { + PL_UNIX_TOTALSIZE = 0, + PL_UNIX_FILETYPE, + PL_UNIX_PERMISSION, + PL_UNIX_HLINKS, + PL_UNIX_USER, + PL_UNIX_GROUP, + PL_UNIX_SIZE, + PL_UNIX_TIME, + PL_UNIX_FILENAME, + PL_UNIX_SYMLINK +} pl_unix_mainstate; + +typedef union { + enum { + PL_UNIX_TOTALSIZE_INIT = 0, + PL_UNIX_TOTALSIZE_READING + } total_dirsize; + + enum { + PL_UNIX_HLINKS_PRESPACE = 0, + PL_UNIX_HLINKS_NUMBER + } hlinks; + + enum { + PL_UNIX_USER_PRESPACE = 0, + PL_UNIX_USER_PARSING + } user; + + enum { + PL_UNIX_GROUP_PRESPACE = 0, + PL_UNIX_GROUP_NAME + } group; + + enum { + PL_UNIX_SIZE_PRESPACE = 0, + PL_UNIX_SIZE_NUMBER + } size; + + enum { + PL_UNIX_TIME_PREPART1 = 0, + PL_UNIX_TIME_PART1, + PL_UNIX_TIME_PREPART2, + PL_UNIX_TIME_PART2, + PL_UNIX_TIME_PREPART3, + PL_UNIX_TIME_PART3 + } time; + + enum { + PL_UNIX_FILENAME_PRESPACE = 0, + PL_UNIX_FILENAME_NAME, + PL_UNIX_FILENAME_WINDOWSEOL + } filename; + + enum { + PL_UNIX_SYMLINK_PRESPACE = 0, + PL_UNIX_SYMLINK_NAME, + PL_UNIX_SYMLINK_PRETARGET1, + PL_UNIX_SYMLINK_PRETARGET2, + PL_UNIX_SYMLINK_PRETARGET3, + PL_UNIX_SYMLINK_PRETARGET4, + PL_UNIX_SYMLINK_TARGET, + PL_UNIX_SYMLINK_WINDOWSEOL + } symlink; +} pl_unix_substate; + +typedef enum { + PL_WINNT_DATE = 0, + PL_WINNT_TIME, + PL_WINNT_DIRORSIZE, + PL_WINNT_FILENAME +} pl_winNT_mainstate; + +typedef union { + enum { + PL_WINNT_TIME_PRESPACE = 0, + PL_WINNT_TIME_TIME + } time; + enum { + PL_WINNT_DIRORSIZE_PRESPACE = 0, + PL_WINNT_DIRORSIZE_CONTENT + } dirorsize; + enum { + PL_WINNT_FILENAME_PRESPACE = 0, + PL_WINNT_FILENAME_CONTENT, + PL_WINNT_FILENAME_WINEOL + } filename; +} pl_winNT_substate; + +/* This struct is used in wildcard downloading - for parsing LIST response */ +struct ftp_parselist_data { + enum { + OS_TYPE_UNKNOWN = 0, + OS_TYPE_UNIX, + OS_TYPE_WIN_NT + } os_type; + + union { + struct { + pl_unix_mainstate main; + pl_unix_substate sub; + } UNIX; + + struct { + pl_winNT_mainstate main; + pl_winNT_substate sub; + } NT; + } state; + + CURLcode error; + struct fileinfo *file_data; + unsigned int item_length; + size_t item_offset; + struct { + size_t filename; + size_t user; + size_t group; + size_t time; + size_t perm; + size_t symlink_target; + } offsets; +}; + +struct ftp_parselist_data *Curl_ftp_parselist_data_alloc(void) +{ + return calloc(1, sizeof(struct ftp_parselist_data)); +} + + +void Curl_ftp_parselist_data_free(struct ftp_parselist_data **parserp) +{ + struct ftp_parselist_data *parser = *parserp; + if(parser) + Curl_fileinfo_cleanup(parser->file_data); + free(parser); + *parserp = NULL; +} + + +CURLcode Curl_ftp_parselist_geterror(struct ftp_parselist_data *pl_data) +{ + return pl_data->error; +} + + +#define FTP_LP_MALFORMATED_PERM 0x01000000 + +static int ftp_pl_get_permission(const char *str) +{ + int permissions = 0; + /* USER */ + if(str[0] == 'r') + permissions |= 1 << 8; + else if(str[0] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[1] == 'w') + permissions |= 1 << 7; + else if(str[1] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + + if(str[2] == 'x') + permissions |= 1 << 6; + else if(str[2] == 's') { + permissions |= 1 << 6; + permissions |= 1 << 11; + } + else if(str[2] == 'S') + permissions |= 1 << 11; + else if(str[2] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + /* GROUP */ + if(str[3] == 'r') + permissions |= 1 << 5; + else if(str[3] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[4] == 'w') + permissions |= 1 << 4; + else if(str[4] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[5] == 'x') + permissions |= 1 << 3; + else if(str[5] == 's') { + permissions |= 1 << 3; + permissions |= 1 << 10; + } + else if(str[5] == 'S') + permissions |= 1 << 10; + else if(str[5] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + /* others */ + if(str[6] == 'r') + permissions |= 1 << 2; + else if(str[6] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[7] == 'w') + permissions |= 1 << 1; + else if(str[7] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + if(str[8] == 'x') + permissions |= 1; + else if(str[8] == 't') { + permissions |= 1; + permissions |= 1 << 9; + } + else if(str[8] == 'T') + permissions |= 1 << 9; + else if(str[8] != '-') + permissions |= FTP_LP_MALFORMATED_PERM; + + return permissions; +} + +static CURLcode ftp_pl_insert_finfo(struct Curl_easy *data, + struct fileinfo *infop) +{ + curl_fnmatch_callback compare; + struct WildcardData *wc = &data->wildcard; + struct ftp_wc *ftpwc = wc->protdata; + struct Curl_llist *llist = &wc->filelist; + struct ftp_parselist_data *parser = ftpwc->parser; + bool add = TRUE; + struct curl_fileinfo *finfo = &infop->info; + + /* move finfo pointers to b_data */ + char *str = finfo->b_data; + finfo->filename = str + parser->offsets.filename; + finfo->strings.group = parser->offsets.group ? + str + parser->offsets.group : NULL; + finfo->strings.perm = parser->offsets.perm ? + str + parser->offsets.perm : NULL; + finfo->strings.target = parser->offsets.symlink_target ? + str + parser->offsets.symlink_target : NULL; + finfo->strings.time = str + parser->offsets.time; + finfo->strings.user = parser->offsets.user ? + str + parser->offsets.user : NULL; + + /* get correct fnmatch callback */ + compare = data->set.fnmatch; + if(!compare) + compare = Curl_fnmatch; + + /* filter pattern-corresponding filenames */ + Curl_set_in_callback(data, true); + if(compare(data->set.fnmatch_data, wc->pattern, + finfo->filename) == 0) { + /* discard symlink which is containing multiple " -> " */ + if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target && + (strstr(finfo->strings.target, " -> "))) { + add = FALSE; + } + } + else { + add = FALSE; + } + Curl_set_in_callback(data, false); + + if(add) { + Curl_llist_insert_next(llist, llist->tail, finfo, &infop->list); + } + else { + Curl_fileinfo_cleanup(infop); + } + + ftpwc->parser->file_data = NULL; + return CURLE_OK; +} + +size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb, + void *connptr) +{ + size_t bufflen = size*nmemb; + struct Curl_easy *data = (struct Curl_easy *)connptr; + struct ftp_wc *ftpwc = data->wildcard.protdata; + struct ftp_parselist_data *parser = ftpwc->parser; + struct fileinfo *infop; + struct curl_fileinfo *finfo; + unsigned long i = 0; + CURLcode result; + size_t retsize = bufflen; + + if(parser->error) { /* error in previous call */ + /* scenario: + * 1. call => OK.. + * 2. call => OUT_OF_MEMORY (or other error) + * 3. (last) call => is skipped RIGHT HERE and the error is hadled later + * in wc_statemach() + */ + goto fail; + } + + if(parser->os_type == OS_TYPE_UNKNOWN && bufflen > 0) { + /* considering info about FILE response format */ + parser->os_type = (buffer[0] >= '0' && buffer[0] <= '9') ? + OS_TYPE_WIN_NT : OS_TYPE_UNIX; + } + + while(i < bufflen) { /* FSM */ + + char c = buffer[i]; + if(!parser->file_data) { /* tmp file data is not allocated yet */ + parser->file_data = Curl_fileinfo_alloc(); + if(!parser->file_data) { + parser->error = CURLE_OUT_OF_MEMORY; + goto fail; + } + parser->file_data->info.b_data = malloc(FTP_BUFFER_ALLOCSIZE); + if(!parser->file_data->info.b_data) { + parser->error = CURLE_OUT_OF_MEMORY; + goto fail; + } + parser->file_data->info.b_size = FTP_BUFFER_ALLOCSIZE; + parser->item_offset = 0; + parser->item_length = 0; + } + + infop = parser->file_data; + finfo = &infop->info; + finfo->b_data[finfo->b_used++] = c; + + if(finfo->b_used >= finfo->b_size - 1) { + /* if it is important, extend buffer space for file data */ + char *tmp = realloc(finfo->b_data, + finfo->b_size + FTP_BUFFER_ALLOCSIZE); + if(tmp) { + finfo->b_size += FTP_BUFFER_ALLOCSIZE; + finfo->b_data = tmp; + } + else { + Curl_fileinfo_cleanup(parser->file_data); + parser->file_data = NULL; + parser->error = CURLE_OUT_OF_MEMORY; + goto fail; + } + } + + switch(parser->os_type) { + case OS_TYPE_UNIX: + switch(parser->state.UNIX.main) { + case PL_UNIX_TOTALSIZE: + switch(parser->state.UNIX.sub.total_dirsize) { + case PL_UNIX_TOTALSIZE_INIT: + if(c == 't') { + parser->state.UNIX.sub.total_dirsize = PL_UNIX_TOTALSIZE_READING; + parser->item_length++; + } + else { + parser->state.UNIX.main = PL_UNIX_FILETYPE; + /* start FSM again not considering size of directory */ + finfo->b_used = 0; + continue; + } + break; + case PL_UNIX_TOTALSIZE_READING: + parser->item_length++; + if(c == '\r') { + parser->item_length--; + finfo->b_used--; + } + else if(c == '\n') { + finfo->b_data[parser->item_length - 1] = 0; + if(strncmp("total ", finfo->b_data, 6) == 0) { + char *endptr = finfo->b_data + 6; + /* here we can deal with directory size, pass the leading + whitespace and then the digits */ + while(ISSPACE(*endptr)) + endptr++; + while(ISDIGIT(*endptr)) + endptr++; + if(*endptr) { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + parser->state.UNIX.main = PL_UNIX_FILETYPE; + finfo->b_used = 0; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + break; + } + break; + case PL_UNIX_FILETYPE: + switch(c) { + case '-': + finfo->filetype = CURLFILETYPE_FILE; + break; + case 'd': + finfo->filetype = CURLFILETYPE_DIRECTORY; + break; + case 'l': + finfo->filetype = CURLFILETYPE_SYMLINK; + break; + case 'p': + finfo->filetype = CURLFILETYPE_NAMEDPIPE; + break; + case 's': + finfo->filetype = CURLFILETYPE_SOCKET; + break; + case 'c': + finfo->filetype = CURLFILETYPE_DEVICE_CHAR; + break; + case 'b': + finfo->filetype = CURLFILETYPE_DEVICE_BLOCK; + break; + case 'D': + finfo->filetype = CURLFILETYPE_DOOR; + break; + default: + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + parser->state.UNIX.main = PL_UNIX_PERMISSION; + parser->item_length = 0; + parser->item_offset = 1; + break; + case PL_UNIX_PERMISSION: + parser->item_length++; + if(parser->item_length <= 9) { + if(!strchr("rwx-tTsS", c)) { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + else if(parser->item_length == 10) { + unsigned int perm; + if(c != ' ') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + finfo->b_data[10] = 0; /* terminate permissions */ + perm = ftp_pl_get_permission(finfo->b_data + parser->item_offset); + if(perm & FTP_LP_MALFORMATED_PERM) { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_PERM; + parser->file_data->info.perm = perm; + parser->offsets.perm = parser->item_offset; + + parser->item_length = 0; + parser->state.UNIX.main = PL_UNIX_HLINKS; + parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; + } + break; + case PL_UNIX_HLINKS: + switch(parser->state.UNIX.sub.hlinks) { + case PL_UNIX_HLINKS_PRESPACE: + if(c != ' ') { + if(c >= '0' && c <= '9') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + break; + case PL_UNIX_HLINKS_NUMBER: + parser->item_length ++; + if(c == ' ') { + char *p; + long int hlinks; + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + hlinks = strtol(finfo->b_data + parser->item_offset, &p, 10); + if(p[0] == '\0' && hlinks != LONG_MAX && hlinks != LONG_MIN) { + parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_HLINKCOUNT; + parser->file_data->info.hardlinks = hlinks; + } + parser->item_length = 0; + parser->item_offset = 0; + parser->state.UNIX.main = PL_UNIX_USER; + parser->state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; + } + else if(c < '0' || c > '9') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + } + break; + case PL_UNIX_USER: + switch(parser->state.UNIX.sub.user) { + case PL_UNIX_USER_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.user = PL_UNIX_USER_PARSING; + } + break; + case PL_UNIX_USER_PARSING: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.user = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_GROUP; + parser->state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; + parser->item_offset = 0; + parser->item_length = 0; + } + break; + } + break; + case PL_UNIX_GROUP: + switch(parser->state.UNIX.sub.group) { + case PL_UNIX_GROUP_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.group = PL_UNIX_GROUP_NAME; + } + break; + case PL_UNIX_GROUP_NAME: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.group = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_SIZE; + parser->state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; + parser->item_offset = 0; + parser->item_length = 0; + } + break; + } + break; + case PL_UNIX_SIZE: + switch(parser->state.UNIX.sub.size) { + case PL_UNIX_SIZE_PRESPACE: + if(c != ' ') { + if(c >= '0' && c <= '9') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + break; + case PL_UNIX_SIZE_NUMBER: + parser->item_length++; + if(c == ' ') { + char *p; + curl_off_t fsize; + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + if(!curlx_strtoofft(finfo->b_data + parser->item_offset, + &p, 10, &fsize)) { + if(p[0] == '\0' && fsize != CURL_OFF_T_MAX && + fsize != CURL_OFF_T_MIN) { + parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_SIZE; + parser->file_data->info.size = fsize; + } + parser->item_length = 0; + parser->item_offset = 0; + parser->state.UNIX.main = PL_UNIX_TIME; + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; + } + } + else if(!ISDIGIT(c)) { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + } + break; + case PL_UNIX_TIME: + switch(parser->state.UNIX.sub.time) { + case PL_UNIX_TIME_PREPART1: + if(c != ' ') { + if(ISALNUM(c)) { + parser->item_offset = finfo->b_used -1; + parser->item_length = 1; + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART1; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + break; + case PL_UNIX_TIME_PART1: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; + } + else if(!ISALNUM(c) && c != '.') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + case PL_UNIX_TIME_PREPART2: + parser->item_length++; + if(c != ' ') { + if(ISALNUM(c)) { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART2; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + break; + case PL_UNIX_TIME_PART2: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; + } + else if(!ISALNUM(c) && c != '.') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + case PL_UNIX_TIME_PREPART3: + parser->item_length++; + if(c != ' ') { + if(ISALNUM(c)) { + parser->state.UNIX.sub.time = PL_UNIX_TIME_PART3; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + break; + case PL_UNIX_TIME_PART3: + parser->item_length++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length -1] = 0; + parser->offsets.time = parser->item_offset; + /* + if(ftp_pl_gettime(parser, finfo->b_data + parser->item_offset)) { + parser->file_data->flags |= CURLFINFOFLAG_KNOWN_TIME; + } + */ + if(finfo->filetype == CURLFILETYPE_SYMLINK) { + parser->state.UNIX.main = PL_UNIX_SYMLINK; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; + } + else { + parser->state.UNIX.main = PL_UNIX_FILENAME; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_PRESPACE; + } + } + else if(!ISALNUM(c) && c != '.' && c != ':') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + } + break; + case PL_UNIX_FILENAME: + switch(parser->state.UNIX.sub.filename) { + case PL_UNIX_FILENAME_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; + } + break; + case PL_UNIX_FILENAME_NAME: + parser->item_length++; + if(c == '\r') { + parser->state.UNIX.sub.filename = PL_UNIX_FILENAME_WINDOWSEOL; + } + else if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.filename = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_FILETYPE; + result = ftp_pl_insert_finfo(data, infop); + if(result) { + parser->error = result; + goto fail; + } + } + break; + case PL_UNIX_FILENAME_WINDOWSEOL: + if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.filename = parser->item_offset; + parser->state.UNIX.main = PL_UNIX_FILETYPE; + result = ftp_pl_insert_finfo(data, infop); + if(result) { + parser->error = result; + goto fail; + } + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + } + break; + case PL_UNIX_SYMLINK: + switch(parser->state.UNIX.sub.symlink) { + case PL_UNIX_SYMLINK_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_NAME: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET1; + } + else if(c == '\r' || c == '\n') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + case PL_UNIX_SYMLINK_PRETARGET1: + parser->item_length++; + if(c == '-') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET2; + } + else if(c == '\r' || c == '\n') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET2: + parser->item_length++; + if(c == '>') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET3; + } + else if(c == '\r' || c == '\n') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET3: + parser->item_length++; + if(c == ' ') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRETARGET4; + /* now place where is symlink following */ + finfo->b_data[parser->item_offset + parser->item_length - 4] = 0; + parser->offsets.filename = parser->item_offset; + parser->item_length = 0; + parser->item_offset = 0; + } + else if(c == '\r' || c == '\n') { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + else { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; + } + break; + case PL_UNIX_SYMLINK_PRETARGET4: + if(c != '\r' && c != '\n') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + case PL_UNIX_SYMLINK_TARGET: + parser->item_length++; + if(c == '\r') { + parser->state.UNIX.sub.symlink = PL_UNIX_SYMLINK_WINDOWSEOL; + } + else if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.symlink_target = parser->item_offset; + result = ftp_pl_insert_finfo(data, infop); + if(result) { + parser->error = result; + goto fail; + } + parser->state.UNIX.main = PL_UNIX_FILETYPE; + } + break; + case PL_UNIX_SYMLINK_WINDOWSEOL: + if(c == '\n') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + parser->offsets.symlink_target = parser->item_offset; + result = ftp_pl_insert_finfo(data, infop); + if(result) { + parser->error = result; + goto fail; + } + parser->state.UNIX.main = PL_UNIX_FILETYPE; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + } + break; + } + break; + case OS_TYPE_WIN_NT: + switch(parser->state.NT.main) { + case PL_WINNT_DATE: + parser->item_length++; + if(parser->item_length < 9) { + if(!strchr("0123456789-", c)) { /* only simple control */ + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + else if(parser->item_length == 9) { + if(c == ' ') { + parser->state.NT.main = PL_WINNT_TIME; + parser->state.NT.sub.time = PL_WINNT_TIME_PRESPACE; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + case PL_WINNT_TIME: + parser->item_length++; + switch(parser->state.NT.sub.time) { + case PL_WINNT_TIME_PRESPACE: + if(!ISSPACE(c)) { + parser->state.NT.sub.time = PL_WINNT_TIME_TIME; + } + break; + case PL_WINNT_TIME_TIME: + if(c == ' ') { + parser->offsets.time = parser->item_offset; + finfo->b_data[parser->item_offset + parser->item_length -1] = 0; + parser->state.NT.main = PL_WINNT_DIRORSIZE; + parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; + parser->item_length = 0; + } + else if(!strchr("APM0123456789:", c)) { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + } + break; + case PL_WINNT_DIRORSIZE: + switch(parser->state.NT.sub.dirorsize) { + case PL_WINNT_DIRORSIZE_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used - 1; + parser->item_length = 1; + parser->state.NT.sub.dirorsize = PL_WINNT_DIRORSIZE_CONTENT; + } + break; + case PL_WINNT_DIRORSIZE_CONTENT: + parser->item_length ++; + if(c == ' ') { + finfo->b_data[parser->item_offset + parser->item_length - 1] = 0; + if(strcmp("", finfo->b_data + parser->item_offset) == 0) { + finfo->filetype = CURLFILETYPE_DIRECTORY; + finfo->size = 0; + } + else { + char *endptr; + if(curlx_strtoofft(finfo->b_data + + parser->item_offset, + &endptr, 10, &finfo->size)) { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + /* correct file type */ + parser->file_data->info.filetype = CURLFILETYPE_FILE; + } + + parser->file_data->info.flags |= CURLFINFOFLAG_KNOWN_SIZE; + parser->item_length = 0; + parser->state.NT.main = PL_WINNT_FILENAME; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + break; + } + break; + case PL_WINNT_FILENAME: + switch(parser->state.NT.sub.filename) { + case PL_WINNT_FILENAME_PRESPACE: + if(c != ' ') { + parser->item_offset = finfo->b_used -1; + parser->item_length = 1; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; + } + break; + case PL_WINNT_FILENAME_CONTENT: + parser->item_length++; + if(c == '\r') { + parser->state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; + finfo->b_data[finfo->b_used - 1] = 0; + } + else if(c == '\n') { + parser->offsets.filename = parser->item_offset; + finfo->b_data[finfo->b_used - 1] = 0; + result = ftp_pl_insert_finfo(data, infop); + if(result) { + parser->error = result; + goto fail; + } + parser->state.NT.main = PL_WINNT_DATE; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + break; + case PL_WINNT_FILENAME_WINEOL: + if(c == '\n') { + parser->offsets.filename = parser->item_offset; + result = ftp_pl_insert_finfo(data, infop); + if(result) { + parser->error = result; + goto fail; + } + parser->state.NT.main = PL_WINNT_DATE; + parser->state.NT.sub.filename = PL_WINNT_FILENAME_PRESPACE; + } + else { + parser->error = CURLE_FTP_BAD_FILE_LIST; + goto fail; + } + break; + } + break; + } + break; + default: + retsize = bufflen + 1; + goto fail; + } + + i++; + } + return retsize; + +fail: + + /* Clean up any allocated memory. */ + if(parser->file_data) { + Curl_fileinfo_cleanup(parser->file_data); + parser->file_data = NULL; + } + + return retsize; +} + +#endif /* CURL_DISABLE_FTP */ diff --git a/lib/ftplistparser.rs b/lib/ftplistparser.rs deleted file mode 100644 index 2d5a00f..0000000 --- a/lib/ftplistparser.rs +++ /dev/null @@ -1,31510 +0,0 @@ -#![allow(dead_code, mutable_transmutes, non_camel_case_types, non_snake_case, non_upper_case_globals, unused_assignments, unused_mut)] -#![register_tool(c2rust)] -#![feature(extern_types, register_tool)] -extern "C" { - pub type _IO_wide_data; - pub type _IO_codecvt; - pub type _IO_marker; - pub type Curl_URL; - pub type thread_data; - pub type altsvcinfo; - pub type hsts; - pub type TELNET; - pub type smb_request; - pub type ldapreqinfo; - pub type contenc_writer; - pub type psl_ctx_st; - pub type Curl_share; - pub type curl_pushheaders; - pub type http_connect_state; - pub type ldapconninfo; - pub type tftp_state_data; - pub type nghttp2_session; - pub type ssl_backend_data; - fn Curl_isalnum(c: libc::c_int) -> libc::c_int; - fn Curl_isdigit(c: libc::c_int) -> libc::c_int; - fn Curl_isspace(c: libc::c_int) -> libc::c_int; - fn strtol( - _: *const libc::c_char, - _: *mut *mut libc::c_char, - _: libc::c_int, - ) -> libc::c_long; - fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int; - fn strncmp( - _: *const libc::c_char, - _: *const libc::c_char, - _: libc::c_ulong, - ) -> libc::c_int; - fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; - fn strstr(_: *const libc::c_char, _: *const libc::c_char) -> *mut libc::c_char; - fn Curl_llist_insert_next( - _: *mut Curl_llist, - _: *mut Curl_llist_element, - _: *const libc::c_void, - node: *mut Curl_llist_element, - ); - fn Curl_fileinfo_alloc() -> *mut fileinfo; - fn Curl_fileinfo_cleanup(finfo: *mut fileinfo); - fn curlx_strtoofft( - str: *const libc::c_char, - endp: *mut *mut libc::c_char, - base: libc::c_int, - num: *mut curl_off_t, - ) -> CURLofft; - fn Curl_fnmatch( - ptr: *mut libc::c_void, - pattern: *const libc::c_char, - string: *const libc::c_char, - ) -> libc::c_int; - static mut Curl_cmalloc: curl_malloc_callback; - static mut Curl_cfree: curl_free_callback; - static mut Curl_crealloc: curl_realloc_callback; - static mut Curl_ccalloc: curl_calloc_callback; - fn Curl_set_in_callback(data: *mut Curl_easy, value: bool); -} -pub type __uint8_t = libc::c_uchar; -pub type __int32_t = libc::c_int; -pub type __uint32_t = libc::c_uint; -pub type __off_t = libc::c_long; -pub type __off64_t = libc::c_long; -pub type __pid_t = libc::c_int; -pub type __time_t = libc::c_long; -pub type __ssize_t = libc::c_long; -pub type __socklen_t = libc::c_uint; -pub type pid_t = __pid_t; -pub type ssize_t = __ssize_t; -pub type time_t = __time_t; -pub type size_t = libc::c_ulong; -pub type int32_t = __int32_t; -pub type socklen_t = __socklen_t; -pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} -pub type curl_socklen_t = socklen_t; -pub type curl_off_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _IO_FILE { - pub _flags: libc::c_int, - pub _IO_read_ptr: *mut libc::c_char, - pub _IO_read_end: *mut libc::c_char, - pub _IO_read_base: *mut libc::c_char, - pub _IO_write_base: *mut libc::c_char, - pub _IO_write_ptr: *mut libc::c_char, - pub _IO_write_end: *mut libc::c_char, - pub _IO_buf_base: *mut libc::c_char, - pub _IO_buf_end: *mut libc::c_char, - pub _IO_save_base: *mut libc::c_char, - pub _IO_backup_base: *mut libc::c_char, - pub _IO_save_end: *mut libc::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: libc::c_int, - pub _flags2: libc::c_int, - pub _old_offset: __off_t, - pub _cur_column: libc::c_ushort, - pub _vtable_offset: libc::c_schar, - pub _shortbuf: [libc::c_char; 1], - pub _lock: *mut libc::c_void, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut libc::c_void, - pub __pad5: size_t, - pub _mode: libc::c_int, - pub _unused2: [libc::c_char; 20], -} -pub type _IO_lock_t = (); -pub type FILE = _IO_FILE; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_easy { - pub magic: libc::c_uint, - pub next: *mut Curl_easy, - pub prev: *mut Curl_easy, - pub conn: *mut connectdata, - pub connect_queue: Curl_llist_element, - pub conn_queue: Curl_llist_element, - pub mstate: CURLMstate, - pub result: CURLcode, - pub msg: Curl_message, - pub sockets: [curl_socket_t; 5], - pub actions: [libc::c_uchar; 5], - pub numsocks: libc::c_int, - pub dns: Names, - pub multi: *mut Curl_multi, - pub multi_easy: *mut Curl_multi, - pub share: *mut Curl_share, - pub psl: *mut PslCache, - pub req: SingleRequest, - pub set: UserDefined, - pub cookies: *mut CookieInfo, - pub hsts: *mut hsts, - pub asi: *mut altsvcinfo, - pub progress: Progress, - pub state: UrlState, - pub wildcard: WildcardData, - pub info: PureInfo, - pub tsi: curl_tlssessioninfo, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} -pub type curl_sslbackend = libc::c_uint; -pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; -pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; -pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; -pub const CURLSSLBACKEND_MBEDTLS: curl_sslbackend = 11; -pub const CURLSSLBACKEND_AXTLS: curl_sslbackend = 10; -pub const CURLSSLBACKEND_SECURETRANSPORT: curl_sslbackend = 9; -pub const CURLSSLBACKEND_SCHANNEL: curl_sslbackend = 8; -pub const CURLSSLBACKEND_WOLFSSL: curl_sslbackend = 7; -pub const CURLSSLBACKEND_POLARSSL: curl_sslbackend = 6; -pub const CURLSSLBACKEND_GSKIT: curl_sslbackend = 5; -pub const CURLSSLBACKEND_OBSOLETE4: curl_sslbackend = 4; -pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; -pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; -pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; -pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; -pub const CURLPX_LAST: CURLproxycode = 34; -pub const CURLPX_USER_REJECTED: CURLproxycode = 33; -pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; -pub const CURLPX_UNKNOWN_FAIL: CURLproxycode = 31; -pub const CURLPX_SEND_REQUEST: CURLproxycode = 30; -pub const CURLPX_SEND_CONNECT: CURLproxycode = 29; -pub const CURLPX_SEND_AUTH: CURLproxycode = 28; -pub const CURLPX_RESOLVE_HOST: CURLproxycode = 27; -pub const CURLPX_REQUEST_FAILED: CURLproxycode = 26; -pub const CURLPX_REPLY_UNASSIGNED: CURLproxycode = 25; -pub const CURLPX_REPLY_TTL_EXPIRED: CURLproxycode = 24; -pub const CURLPX_REPLY_NOT_ALLOWED: CURLproxycode = 23; -pub const CURLPX_REPLY_NETWORK_UNREACHABLE: CURLproxycode = 22; -pub const CURLPX_REPLY_HOST_UNREACHABLE: CURLproxycode = 21; -pub const CURLPX_REPLY_GENERAL_SERVER_FAILURE: CURLproxycode = 20; -pub const CURLPX_REPLY_CONNECTION_REFUSED: CURLproxycode = 19; -pub const CURLPX_REPLY_COMMAND_NOT_SUPPORTED: CURLproxycode = 18; -pub const CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED: CURLproxycode = 17; -pub const CURLPX_RECV_REQACK: CURLproxycode = 16; -pub const CURLPX_RECV_CONNECT: CURLproxycode = 15; -pub const CURLPX_RECV_AUTH: CURLproxycode = 14; -pub const CURLPX_RECV_ADDRESS: CURLproxycode = 13; -pub const CURLPX_NO_AUTH: CURLproxycode = 12; -pub const CURLPX_LONG_USER: CURLproxycode = 11; -pub const CURLPX_LONG_PASSWD: CURLproxycode = 10; -pub const CURLPX_LONG_HOSTNAME: CURLproxycode = 9; -pub const CURLPX_IDENTD_DIFFER: CURLproxycode = 8; -pub const CURLPX_IDENTD: CURLproxycode = 7; -pub const CURLPX_GSSAPI_PROTECTION: CURLproxycode = 6; -pub const CURLPX_GSSAPI_PERMSG: CURLproxycode = 5; -pub const CURLPX_GSSAPI: CURLproxycode = 4; -pub const CURLPX_CLOSED: CURLproxycode = 3; -pub const CURLPX_BAD_VERSION: CURLproxycode = 2; -pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; -pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option:: ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option::< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> (), ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; -pub const CURLWC_DONE: wildcard_states = 7; -pub const CURLWC_ERROR: wildcard_states = 6; -pub const CURLWC_SKIP: wildcard_states = 5; -pub const CURLWC_CLEAN: wildcard_states = 4; -pub const CURLWC_DOWNLOADING: wildcard_states = 3; -pub const CURLWC_MATCHING: wildcard_states = 2; -pub const CURLWC_INIT: wildcard_states = 1; -pub const CURLWC_CLEAR: wildcard_states = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UrlState { - pub conn_cache: *mut conncache, - pub keeps_speed: curltime, - pub lastconnect_id: libc::c_long, - pub headerb: dynbuf, - pub buffer: *mut libc::c_char, - pub ulbuf: *mut libc::c_char, - pub current_speed: curl_off_t, - pub first_host: *mut libc::c_char, - pub retrycount: libc::c_int, - pub first_remote_port: libc::c_int, - pub session: *mut Curl_ssl_session, - pub sessionage: libc::c_long, - pub tempwrite: [tempbuf; 3], - pub tempcount: libc::c_uint, - pub os_errno: libc::c_int, - pub scratch: *mut libc::c_char, - pub followlocation: libc::c_long, - pub prev_signal: Option:: ()>, - pub digest: digestdata, - pub proxydigest: digestdata, - pub authhost: auth, - pub authproxy: auth, - pub async_0: Curl_async, - pub engine: *mut libc::c_void, - pub expiretime: curltime, - pub timenode: Curl_tree, - pub timeoutlist: Curl_llist, - pub expires: [time_node; 13], - pub most_recent_ftp_entrypath: *mut libc::c_char, - pub httpwant: libc::c_uchar, - pub httpversion: libc::c_uchar, - #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] - pub prev_block_had_trailing_cr: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 5], - pub crlf_conversions: curl_off_t, - pub range: *mut libc::c_char, - pub resume_from: curl_off_t, - pub rtsp_next_client_CSeq: libc::c_long, - pub rtsp_next_server_CSeq: libc::c_long, - pub rtsp_CSeq_recv: libc::c_long, - pub infilesize: curl_off_t, - pub drain: size_t, - pub fread_func: curl_read_callback, - pub in_0: *mut libc::c_void, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub uh: *mut CURLU, - pub up: urlpieces, - pub httpreq: Curl_HttpReq, - pub url: *mut libc::c_char, - pub referer: *mut libc::c_char, - pub cookielist: *mut curl_slist, - pub resolve: *mut curl_slist, - pub trailers_bytes_sent: size_t, - pub trailers_buf: dynbuf, - pub trailers_state: trailers_state, - pub aptr: dynamically_allocated_data, - #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] - #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] - #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] - #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] - #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] - #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] - #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] - #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] - #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] - #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] - #[bitfield(name = "done", ty = "bit", bits = "12..=12")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] - #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] - #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] - #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] - #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] - #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] - #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: [u8; 3], - #[bitfield(padding)] - pub c2rust_padding_0: [u8; 5], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; -pub const TRAILERS_DONE: trailers_state = 3; -pub const TRAILERS_SENDING: trailers_state = 2; -pub const TRAILERS_INITIALIZED: trailers_state = 1; -pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; -pub const HTTPREQ_HEAD: Curl_HttpReq = 5; -pub const HTTPREQ_PUT: Curl_HttpReq = 4; -pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; -pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; -pub const HTTPREQ_POST: Curl_HttpReq = 1; -pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} -pub type CURLU = Curl_URL; -pub type curl_read_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; -pub const EXPIRE_LAST: expire_id = 13; -pub const EXPIRE_QUIC: expire_id = 12; -pub const EXPIRE_TOOFAST: expire_id = 11; -pub const EXPIRE_TIMEOUT: expire_id = 10; -pub const EXPIRE_SPEEDCHECK: expire_id = 9; -pub const EXPIRE_RUN_NOW: expire_id = 8; -pub const EXPIRE_MULTI_PENDING: expire_id = 7; -pub const EXPIRE_HAPPY_EYEBALLS: expire_id = 6; -pub const EXPIRE_HAPPY_EYEBALLS_DNS: expire_id = 5; -pub const EXPIRE_DNS_PER_NAME2: expire_id = 4; -pub const EXPIRE_DNS_PER_NAME: expire_id = 3; -pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; -pub const EXPIRE_ASYNC_NAME: expire_id = 1; -pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Curl_async { - pub hostname: *mut libc::c_char, - pub dns: *mut Curl_dns_entry, - pub tdata: *mut thread_data, - pub resolver: *mut libc::c_void, - pub port: libc::c_int, - pub status: libc::c_int, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - pub done: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl_session { - pub name: *mut libc::c_char, - pub conn_to_host: *mut libc::c_char, - pub scheme: *const libc::c_char, - pub sessionid: *mut libc::c_void, - pub idsize: size_t, - pub age: libc::c_long, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub ssl_config: ssl_primary_config, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_primary_config { - pub version: libc::c_long, - pub version_max: libc::c_long, - pub CApath: *mut libc::c_char, - pub CAfile: *mut libc::c_char, - pub issuercert: *mut libc::c_char, - pub clientcert: *mut libc::c_char, - pub random_file: *mut libc::c_char, - pub egdsocket: *mut libc::c_char, - pub cipher_list: *mut libc::c_char, - pub cipher_list13: *mut libc::c_char, - pub pinned_key: *mut libc::c_char, - pub cert_blob: *mut curl_blob, - pub ca_info_blob: *mut curl_blob, - pub issuercert_blob: *mut curl_blob, - pub curves: *mut libc::c_char, - #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] - #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] - #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] - #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] - pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct conncache { - pub hash: Curl_hash, - pub num_conn: size_t, - pub next_connection_id: libc::c_long, - pub last_cleanup: curltime, - pub closure_handle: *mut Curl_easy, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option:: ()>; -pub type comp_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, *mut libc::c_void, size_t) -> size_t, ->; -pub type hash_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, size_t) -> size_t, ->; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UserDefined { - pub err: *mut FILE, - pub debugdata: *mut libc::c_void, - pub errorbuffer: *mut libc::c_char, - pub proxyport: libc::c_long, - pub out: *mut libc::c_void, - pub in_set: *mut libc::c_void, - pub writeheader: *mut libc::c_void, - pub rtp_out: *mut libc::c_void, - pub use_port: libc::c_long, - pub httpauth: libc::c_ulong, - pub proxyauth: libc::c_ulong, - pub socks5auth: libc::c_ulong, - pub maxredirs: libc::c_long, - pub keep_post: libc::c_int, - pub postfields: *mut libc::c_void, - pub seek_func: curl_seek_callback, - pub postfieldsize: curl_off_t, - pub localport: libc::c_ushort, - pub localportrange: libc::c_int, - pub fwrite_func: curl_write_callback, - pub fwrite_header: curl_write_callback, - pub fwrite_rtp: curl_write_callback, - pub fread_func_set: curl_read_callback, - pub fprogress: curl_progress_callback, - pub fxferinfo: curl_xferinfo_callback, - pub fdebug: curl_debug_callback, - pub ioctl_func: curl_ioctl_callback, - pub fsockopt: curl_sockopt_callback, - pub sockopt_client: *mut libc::c_void, - pub fopensocket: curl_opensocket_callback, - pub opensocket_client: *mut libc::c_void, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub seek_client: *mut libc::c_void, - pub convfromnetwork: curl_conv_callback, - pub convtonetwork: curl_conv_callback, - pub convfromutf8: curl_conv_callback, - pub hsts_read: curl_hstsread_callback, - pub hsts_read_userp: *mut libc::c_void, - pub hsts_write: curl_hstswrite_callback, - pub hsts_write_userp: *mut libc::c_void, - pub progress_client: *mut libc::c_void, - pub ioctl_client: *mut libc::c_void, - pub timeout: libc::c_long, - pub connecttimeout: libc::c_long, - pub accepttimeout: libc::c_long, - pub happy_eyeballs_timeout: libc::c_long, - pub server_response_timeout: libc::c_long, - pub maxage_conn: libc::c_long, - pub tftp_blksize: libc::c_long, - pub filesize: curl_off_t, - pub low_speed_limit: libc::c_long, - pub low_speed_time: libc::c_long, - pub max_send_speed: curl_off_t, - pub max_recv_speed: curl_off_t, - pub set_resume_from: curl_off_t, - pub headers: *mut curl_slist, - pub proxyheaders: *mut curl_slist, - pub httppost: *mut curl_httppost, - pub mimepost: curl_mimepart, - pub quote: *mut curl_slist, - pub postquote: *mut curl_slist, - pub prequote: *mut curl_slist, - pub source_quote: *mut curl_slist, - pub source_prequote: *mut curl_slist, - pub source_postquote: *mut curl_slist, - pub telnet_options: *mut curl_slist, - pub resolve: *mut curl_slist, - pub connect_to: *mut curl_slist, - pub timecondition: curl_TimeCond, - pub proxytype: curl_proxytype, - pub timevalue: time_t, - pub method: Curl_HttpReq, - pub httpwant: libc::c_uchar, - pub ssl: ssl_config_data, - pub proxy_ssl: ssl_config_data, - pub general_ssl: ssl_general_config, - pub dns_cache_timeout: libc::c_long, - pub buffer_size: libc::c_long, - pub upload_buffer_size: libc::c_uint, - pub private_data: *mut libc::c_void, - pub http200aliases: *mut curl_slist, - pub ipver: libc::c_uchar, - pub max_filesize: curl_off_t, - pub ftp_filemethod: curl_ftpfile, - pub ftpsslauth: curl_ftpauth, - pub ftp_ccc: curl_ftpccc, - pub ftp_create_missing_dirs: libc::c_int, - pub ssh_keyfunc: curl_sshkeycallback, - pub ssh_keyfunc_userp: *mut libc::c_void, - pub use_netrc: CURL_NETRC_OPTION, - pub use_ssl: curl_usessl, - pub new_file_perms: libc::c_long, - pub new_directory_perms: libc::c_long, - pub ssh_auth_types: libc::c_long, - pub str_0: [*mut libc::c_char; 80], - pub blobs: [*mut curl_blob; 8], - pub scope_id: libc::c_uint, - pub allowed_protocols: libc::c_long, - pub redir_protocols: libc::c_long, - pub mail_rcpt: *mut curl_slist, - pub rtspreq: Curl_RtspReq, - pub rtspversion: libc::c_long, - pub chunk_bgn: curl_chunk_bgn_callback, - pub chunk_end: curl_chunk_end_callback, - pub fnmatch: curl_fnmatch_callback, - pub fnmatch_data: *mut libc::c_void, - pub gssapi_delegation: libc::c_long, - pub tcp_keepidle: libc::c_long, - pub tcp_keepintvl: libc::c_long, - pub maxconnects: size_t, - pub expect_100_timeout: libc::c_long, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub stream_dependents: *mut Curl_http2_dep, - pub resolver_start: curl_resolver_start_callback, - pub resolver_start_client: *mut libc::c_void, - pub upkeep_interval_ms: libc::c_long, - pub fmultidone: multidone_func, - pub dohfor: *mut Curl_easy, - pub uh: *mut CURLU, - pub trailer_data: *mut libc::c_void, - pub trailer_callback: curl_trailer_callback, - #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] - #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] - #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] - #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] - #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] - #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] - #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] - #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] - #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] - #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] - #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] - #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] - #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] - #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] - #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] - #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] - #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] - #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] - #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] - #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] - #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] - #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] - #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] - #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] - #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] - #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] - #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] - #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] - #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] - #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] - #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] - #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] - #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] - #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] - #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] - #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] - #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] - #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] - #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] - #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] - #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] - #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] - #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] - #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] - #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] - #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] - #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] - #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] - #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] - #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] - #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] - #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] - #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] - #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: [u8; 8], -} -pub type curl_trailer_callback = Option::< - unsafe extern "C" fn(*mut *mut curl_slist, *mut libc::c_void) -> libc::c_int, ->; -pub type multidone_func = Option::< - unsafe extern "C" fn(*mut Curl_easy, CURLcode) -> libc::c_int, ->; -pub type CURLcode = libc::c_uint; -pub const CURL_LAST: CURLcode = 99; -pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; -pub const CURLE_PROXY: CURLcode = 97; -pub const CURLE_QUIC_CONNECT_ERROR: CURLcode = 96; -pub const CURLE_HTTP3: CURLcode = 95; -pub const CURLE_AUTH_ERROR: CURLcode = 94; -pub const CURLE_RECURSIVE_API_CALL: CURLcode = 93; -pub const CURLE_HTTP2_STREAM: CURLcode = 92; -pub const CURLE_SSL_INVALIDCERTSTATUS: CURLcode = 91; -pub const CURLE_SSL_PINNEDPUBKEYNOTMATCH: CURLcode = 90; -pub const CURLE_NO_CONNECTION_AVAILABLE: CURLcode = 89; -pub const CURLE_CHUNK_FAILED: CURLcode = 88; -pub const CURLE_FTP_BAD_FILE_LIST: CURLcode = 87; -pub const CURLE_RTSP_SESSION_ERROR: CURLcode = 86; -pub const CURLE_RTSP_CSEQ_ERROR: CURLcode = 85; -pub const CURLE_FTP_PRET_FAILED: CURLcode = 84; -pub const CURLE_SSL_ISSUER_ERROR: CURLcode = 83; -pub const CURLE_SSL_CRL_BADFILE: CURLcode = 82; -pub const CURLE_AGAIN: CURLcode = 81; -pub const CURLE_SSL_SHUTDOWN_FAILED: CURLcode = 80; -pub const CURLE_SSH: CURLcode = 79; -pub const CURLE_REMOTE_FILE_NOT_FOUND: CURLcode = 78; -pub const CURLE_SSL_CACERT_BADFILE: CURLcode = 77; -pub const CURLE_CONV_REQD: CURLcode = 76; -pub const CURLE_CONV_FAILED: CURLcode = 75; -pub const CURLE_TFTP_NOSUCHUSER: CURLcode = 74; -pub const CURLE_REMOTE_FILE_EXISTS: CURLcode = 73; -pub const CURLE_TFTP_UNKNOWNID: CURLcode = 72; -pub const CURLE_TFTP_ILLEGAL: CURLcode = 71; -pub const CURLE_REMOTE_DISK_FULL: CURLcode = 70; -pub const CURLE_TFTP_PERM: CURLcode = 69; -pub const CURLE_TFTP_NOTFOUND: CURLcode = 68; -pub const CURLE_LOGIN_DENIED: CURLcode = 67; -pub const CURLE_SSL_ENGINE_INITFAILED: CURLcode = 66; -pub const CURLE_SEND_FAIL_REWIND: CURLcode = 65; -pub const CURLE_USE_SSL_FAILED: CURLcode = 64; -pub const CURLE_FILESIZE_EXCEEDED: CURLcode = 63; -pub const CURLE_LDAP_INVALID_URL: CURLcode = 62; -pub const CURLE_BAD_CONTENT_ENCODING: CURLcode = 61; -pub const CURLE_PEER_FAILED_VERIFICATION: CURLcode = 60; -pub const CURLE_SSL_CIPHER: CURLcode = 59; -pub const CURLE_SSL_CERTPROBLEM: CURLcode = 58; -pub const CURLE_OBSOLETE57: CURLcode = 57; -pub const CURLE_RECV_ERROR: CURLcode = 56; -pub const CURLE_SEND_ERROR: CURLcode = 55; -pub const CURLE_SSL_ENGINE_SETFAILED: CURLcode = 54; -pub const CURLE_SSL_ENGINE_NOTFOUND: CURLcode = 53; -pub const CURLE_GOT_NOTHING: CURLcode = 52; -pub const CURLE_OBSOLETE51: CURLcode = 51; -pub const CURLE_OBSOLETE50: CURLcode = 50; -pub const CURLE_SETOPT_OPTION_SYNTAX: CURLcode = 49; -pub const CURLE_UNKNOWN_OPTION: CURLcode = 48; -pub const CURLE_TOO_MANY_REDIRECTS: CURLcode = 47; -pub const CURLE_OBSOLETE46: CURLcode = 46; -pub const CURLE_INTERFACE_FAILED: CURLcode = 45; -pub const CURLE_OBSOLETE44: CURLcode = 44; -pub const CURLE_BAD_FUNCTION_ARGUMENT: CURLcode = 43; -pub const CURLE_ABORTED_BY_CALLBACK: CURLcode = 42; -pub const CURLE_FUNCTION_NOT_FOUND: CURLcode = 41; -pub const CURLE_OBSOLETE40: CURLcode = 40; -pub const CURLE_LDAP_SEARCH_FAILED: CURLcode = 39; -pub const CURLE_LDAP_CANNOT_BIND: CURLcode = 38; -pub const CURLE_FILE_COULDNT_READ_FILE: CURLcode = 37; -pub const CURLE_BAD_DOWNLOAD_RESUME: CURLcode = 36; -pub const CURLE_SSL_CONNECT_ERROR: CURLcode = 35; -pub const CURLE_HTTP_POST_ERROR: CURLcode = 34; -pub const CURLE_RANGE_ERROR: CURLcode = 33; -pub const CURLE_OBSOLETE32: CURLcode = 32; -pub const CURLE_FTP_COULDNT_USE_REST: CURLcode = 31; -pub const CURLE_FTP_PORT_FAILED: CURLcode = 30; -pub const CURLE_OBSOLETE29: CURLcode = 29; -pub const CURLE_OPERATION_TIMEDOUT: CURLcode = 28; -pub const CURLE_OUT_OF_MEMORY: CURLcode = 27; -pub const CURLE_READ_ERROR: CURLcode = 26; -pub const CURLE_UPLOAD_FAILED: CURLcode = 25; -pub const CURLE_OBSOLETE24: CURLcode = 24; -pub const CURLE_WRITE_ERROR: CURLcode = 23; -pub const CURLE_HTTP_RETURNED_ERROR: CURLcode = 22; -pub const CURLE_QUOTE_ERROR: CURLcode = 21; -pub const CURLE_OBSOLETE20: CURLcode = 20; -pub const CURLE_FTP_COULDNT_RETR_FILE: CURLcode = 19; -pub const CURLE_PARTIAL_FILE: CURLcode = 18; -pub const CURLE_FTP_COULDNT_SET_TYPE: CURLcode = 17; -pub const CURLE_HTTP2: CURLcode = 16; -pub const CURLE_FTP_CANT_GET_HOST: CURLcode = 15; -pub const CURLE_FTP_WEIRD_227_FORMAT: CURLcode = 14; -pub const CURLE_FTP_WEIRD_PASV_REPLY: CURLcode = 13; -pub const CURLE_FTP_ACCEPT_TIMEOUT: CURLcode = 12; -pub const CURLE_FTP_WEIRD_PASS_REPLY: CURLcode = 11; -pub const CURLE_FTP_ACCEPT_FAILED: CURLcode = 10; -pub const CURLE_REMOTE_ACCESS_DENIED: CURLcode = 9; -pub const CURLE_WEIRD_SERVER_REPLY: CURLcode = 8; -pub const CURLE_COULDNT_CONNECT: CURLcode = 7; -pub const CURLE_COULDNT_RESOLVE_HOST: CURLcode = 6; -pub const CURLE_COULDNT_RESOLVE_PROXY: CURLcode = 5; -pub const CURLE_NOT_BUILT_IN: CURLcode = 4; -pub const CURLE_URL_MALFORMAT: CURLcode = 3; -pub const CURLE_FAILED_INIT: CURLcode = 2; -pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; -pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_http2_dep { - pub next: *mut Curl_http2_dep, - pub data: *mut Curl_easy, -} -pub type curl_fnmatch_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void) -> libc::c_long, ->; -pub type curl_chunk_bgn_callback = Option::< - unsafe extern "C" fn( - *const libc::c_void, - *mut libc::c_void, - libc::c_int, - ) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; -pub const RTSPREQ_LAST: Curl_RtspReq = 12; -pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; -pub const RTSPREQ_RECORD: Curl_RtspReq = 10; -pub const RTSPREQ_SET_PARAMETER: Curl_RtspReq = 9; -pub const RTSPREQ_GET_PARAMETER: Curl_RtspReq = 8; -pub const RTSPREQ_TEARDOWN: Curl_RtspReq = 7; -pub const RTSPREQ_PAUSE: Curl_RtspReq = 6; -pub const RTSPREQ_PLAY: Curl_RtspReq = 5; -pub const RTSPREQ_SETUP: Curl_RtspReq = 4; -pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; -pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; -pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; -pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; -pub const CURLUSESSL_LAST: curl_usessl = 4; -pub const CURLUSESSL_ALL: curl_usessl = 3; -pub const CURLUSESSL_CONTROL: curl_usessl = 2; -pub const CURLUSESSL_TRY: curl_usessl = 1; -pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; -pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; -pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; -pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; -pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option::< - unsafe extern "C" fn( - *mut CURL, - *const curl_khkey, - *const curl_khkey, - curl_khmatch, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_khmatch = libc::c_uint; -pub const CURLKHMATCH_LAST: curl_khmatch = 3; -pub const CURLKHMATCH_MISSING: curl_khmatch = 2; -pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; -pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; -pub const CURLKHTYPE_ED25519: curl_khtype = 5; -pub const CURLKHTYPE_ECDSA: curl_khtype = 4; -pub const CURLKHTYPE_DSS: curl_khtype = 3; -pub const CURLKHTYPE_RSA: curl_khtype = 2; -pub const CURLKHTYPE_RSA1: curl_khtype = 1; -pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; -pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; -pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; -pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; -pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; -pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; -pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; -pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; -pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; -pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; -pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; -pub const FTPFILE_NOCWD: curl_ftpfile = 2; -pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_config_data { - pub primary: ssl_primary_config, - pub certverifyresult: libc::c_long, - pub CRLfile: *mut libc::c_char, - pub fsslctx: curl_ssl_ctx_callback, - pub fsslctxp: *mut libc::c_void, - pub cert_type: *mut libc::c_char, - pub key: *mut libc::c_char, - pub key_blob: *mut curl_blob, - pub key_type: *mut libc::c_char, - pub key_passwd: *mut libc::c_char, - pub username: *mut libc::c_char, - pub password: *mut libc::c_char, - pub authtype: CURL_TLSAUTH, - #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] - #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] - #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] - #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] - #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] - #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] - #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] - #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type CURL_TLSAUTH = libc::c_uint; -pub const CURL_TLSAUTH_LAST: CURL_TLSAUTH = 2; -pub const CURL_TLSAUTH_SRP: CURL_TLSAUTH = 1; -pub const CURL_TLSAUTH_NONE: CURL_TLSAUTH = 0; -pub type curl_ssl_ctx_callback = Option::< - unsafe extern "C" fn(*mut CURL, *mut libc::c_void, *mut libc::c_void) -> CURLcode, ->; -pub type curl_proxytype = libc::c_uint; -pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; -pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; -pub const CURLPROXY_SOCKS5: curl_proxytype = 5; -pub const CURLPROXY_SOCKS4: curl_proxytype = 4; -pub const CURLPROXY_HTTPS: curl_proxytype = 2; -pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; -pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; -pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; -pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; -pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; -pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; -pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mimepart { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mime, - pub nextpart: *mut curl_mimepart, - pub kind: mimekind, - pub flags: libc::c_uint, - pub data: *mut libc::c_char, - pub readfunc: curl_read_callback, - pub seekfunc: curl_seek_callback, - pub freefunc: curl_free_callback, - pub arg: *mut libc::c_void, - pub fp: *mut FILE, - pub curlheaders: *mut curl_slist, - pub userheaders: *mut curl_slist, - pub mimetype: *mut libc::c_char, - pub filename: *mut libc::c_char, - pub name: *mut libc::c_char, - pub datasize: curl_off_t, - pub state: mime_state, - pub encoder: *const mime_encoder, - pub encstate: mime_encoder_state, - pub lastreadstatus: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder { - pub name: *const libc::c_char, - pub encodefunc: Option::< - unsafe extern "C" fn( - *mut libc::c_char, - size_t, - bool, - *mut curl_mimepart, - ) -> size_t, - >, - pub sizefunc: Option:: curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, -} -pub type mimestate = libc::c_uint; -pub const MIMESTATE_LAST: mimestate = 9; -pub const MIMESTATE_END: mimestate = 8; -pub const MIMESTATE_CONTENT: mimestate = 7; -pub const MIMESTATE_BOUNDARY2: mimestate = 6; -pub const MIMESTATE_BOUNDARY1: mimestate = 5; -pub const MIMESTATE_BODY: mimestate = 4; -pub const MIMESTATE_EOH: mimestate = 3; -pub const MIMESTATE_USERHEADERS: mimestate = 2; -pub const MIMESTATE_CURLHEADERS: mimestate = 1; -pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option:: ()>; -pub type curl_seek_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_off_t, libc::c_int) -> libc::c_int, ->; -pub type mimekind = libc::c_uint; -pub const MIMEKIND_LAST: mimekind = 5; -pub const MIMEKIND_MULTIPART: mimekind = 4; -pub const MIMEKIND_CALLBACK: mimekind = 3; -pub const MIMEKIND_FILE: mimekind = 2; -pub const MIMEKIND_DATA: mimekind = 1; -pub const MIMEKIND_NONE: mimekind = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mime { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mimepart, - pub firstpart: *mut curl_mimepart, - pub lastpart: *mut curl_mimepart, - pub boundary: [libc::c_char; 41], - pub state: mime_state, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut curl_index, - *mut libc::c_void, - ) -> CURLSTScode, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; -pub const CURLSTS_FAIL: CURLSTScode = 2; -pub const CURLSTS_DONE: CURLSTScode = 1; -pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut libc::c_void, - ) -> CURLSTScode, ->; -pub type curl_conv_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t) -> CURLcode, ->; -pub type curl_closesocket_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t) -> libc::c_int, ->; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - curlsocktype, - *mut curl_sockaddr, - ) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; -pub const CURLSOCKTYPE_LAST: curlsocktype = 2; -pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; -pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t, curlsocktype) -> libc::c_int, ->; -pub type curl_ioctl_callback = Option::< - unsafe extern "C" fn(*mut CURL, libc::c_int, *mut libc::c_void) -> curlioerr, ->; -pub type curlioerr = libc::c_uint; -pub const CURLIOE_LAST: curlioerr = 3; -pub const CURLIOE_FAILRESTART: curlioerr = 2; -pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; -pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_infotype = libc::c_uint; -pub const CURLINFO_END: curl_infotype = 7; -pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; -pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; -pub const CURLINFO_DATA_OUT: curl_infotype = 4; -pub const CURLINFO_DATA_IN: curl_infotype = 3; -pub const CURLINFO_HEADER_OUT: curl_infotype = 2; -pub const CURLINFO_HEADER_IN: curl_infotype = 1; -pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, ->; -pub type curl_progress_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, - ) -> libc::c_int, ->; -pub type curl_write_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct SingleRequest { - pub size: curl_off_t, - pub maxdownload: curl_off_t, - pub bytecount: curl_off_t, - pub writebytecount: curl_off_t, - pub headerbytecount: curl_off_t, - pub deductheadercount: curl_off_t, - pub pendingheader: curl_off_t, - pub start: curltime, - pub now: curltime, - pub badheader: C2RustUnnamed_1, - pub headerline: libc::c_int, - pub str_0: *mut libc::c_char, - pub offset: curl_off_t, - pub httpcode: libc::c_int, - pub keepon: libc::c_int, - pub start100: curltime, - pub exp100: expect100, - pub upgr101: upgrade101, - pub writer_stack: *mut contenc_writer, - pub timeofdoc: time_t, - pub bodywrites: libc::c_long, - pub location: *mut libc::c_char, - pub newurl: *mut libc::c_char, - pub upload_present: ssize_t, - pub upload_fromhere: *mut libc::c_char, - pub p: C2RustUnnamed, - pub doh: *mut dohdata, - #[bitfield(name = "header", ty = "bit", bits = "0..=0")] - #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] - #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] - #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] - #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] - #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] - #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] - #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] - #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: [u8; 2], - #[bitfield(padding)] - pub c2rust_padding: [u8; 6], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dohdata { - pub headers: *mut curl_slist, - pub probe: [dnsprobe; 2], - pub pending: libc::c_uint, - pub port: libc::c_int, - pub host: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dnsprobe { - pub easy: *mut CURL, - pub dnstype: libc::c_int, - pub dohbuffer: [libc::c_uchar; 512], - pub dohlen: size_t, - pub serverdoh: dynbuf, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed { - pub file: *mut FILEPROTO, - pub ftp: *mut FTP, - pub http: *mut HTTP, - pub imap: *mut IMAP, - pub ldap: *mut ldapreqinfo, - pub mqtt: *mut MQTT, - pub pop3: *mut POP3, - pub rtsp: *mut RTSP, - pub smb: *mut smb_request, - pub smtp: *mut SMTP, - pub ssh: *mut SSHPROTO, - pub telnet: *mut TELNET, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; -pub const PPTRANSFER_NONE: curl_pp_transfer = 2; -pub const PPTRANSFER_INFO: curl_pp_transfer = 1; -pub const PPTRANSFER_BODY: curl_pp_transfer = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct RTSP { - pub http_wrapper: HTTP, - pub CSeq_sent: libc::c_long, - pub CSeq_recv: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HTTP { - pub sendit: *mut curl_mimepart, - pub postsize: curl_off_t, - pub postdata: *const libc::c_char, - pub p_pragma: *const libc::c_char, - pub form: curl_mimepart, - pub backup: back, - pub sending: C2RustUnnamed_0, - pub send_buffer: dynbuf, - pub stream_id: int32_t, - pub bodystarted: bool, - pub header_recvbuf: dynbuf, - pub nread_header_recvbuf: size_t, - pub trailer_recvbuf: dynbuf, - pub status_code: libc::c_int, - pub pausedata: *const uint8_t, - pub pauselen: size_t, - pub close_handled: bool, - pub push_headers: *mut *mut libc::c_char, - pub push_headers_used: size_t, - pub push_headers_alloc: size_t, - pub error: uint32_t, - pub closed: bool, - pub mem: *mut libc::c_char, - pub len: size_t, - pub memlen: size_t, - pub upload_mem: *const uint8_t, - pub upload_len: size_t, - pub upload_left: curl_off_t, -} -pub type uint8_t = __uint8_t; -pub type uint32_t = __uint32_t; -pub type C2RustUnnamed_0 = libc::c_uint; -pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; -pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; -pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -pub type upgrade101 = libc::c_uint; -pub const UPGR101_WORKING: upgrade101 = 3; -pub const UPGR101_RECEIVED: upgrade101 = 2; -pub const UPGR101_REQUESTED: upgrade101 = 1; -pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; -pub const EXP100_FAILED: expect100 = 3; -pub const EXP100_SENDING_REQUEST: expect100 = 2; -pub const EXP100_AWAITING_CONTINUE: expect100 = 1; -pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; -pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; -pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; -pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct PslCache { - pub psl: *const psl_ctx_t, - pub expires: time_t, - pub dynamic: bool, -} -pub type psl_ctx_t = psl_ctx_st; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_multi { - pub magic: libc::c_uint, - pub easyp: *mut Curl_easy, - pub easylp: *mut Curl_easy, - pub num_easy: libc::c_int, - pub num_alive: libc::c_int, - pub msglist: Curl_llist, - pub pending: Curl_llist, - pub socket_cb: curl_socket_callback, - pub socket_userp: *mut libc::c_void, - pub push_cb: curl_push_callback, - pub push_userp: *mut libc::c_void, - pub hostcache: Curl_hash, - pub psl: PslCache, - pub timetree: *mut Curl_tree, - pub sockhash: Curl_hash, - pub conn_cache: conncache, - pub maxconnects: libc::c_long, - pub max_host_connections: libc::c_long, - pub max_total_connections: libc::c_long, - pub timer_cb: curl_multi_timer_callback, - pub timer_userp: *mut libc::c_void, - pub timer_lastcall: curltime, - pub max_concurrent_streams: libc::c_uint, - pub wakeup_pair: [curl_socket_t; 2], - pub multiplexing: bool, - pub recheckstate: bool, - pub in_callback: bool, - pub ipv6_works: bool, - pub ssl_seeded: bool, -} -pub type curl_multi_timer_callback = Option::< - unsafe extern "C" fn(*mut CURLM, libc::c_long, *mut libc::c_void) -> libc::c_int, ->; -pub type CURLM = Curl_multi; -pub type curl_push_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut CURL, - size_t, - *mut curl_pushheaders, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_socket_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_socket_t, - libc::c_int, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; -pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; -pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; -pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_message { - pub list: Curl_llist_element, - pub extmsg: CURLMsg, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CURLMsg { - pub msg: CURLMSG, - pub easy_handle: *mut CURL, - pub data: C2RustUnnamed_3, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_3 { - pub whatever: *mut libc::c_void, - pub result: CURLcode, -} -pub type CURLMSG = libc::c_uint; -pub const CURLMSG_LAST: CURLMSG = 2; -pub const CURLMSG_DONE: CURLMSG = 1; -pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; -pub const MSTATE_LAST: CURLMstate = 17; -pub const MSTATE_MSGSENT: CURLMstate = 16; -pub const MSTATE_COMPLETED: CURLMstate = 15; -pub const MSTATE_DONE: CURLMstate = 14; -pub const MSTATE_RATELIMITING: CURLMstate = 13; -pub const MSTATE_PERFORMING: CURLMstate = 12; -pub const MSTATE_DID: CURLMstate = 11; -pub const MSTATE_DOING_MORE: CURLMstate = 10; -pub const MSTATE_DOING: CURLMstate = 9; -pub const MSTATE_DO: CURLMstate = 8; -pub const MSTATE_PROTOCONNECTING: CURLMstate = 7; -pub const MSTATE_PROTOCONNECT: CURLMstate = 6; -pub const MSTATE_TUNNELING: CURLMstate = 5; -pub const MSTATE_CONNECTING: CURLMstate = 4; -pub const MSTATE_RESOLVING: CURLMstate = 3; -pub const MSTATE_CONNECT: CURLMstate = 2; -pub const MSTATE_PENDING: CURLMstate = 1; -pub const MSTATE_INIT: CURLMstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectdata { - pub cnnct: connstate, - pub bundle_node: Curl_llist_element, - pub chunk: Curl_chunker, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub connection_id: libc::c_long, - pub dns_entry: *mut Curl_dns_entry, - pub ip_addr: *mut Curl_addrinfo, - pub tempaddr: [*mut Curl_addrinfo; 2], - pub scope_id: libc::c_uint, - pub transport: C2RustUnnamed_5, - pub host: hostname, - pub hostname_resolve: *mut libc::c_char, - pub secondaryhostname: *mut libc::c_char, - pub conn_to_host: hostname, - pub socks_proxy: proxy_info, - pub http_proxy: proxy_info, - pub port: libc::c_int, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub secondary_port: libc::c_ushort, - pub primary_ip: [libc::c_char; 46], - pub ip_version: libc::c_uchar, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub options: *mut libc::c_char, - pub sasl_authzid: *mut libc::c_char, - pub httpversion: libc::c_uchar, - pub now: curltime, - pub created: curltime, - pub lastused: curltime, - pub sock: [curl_socket_t; 2], - pub tempsock: [curl_socket_t; 2], - pub tempfamily: [libc::c_int; 2], - pub recv: [Option::; 2], - pub send: [Option::; 2], - pub ssl: [ssl_connect_data; 2], - pub proxy_ssl: [ssl_connect_data; 2], - pub ssl_extra: *mut libc::c_void, - pub ssl_config: ssl_primary_config, - pub proxy_ssl_config: ssl_primary_config, - pub bits: ConnectBits, - pub num_addr: libc::c_int, - pub connecttime: curltime, - pub timeoutms_per_addr: [timediff_t; 2], - pub handler: *const Curl_handler, - pub given: *const Curl_handler, - pub keepalive: curltime, - pub sockfd: curl_socket_t, - pub writesockfd: curl_socket_t, - pub easyq: Curl_llist, - pub seek_func: curl_seek_callback, - pub seek_client: *mut libc::c_void, - pub http_ntlm_state: curlntlm, - pub proxy_ntlm_state: curlntlm, - pub ntlm: ntlmdata, - pub proxyntlm: ntlmdata, - pub trailer: dynbuf, - pub proto: C2RustUnnamed_4, - pub connect_state: *mut http_connect_state, - pub bundle: *mut connectbundle, - pub unix_domain_socket: *mut libc::c_char, - pub localdev: *mut libc::c_char, - pub localportrange: libc::c_int, - pub cselect_bits: libc::c_int, - pub waitfor: libc::c_int, - pub negnpn: libc::c_int, - pub localport: libc::c_ushort, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_4 { - pub ftpc: ftp_conn, - pub httpc: http_conn, - pub sshc: ssh_conn, - pub tftpc: *mut tftp_state_data, - pub imapc: imap_conn, - pub pop3c: pop3_conn, - pub smtpc: smtp_conn, - pub rtspc: rtsp_conn, - pub smbc: smb_conn, - pub rtmp: *mut libc::c_void, - pub ldapc: *mut ldapconninfo, - pub mqtt: mqtt_conn, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; -pub const MQTT_NOSTATE: mqttstate = 7; -pub const MQTT_PUB_REMAIN: mqttstate = 6; -pub const MQTT_PUBWAIT: mqttstate = 5; -pub const MQTT_SUBACK_COMING: mqttstate = 4; -pub const MQTT_SUBACK: mqttstate = 3; -pub const MQTT_CONNACK: mqttstate = 2; -pub const MQTT_REMAINING_LENGTH: mqttstate = 1; -pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; -pub const SMB_CONNECTED: smb_conn_state = 4; -pub const SMB_SETUP: smb_conn_state = 3; -pub const SMB_NEGOTIATE: smb_conn_state = 2; -pub const SMB_CONNECTING: smb_conn_state = 1; -pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smtp_conn { - pub pp: pingpong, - pub state: smtpstate, - pub ssldone: bool, - pub domain: *mut libc::c_char, - pub sasl: SASL, - pub tls_supported: bool, - pub size_supported: bool, - pub utf8_supported: bool, - pub auth_supported: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASL { - pub params: *const SASLproto, - pub state: saslstate, - pub authmechs: libc::c_ushort, - pub prefmech: libc::c_ushort, - pub authused: libc::c_ushort, - pub resetprefs: bool, - pub mutual_auth: bool, - pub force_ir: bool, -} -pub type saslstate = libc::c_uint; -pub const SASL_FINAL: saslstate = 17; -pub const SASL_CANCEL: saslstate = 16; -pub const SASL_GSASL: saslstate = 15; -pub const SASL_OAUTH2_RESP: saslstate = 14; -pub const SASL_OAUTH2: saslstate = 13; -pub const SASL_GSSAPI_NO_DATA: saslstate = 12; -pub const SASL_GSSAPI_TOKEN: saslstate = 11; -pub const SASL_GSSAPI: saslstate = 10; -pub const SASL_NTLM_TYPE2MSG: saslstate = 9; -pub const SASL_NTLM: saslstate = 8; -pub const SASL_DIGESTMD5_RESP: saslstate = 7; -pub const SASL_DIGESTMD5: saslstate = 6; -pub const SASL_CRAMMD5: saslstate = 5; -pub const SASL_EXTERNAL: saslstate = 4; -pub const SASL_LOGIN_PASSWD: saslstate = 3; -pub const SASL_LOGIN: saslstate = 2; -pub const SASL_PLAIN: saslstate = 1; -pub const SASL_STOP: saslstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASLproto { - pub service: *const libc::c_char, - pub contcode: libc::c_int, - pub finalcode: libc::c_int, - pub maxirlen: size_t, - pub sendauth: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - *const libc::c_char, - ) -> CURLcode, - >, - pub sendcont: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - ) -> CURLcode, - >, - pub getmessage: Option::< - unsafe extern "C" fn(*mut libc::c_char, *mut *mut libc::c_char) -> (), - >, -} -pub type smtpstate = libc::c_uint; -pub const SMTP_LAST: smtpstate = 13; -pub const SMTP_QUIT: smtpstate = 12; -pub const SMTP_POSTDATA: smtpstate = 11; -pub const SMTP_DATA: smtpstate = 10; -pub const SMTP_RCPT: smtpstate = 9; -pub const SMTP_MAIL: smtpstate = 8; -pub const SMTP_COMMAND: smtpstate = 7; -pub const SMTP_AUTH: smtpstate = 6; -pub const SMTP_UPGRADETLS: smtpstate = 5; -pub const SMTP_STARTTLS: smtpstate = 4; -pub const SMTP_HELO: smtpstate = 3; -pub const SMTP_EHLO: smtpstate = 2; -pub const SMTP_SERVERGREET: smtpstate = 1; -pub const SMTP_STOP: smtpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pingpong { - pub cache: *mut libc::c_char, - pub cache_size: size_t, - pub nread_resp: size_t, - pub linestart_resp: *mut libc::c_char, - pub pending_resp: bool, - pub sendthis: *mut libc::c_char, - pub sendleft: size_t, - pub sendsize: size_t, - pub response: curltime, - pub response_time: timediff_t, - pub sendbuf: dynbuf, - pub statemachine: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub endofresp: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - >, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pop3_conn { - pub pp: pingpong, - pub state: pop3state, - pub ssldone: bool, - pub tls_supported: bool, - pub eob: size_t, - pub strip: size_t, - pub sasl: SASL, - pub authtypes: libc::c_uint, - pub preftype: libc::c_uint, - pub apoptimestamp: *mut libc::c_char, -} -pub type pop3state = libc::c_uint; -pub const POP3_LAST: pop3state = 11; -pub const POP3_QUIT: pop3state = 10; -pub const POP3_COMMAND: pop3state = 9; -pub const POP3_PASS: pop3state = 8; -pub const POP3_USER: pop3state = 7; -pub const POP3_APOP: pop3state = 6; -pub const POP3_AUTH: pop3state = 5; -pub const POP3_UPGRADETLS: pop3state = 4; -pub const POP3_STARTTLS: pop3state = 3; -pub const POP3_CAPA: pop3state = 2; -pub const POP3_SERVERGREET: pop3state = 1; -pub const POP3_STOP: pop3state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct imap_conn { - pub pp: pingpong, - pub state: imapstate, - pub ssldone: bool, - pub preauth: bool, - pub sasl: SASL, - pub preftype: libc::c_uint, - pub cmdid: libc::c_uint, - pub resptag: [libc::c_char; 5], - pub tls_supported: bool, - pub login_disabled: bool, - pub ir_supported: bool, - pub mailbox: *mut libc::c_char, - pub mailbox_uidvalidity: *mut libc::c_char, - pub dyn_0: dynbuf, -} -pub type imapstate = libc::c_uint; -pub const IMAP_LAST: imapstate = 15; -pub const IMAP_LOGOUT: imapstate = 14; -pub const IMAP_SEARCH: imapstate = 13; -pub const IMAP_APPEND_FINAL: imapstate = 12; -pub const IMAP_APPEND: imapstate = 11; -pub const IMAP_FETCH_FINAL: imapstate = 10; -pub const IMAP_FETCH: imapstate = 9; -pub const IMAP_SELECT: imapstate = 8; -pub const IMAP_LIST: imapstate = 7; -pub const IMAP_LOGIN: imapstate = 6; -pub const IMAP_AUTHENTICATE: imapstate = 5; -pub const IMAP_UPGRADETLS: imapstate = 4; -pub const IMAP_STARTTLS: imapstate = 3; -pub const IMAP_CAPABILITY: imapstate = 2; -pub const IMAP_SERVERGREET: imapstate = 1; -pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; -pub const SSH_LAST: sshstate = 60; -pub const SSH_QUIT: sshstate = 59; -pub const SSH_SESSION_FREE: sshstate = 58; -pub const SSH_SESSION_DISCONNECT: sshstate = 57; -pub const SSH_SCP_CHANNEL_FREE: sshstate = 56; -pub const SSH_SCP_WAIT_CLOSE: sshstate = 55; -pub const SSH_SCP_WAIT_EOF: sshstate = 54; -pub const SSH_SCP_SEND_EOF: sshstate = 53; -pub const SSH_SCP_DONE: sshstate = 52; -pub const SSH_SCP_DOWNLOAD: sshstate = 51; -pub const SSH_SCP_DOWNLOAD_INIT: sshstate = 50; -pub const SSH_SCP_UPLOAD_INIT: sshstate = 49; -pub const SSH_SCP_TRANS_INIT: sshstate = 48; -pub const SSH_SFTP_SHUTDOWN: sshstate = 47; -pub const SSH_SFTP_CLOSE: sshstate = 46; -pub const SSH_SFTP_DOWNLOAD_STAT: sshstate = 45; -pub const SSH_SFTP_DOWNLOAD_INIT: sshstate = 44; -pub const SSH_SFTP_READDIR_DONE: sshstate = 43; -pub const SSH_SFTP_READDIR_BOTTOM: sshstate = 42; -pub const SSH_SFTP_READDIR_LINK: sshstate = 41; -pub const SSH_SFTP_READDIR: sshstate = 40; -pub const SSH_SFTP_READDIR_INIT: sshstate = 39; -pub const SSH_SFTP_CREATE_DIRS_MKDIR: sshstate = 38; -pub const SSH_SFTP_CREATE_DIRS: sshstate = 37; -pub const SSH_SFTP_CREATE_DIRS_INIT: sshstate = 36; -pub const SSH_SFTP_UPLOAD_INIT: sshstate = 35; -pub const SSH_SFTP_TRANS_INIT: sshstate = 34; -pub const SSH_SFTP_FILETIME: sshstate = 33; -pub const SSH_SFTP_GETINFO: sshstate = 32; -pub const SSH_SFTP_QUOTE_STATVFS: sshstate = 31; -pub const SSH_SFTP_QUOTE_UNLINK: sshstate = 30; -pub const SSH_SFTP_QUOTE_RMDIR: sshstate = 29; -pub const SSH_SFTP_QUOTE_RENAME: sshstate = 28; -pub const SSH_SFTP_QUOTE_MKDIR: sshstate = 27; -pub const SSH_SFTP_QUOTE_SYMLINK: sshstate = 26; -pub const SSH_SFTP_QUOTE_SETSTAT: sshstate = 25; -pub const SSH_SFTP_QUOTE_STAT: sshstate = 24; -pub const SSH_SFTP_NEXT_QUOTE: sshstate = 23; -pub const SSH_SFTP_QUOTE: sshstate = 22; -pub const SSH_SFTP_POSTQUOTE_INIT: sshstate = 21; -pub const SSH_SFTP_QUOTE_INIT: sshstate = 20; -pub const SSH_SFTP_REALPATH: sshstate = 19; -pub const SSH_SFTP_INIT: sshstate = 18; -pub const SSH_AUTH_DONE: sshstate = 17; -pub const SSH_AUTH_GSSAPI: sshstate = 16; -pub const SSH_AUTH_KEY: sshstate = 15; -pub const SSH_AUTH_KEY_INIT: sshstate = 14; -pub const SSH_AUTH_HOST: sshstate = 13; -pub const SSH_AUTH_HOST_INIT: sshstate = 12; -pub const SSH_AUTH_AGENT: sshstate = 11; -pub const SSH_AUTH_AGENT_LIST: sshstate = 10; -pub const SSH_AUTH_AGENT_INIT: sshstate = 9; -pub const SSH_AUTH_PASS: sshstate = 8; -pub const SSH_AUTH_PASS_INIT: sshstate = 7; -pub const SSH_AUTH_PKEY: sshstate = 6; -pub const SSH_AUTH_PKEY_INIT: sshstate = 5; -pub const SSH_AUTHLIST: sshstate = 4; -pub const SSH_HOSTKEY: sshstate = 3; -pub const SSH_S_STARTUP: sshstate = 2; -pub const SSH_INIT: sshstate = 1; -pub const SSH_STOP: sshstate = 0; -pub const SSH_NO_STATE: sshstate = -1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct http_conn { - pub binsettings: [uint8_t; 80], - pub binlen: size_t, - pub trnsfr: *mut Curl_easy, - pub h2: *mut nghttp2_session, - pub send_underlying: Option::, - pub recv_underlying: Option::, - pub inbuf: *mut libc::c_char, - pub inbuflen: size_t, - pub nread_inbuf: size_t, - pub pause_stream_id: int32_t, - pub drain_total: size_t, - pub settings: h2settings, - pub local_settings: [nghttp2_settings_entry; 3], - pub local_settings_num: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct nghttp2_settings_entry { - pub settings_id: int32_t, - pub value: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct h2settings { - pub max_concurrent_streams: uint32_t, - pub enable_push: bool, -} -pub type Curl_recv = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *mut libc::c_char, - size_t, - *mut CURLcode, -) -> ssize_t; -pub type Curl_send = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *const libc::c_void, - size_t, - *mut CURLcode, -) -> ssize_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_conn { - pub pp: pingpong, - pub entrypath: *mut libc::c_char, - pub file: *mut libc::c_char, - pub dirs: *mut *mut libc::c_char, - pub dirdepth: libc::c_int, - pub dont_check: bool, - pub ctl_valid: bool, - pub cwddone: bool, - pub cwdcount: libc::c_int, - pub cwdfail: bool, - pub wait_data_conn: bool, - pub newport: libc::c_ushort, - pub newhost: *mut libc::c_char, - pub prevpath: *mut libc::c_char, - pub transfertype: libc::c_char, - pub count1: libc::c_int, - pub count2: libc::c_int, - pub count3: libc::c_int, - pub state: ftpstate, - pub state_saved: ftpstate, - pub retr_size_saved: curl_off_t, - pub server_os: *mut libc::c_char, - pub known_filesize: curl_off_t, -} -pub type ftpstate = libc::c_uint; -pub const FTP_LAST: ftpstate = 35; -pub const FTP_QUIT: ftpstate = 34; -pub const FTP_STOR: ftpstate = 33; -pub const FTP_RETR: ftpstate = 32; -pub const FTP_LIST: ftpstate = 31; -pub const FTP_PASV: ftpstate = 30; -pub const FTP_PRET: ftpstate = 29; -pub const FTP_PORT: ftpstate = 28; -pub const FTP_RETR_REST: ftpstate = 27; -pub const FTP_REST: ftpstate = 26; -pub const FTP_STOR_SIZE: ftpstate = 25; -pub const FTP_RETR_SIZE: ftpstate = 24; -pub const FTP_SIZE: ftpstate = 23; -pub const FTP_STOR_TYPE: ftpstate = 22; -pub const FTP_RETR_TYPE: ftpstate = 21; -pub const FTP_LIST_TYPE: ftpstate = 20; -pub const FTP_TYPE: ftpstate = 19; -pub const FTP_MDTM: ftpstate = 18; -pub const FTP_MKD: ftpstate = 17; -pub const FTP_CWD: ftpstate = 16; -pub const FTP_POSTQUOTE: ftpstate = 15; -pub const FTP_STOR_PREQUOTE: ftpstate = 14; -pub const FTP_RETR_PREQUOTE: ftpstate = 13; -pub const FTP_QUOTE: ftpstate = 12; -pub const FTP_NAMEFMT: ftpstate = 11; -pub const FTP_SYST: ftpstate = 10; -pub const FTP_PWD: ftpstate = 9; -pub const FTP_CCC: ftpstate = 8; -pub const FTP_PROT: ftpstate = 7; -pub const FTP_PBSZ: ftpstate = 6; -pub const FTP_ACCT: ftpstate = 5; -pub const FTP_PASS: ftpstate = 4; -pub const FTP_USER: ftpstate = 3; -pub const FTP_AUTH: ftpstate = 2; -pub const FTP_WAIT220: ftpstate = 1; -pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ntlmdata { - pub flags: libc::c_uint, - pub nonce: [libc::c_uchar; 8], - pub target_info_len: libc::c_uint, - pub target_info: *mut libc::c_void, - pub ntlm_auth_hlpr_socket: curl_socket_t, - pub ntlm_auth_hlpr_pid: pid_t, - pub challenge: *mut libc::c_char, - pub response: *mut libc::c_char, -} -pub type curlntlm = libc::c_uint; -pub const NTLMSTATE_LAST: curlntlm = 4; -pub const NTLMSTATE_TYPE3: curlntlm = 3; -pub const NTLMSTATE_TYPE2: curlntlm = 2; -pub const NTLMSTATE_TYPE1: curlntlm = 1; -pub const NTLMSTATE_NONE: curlntlm = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_handler { - pub scheme: *const libc::c_char, - pub setup_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub do_it: Option:: CURLcode>, - pub done: Option:: CURLcode>, - pub do_more: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, - >, - pub connect_it: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - >, - pub connecting: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - >, - pub doing: Option:: CURLcode>, - pub proto_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub doing_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub domore_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub perform_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub disconnect: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, bool) -> CURLcode, - >, - pub readwrite: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut ssize_t, - *mut bool, - ) -> CURLcode, - >, - pub connection_check: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_uint, - ) -> libc::c_uint, - >, - pub attach: Option:: ()>, - pub defport: libc::c_int, - pub protocol: libc::c_uint, - pub family: libc::c_uint, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_connect_data { - pub state: ssl_connection_state, - pub connecting_state: ssl_connect_state, - pub backend: *mut ssl_backend_data, - #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] - pub use_0: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type ssl_connect_state = libc::c_uint; -pub const ssl_connect_done: ssl_connect_state = 5; -pub const ssl_connect_3: ssl_connect_state = 4; -pub const ssl_connect_2_writing: ssl_connect_state = 3; -pub const ssl_connect_2_reading: ssl_connect_state = 2; -pub const ssl_connect_2: ssl_connect_state = 1; -pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; -pub const ssl_connection_complete: ssl_connection_state = 2; -pub const ssl_connection_negotiating: ssl_connection_state = 1; -pub const ssl_connection_none: ssl_connection_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_5 = libc::c_uint; -pub const TRNSPRT_QUIC: C2RustUnnamed_5 = 5; -pub const TRNSPRT_UDP: C2RustUnnamed_5 = 4; -pub const TRNSPRT_TCP: C2RustUnnamed_5 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; -pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; -pub const CHUNK_TRAILER_CR: ChunkyState = 6; -pub const CHUNK_TRAILER: ChunkyState = 5; -pub const CHUNK_STOP: ChunkyState = 4; -pub const CHUNK_POSTLF: ChunkyState = 3; -pub const CHUNK_DATA: ChunkyState = 2; -pub const CHUNK_LF: ChunkyState = 1; -pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; -pub const CONNECT_DONE: connect_t = 17; -pub const CONNECT_REQ_READ_MORE: connect_t = 16; -pub const CONNECT_REQ_READ: connect_t = 15; -pub const CONNECT_REQ_SENDING: connect_t = 14; -pub const CONNECT_REQ_SEND: connect_t = 13; -pub const CONNECT_RESOLVE_REMOTE: connect_t = 12; -pub const CONNECT_RESOLVED: connect_t = 11; -pub const CONNECT_RESOLVING: connect_t = 10; -pub const CONNECT_REQ_INIT: connect_t = 9; -pub const CONNECT_AUTH_READ: connect_t = 8; -pub const CONNECT_AUTH_SEND: connect_t = 7; -pub const CONNECT_AUTH_INIT: connect_t = 6; -pub const CONNECT_GSSAPI_INIT: connect_t = 5; -pub const CONNECT_SOCKS_READ: connect_t = 4; -pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; -pub const CONNECT_SOCKS_SEND: connect_t = 2; -pub const CONNECT_SOCKS_INIT: connect_t = 1; -pub const CONNECT_INIT: connect_t = 0; -pub type curlfiletype = libc::c_uint; -pub const CURLFILETYPE_UNKNOWN: curlfiletype = 8; -pub const CURLFILETYPE_DOOR: curlfiletype = 7; -pub const CURLFILETYPE_SOCKET: curlfiletype = 6; -pub const CURLFILETYPE_NAMEDPIPE: curlfiletype = 5; -pub const CURLFILETYPE_DEVICE_CHAR: curlfiletype = 4; -pub const CURLFILETYPE_DEVICE_BLOCK: curlfiletype = 3; -pub const CURLFILETYPE_SYMLINK: curlfiletype = 2; -pub const CURLFILETYPE_DIRECTORY: curlfiletype = 1; -pub const CURLFILETYPE_FILE: curlfiletype = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_fileinfo { - pub filename: *mut libc::c_char, - pub filetype: curlfiletype, - pub time: time_t, - pub perm: libc::c_uint, - pub uid: libc::c_int, - pub gid: libc::c_int, - pub size: curl_off_t, - pub hardlinks: libc::c_long, - pub strings: C2RustUnnamed_6, - pub flags: libc::c_uint, - pub b_data: *mut libc::c_char, - pub b_size: size_t, - pub b_used: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct C2RustUnnamed_6 { - pub time: *mut libc::c_char, - pub perm: *mut libc::c_char, - pub user: *mut libc::c_char, - pub group: *mut libc::c_char, - pub target: *mut libc::c_char, -} -pub type curl_malloc_callback = Option::< - unsafe extern "C" fn(size_t) -> *mut libc::c_void, ->; -pub type curl_realloc_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t) -> *mut libc::c_void, ->; -pub type curl_calloc_callback = Option::< - unsafe extern "C" fn(size_t, size_t) -> *mut libc::c_void, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_parselist_data { - pub os_type: C2RustUnnamed_22, - pub state: C2RustUnnamed_8, - pub error: CURLcode, - pub file_data: *mut fileinfo, - pub item_length: libc::c_uint, - pub item_offset: size_t, - pub offsets: C2RustUnnamed_7, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct C2RustUnnamed_7 { - pub filename: size_t, - pub user: size_t, - pub group: size_t, - pub time: size_t, - pub perm: size_t, - pub symlink_target: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct fileinfo { - pub info: curl_fileinfo, - pub list: Curl_llist_element, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_8 { - pub UNIX: C2RustUnnamed_13, - pub NT: C2RustUnnamed_9, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct C2RustUnnamed_9 { - pub main: pl_winNT_mainstate, - pub sub: pl_winNT_substate, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union pl_winNT_substate { - pub time: C2RustUnnamed_12, - pub dirorsize: C2RustUnnamed_11, - pub filename: C2RustUnnamed_10, -} -pub type C2RustUnnamed_10 = libc::c_uint; -pub const PL_WINNT_FILENAME_WINEOL: C2RustUnnamed_10 = 2; -pub const PL_WINNT_FILENAME_CONTENT: C2RustUnnamed_10 = 1; -pub const PL_WINNT_FILENAME_PRESPACE: C2RustUnnamed_10 = 0; -pub type C2RustUnnamed_11 = libc::c_uint; -pub const PL_WINNT_DIRORSIZE_CONTENT: C2RustUnnamed_11 = 1; -pub const PL_WINNT_DIRORSIZE_PRESPACE: C2RustUnnamed_11 = 0; -pub type C2RustUnnamed_12 = libc::c_uint; -pub const PL_WINNT_TIME_TIME: C2RustUnnamed_12 = 1; -pub const PL_WINNT_TIME_PRESPACE: C2RustUnnamed_12 = 0; -pub type pl_winNT_mainstate = libc::c_uint; -pub const PL_WINNT_FILENAME: pl_winNT_mainstate = 3; -pub const PL_WINNT_DIRORSIZE: pl_winNT_mainstate = 2; -pub const PL_WINNT_TIME: pl_winNT_mainstate = 1; -pub const PL_WINNT_DATE: pl_winNT_mainstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct C2RustUnnamed_13 { - pub main: pl_unix_mainstate, - pub sub: pl_unix_substate, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union pl_unix_substate { - pub total_dirsize: C2RustUnnamed_21, - pub hlinks: C2RustUnnamed_20, - pub user: C2RustUnnamed_19, - pub group: C2RustUnnamed_18, - pub size: C2RustUnnamed_17, - pub time: C2RustUnnamed_16, - pub filename: C2RustUnnamed_15, - pub symlink: C2RustUnnamed_14, -} -pub type C2RustUnnamed_14 = libc::c_uint; -pub const PL_UNIX_SYMLINK_WINDOWSEOL: C2RustUnnamed_14 = 7; -pub const PL_UNIX_SYMLINK_TARGET: C2RustUnnamed_14 = 6; -pub const PL_UNIX_SYMLINK_PRETARGET4: C2RustUnnamed_14 = 5; -pub const PL_UNIX_SYMLINK_PRETARGET3: C2RustUnnamed_14 = 4; -pub const PL_UNIX_SYMLINK_PRETARGET2: C2RustUnnamed_14 = 3; -pub const PL_UNIX_SYMLINK_PRETARGET1: C2RustUnnamed_14 = 2; -pub const PL_UNIX_SYMLINK_NAME: C2RustUnnamed_14 = 1; -pub const PL_UNIX_SYMLINK_PRESPACE: C2RustUnnamed_14 = 0; -pub type C2RustUnnamed_15 = libc::c_uint; -pub const PL_UNIX_FILENAME_WINDOWSEOL: C2RustUnnamed_15 = 2; -pub const PL_UNIX_FILENAME_NAME: C2RustUnnamed_15 = 1; -pub const PL_UNIX_FILENAME_PRESPACE: C2RustUnnamed_15 = 0; -pub type C2RustUnnamed_16 = libc::c_uint; -pub const PL_UNIX_TIME_PART3: C2RustUnnamed_16 = 5; -pub const PL_UNIX_TIME_PREPART3: C2RustUnnamed_16 = 4; -pub const PL_UNIX_TIME_PART2: C2RustUnnamed_16 = 3; -pub const PL_UNIX_TIME_PREPART2: C2RustUnnamed_16 = 2; -pub const PL_UNIX_TIME_PART1: C2RustUnnamed_16 = 1; -pub const PL_UNIX_TIME_PREPART1: C2RustUnnamed_16 = 0; -pub type C2RustUnnamed_17 = libc::c_uint; -pub const PL_UNIX_SIZE_NUMBER: C2RustUnnamed_17 = 1; -pub const PL_UNIX_SIZE_PRESPACE: C2RustUnnamed_17 = 0; -pub type C2RustUnnamed_18 = libc::c_uint; -pub const PL_UNIX_GROUP_NAME: C2RustUnnamed_18 = 1; -pub const PL_UNIX_GROUP_PRESPACE: C2RustUnnamed_18 = 0; -pub type C2RustUnnamed_19 = libc::c_uint; -pub const PL_UNIX_USER_PARSING: C2RustUnnamed_19 = 1; -pub const PL_UNIX_USER_PRESPACE: C2RustUnnamed_19 = 0; -pub type C2RustUnnamed_20 = libc::c_uint; -pub const PL_UNIX_HLINKS_NUMBER: C2RustUnnamed_20 = 1; -pub const PL_UNIX_HLINKS_PRESPACE: C2RustUnnamed_20 = 0; -pub type C2RustUnnamed_21 = libc::c_uint; -pub const PL_UNIX_TOTALSIZE_READING: C2RustUnnamed_21 = 1; -pub const PL_UNIX_TOTALSIZE_INIT: C2RustUnnamed_21 = 0; -pub type pl_unix_mainstate = libc::c_uint; -pub const PL_UNIX_SYMLINK: pl_unix_mainstate = 9; -pub const PL_UNIX_FILENAME: pl_unix_mainstate = 8; -pub const PL_UNIX_TIME: pl_unix_mainstate = 7; -pub const PL_UNIX_SIZE: pl_unix_mainstate = 6; -pub const PL_UNIX_GROUP: pl_unix_mainstate = 5; -pub const PL_UNIX_USER: pl_unix_mainstate = 4; -pub const PL_UNIX_HLINKS: pl_unix_mainstate = 3; -pub const PL_UNIX_PERMISSION: pl_unix_mainstate = 2; -pub const PL_UNIX_FILETYPE: pl_unix_mainstate = 1; -pub const PL_UNIX_TOTALSIZE: pl_unix_mainstate = 0; -pub type C2RustUnnamed_22 = libc::c_uint; -pub const OS_TYPE_WIN_NT: C2RustUnnamed_22 = 2; -pub const OS_TYPE_UNIX: C2RustUnnamed_22 = 1; -pub const OS_TYPE_UNKNOWN: C2RustUnnamed_22 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_wc { - pub parser: *mut ftp_parselist_data, - pub backup: C2RustUnnamed_23, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct C2RustUnnamed_23 { - pub write_function: curl_write_callback, - pub file_descriptor: *mut FILE, -} -pub type CURLofft = libc::c_uint; -pub const CURL_OFFT_INVAL: CURLofft = 2; -pub const CURL_OFFT_FLOW: CURLofft = 1; -pub const CURL_OFFT_OK: CURLofft = 0; -#[no_mangle] -pub unsafe extern "C" fn Curl_ftp_parselist_data_alloc() -> *mut ftp_parselist_data { - return Curl_ccalloc - .expect( - "non-null function pointer", - )( - 1 as libc::c_int as size_t, - ::std::mem::size_of::() as libc::c_ulong, - ) as *mut ftp_parselist_data; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_ftp_parselist_data_free( - mut parserp: *mut *mut ftp_parselist_data, -) { - let mut parser: *mut ftp_parselist_data = *parserp; - if !parser.is_null() { - Curl_fileinfo_cleanup((*parser).file_data); - } - Curl_cfree.expect("non-null function pointer")(parser as *mut libc::c_void); - *parserp = 0 as *mut ftp_parselist_data; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_ftp_parselist_geterror( - mut pl_data: *mut ftp_parselist_data, -) -> CURLcode { - return (*pl_data).error; -} -unsafe extern "C" fn ftp_pl_get_permission(mut str: *const libc::c_char) -> libc::c_int { - let mut permissions: libc::c_int = 0 as libc::c_int; - if *str.offset(0 as libc::c_int as isize) as libc::c_int == 'r' as i32 { - permissions |= (1 as libc::c_int) << 8 as libc::c_int; - } else if *str.offset(0 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(1 as libc::c_int as isize) as libc::c_int == 'w' as i32 { - permissions |= (1 as libc::c_int) << 7 as libc::c_int; - } else if *str.offset(1 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(2 as libc::c_int as isize) as libc::c_int == 'x' as i32 { - permissions |= (1 as libc::c_int) << 6 as libc::c_int; - } else if *str.offset(2 as libc::c_int as isize) as libc::c_int == 's' as i32 { - permissions |= (1 as libc::c_int) << 6 as libc::c_int; - permissions |= (1 as libc::c_int) << 11 as libc::c_int; - } else if *str.offset(2 as libc::c_int as isize) as libc::c_int == 'S' as i32 { - permissions |= (1 as libc::c_int) << 11 as libc::c_int; - } else if *str.offset(2 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(3 as libc::c_int as isize) as libc::c_int == 'r' as i32 { - permissions |= (1 as libc::c_int) << 5 as libc::c_int; - } else if *str.offset(3 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(4 as libc::c_int as isize) as libc::c_int == 'w' as i32 { - permissions |= (1 as libc::c_int) << 4 as libc::c_int; - } else if *str.offset(4 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(5 as libc::c_int as isize) as libc::c_int == 'x' as i32 { - permissions |= (1 as libc::c_int) << 3 as libc::c_int; - } else if *str.offset(5 as libc::c_int as isize) as libc::c_int == 's' as i32 { - permissions |= (1 as libc::c_int) << 3 as libc::c_int; - permissions |= (1 as libc::c_int) << 10 as libc::c_int; - } else if *str.offset(5 as libc::c_int as isize) as libc::c_int == 'S' as i32 { - permissions |= (1 as libc::c_int) << 10 as libc::c_int; - } else if *str.offset(5 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(6 as libc::c_int as isize) as libc::c_int == 'r' as i32 { - permissions |= (1 as libc::c_int) << 2 as libc::c_int; - } else if *str.offset(6 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(7 as libc::c_int as isize) as libc::c_int == 'w' as i32 { - permissions |= (1 as libc::c_int) << 1 as libc::c_int; - } else if *str.offset(7 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - if *str.offset(8 as libc::c_int as isize) as libc::c_int == 'x' as i32 { - permissions |= 1 as libc::c_int; - } else if *str.offset(8 as libc::c_int as isize) as libc::c_int == 't' as i32 { - permissions |= 1 as libc::c_int; - permissions |= (1 as libc::c_int) << 9 as libc::c_int; - } else if *str.offset(8 as libc::c_int as isize) as libc::c_int == 'T' as i32 { - permissions |= (1 as libc::c_int) << 9 as libc::c_int; - } else if *str.offset(8 as libc::c_int as isize) as libc::c_int != '-' as i32 { - permissions |= 0x1000000 as libc::c_int; - } - return permissions; -} -unsafe extern "C" fn ftp_pl_insert_finfo( - mut data: *mut Curl_easy, - mut infop: *mut fileinfo, -) -> CURLcode { - let mut compare: curl_fnmatch_callback = None; - let mut wc: *mut WildcardData = &mut (*data).wildcard; - let mut ftpwc: *mut ftp_wc = (*wc).protdata as *mut ftp_wc; - let mut llist: *mut Curl_llist = &mut (*wc).filelist; - let mut parser: *mut ftp_parselist_data = (*ftpwc).parser; - let mut add: bool = 1 as libc::c_int != 0; - let mut finfo: *mut curl_fileinfo = &mut (*infop).info; - let mut str: *mut libc::c_char = (*finfo).b_data; - let ref mut fresh0 = (*finfo).filename; - *fresh0 = str.offset((*parser).offsets.filename as isize); - let ref mut fresh1 = (*finfo).strings.group; - *fresh1 = if (*parser).offsets.group != 0 { - str.offset((*parser).offsets.group as isize) - } else { - 0 as *mut libc::c_char - }; - let ref mut fresh2 = (*finfo).strings.perm; - *fresh2 = if (*parser).offsets.perm != 0 { - str.offset((*parser).offsets.perm as isize) - } else { - 0 as *mut libc::c_char - }; - let ref mut fresh3 = (*finfo).strings.target; - *fresh3 = if (*parser).offsets.symlink_target != 0 { - str.offset((*parser).offsets.symlink_target as isize) - } else { - 0 as *mut libc::c_char - }; - let ref mut fresh4 = (*finfo).strings.time; - *fresh4 = str.offset((*parser).offsets.time as isize); - let ref mut fresh5 = (*finfo).strings.user; - *fresh5 = if (*parser).offsets.user != 0 { - str.offset((*parser).offsets.user as isize) - } else { - 0 as *mut libc::c_char - }; - compare = (*data).set.fnmatch; - if compare.is_none() { - compare = Some( - Curl_fnmatch - as unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, - ); - } - Curl_set_in_callback(data, 1 as libc::c_int != 0); - if compare - .expect( - "non-null function pointer", - )((*data).set.fnmatch_data, (*wc).pattern, (*finfo).filename) == 0 as libc::c_int - { - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - && !((*finfo).strings.target).is_null() - && !(strstr( - (*finfo).strings.target, - b" -> \0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - add = 0 as libc::c_int != 0; - } - } else { - add = 0 as libc::c_int != 0; - } - Curl_set_in_callback(data, 0 as libc::c_int != 0); - if add { - Curl_llist_insert_next( - llist, - (*llist).tail, - finfo as *const libc::c_void, - &mut (*infop).list, - ); - } else { - Curl_fileinfo_cleanup(infop); - } - let ref mut fresh6 = (*(*ftpwc).parser).file_data; - *fresh6 = 0 as *mut fileinfo; - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_ftp_parselist( - mut buffer: *mut libc::c_char, - mut size: size_t, - mut nmemb: size_t, - mut connptr: *mut libc::c_void, -) -> size_t { - let mut current_block: u64; - let mut bufflen: size_t = size.wrapping_mul(nmemb); - let mut data: *mut Curl_easy = connptr as *mut Curl_easy; - let mut ftpwc: *mut ftp_wc = (*data).wildcard.protdata as *mut ftp_wc; - let mut parser: *mut ftp_parselist_data = (*ftpwc).parser; - let mut infop: *mut fileinfo = 0 as *mut fileinfo; - let mut finfo: *mut curl_fileinfo = 0 as *mut curl_fileinfo; - let mut i: libc::c_ulong = 0 as libc::c_int as libc::c_ulong; - let mut result: CURLcode = CURLE_OK; - let mut retsize: size_t = bufflen; - if !((*parser).error as u64 != 0) { - if (*parser).os_type as libc::c_uint - == OS_TYPE_UNKNOWN as libc::c_int as libc::c_uint - && bufflen > 0 as libc::c_int as libc::c_ulong - { - (*parser) - .os_type = (if *buffer.offset(0 as libc::c_int as isize) as libc::c_int - >= '0' as i32 - && *buffer.offset(0 as libc::c_int as isize) as libc::c_int <= '9' as i32 - { - OS_TYPE_WIN_NT as libc::c_int - } else { - OS_TYPE_UNIX as libc::c_int - }) as C2RustUnnamed_22; - } - loop { - if !(i < bufflen) { - current_block = 12024005797910882043; - break; - } - let mut c: libc::c_char = *buffer.offset(i as isize); - if ((*parser).file_data).is_null() { - let ref mut fresh7 = (*parser).file_data; - *fresh7 = Curl_fileinfo_alloc(); - if ((*parser).file_data).is_null() { - (*parser).error = CURLE_OUT_OF_MEMORY; - current_block = 16980866091698012183; - break; - } else { - let ref mut fresh8 = (*(*parser).file_data).info.b_data; - *fresh8 = Curl_cmalloc - .expect( - "non-null function pointer", - )(160 as libc::c_int as size_t) as *mut libc::c_char; - if ((*(*parser).file_data).info.b_data).is_null() { - (*parser).error = CURLE_OUT_OF_MEMORY; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data) - .info - .b_size = 160 as libc::c_int as size_t; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - } - infop = (*parser).file_data; - finfo = &mut (*infop).info; - let ref mut fresh9 = (*finfo).b_used; - let fresh10 = *fresh9; - *fresh9 = (*fresh9).wrapping_add(1); - *((*finfo).b_data).offset(fresh10 as isize) = c; - if (*finfo).b_used - >= ((*finfo).b_size).wrapping_sub(1 as libc::c_int as libc::c_ulong) - { - let mut tmp: *mut libc::c_char = Curl_crealloc - .expect( - "non-null function pointer", - )( - (*finfo).b_data as *mut libc::c_void, - ((*finfo).b_size).wrapping_add(160 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if !tmp.is_null() { - let ref mut fresh11 = (*finfo).b_size; - *fresh11 = (*fresh11 as libc::c_ulong) - .wrapping_add(160 as libc::c_int as libc::c_ulong) as size_t - as size_t; - let ref mut fresh12 = (*finfo).b_data; - *fresh12 = tmp; - } else { - Curl_fileinfo_cleanup((*parser).file_data); - let ref mut fresh13 = (*parser).file_data; - *fresh13 = 0 as *mut fileinfo; - (*parser).error = CURLE_OUT_OF_MEMORY; - current_block = 16980866091698012183; - break; - } - } - match (*parser).os_type as libc::c_uint { - 1 => { - match (*parser).state.UNIX.main as libc::c_uint { - 0 => { - current_block = 17024674780638317650; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 1 => { - current_block = 9625400769004322558; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 2 => { - current_block = 9904077679713191023; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 3 => { - current_block = 2504653350889004047; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 4 => { - current_block = 9811869791021064406; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 5 => { - current_block = 14897958723503621653; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 6 => { - current_block = 16624850812192366308; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 7 => { - current_block = 239935657650551384; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 8 => { - current_block = 6779615841179357261; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 9 => { - current_block = 12270305463401793827; - match current_block { - 14897958723503621653 => { - match (*parser).state.UNIX.sub.group as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_NAME; - } - } - 1 => { - let ref mut fresh21 = (*parser).item_length; - *fresh21 = (*fresh21).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.group = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_SIZE; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - 6779615841179357261 => { - match (*parser).state.UNIX.sub.filename as libc::c_uint { - 0 => { - current_block = 9460353118185870455; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 237011551503419106; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 8794836904205913937; - match current_block { - 9460353118185870455 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.filename = PL_UNIX_FILENAME_NAME; - } - } - 237011551503419106 => { - let ref mut fresh28 = (*parser).item_length; - *fresh28 = (*fresh28).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 239935657650551384 => { - match (*parser).state.UNIX.sub.time as libc::c_uint { - 0 => { - current_block = 16799793128756688569; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 3676047842931404030; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 4348891415139402515; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 9778139347000538655; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6646479082925444416; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 4328367172772116072; - match current_block { - 16799793128756688569 => { - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART1; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 6646479082925444416 => { - let ref mut fresh26 = (*parser).item_length; - *fresh26 = (*fresh26).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART3; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 9778139347000538655 => { - let ref mut fresh25 = (*parser).item_length; - *fresh25 = (*fresh25).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART3; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 4348891415139402515 => { - let ref mut fresh24 = (*parser).item_length; - *fresh24 = (*fresh24).wrapping_add(1); - if c as libc::c_int != ' ' as i32 { - if Curl_isalnum(c as libc::c_uchar as libc::c_int) != 0 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PART2; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - 3676047842931404030 => { - let ref mut fresh23 = (*parser).item_length; - *fresh23 = (*fresh23).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART2; - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - let ref mut fresh27 = (*parser).item_length; - *fresh27 = (*fresh27).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.time = (*parser).item_offset; - if (*finfo).filetype as libc::c_uint - == CURLFILETYPE_SYMLINK as libc::c_int as libc::c_uint - { - (*parser).state.UNIX.main = PL_UNIX_SYMLINK; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_PRESPACE; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILENAME; - (*parser) - .state - .UNIX - .sub - .filename = PL_UNIX_FILENAME_PRESPACE; - } - } else if Curl_isalnum(c as libc::c_uchar as libc::c_int) - == 0 && c as libc::c_int != '.' as i32 - && c as libc::c_int != ':' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 16624850812192366308 => { - match (*parser).state.UNIX.sub.size as libc::c_uint { - 0 => { - current_block = 4003799678443473047; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16318689547377354787; - match current_block { - 4003799678443473047 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.size = PL_UNIX_SIZE_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh22 = (*parser).item_length; - *fresh22 = (*fresh22).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p_0: *mut libc::c_char = 0 as *mut libc::c_char; - let mut fsize: curl_off_t = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p_0, - 10 as libc::c_int, - &mut fsize, - ) as u64 == 0 - { - if *p_0.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && fsize != 0x7fffffffffffffff as libc::c_long - && fsize - != -(0x7fffffffffffffff as libc::c_long) - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.size = fsize; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_TIME; - (*parser).state.UNIX.sub.time = PL_UNIX_TIME_PREPART1; - } - } else if Curl_isdigit(c as libc::c_uchar as libc::c_int) - == 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 2504653350889004047 => { - match (*parser).state.UNIX.sub.hlinks as libc::c_uint { - 0 => { - current_block = 3684944600068393837; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 5484315482916150815; - match current_block { - 3684944600068393837 => { - if c as libc::c_int != ' ' as i32 { - if c as libc::c_int >= '0' as i32 - && c as libc::c_int <= '9' as i32 - { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_NUMBER; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - _ => { - let ref mut fresh19 = (*parser).item_length; - *fresh19 = (*fresh19).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - let mut p: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hlinks: libc::c_long = 0; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - hlinks = strtol( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut p, - 10 as libc::c_int, - ); - if *p.offset(0 as libc::c_int as isize) as libc::c_int - == '\u{0}' as i32 - && hlinks != 9223372036854775807 as libc::c_long - && hlinks - != -(9223372036854775807 as libc::c_long) - - 1 as libc::c_long - { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 7 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.hardlinks = hlinks; - } - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).state.UNIX.main = PL_UNIX_USER; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PRESPACE; - } else if (c as libc::c_int) < '0' as i32 - || c as libc::c_int > '9' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - 9904077679713191023 => { - let ref mut fresh18 = (*parser).item_length; - *fresh18 = (*fresh18).wrapping_add(1); - if (*parser).item_length <= 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"rwx-tTsS\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 10 as libc::c_int as libc::c_uint - { - let mut perm: libc::c_uint = 0; - if c as libc::c_int != ' ' as i32 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - *((*finfo).b_data) - .offset( - 10 as libc::c_int as isize, - ) = 0 as libc::c_int as libc::c_char; - perm = ftp_pl_get_permission( - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) as libc::c_uint; - if perm & 0x1000000 as libc::c_int as libc::c_uint != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 3 as libc::c_int) as libc::c_uint; - (*(*parser).file_data).info.perm = perm; - (*parser).offsets.perm = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.main = PL_UNIX_HLINKS; - (*parser).state.UNIX.sub.hlinks = PL_UNIX_HLINKS_PRESPACE; - } - } - } - } - 9625400769004322558 => { - match c as libc::c_int { - 45 => { - (*finfo).filetype = CURLFILETYPE_FILE; - } - 100 => { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - } - 108 => { - (*finfo).filetype = CURLFILETYPE_SYMLINK; - } - 112 => { - (*finfo).filetype = CURLFILETYPE_NAMEDPIPE; - } - 115 => { - (*finfo).filetype = CURLFILETYPE_SOCKET; - } - 99 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_CHAR; - } - 98 => { - (*finfo).filetype = CURLFILETYPE_DEVICE_BLOCK; - } - 68 => { - (*finfo).filetype = CURLFILETYPE_DOOR; - } - _ => { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - (*parser).state.UNIX.main = PL_UNIX_PERMISSION; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 1 as libc::c_int as size_t; - } - 17024674780638317650 => { - match (*parser).state.UNIX.sub.total_dirsize as libc::c_uint - { - 0 => { - current_block = 6514364568132207893; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - 1 => { - current_block = 13626467451598339886; - match current_block { - 6514364568132207893 => { - if c as libc::c_int == 't' as i32 { - (*parser) - .state - .UNIX - .sub - .total_dirsize = PL_UNIX_TOTALSIZE_READING; - let ref mut fresh14 = (*parser).item_length; - *fresh14 = (*fresh14).wrapping_add(1); - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - continue; - } - } - _ => { - let ref mut fresh15 = (*parser).item_length; - *fresh15 = (*fresh15).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - let ref mut fresh16 = (*parser).item_length; - *fresh16 = (*fresh16).wrapping_sub(1); - let ref mut fresh17 = (*finfo).b_used; - *fresh17 = (*fresh17).wrapping_sub(1); - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_length) - .wrapping_sub(1 as libc::c_int as libc::c_uint) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strncmp( - b"total \0" as *const u8 as *const libc::c_char, - (*finfo).b_data, - 6 as libc::c_int as libc::c_ulong, - ) == 0 as libc::c_int - { - let mut endptr: *mut libc::c_char = ((*finfo).b_data) - .offset(6 as libc::c_int as isize); - while Curl_isspace(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - while Curl_isdigit(*endptr as libc::c_uchar as libc::c_int) - != 0 - { - endptr = endptr.offset(1); - } - if *endptr != 0 { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - (*finfo).b_used = 0 as libc::c_int as size_t; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - } - _ => {} - } - } - 9811869791021064406 => { - match (*parser).state.UNIX.sub.user as libc::c_uint { - 0 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.user = PL_UNIX_USER_PARSING; - } - } - 1 => { - let ref mut fresh20 = (*parser).item_length; - *fresh20 = (*fresh20).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.user = (*parser).item_offset; - (*parser).state.UNIX.main = PL_UNIX_GROUP; - (*parser).state.UNIX.sub.group = PL_UNIX_GROUP_PRESPACE; - (*parser).item_offset = 0 as libc::c_int as size_t; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } - } - _ => {} - } - } - _ => { - match (*parser).state.UNIX.sub.symlink as libc::c_uint { - 0 => { - current_block = 17809359888120058514; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 16368170406074945475; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 10105930990766199517; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 3 => { - current_block = 11357570484085178253; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 4 => { - current_block = 6032193395927242546; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 5 => { - current_block = 755694297841528034; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 6 => { - current_block = 5173505947521674114; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 7 => { - current_block = 12108948829114559637; - match current_block { - 17809359888120058514 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 5173505947521674114 => { - let ref mut fresh33 = (*parser).item_length; - *fresh33 = (*fresh33).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_WINDOWSEOL; - } else if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } - } - 755694297841528034 => { - if c as libc::c_int != '\r' as i32 - && c as libc::c_int != '\n' as i32 - { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_TARGET; - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 6032193395927242546 => { - let ref mut fresh32 = (*parser).item_length; - *fresh32 = (*fresh32).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET4; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(4 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.filename = (*parser).item_offset; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).item_offset = 0 as libc::c_int as size_t; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 11357570484085178253 => { - let ref mut fresh31 = (*parser).item_length; - *fresh31 = (*fresh31).wrapping_add(1); - if c as libc::c_int == '>' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET3; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 10105930990766199517 => { - let ref mut fresh30 = (*parser).item_length; - *fresh30 = (*fresh30).wrapping_add(1); - if c as libc::c_int == '-' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET2; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.sub.symlink = PL_UNIX_SYMLINK_NAME; - } - } - 16368170406074945475 => { - let ref mut fresh29 = (*parser).item_length; - *fresh29 = (*fresh29).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - (*parser) - .state - .UNIX - .sub - .symlink = PL_UNIX_SYMLINK_PRETARGET1; - } else if c as libc::c_int == '\r' as i32 - || c as libc::c_int == '\n' as i32 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).offsets.symlink_target = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.UNIX.main = PL_UNIX_FILETYPE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - _ => {} - } - } - 2 => { - match (*parser).state.NT.main as libc::c_uint { - 0 => { - current_block = 10276754450170513663; - match current_block { - 10276754450170513663 => { - let ref mut fresh34 = (*parser).item_length; - *fresh34 = (*fresh34).wrapping_add(1); - if (*parser).item_length < 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"0123456789-\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 9 as libc::c_int as libc::c_uint - { - if c as libc::c_int == ' ' as i32 { - (*parser).state.NT.main = PL_WINNT_TIME; - (*parser).state.NT.sub.time = PL_WINNT_TIME_PRESPACE; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 538492802611270279 => { - match (*parser).state.NT.sub.dirorsize as libc::c_uint { - 0 => { - current_block = 5336772990438301456; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - 1 => { - current_block = 9790556430701464115; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - _ => {} - } - } - 9608327422557688744 => { - let ref mut fresh35 = (*parser).item_length; - *fresh35 = (*fresh35).wrapping_add(1); - match (*parser).state.NT.sub.time as libc::c_uint { - 0 => { - current_block = 2747568622853712931; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 13271080678501671613; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - _ => { - match (*parser).state.NT.sub.filename as libc::c_uint { - 0 => { - current_block = 10190897281885295872; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 12975579885717081312; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 3027624313100770395; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 1 => { - current_block = 9608327422557688744; - match current_block { - 10276754450170513663 => { - let ref mut fresh34 = (*parser).item_length; - *fresh34 = (*fresh34).wrapping_add(1); - if (*parser).item_length < 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"0123456789-\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 9 as libc::c_int as libc::c_uint - { - if c as libc::c_int == ' ' as i32 { - (*parser).state.NT.main = PL_WINNT_TIME; - (*parser).state.NT.sub.time = PL_WINNT_TIME_PRESPACE; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 538492802611270279 => { - match (*parser).state.NT.sub.dirorsize as libc::c_uint { - 0 => { - current_block = 5336772990438301456; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - 1 => { - current_block = 9790556430701464115; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - _ => {} - } - } - 9608327422557688744 => { - let ref mut fresh35 = (*parser).item_length; - *fresh35 = (*fresh35).wrapping_add(1); - match (*parser).state.NT.sub.time as libc::c_uint { - 0 => { - current_block = 2747568622853712931; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 13271080678501671613; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - _ => { - match (*parser).state.NT.sub.filename as libc::c_uint { - 0 => { - current_block = 10190897281885295872; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 12975579885717081312; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 3027624313100770395; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 2 => { - current_block = 538492802611270279; - match current_block { - 10276754450170513663 => { - let ref mut fresh34 = (*parser).item_length; - *fresh34 = (*fresh34).wrapping_add(1); - if (*parser).item_length < 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"0123456789-\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 9 as libc::c_int as libc::c_uint - { - if c as libc::c_int == ' ' as i32 { - (*parser).state.NT.main = PL_WINNT_TIME; - (*parser).state.NT.sub.time = PL_WINNT_TIME_PRESPACE; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 538492802611270279 => { - match (*parser).state.NT.sub.dirorsize as libc::c_uint { - 0 => { - current_block = 5336772990438301456; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - 1 => { - current_block = 9790556430701464115; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - _ => {} - } - } - 9608327422557688744 => { - let ref mut fresh35 = (*parser).item_length; - *fresh35 = (*fresh35).wrapping_add(1); - match (*parser).state.NT.sub.time as libc::c_uint { - 0 => { - current_block = 2747568622853712931; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 13271080678501671613; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - _ => { - match (*parser).state.NT.sub.filename as libc::c_uint { - 0 => { - current_block = 10190897281885295872; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 12975579885717081312; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 3027624313100770395; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - 3 => { - current_block = 2336264180246734603; - match current_block { - 10276754450170513663 => { - let ref mut fresh34 = (*parser).item_length; - *fresh34 = (*fresh34).wrapping_add(1); - if (*parser).item_length < 9 as libc::c_int as libc::c_uint - { - if (strchr( - b"0123456789-\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else if (*parser).item_length - == 9 as libc::c_int as libc::c_uint - { - if c as libc::c_int == ' ' as i32 { - (*parser).state.NT.main = PL_WINNT_TIME; - (*parser).state.NT.sub.time = PL_WINNT_TIME_PRESPACE; - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - 538492802611270279 => { - match (*parser).state.NT.sub.dirorsize as libc::c_uint { - 0 => { - current_block = 5336772990438301456; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - 1 => { - current_block = 9790556430701464115; - match current_block { - 5336772990438301456 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_CONTENT; - } - } - _ => { - let ref mut fresh36 = (*parser).item_length; - *fresh36 = (*fresh36).wrapping_add(1); - if c as libc::c_int == ' ' as i32 { - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - if strcmp( - b"\0" as *const u8 as *const libc::c_char, - ((*finfo).b_data).offset((*parser).item_offset as isize), - ) == 0 as libc::c_int - { - (*finfo).filetype = CURLFILETYPE_DIRECTORY; - (*finfo).size = 0 as libc::c_int as curl_off_t; - } else { - let mut endptr_0: *mut libc::c_char = 0 - as *mut libc::c_char; - if curlx_strtoofft( - ((*finfo).b_data).offset((*parser).item_offset as isize), - &mut endptr_0, - 10 as libc::c_int, - &mut (*finfo).size, - ) as u64 != 0 - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } else { - (*(*parser).file_data).info.filetype = CURLFILETYPE_FILE; - } - } - (*(*parser).file_data).info.flags - |= ((1 as libc::c_int) << 6 as libc::c_int) as libc::c_uint; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - (*parser).state.NT.main = PL_WINNT_FILENAME; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - } - _ => {} - } - } - 9608327422557688744 => { - let ref mut fresh35 = (*parser).item_length; - *fresh35 = (*fresh35).wrapping_add(1); - match (*parser).state.NT.sub.time as libc::c_uint { - 0 => { - current_block = 2747568622853712931; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 13271080678501671613; - match current_block { - 2747568622853712931 => { - if Curl_isspace(c as libc::c_uchar as libc::c_int) == 0 { - (*parser).state.NT.sub.time = PL_WINNT_TIME_TIME; - } - } - _ => { - if c as libc::c_int == ' ' as i32 { - (*parser).offsets.time = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*parser).item_offset) - .wrapping_add((*parser).item_length as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - (*parser).state.NT.main = PL_WINNT_DIRORSIZE; - (*parser) - .state - .NT - .sub - .dirorsize = PL_WINNT_DIRORSIZE_PRESPACE; - (*parser).item_length = 0 as libc::c_int as libc::c_uint; - } else if (strchr( - b"APM0123456789:\0" as *const u8 as *const libc::c_char, - c as libc::c_int, - )) - .is_null() - { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - _ => { - match (*parser).state.NT.sub.filename as libc::c_uint { - 0 => { - current_block = 10190897281885295872; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 1 => { - current_block = 12975579885717081312; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - 2 => { - current_block = 3027624313100770395; - match current_block { - 10190897281885295872 => { - if c as libc::c_int != ' ' as i32 { - (*parser) - .item_offset = ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong); - (*parser).item_length = 1 as libc::c_int as libc::c_uint; - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_CONTENT; - } - } - 12975579885717081312 => { - let ref mut fresh37 = (*parser).item_length; - *fresh37 = (*fresh37).wrapping_add(1); - if c as libc::c_int == '\r' as i32 { - (*parser).state.NT.sub.filename = PL_WINNT_FILENAME_WINEOL; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - } else if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - *((*finfo).b_data) - .offset( - ((*finfo).b_used) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize, - ) = 0 as libc::c_int as libc::c_char; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } - } - _ => { - if c as libc::c_int == '\n' as i32 { - (*parser).offsets.filename = (*parser).item_offset; - result = ftp_pl_insert_finfo(data, infop); - if result as u64 != 0 { - (*parser).error = result; - current_block = 16980866091698012183; - break; - } else { - (*parser).state.NT.main = PL_WINNT_DATE; - (*parser) - .state - .NT - .sub - .filename = PL_WINNT_FILENAME_PRESPACE; - } - } else { - (*parser).error = CURLE_FTP_BAD_FILE_LIST; - current_block = 16980866091698012183; - break; - } - } - } - } - _ => {} - } - } - } - } - _ => {} - } - } - _ => { - retsize = bufflen.wrapping_add(1 as libc::c_int as libc::c_ulong); - current_block = 16980866091698012183; - break; - } - } - i = i.wrapping_add(1); - } - match current_block { - 16980866091698012183 => {} - _ => return retsize, - } - } - if !((*parser).file_data).is_null() { - Curl_fileinfo_cleanup((*parser).file_data); - let ref mut fresh38 = (*parser).file_data; - *fresh38 = 0 as *mut fileinfo; - } - return retsize; -} diff --git a/lib/http.c b/lib/http.c new file mode 100644 index 0000000..648583c --- /dev/null +++ b/lib/http.c @@ -0,0 +1,4382 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifndef CURL_DISABLE_HTTP + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +#ifdef HAVE_SYS_IOCTL_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef USE_HYPER +#include +#endif + +#include "urldata.h" +#include +#include "transfer.h" +#include "sendf.h" +#include "formdata.h" +#include "mime.h" +#include "progress.h" +#include "curl_base64.h" +#include "cookie.h" +#include "vauth/vauth.h" +#include "vtls/vtls.h" +#include "http_digest.h" +#include "http_ntlm.h" +#include "curl_ntlm_wb.h" +#include "http_negotiate.h" +#include "http_aws_sigv4.h" +#include "url.h" +#include "share.h" +#include "hostip.h" +#include "http.h" +#include "select.h" +#include "parsedate.h" /* for the week day and month names */ +#include "strtoofft.h" +#include "multiif.h" +#include "strcase.h" +#include "content_encoding.h" +#include "http_proxy.h" +#include "warnless.h" +#include "non-ascii.h" +#include "http2.h" +#include "connect.h" +#include "strdup.h" +#include "altsvc.h" +#include "hsts.h" +#include "c-hyper.h" + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" + +/* + * Forward declarations. + */ + +static int http_getsock_do(struct Curl_easy *data, + struct connectdata *conn, + curl_socket_t *socks); +static bool http_should_fail(struct Curl_easy *data); + +#ifndef CURL_DISABLE_PROXY +static CURLcode add_haproxy_protocol_header(struct Curl_easy *data); +#endif + +#ifdef USE_SSL +static CURLcode https_connecting(struct Curl_easy *data, bool *done); +static int https_getsock(struct Curl_easy *data, + struct connectdata *conn, + curl_socket_t *socks); +#else +#define https_connecting(x,y) CURLE_COULDNT_CONNECT +#endif +static CURLcode http_setup_conn(struct Curl_easy *data, + struct connectdata *conn); + +/* + * HTTP handler interface. + */ +const struct Curl_handler Curl_handler_http = { + "HTTP", /* scheme */ + http_setup_conn, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + Curl_http_connect, /* connect_it */ + ZERO_NULL, /* connecting */ + ZERO_NULL, /* doing */ + ZERO_NULL, /* proto_getsock */ + http_getsock_do, /* doing_getsock */ + ZERO_NULL, /* domore_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + ZERO_NULL, /* readwrite */ + ZERO_NULL, /* connection_check */ + ZERO_NULL, /* attach connection */ + PORT_HTTP, /* defport */ + CURLPROTO_HTTP, /* protocol */ + CURLPROTO_HTTP, /* family */ + PROTOPT_CREDSPERREQUEST | /* flags */ + PROTOPT_USERPWDCTRL +}; + +#ifdef USE_SSL +/* + * HTTPS handler interface. + */ +const struct Curl_handler Curl_handler_https = { + "HTTPS", /* scheme */ + http_setup_conn, /* setup_connection */ + Curl_http, /* do_it */ + Curl_http_done, /* done */ + ZERO_NULL, /* do_more */ + Curl_http_connect, /* connect_it */ + https_connecting, /* connecting */ + ZERO_NULL, /* doing */ + https_getsock, /* proto_getsock */ + http_getsock_do, /* doing_getsock */ + ZERO_NULL, /* domore_getsock */ + ZERO_NULL, /* perform_getsock */ + ZERO_NULL, /* disconnect */ + ZERO_NULL, /* readwrite */ + ZERO_NULL, /* connection_check */ + ZERO_NULL, /* attach connection */ + PORT_HTTPS, /* defport */ + CURLPROTO_HTTPS, /* protocol */ + CURLPROTO_HTTP, /* family */ + PROTOPT_SSL | PROTOPT_CREDSPERREQUEST | PROTOPT_ALPN_NPN | /* flags */ + PROTOPT_USERPWDCTRL +}; +#endif + +static CURLcode http_setup_conn(struct Curl_easy *data, + struct connectdata *conn) +{ + /* allocate the HTTP-specific struct for the Curl_easy, only to survive + during this request */ + struct HTTP *http; + DEBUGASSERT(data->req.p.http == NULL); + + http = calloc(1, sizeof(struct HTTP)); + if(!http) + return CURLE_OUT_OF_MEMORY; + + Curl_mime_initpart(&http->form, data); + data->req.p.http = http; + + if(data->state.httpwant == CURL_HTTP_VERSION_3) { + if(conn->handler->flags & PROTOPT_SSL) + /* Only go HTTP/3 directly on HTTPS URLs. It needs a UDP socket and does + the QUIC dance. */ + conn->transport = TRNSPRT_QUIC; + else { + failf(data, "HTTP/3 requested for non-HTTPS URL"); + return CURLE_URL_MALFORMAT; + } + } + else { + if(!CONN_INUSE(conn)) + /* if not already multi-using, setup connection details */ + Curl_http2_setup_conn(conn); + Curl_http2_setup_req(data); + } + return CURLE_OK; +} + +#ifndef CURL_DISABLE_PROXY +/* + * checkProxyHeaders() checks the linked list of custom proxy headers + * if proxy headers are not available, then it will lookup into http header + * link list + * + * It takes a connectdata struct as input to see if this is a proxy request or + * not, as it then might check a different header list. Provide the header + * prefix without colon! + */ +char *Curl_checkProxyheaders(struct Curl_easy *data, + const struct connectdata *conn, + const char *thisheader) +{ + struct curl_slist *head; + size_t thislen = strlen(thisheader); + + for(head = (conn->bits.proxy && data->set.sep_headers) ? + data->set.proxyheaders : data->set.headers; + head; head = head->next) { + if(strncasecompare(head->data, thisheader, thislen) && + Curl_headersep(head->data[thislen])) + return head->data; + } + + return NULL; +} +#else +/* disabled */ +#define Curl_checkProxyheaders(x,y,z) NULL +#endif + +/* + * Strip off leading and trailing whitespace from the value in the + * given HTTP header line and return a strdupped copy. Returns NULL in + * case of allocation failure. Returns an empty string if the header value + * consists entirely of whitespace. + */ +char *Curl_copy_header_value(const char *header) +{ + const char *start; + const char *end; + char *value; + size_t len; + + /* Find the end of the header name */ + while(*header && (*header != ':')) + ++header; + + if(*header) + /* Skip over colon */ + ++header; + + /* Find the first non-space letter */ + start = header; + while(*start && ISSPACE(*start)) + start++; + + /* data is in the host encoding so + use '\r' and '\n' instead of 0x0d and 0x0a */ + end = strchr(start, '\r'); + if(!end) + end = strchr(start, '\n'); + if(!end) + end = strchr(start, '\0'); + if(!end) + return NULL; + + /* skip all trailing space letters */ + while((end > start) && ISSPACE(*end)) + end--; + + /* get length of the type */ + len = end - start + 1; + + value = malloc(len + 1); + if(!value) + return NULL; + + memcpy(value, start, len); + value[len] = 0; /* null-terminate */ + + return value; +} + +#ifndef CURL_DISABLE_HTTP_AUTH +/* + * http_output_basic() sets up an Authorization: header (or the proxy version) + * for HTTP Basic authentication. + * + * Returns CURLcode. + */ +static CURLcode http_output_basic(struct Curl_easy *data, bool proxy) +{ + size_t size = 0; + char *authorization = NULL; + char **userp; + const char *user; + const char *pwd; + CURLcode result; + char *out; + + /* credentials are unique per transfer for HTTP, do not use the ones for the + connection */ + if(proxy) { +#ifndef CURL_DISABLE_PROXY + userp = &data->state.aptr.proxyuserpwd; + user = data->state.aptr.proxyuser; + pwd = data->state.aptr.proxypasswd; +#else + return CURLE_NOT_BUILT_IN; +#endif + } + else { + userp = &data->state.aptr.userpwd; + user = data->state.aptr.user; + pwd = data->state.aptr.passwd; + } + + out = aprintf("%s:%s", user, pwd ? pwd : ""); + if(!out) + return CURLE_OUT_OF_MEMORY; + + result = Curl_base64_encode(data, out, strlen(out), &authorization, &size); + if(result) + goto fail; + + if(!authorization) { + result = CURLE_REMOTE_ACCESS_DENIED; + goto fail; + } + + free(*userp); + *userp = aprintf("%sAuthorization: Basic %s\r\n", + proxy ? "Proxy-" : "", + authorization); + free(authorization); + if(!*userp) { + result = CURLE_OUT_OF_MEMORY; + goto fail; + } + + fail: + free(out); + return result; +} + +/* + * http_output_bearer() sets up an Authorization: header + * for HTTP Bearer authentication. + * + * Returns CURLcode. + */ +static CURLcode http_output_bearer(struct Curl_easy *data) +{ + char **userp; + CURLcode result = CURLE_OK; + + userp = &data->state.aptr.userpwd; + free(*userp); + *userp = aprintf("Authorization: Bearer %s\r\n", + data->set.str[STRING_BEARER]); + + if(!*userp) { + result = CURLE_OUT_OF_MEMORY; + goto fail; + } + + fail: + return result; +} + +#endif + +/* pickoneauth() selects the most favourable authentication method from the + * ones available and the ones we want. + * + * return TRUE if one was picked + */ +static bool pickoneauth(struct auth *pick, unsigned long mask) +{ + bool picked; + /* only deal with authentication we want */ + unsigned long avail = pick->avail & pick->want & mask; + picked = TRUE; + + /* The order of these checks is highly relevant, as this will be the order + of preference in case of the existence of multiple accepted types. */ + if(avail & CURLAUTH_NEGOTIATE) + pick->picked = CURLAUTH_NEGOTIATE; + else if(avail & CURLAUTH_BEARER) + pick->picked = CURLAUTH_BEARER; + else if(avail & CURLAUTH_DIGEST) + pick->picked = CURLAUTH_DIGEST; + else if(avail & CURLAUTH_NTLM) + pick->picked = CURLAUTH_NTLM; + else if(avail & CURLAUTH_NTLM_WB) + pick->picked = CURLAUTH_NTLM_WB; + else if(avail & CURLAUTH_BASIC) + pick->picked = CURLAUTH_BASIC; + else if(avail & CURLAUTH_AWS_SIGV4) + pick->picked = CURLAUTH_AWS_SIGV4; + else { + pick->picked = CURLAUTH_PICKNONE; /* we select to use nothing */ + picked = FALSE; + } + pick->avail = CURLAUTH_NONE; /* clear it here */ + + return picked; +} + +/* + * http_perhapsrewind() + * + * If we are doing POST or PUT { + * If we have more data to send { + * If we are doing NTLM { + * Keep sending since we must not disconnect + * } + * else { + * If there is more than just a little data left to send, close + * the current connection by force. + * } + * } + * If we have sent any data { + * If we don't have track of all the data { + * call app to tell it to rewind + * } + * else { + * rewind internally so that the operation can restart fine + * } + * } + * } + */ +static CURLcode http_perhapsrewind(struct Curl_easy *data, + struct connectdata *conn) +{ + struct HTTP *http = data->req.p.http; + curl_off_t bytessent; + curl_off_t expectsend = -1; /* default is unknown */ + + if(!http) + /* If this is still NULL, we have not reach very far and we can safely + skip this rewinding stuff */ + return CURLE_OK; + + switch(data->state.httpreq) { + case HTTPREQ_GET: + case HTTPREQ_HEAD: + return CURLE_OK; + default: + break; + } + + bytessent = data->req.writebytecount; + + if(conn->bits.authneg) { + /* This is a state where we are known to be negotiating and we don't send + any data then. */ + expectsend = 0; + } + else if(!conn->bits.protoconnstart) { + /* HTTP CONNECT in progress: there is no body */ + expectsend = 0; + } + else { + /* figure out how much data we are expected to send */ + switch(data->state.httpreq) { + case HTTPREQ_POST: + case HTTPREQ_PUT: + if(data->state.infilesize != -1) + expectsend = data->state.infilesize; + break; + case HTTPREQ_POST_FORM: + case HTTPREQ_POST_MIME: + expectsend = http->postsize; + break; + default: + break; + } + } + + conn->bits.rewindaftersend = FALSE; /* default */ + + if((expectsend == -1) || (expectsend > bytessent)) { +#if defined(USE_NTLM) + /* There is still data left to send */ + if((data->state.authproxy.picked == CURLAUTH_NTLM) || + (data->state.authhost.picked == CURLAUTH_NTLM) || + (data->state.authproxy.picked == CURLAUTH_NTLM_WB) || + (data->state.authhost.picked == CURLAUTH_NTLM_WB)) { + if(((expectsend - bytessent) < 2000) || + (conn->http_ntlm_state != NTLMSTATE_NONE) || + (conn->proxy_ntlm_state != NTLMSTATE_NONE)) { + /* The NTLM-negotiation has started *OR* there is just a little (<2K) + data left to send, keep on sending. */ + + /* rewind data when completely done sending! */ + if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) { + conn->bits.rewindaftersend = TRUE; + infof(data, "Rewind stream after send"); + } + + return CURLE_OK; + } + + if(conn->bits.close) + /* this is already marked to get closed */ + return CURLE_OK; + + infof(data, "NTLM send, close instead of sending %" + CURL_FORMAT_CURL_OFF_T " bytes", + (curl_off_t)(expectsend - bytessent)); + } +#endif +#if defined(USE_SPNEGO) + /* There is still data left to send */ + if((data->state.authproxy.picked == CURLAUTH_NEGOTIATE) || + (data->state.authhost.picked == CURLAUTH_NEGOTIATE)) { + if(((expectsend - bytessent) < 2000) || + (conn->http_negotiate_state != GSS_AUTHNONE) || + (conn->proxy_negotiate_state != GSS_AUTHNONE)) { + /* The NEGOTIATE-negotiation has started *OR* + there is just a little (<2K) data left to send, keep on sending. */ + + /* rewind data when completely done sending! */ + if(!conn->bits.authneg && (conn->writesockfd != CURL_SOCKET_BAD)) { + conn->bits.rewindaftersend = TRUE; + infof(data, "Rewind stream after send"); + } + + return CURLE_OK; + } + + if(conn->bits.close) + /* this is already marked to get closed */ + return CURLE_OK; + + infof(data, "NEGOTIATE send, close instead of sending %" + CURL_FORMAT_CURL_OFF_T " bytes", + (curl_off_t)(expectsend - bytessent)); + } +#endif + + /* This is not NEGOTIATE/NTLM or many bytes left to send: close */ + streamclose(conn, "Mid-auth HTTP and much data left to send"); + data->req.size = 0; /* don't download any more than 0 bytes */ + + /* There still is data left to send, but this connection is marked for + closure so we can safely do the rewind right now */ + } + + if(bytessent) + /* we rewind now at once since if we already sent something */ + return Curl_readrewind(data); + + return CURLE_OK; +} + +/* + * Curl_http_auth_act() gets called when all HTTP headers have been received + * and it checks what authentication methods that are available and decides + * which one (if any) to use. It will set 'newurl' if an auth method was + * picked. + */ + +CURLcode Curl_http_auth_act(struct Curl_easy *data) +{ + struct connectdata *conn = data->conn; + bool pickhost = FALSE; + bool pickproxy = FALSE; + CURLcode result = CURLE_OK; + unsigned long authmask = ~0ul; + + if(!data->set.str[STRING_BEARER]) + authmask &= (unsigned long)~CURLAUTH_BEARER; + + if(100 <= data->req.httpcode && 199 >= data->req.httpcode) + /* this is a transient response code, ignore */ + return CURLE_OK; + + if(data->state.authproblem) + return data->set.http_fail_on_error?CURLE_HTTP_RETURNED_ERROR:CURLE_OK; + + if((conn->bits.user_passwd || data->set.str[STRING_BEARER]) && + ((data->req.httpcode == 401) || + (conn->bits.authneg && data->req.httpcode < 300))) { + pickhost = pickoneauth(&data->state.authhost, authmask); + if(!pickhost) + data->state.authproblem = TRUE; + if(data->state.authhost.picked == CURLAUTH_NTLM && + conn->httpversion > 11) { + infof(data, "Forcing HTTP/1.1 for NTLM"); + connclose(conn, "Force HTTP/1.1 connection"); + data->state.httpwant = CURL_HTTP_VERSION_1_1; + } + } +#ifndef CURL_DISABLE_PROXY + if(conn->bits.proxy_user_passwd && + ((data->req.httpcode == 407) || + (conn->bits.authneg && data->req.httpcode < 300))) { + pickproxy = pickoneauth(&data->state.authproxy, + authmask & ~CURLAUTH_BEARER); + if(!pickproxy) + data->state.authproblem = TRUE; + } +#endif + + if(pickhost || pickproxy) { + if((data->state.httpreq != HTTPREQ_GET) && + (data->state.httpreq != HTTPREQ_HEAD) && + !conn->bits.rewindaftersend) { + result = http_perhapsrewind(data, conn); + if(result) + return result; + } + /* In case this is GSS auth, the newurl field is already allocated so + we must make sure to free it before allocating a new one. As figured + out in bug #2284386 */ + Curl_safefree(data->req.newurl); + data->req.newurl = strdup(data->state.url); /* clone URL */ + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + } + else if((data->req.httpcode < 300) && + (!data->state.authhost.done) && + conn->bits.authneg) { + /* no (known) authentication available, + authentication is not "done" yet and + no authentication seems to be required and + we didn't try HEAD or GET */ + if((data->state.httpreq != HTTPREQ_GET) && + (data->state.httpreq != HTTPREQ_HEAD)) { + data->req.newurl = strdup(data->state.url); /* clone URL */ + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + data->state.authhost.done = TRUE; + } + } + if(http_should_fail(data)) { + failf(data, "The requested URL returned error: %d", + data->req.httpcode); + result = CURLE_HTTP_RETURNED_ERROR; + } + + return result; +} + +#ifndef CURL_DISABLE_HTTP_AUTH +/* + * Output the correct authentication header depending on the auth type + * and whether or not it is to a proxy. + */ +static CURLcode +output_auth_headers(struct Curl_easy *data, + struct connectdata *conn, + struct auth *authstatus, + const char *request, + const char *path, + bool proxy) +{ + const char *auth = NULL; + CURLcode result = CURLE_OK; + +#ifdef CURL_DISABLE_CRYPTO_AUTH + (void)request; + (void)path; +#endif +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(authstatus->picked == CURLAUTH_AWS_SIGV4) { + auth = "AWS_SIGV4"; + result = Curl_output_aws_sigv4(data, proxy); + if(result) + return result; + } + else +#endif +#ifdef USE_SPNEGO + if(authstatus->picked == CURLAUTH_NEGOTIATE) { + auth = "Negotiate"; + result = Curl_output_negotiate(data, conn, proxy); + if(result) + return result; + } + else +#endif +#ifdef USE_NTLM + if(authstatus->picked == CURLAUTH_NTLM) { + auth = "NTLM"; + result = Curl_output_ntlm(data, proxy); + if(result) + return result; + } + else +#endif +#if defined(USE_NTLM) && defined(NTLM_WB_ENABLED) + if(authstatus->picked == CURLAUTH_NTLM_WB) { + auth = "NTLM_WB"; + result = Curl_output_ntlm_wb(data, conn, proxy); + if(result) + return result; + } + else +#endif +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(authstatus->picked == CURLAUTH_DIGEST) { + auth = "Digest"; + result = Curl_output_digest(data, + proxy, + (const unsigned char *)request, + (const unsigned char *)path); + if(result) + return result; + } + else +#endif + if(authstatus->picked == CURLAUTH_BASIC) { + /* Basic */ + if( +#ifndef CURL_DISABLE_PROXY + (proxy && conn->bits.proxy_user_passwd && + !Curl_checkProxyheaders(data, conn, "Proxy-authorization")) || +#endif + (!proxy && conn->bits.user_passwd && + !Curl_checkheaders(data, "Authorization"))) { + auth = "Basic"; + result = http_output_basic(data, proxy); + if(result) + return result; + } + + /* NOTE: this function should set 'done' TRUE, as the other auth + functions work that way */ + authstatus->done = TRUE; + } + if(authstatus->picked == CURLAUTH_BEARER) { + /* Bearer */ + if((!proxy && data->set.str[STRING_BEARER] && + !Curl_checkheaders(data, "Authorization"))) { + auth = "Bearer"; + result = http_output_bearer(data); + if(result) + return result; + } + + /* NOTE: this function should set 'done' TRUE, as the other auth + functions work that way */ + authstatus->done = TRUE; + } + + if(auth) { +#ifndef CURL_DISABLE_PROXY + infof(data, "%s auth using %s with user '%s'", + proxy ? "Proxy" : "Server", auth, + proxy ? (data->state.aptr.proxyuser ? + data->state.aptr.proxyuser : "") : + (data->state.aptr.user ? + data->state.aptr.user : "")); +#else + infof(data, "Server auth using %s with user '%s'", + auth, data->state.aptr.user ? + data->state.aptr.user : ""); +#endif + authstatus->multipass = (!authstatus->done) ? TRUE : FALSE; + } + else + authstatus->multipass = FALSE; + + return CURLE_OK; +} + +/** + * Curl_http_output_auth() setups the authentication headers for the + * host/proxy and the correct authentication + * method. data->state.authdone is set to TRUE when authentication is + * done. + * + * @param conn all information about the current connection + * @param request pointer to the request keyword + * @param path pointer to the requested path; should include query part + * @param proxytunnel boolean if this is the request setting up a "proxy + * tunnel" + * + * @returns CURLcode + */ +CURLcode +Curl_http_output_auth(struct Curl_easy *data, + struct connectdata *conn, + const char *request, + Curl_HttpReq httpreq, + const char *path, + bool proxytunnel) /* TRUE if this is the request setting + up the proxy tunnel */ +{ + CURLcode result = CURLE_OK; + struct auth *authhost; + struct auth *authproxy; + + DEBUGASSERT(data); + + authhost = &data->state.authhost; + authproxy = &data->state.authproxy; + + if( +#ifndef CURL_DISABLE_PROXY + (conn->bits.httpproxy && conn->bits.proxy_user_passwd) || +#endif + conn->bits.user_passwd || data->set.str[STRING_BEARER]) + /* continue please */; + else { + authhost->done = TRUE; + authproxy->done = TRUE; + return CURLE_OK; /* no authentication with no user or password */ + } + + if(authhost->want && !authhost->picked) + /* The app has selected one or more methods, but none has been picked + so far by a server round-trip. Then we set the picked one to the + want one, and if this is one single bit it'll be used instantly. */ + authhost->picked = authhost->want; + + if(authproxy->want && !authproxy->picked) + /* The app has selected one or more methods, but none has been picked so + far by a proxy round-trip. Then we set the picked one to the want one, + and if this is one single bit it'll be used instantly. */ + authproxy->picked = authproxy->want; + +#ifndef CURL_DISABLE_PROXY + /* Send proxy authentication header if needed */ + if(conn->bits.httpproxy && + (conn->bits.tunnel_proxy == (bit)proxytunnel)) { + result = output_auth_headers(data, conn, authproxy, request, path, TRUE); + if(result) + return result; + } + else +#else + (void)proxytunnel; +#endif /* CURL_DISABLE_PROXY */ + /* we have no proxy so let's pretend we're done authenticating + with it */ + authproxy->done = TRUE; + + /* To prevent the user+password to get sent to other than the original + host due to a location-follow, we do some weirdo checks here */ + if(!data->state.this_is_a_follow || +#ifndef CURL_DISABLE_NETRC + conn->bits.netrc || +#endif + !data->state.first_host || + data->set.allow_auth_to_other_hosts || + strcasecompare(data->state.first_host, conn->host.name)) { + result = output_auth_headers(data, conn, authhost, request, path, FALSE); + } + else + authhost->done = TRUE; + + if(((authhost->multipass && !authhost->done) || + (authproxy->multipass && !authproxy->done)) && + (httpreq != HTTPREQ_GET) && + (httpreq != HTTPREQ_HEAD)) { + /* Auth is required and we are not authenticated yet. Make a PUT or POST + with content-length zero as a "probe". */ + conn->bits.authneg = TRUE; + } + else + conn->bits.authneg = FALSE; + + return result; +} + +#else +/* when disabled */ +CURLcode +Curl_http_output_auth(struct Curl_easy *data, + struct connectdata *conn, + const char *request, + Curl_HttpReq httpreq, + const char *path, + bool proxytunnel) +{ + (void)data; + (void)conn; + (void)request; + (void)httpreq; + (void)path; + (void)proxytunnel; + return CURLE_OK; +} +#endif + +/* + * Curl_http_input_auth() deals with Proxy-Authenticate: and WWW-Authenticate: + * headers. They are dealt with both in the transfer.c main loop and in the + * proxy CONNECT loop. + */ + +static int is_valid_auth_separator(char ch) +{ + return ch == '\0' || ch == ',' || ISSPACE(ch); +} + +CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy, + const char *auth) /* the first non-space */ +{ + /* + * This resource requires authentication + */ + struct connectdata *conn = data->conn; +#ifdef USE_SPNEGO + curlnegotiate *negstate = proxy ? &conn->proxy_negotiate_state : + &conn->http_negotiate_state; +#endif + unsigned long *availp; + struct auth *authp; + + (void) conn; /* In case conditionals make it unused. */ + + if(proxy) { + availp = &data->info.proxyauthavail; + authp = &data->state.authproxy; + } + else { + availp = &data->info.httpauthavail; + authp = &data->state.authhost; + } + + /* + * Here we check if we want the specific single authentication (using ==) and + * if we do, we initiate usage of it. + * + * If the provided authentication is wanted as one out of several accepted + * types (using &), we OR this authentication type to the authavail + * variable. + * + * Note: + * + * ->picked is first set to the 'want' value (one or more bits) before the + * request is sent, and then it is again set _after_ all response 401/407 + * headers have been received but then only to a single preferred method + * (bit). + */ + + while(*auth) { +#ifdef USE_SPNEGO + if(checkprefix("Negotiate", auth) && is_valid_auth_separator(auth[9])) { + if((authp->avail & CURLAUTH_NEGOTIATE) || + Curl_auth_is_spnego_supported()) { + *availp |= CURLAUTH_NEGOTIATE; + authp->avail |= CURLAUTH_NEGOTIATE; + + if(authp->picked == CURLAUTH_NEGOTIATE) { + CURLcode result = Curl_input_negotiate(data, conn, proxy, auth); + if(!result) { + DEBUGASSERT(!data->req.newurl); + data->req.newurl = strdup(data->state.url); + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + data->state.authproblem = FALSE; + /* we received a GSS auth token and we dealt with it fine */ + *negstate = GSS_AUTHRECV; + } + else + data->state.authproblem = TRUE; + } + } + } + else +#endif +#ifdef USE_NTLM + /* NTLM support requires the SSL crypto libs */ + if(checkprefix("NTLM", auth) && is_valid_auth_separator(auth[4])) { + if((authp->avail & CURLAUTH_NTLM) || + (authp->avail & CURLAUTH_NTLM_WB) || + Curl_auth_is_ntlm_supported()) { + *availp |= CURLAUTH_NTLM; + authp->avail |= CURLAUTH_NTLM; + + if(authp->picked == CURLAUTH_NTLM || + authp->picked == CURLAUTH_NTLM_WB) { + /* NTLM authentication is picked and activated */ + CURLcode result = Curl_input_ntlm(data, proxy, auth); + if(!result) { + data->state.authproblem = FALSE; +#ifdef NTLM_WB_ENABLED + if(authp->picked == CURLAUTH_NTLM_WB) { + *availp &= ~CURLAUTH_NTLM; + authp->avail &= ~CURLAUTH_NTLM; + *availp |= CURLAUTH_NTLM_WB; + authp->avail |= CURLAUTH_NTLM_WB; + + result = Curl_input_ntlm_wb(data, conn, proxy, auth); + if(result) { + infof(data, "Authentication problem. Ignoring this."); + data->state.authproblem = TRUE; + } + } +#endif + } + else { + infof(data, "Authentication problem. Ignoring this."); + data->state.authproblem = TRUE; + } + } + } + } + else +#endif +#ifndef CURL_DISABLE_CRYPTO_AUTH + if(checkprefix("Digest", auth) && is_valid_auth_separator(auth[6])) { + if((authp->avail & CURLAUTH_DIGEST) != 0) + infof(data, "Ignoring duplicate digest auth header."); + else if(Curl_auth_is_digest_supported()) { + CURLcode result; + + *availp |= CURLAUTH_DIGEST; + authp->avail |= CURLAUTH_DIGEST; + + /* We call this function on input Digest headers even if Digest + * authentication isn't activated yet, as we need to store the + * incoming data from this header in case we are going to use + * Digest */ + result = Curl_input_digest(data, proxy, auth); + if(result) { + infof(data, "Authentication problem. Ignoring this."); + data->state.authproblem = TRUE; + } + } + } + else +#endif + if(checkprefix("Basic", auth) && + is_valid_auth_separator(auth[5])) { + *availp |= CURLAUTH_BASIC; + authp->avail |= CURLAUTH_BASIC; + if(authp->picked == CURLAUTH_BASIC) { + /* We asked for Basic authentication but got a 40X back + anyway, which basically means our name+password isn't + valid. */ + authp->avail = CURLAUTH_NONE; + infof(data, "Authentication problem. Ignoring this."); + data->state.authproblem = TRUE; + } + } + else + if(checkprefix("Bearer", auth) && + is_valid_auth_separator(auth[6])) { + *availp |= CURLAUTH_BEARER; + authp->avail |= CURLAUTH_BEARER; + if(authp->picked == CURLAUTH_BEARER) { + /* We asked for Bearer authentication but got a 40X back + anyway, which basically means our token isn't valid. */ + authp->avail = CURLAUTH_NONE; + infof(data, "Authentication problem. Ignoring this."); + data->state.authproblem = TRUE; + } + } + + /* there may be multiple methods on one line, so keep reading */ + while(*auth && *auth != ',') /* read up to the next comma */ + auth++; + if(*auth == ',') /* if we're on a comma, skip it */ + auth++; + while(*auth && ISSPACE(*auth)) + auth++; + } + + return CURLE_OK; +} + +/** + * http_should_fail() determines whether an HTTP response has gotten us + * into an error state or not. + * + * @param conn all information about the current connection + * + * @retval FALSE communications should continue + * + * @retval TRUE communications should not continue + */ +static bool http_should_fail(struct Curl_easy *data) +{ + int httpcode; + DEBUGASSERT(data); + DEBUGASSERT(data->conn); + + httpcode = data->req.httpcode; + + /* + ** If we haven't been asked to fail on error, + ** don't fail. + */ + if(!data->set.http_fail_on_error) + return FALSE; + + /* + ** Any code < 400 is never terminal. + */ + if(httpcode < 400) + return FALSE; + + /* + ** A 416 response to a resume request is presumably because the file is + ** already completely downloaded and thus not actually a fail. + */ + if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET && + httpcode == 416) + return FALSE; + + /* + ** Any code >= 400 that's not 401 or 407 is always + ** a terminal error + */ + if((httpcode != 401) && (httpcode != 407)) + return TRUE; + + /* + ** All we have left to deal with is 401 and 407 + */ + DEBUGASSERT((httpcode == 401) || (httpcode == 407)); + + /* + ** Examine the current authentication state to see if this + ** is an error. The idea is for this function to get + ** called after processing all the headers in a response + ** message. So, if we've been to asked to authenticate a + ** particular stage, and we've done it, we're OK. But, if + ** we're already completely authenticated, it's not OK to + ** get another 401 or 407. + ** + ** It is possible for authentication to go stale such that + ** the client needs to reauthenticate. Once that info is + ** available, use it here. + */ + + /* + ** Either we're not authenticating, or we're supposed to + ** be authenticating something else. This is an error. + */ + if((httpcode == 401) && !data->conn->bits.user_passwd) + return TRUE; +#ifndef CURL_DISABLE_PROXY + if((httpcode == 407) && !data->conn->bits.proxy_user_passwd) + return TRUE; +#endif + + return data->state.authproblem; +} + +#ifndef USE_HYPER +/* + * readmoredata() is a "fread() emulation" to provide POST and/or request + * data. It is used when a huge POST is to be made and the entire chunk wasn't + * sent in the first send(). This function will then be called from the + * transfer.c loop when more data is to be sent to the peer. + * + * Returns the amount of bytes it filled the buffer with. + */ +static size_t readmoredata(char *buffer, + size_t size, + size_t nitems, + void *userp) +{ + struct Curl_easy *data = (struct Curl_easy *)userp; + struct HTTP *http = data->req.p.http; + size_t fullsize = size * nitems; + + if(!http->postsize) + /* nothing to return */ + return 0; + + /* make sure that a HTTP request is never sent away chunked! */ + data->req.forbidchunk = (http->sending == HTTPSEND_REQUEST)?TRUE:FALSE; + + if(data->set.max_send_speed && + (data->set.max_send_speed < (curl_off_t)fullsize) && + (data->set.max_send_speed < http->postsize)) + /* speed limit */ + fullsize = (size_t)data->set.max_send_speed; + + else if(http->postsize <= (curl_off_t)fullsize) { + memcpy(buffer, http->postdata, (size_t)http->postsize); + fullsize = (size_t)http->postsize; + + if(http->backup.postsize) { + /* move backup data into focus and continue on that */ + http->postdata = http->backup.postdata; + http->postsize = http->backup.postsize; + data->state.fread_func = http->backup.fread_func; + data->state.in = http->backup.fread_in; + + http->sending++; /* move one step up */ + + http->backup.postsize = 0; + } + else + http->postsize = 0; + + return fullsize; + } + + memcpy(buffer, http->postdata, fullsize); + http->postdata += fullsize; + http->postsize -= fullsize; + + return fullsize; +} + +/* + * Curl_buffer_send() sends a header buffer and frees all associated + * memory. Body data may be appended to the header data if desired. + * + * Returns CURLcode + */ +CURLcode Curl_buffer_send(struct dynbuf *in, + struct Curl_easy *data, + /* add the number of sent bytes to this + counter */ + curl_off_t *bytes_written, + /* how much of the buffer contains body data */ + curl_off_t included_body_bytes, + int socketindex) +{ + ssize_t amount; + CURLcode result; + char *ptr; + size_t size; + struct connectdata *conn = data->conn; + struct HTTP *http = data->req.p.http; + size_t sendsize; + curl_socket_t sockfd; + size_t headersize; + + DEBUGASSERT(socketindex <= SECONDARYSOCKET); + + sockfd = conn->sock[socketindex]; + + /* The looping below is required since we use non-blocking sockets, but due + to the circumstances we will just loop and try again and again etc */ + + ptr = Curl_dyn_ptr(in); + size = Curl_dyn_len(in); + + headersize = size - (size_t)included_body_bytes; /* the initial part that + isn't body is header */ + + DEBUGASSERT(size > (size_t)included_body_bytes); + + result = Curl_convert_to_network(data, ptr, headersize); + /* Curl_convert_to_network calls failf if unsuccessful */ + if(result) { + /* conversion failed, free memory and return to the caller */ + Curl_dyn_free(in); + return result; + } + + if((conn->handler->flags & PROTOPT_SSL +#ifndef CURL_DISABLE_PROXY + || conn->http_proxy.proxytype == CURLPROXY_HTTPS +#endif + ) + && conn->httpversion != 20) { + /* Make sure this doesn't send more body bytes than what the max send + speed says. The request bytes do not count to the max speed. + */ + if(data->set.max_send_speed && + (included_body_bytes > data->set.max_send_speed)) { + curl_off_t overflow = included_body_bytes - data->set.max_send_speed; + DEBUGASSERT((size_t)overflow < size); + sendsize = size - (size_t)overflow; + } + else + sendsize = size; + + /* OpenSSL is very picky and we must send the SAME buffer pointer to the + library when we attempt to re-send this buffer. Sending the same data + is not enough, we must use the exact same address. For this reason, we + must copy the data to the uploadbuffer first, since that is the buffer + we will be using if this send is retried later. + */ + result = Curl_get_upload_buffer(data); + if(result) { + /* malloc failed, free memory and return to the caller */ + Curl_dyn_free(in); + return result; + } + /* We never send more than upload_buffer_size bytes in one single chunk + when we speak HTTPS, as if only a fraction of it is sent now, this data + needs to fit into the normal read-callback buffer later on and that + buffer is using this size. + */ + if(sendsize > (size_t)data->set.upload_buffer_size) + sendsize = (size_t)data->set.upload_buffer_size; + + memcpy(data->state.ulbuf, ptr, sendsize); + ptr = data->state.ulbuf; + } + else { +#ifdef CURLDEBUG + /* Allow debug builds to override this logic to force short initial + sends + */ + char *p = getenv("CURL_SMALLREQSEND"); + if(p) { + size_t altsize = (size_t)strtoul(p, NULL, 10); + if(altsize) + sendsize = CURLMIN(size, altsize); + else + sendsize = size; + } + else +#endif + { + /* Make sure this doesn't send more body bytes than what the max send + speed says. The request bytes do not count to the max speed. + */ + if(data->set.max_send_speed && + (included_body_bytes > data->set.max_send_speed)) { + curl_off_t overflow = included_body_bytes - data->set.max_send_speed; + DEBUGASSERT((size_t)overflow < size); + sendsize = size - (size_t)overflow; + } + else + sendsize = size; + } + } + + result = Curl_write(data, sockfd, ptr, sendsize, &amount); + + if(!result) { + /* + * Note that we may not send the entire chunk at once, and we have a set + * number of data bytes at the end of the big buffer (out of which we may + * only send away a part). + */ + /* how much of the header that was sent */ + size_t headlen = (size_t)amount>headersize ? headersize : (size_t)amount; + size_t bodylen = amount - headlen; + + /* this data _may_ contain binary stuff */ + Curl_debug(data, CURLINFO_HEADER_OUT, ptr, headlen); + if(bodylen) + /* there was body data sent beyond the initial header part, pass that on + to the debug callback too */ + Curl_debug(data, CURLINFO_DATA_OUT, ptr + headlen, bodylen); + + /* 'amount' can never be a very large value here so typecasting it so a + signed 31 bit value should not cause problems even if ssize_t is + 64bit */ + *bytes_written += (long)amount; + + if(http) { + /* if we sent a piece of the body here, up the byte counter for it + accordingly */ + data->req.writebytecount += bodylen; + Curl_pgrsSetUploadCounter(data, data->req.writebytecount); + + if((size_t)amount != size) { + /* The whole request could not be sent in one system call. We must + queue it up and send it later when we get the chance. We must not + loop here and wait until it might work again. */ + + size -= amount; + + ptr = Curl_dyn_ptr(in) + amount; + + /* backup the currently set pointers */ + http->backup.fread_func = data->state.fread_func; + http->backup.fread_in = data->state.in; + http->backup.postdata = http->postdata; + http->backup.postsize = http->postsize; + + /* set the new pointers for the request-sending */ + data->state.fread_func = (curl_read_callback)readmoredata; + data->state.in = (void *)data; + http->postdata = ptr; + http->postsize = (curl_off_t)size; + + /* this much data is remaining header: */ + data->req.pendingheader = headersize - headlen; + + http->send_buffer = *in; /* copy the whole struct */ + http->sending = HTTPSEND_REQUEST; + + return CURLE_OK; + } + http->sending = HTTPSEND_BODY; + /* the full buffer was sent, clean up and return */ + } + else { + if((size_t)amount != size) + /* We have no continue-send mechanism now, fail. This can only happen + when this function is used from the CONNECT sending function. We + currently (stupidly) assume that the whole request is always sent + away in the first single chunk. + + This needs FIXing. + */ + return CURLE_SEND_ERROR; + } + } + Curl_dyn_free(in); + + /* no remaining header data */ + data->req.pendingheader = 0; + return result; +} + +#endif + +/* end of the add_buffer functions */ +/* ------------------------------------------------------------------------- */ + + + +/* + * Curl_compareheader() + * + * Returns TRUE if 'headerline' contains the 'header' with given 'content'. + * Pass headers WITH the colon. + */ +bool +Curl_compareheader(const char *headerline, /* line to check */ + const char *header, /* header keyword _with_ colon */ + const char *content) /* content string to find */ +{ + /* RFC2616, section 4.2 says: "Each header field consists of a name followed + * by a colon (":") and the field value. Field names are case-insensitive. + * The field value MAY be preceded by any amount of LWS, though a single SP + * is preferred." */ + + size_t hlen = strlen(header); + size_t clen; + size_t len; + const char *start; + const char *end; + + if(!strncasecompare(headerline, header, hlen)) + return FALSE; /* doesn't start with header */ + + /* pass the header */ + start = &headerline[hlen]; + + /* pass all whitespace */ + while(*start && ISSPACE(*start)) + start++; + + /* find the end of the header line */ + end = strchr(start, '\r'); /* lines end with CRLF */ + if(!end) { + /* in case there's a non-standard compliant line here */ + end = strchr(start, '\n'); + + if(!end) + /* hm, there's no line ending here, use the zero byte! */ + end = strchr(start, '\0'); + } + + len = end-start; /* length of the content part of the input line */ + clen = strlen(content); /* length of the word to find */ + + /* find the content string in the rest of the line */ + for(; len >= clen; len--, start++) { + if(strncasecompare(start, content, clen)) + return TRUE; /* match! */ + } + + return FALSE; /* no match */ +} + +/* + * Curl_http_connect() performs HTTP stuff to do at connect-time, called from + * the generic Curl_connect(). + */ +CURLcode Curl_http_connect(struct Curl_easy *data, bool *done) +{ + CURLcode result; + struct connectdata *conn = data->conn; + + /* We default to persistent connections. We set this already in this connect + function to make the re-use checks properly be able to check this bit. */ + connkeep(conn, "HTTP default"); + +#ifndef CURL_DISABLE_PROXY + /* the CONNECT procedure might not have been completed */ + result = Curl_proxy_connect(data, FIRSTSOCKET); + if(result) + return result; + + if(conn->bits.proxy_connect_closed) + /* this is not an error, just part of the connection negotiation */ + return CURLE_OK; + + if(CONNECT_FIRSTSOCKET_PROXY_SSL()) + return CURLE_OK; /* wait for HTTPS proxy SSL initialization to complete */ + + if(Curl_connect_ongoing(conn)) + /* nothing else to do except wait right now - we're not done here. */ + return CURLE_OK; + + if(data->set.haproxyprotocol) { + /* add HAProxy PROXY protocol header */ + result = add_haproxy_protocol_header(data); + if(result) + return result; + } +#endif + + if(conn->given->protocol & CURLPROTO_HTTPS) { + /* perform SSL initialization */ + result = https_connecting(data, done); + if(result) + return result; + } + else + *done = TRUE; + + return CURLE_OK; +} + +/* this returns the socket to wait for in the DO and DOING state for the multi + interface and then we're always _sending_ a request and thus we wait for + the single socket to become writable only */ +static int http_getsock_do(struct Curl_easy *data, + struct connectdata *conn, + curl_socket_t *socks) +{ + /* write mode */ + (void)data; + socks[0] = conn->sock[FIRSTSOCKET]; + return GETSOCK_WRITESOCK(0); +} + +#ifndef CURL_DISABLE_PROXY +static CURLcode add_haproxy_protocol_header(struct Curl_easy *data) +{ + struct dynbuf req; + CURLcode result; + const char *tcp_version; + DEBUGASSERT(data->conn); + Curl_dyn_init(&req, DYN_HAXPROXY); + +#ifdef USE_UNIX_SOCKETS + if(data->conn->unix_domain_socket) + /* the buffer is large enough to hold this! */ + result = Curl_dyn_add(&req, "PROXY UNKNOWN\r\n"); + else { +#endif + /* Emit the correct prefix for IPv6 */ + tcp_version = data->conn->bits.ipv6 ? "TCP6" : "TCP4"; + + result = Curl_dyn_addf(&req, "PROXY %s %s %s %i %i\r\n", + tcp_version, + data->info.conn_local_ip, + data->info.conn_primary_ip, + data->info.conn_local_port, + data->info.conn_primary_port); + +#ifdef USE_UNIX_SOCKETS + } +#endif + + if(!result) + result = Curl_buffer_send(&req, data, &data->info.request_size, + 0, FIRSTSOCKET); + return result; +} +#endif + +#ifdef USE_SSL +static CURLcode https_connecting(struct Curl_easy *data, bool *done) +{ + CURLcode result; + struct connectdata *conn = data->conn; + DEBUGASSERT((data) && (data->conn->handler->flags & PROTOPT_SSL)); + +#ifdef ENABLE_QUIC + if(conn->transport == TRNSPRT_QUIC) { + *done = TRUE; + return CURLE_OK; + } +#endif + + /* perform SSL initialization for this socket */ + result = Curl_ssl_connect_nonblocking(data, conn, FALSE, FIRSTSOCKET, done); + if(result) + connclose(conn, "Failed HTTPS connection"); + + return result; +} + +static int https_getsock(struct Curl_easy *data, + struct connectdata *conn, + curl_socket_t *socks) +{ + (void)data; + if(conn->handler->flags & PROTOPT_SSL) + return Curl_ssl->getsock(conn, socks); + return GETSOCK_BLANK; +} +#endif /* USE_SSL */ + +/* + * Curl_http_done() gets called after a single HTTP request has been + * performed. + */ + +CURLcode Curl_http_done(struct Curl_easy *data, + CURLcode status, bool premature) +{ + struct connectdata *conn = data->conn; + struct HTTP *http = data->req.p.http; + + /* Clear multipass flag. If authentication isn't done yet, then it will get + * a chance to be set back to true when we output the next auth header */ + data->state.authhost.multipass = FALSE; + data->state.authproxy.multipass = FALSE; + + Curl_unencode_cleanup(data); + + /* set the proper values (possibly modified on POST) */ + conn->seek_func = data->set.seek_func; /* restore */ + conn->seek_client = data->set.seek_client; /* restore */ + + if(!http) + return CURLE_OK; + + Curl_dyn_free(&http->send_buffer); + Curl_http2_done(data, premature); + Curl_quic_done(data, premature); + Curl_mime_cleanpart(&http->form); + Curl_dyn_reset(&data->state.headerb); + Curl_hyper_done(data); + + if(status) + return status; + + if(!premature && /* this check is pointless when DONE is called before the + entire operation is complete */ + !conn->bits.retry && + !data->set.connect_only && + (data->req.bytecount + + data->req.headerbytecount - + data->req.deductheadercount) <= 0) { + /* If this connection isn't simply closed to be retried, AND nothing was + read from the HTTP server (that counts), this can't be right so we + return an error here */ + failf(data, "Empty reply from server"); + /* Mark it as closed to avoid the "left intact" message */ + streamclose(conn, "Empty reply from server"); + return CURLE_GOT_NOTHING; + } + + return CURLE_OK; +} + +/* + * Determine if we should use HTTP 1.1 (OR BETTER) for this request. Reasons + * to avoid it include: + * + * - if the user specifically requested HTTP 1.0 + * - if the server we are connected to only supports 1.0 + * - if any server previously contacted to handle this request only supports + * 1.0. + */ +bool Curl_use_http_1_1plus(const struct Curl_easy *data, + const struct connectdata *conn) +{ + if((data->state.httpversion == 10) || (conn->httpversion == 10)) + return FALSE; + if((data->state.httpwant == CURL_HTTP_VERSION_1_0) && + (conn->httpversion <= 10)) + return FALSE; + return ((data->state.httpwant == CURL_HTTP_VERSION_NONE) || + (data->state.httpwant >= CURL_HTTP_VERSION_1_1)); +} + +#ifndef USE_HYPER +static const char *get_http_string(const struct Curl_easy *data, + const struct connectdata *conn) +{ +#ifdef ENABLE_QUIC + if((data->state.httpwant == CURL_HTTP_VERSION_3) || + (conn->httpversion == 30)) + return "3"; +#endif + +#ifdef USE_NGHTTP2 + if(conn->proto.httpc.h2) + return "2"; +#endif + + if(Curl_use_http_1_1plus(data, conn)) + return "1.1"; + + return "1.0"; +} +#endif + +/* check and possibly add an Expect: header */ +static CURLcode expect100(struct Curl_easy *data, + struct connectdata *conn, + struct dynbuf *req) +{ + CURLcode result = CURLE_OK; + data->state.expect100header = FALSE; /* default to false unless it is set + to TRUE below */ + if(!data->state.disableexpect && Curl_use_http_1_1plus(data, conn) && + (conn->httpversion < 20)) { + /* if not doing HTTP 1.0 or version 2, or disabled explicitly, we add an + Expect: 100-continue to the headers which actually speeds up post + operations (as there is one packet coming back from the web server) */ + const char *ptr = Curl_checkheaders(data, "Expect"); + if(ptr) { + data->state.expect100header = + Curl_compareheader(ptr, "Expect:", "100-continue"); + } + else { + result = Curl_dyn_add(req, "Expect: 100-continue\r\n"); + if(!result) + data->state.expect100header = TRUE; + } + } + + return result; +} + +enum proxy_use { + HEADER_SERVER, /* direct to server */ + HEADER_PROXY, /* regular request to proxy */ + HEADER_CONNECT /* sending CONNECT to a proxy */ +}; + +/* used to compile the provided trailers into one buffer + will return an error code if one of the headers is + not formatted correctly */ +CURLcode Curl_http_compile_trailers(struct curl_slist *trailers, + struct dynbuf *b, + struct Curl_easy *handle) +{ + char *ptr = NULL; + CURLcode result = CURLE_OK; + const char *endofline_native = NULL; + const char *endofline_network = NULL; + + if( +#ifdef CURL_DO_LINEEND_CONV + (handle->state.prefer_ascii) || +#endif + (handle->set.crlf)) { + /* \n will become \r\n later on */ + endofline_native = "\n"; + endofline_network = "\x0a"; + } + else { + endofline_native = "\r\n"; + endofline_network = "\x0d\x0a"; + } + + while(trailers) { + /* only add correctly formatted trailers */ + ptr = strchr(trailers->data, ':'); + if(ptr && *(ptr + 1) == ' ') { + result = Curl_dyn_add(b, trailers->data); + if(result) + return result; + result = Curl_dyn_add(b, endofline_native); + if(result) + return result; + } + else + infof(handle, "Malformatted trailing header ! Skipping trailer."); + trailers = trailers->next; + } + result = Curl_dyn_add(b, endofline_network); + return result; +} + +CURLcode Curl_add_custom_headers(struct Curl_easy *data, + bool is_connect, +#ifndef USE_HYPER + struct dynbuf *req +#else + void *req +#endif + ) +{ + struct connectdata *conn = data->conn; + char *ptr; + struct curl_slist *h[2]; + struct curl_slist *headers; + int numlists = 1; /* by default */ + int i; + +#ifndef CURL_DISABLE_PROXY + enum proxy_use proxy; + + if(is_connect) + proxy = HEADER_CONNECT; + else + proxy = conn->bits.httpproxy && !conn->bits.tunnel_proxy? + HEADER_PROXY:HEADER_SERVER; + + switch(proxy) { + case HEADER_SERVER: + h[0] = data->set.headers; + break; + case HEADER_PROXY: + h[0] = data->set.headers; + if(data->set.sep_headers) { + h[1] = data->set.proxyheaders; + numlists++; + } + break; + case HEADER_CONNECT: + if(data->set.sep_headers) + h[0] = data->set.proxyheaders; + else + h[0] = data->set.headers; + break; + } +#else + (void)is_connect; + h[0] = data->set.headers; +#endif + + /* loop through one or two lists */ + for(i = 0; i < numlists; i++) { + headers = h[i]; + + while(headers) { + char *semicolonp = NULL; + ptr = strchr(headers->data, ':'); + if(!ptr) { + char *optr; + /* no colon, semicolon? */ + ptr = strchr(headers->data, ';'); + if(ptr) { + optr = ptr; + ptr++; /* pass the semicolon */ + while(*ptr && ISSPACE(*ptr)) + ptr++; + + if(*ptr) { + /* this may be used for something else in the future */ + optr = NULL; + } + else { + if(*(--ptr) == ';') { + /* copy the source */ + semicolonp = strdup(headers->data); + if(!semicolonp) { +#ifndef USE_HYPER + Curl_dyn_free(req); +#endif + return CURLE_OUT_OF_MEMORY; + } + /* put a colon where the semicolon is */ + semicolonp[ptr - headers->data] = ':'; + /* point at the colon */ + optr = &semicolonp [ptr - headers->data]; + } + } + ptr = optr; + } + } + if(ptr) { + /* we require a colon for this to be a true header */ + + ptr++; /* pass the colon */ + while(*ptr && ISSPACE(*ptr)) + ptr++; + + if(*ptr || semicolonp) { + /* only send this if the contents was non-blank or done special */ + CURLcode result = CURLE_OK; + char *compare = semicolonp ? semicolonp : headers->data; + + if(data->state.aptr.host && + /* a Host: header was sent already, don't pass on any custom Host: + header as that will produce *two* in the same request! */ + checkprefix("Host:", compare)) + ; + else if(data->state.httpreq == HTTPREQ_POST_FORM && + /* this header (extended by formdata.c) is sent later */ + checkprefix("Content-Type:", compare)) + ; + else if(data->state.httpreq == HTTPREQ_POST_MIME && + /* this header is sent later */ + checkprefix("Content-Type:", compare)) + ; + else if(conn->bits.authneg && + /* while doing auth neg, don't allow the custom length since + we will force length zero then */ + checkprefix("Content-Length:", compare)) + ; + else if(data->state.aptr.te && + /* when asking for Transfer-Encoding, don't pass on a custom + Connection: */ + checkprefix("Connection:", compare)) + ; + else if((conn->httpversion >= 20) && + checkprefix("Transfer-Encoding:", compare)) + /* HTTP/2 doesn't support chunked requests */ + ; + else if((checkprefix("Authorization:", compare) || + checkprefix("Cookie:", compare)) && + /* be careful of sending this potentially sensitive header to + other hosts */ + (data->state.this_is_a_follow && + data->state.first_host && + !data->set.allow_auth_to_other_hosts && + !strcasecompare(data->state.first_host, conn->host.name))) + ; + else { +#ifdef USE_HYPER + result = Curl_hyper_header(data, req, compare); +#else + result = Curl_dyn_addf(req, "%s\r\n", compare); +#endif + } + if(semicolonp) + free(semicolonp); + if(result) + return result; + } + } + headers = headers->next; + } + } + + return CURLE_OK; +} + +#ifndef CURL_DISABLE_PARSEDATE +CURLcode Curl_add_timecondition(struct Curl_easy *data, +#ifndef USE_HYPER + struct dynbuf *req +#else + void *req +#endif + ) +{ + const struct tm *tm; + struct tm keeptime; + CURLcode result; + char datestr[80]; + const char *condp; + + if(data->set.timecondition == CURL_TIMECOND_NONE) + /* no condition was asked for */ + return CURLE_OK; + + result = Curl_gmtime(data->set.timevalue, &keeptime); + if(result) { + failf(data, "Invalid TIMEVALUE"); + return result; + } + tm = &keeptime; + + switch(data->set.timecondition) { + default: + return CURLE_BAD_FUNCTION_ARGUMENT; + + case CURL_TIMECOND_IFMODSINCE: + condp = "If-Modified-Since"; + break; + case CURL_TIMECOND_IFUNMODSINCE: + condp = "If-Unmodified-Since"; + break; + case CURL_TIMECOND_LASTMOD: + condp = "Last-Modified"; + break; + } + + if(Curl_checkheaders(data, condp)) { + /* A custom header was specified; it will be sent instead. */ + return CURLE_OK; + } + + /* The If-Modified-Since header family should have their times set in + * GMT as RFC2616 defines: "All HTTP date/time stamps MUST be + * represented in Greenwich Mean Time (GMT), without exception. For the + * purposes of HTTP, GMT is exactly equal to UTC (Coordinated Universal + * Time)." (see page 20 of RFC2616). + */ + + /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ + msnprintf(datestr, sizeof(datestr), + "%s: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n", + condp, + Curl_wkday[tm->tm_wday?tm->tm_wday-1:6], + tm->tm_mday, + Curl_month[tm->tm_mon], + tm->tm_year + 1900, + tm->tm_hour, + tm->tm_min, + tm->tm_sec); + +#ifndef USE_HYPER + result = Curl_dyn_add(req, datestr); +#else + result = Curl_hyper_header(data, req, datestr); +#endif + + return result; +} +#else +/* disabled */ +CURLcode Curl_add_timecondition(struct Curl_easy *data, + struct dynbuf *req) +{ + (void)data; + (void)req; + return CURLE_OK; +} +#endif + +void Curl_http_method(struct Curl_easy *data, struct connectdata *conn, + const char **method, Curl_HttpReq *reqp) +{ + Curl_HttpReq httpreq = data->state.httpreq; + const char *request; + if((conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_FTP)) && + data->set.upload) + httpreq = HTTPREQ_PUT; + + /* Now set the 'request' pointer to the proper request string */ + if(data->set.str[STRING_CUSTOMREQUEST]) + request = data->set.str[STRING_CUSTOMREQUEST]; + else { + if(data->set.opt_no_body) + request = "HEAD"; + else { + DEBUGASSERT((httpreq >= HTTPREQ_GET) && (httpreq <= HTTPREQ_HEAD)); + switch(httpreq) { + case HTTPREQ_POST: + case HTTPREQ_POST_FORM: + case HTTPREQ_POST_MIME: + request = "POST"; + break; + case HTTPREQ_PUT: + request = "PUT"; + break; + default: /* this should never happen */ + case HTTPREQ_GET: + request = "GET"; + break; + case HTTPREQ_HEAD: + request = "HEAD"; + break; + } + } + } + *method = request; + *reqp = httpreq; +} + +CURLcode Curl_http_useragent(struct Curl_easy *data) +{ + /* The User-Agent string might have been allocated in url.c already, because + it might have been used in the proxy connect, but if we have got a header + with the user-agent string specified, we erase the previously made string + here. */ + if(Curl_checkheaders(data, "User-Agent")) { + free(data->state.aptr.uagent); + data->state.aptr.uagent = NULL; + } + return CURLE_OK; +} + + +CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn) +{ + const char *ptr; + if(!data->state.this_is_a_follow) { + /* Free to avoid leaking memory on multiple requests*/ + free(data->state.first_host); + + data->state.first_host = strdup(conn->host.name); + if(!data->state.first_host) + return CURLE_OUT_OF_MEMORY; + + data->state.first_remote_port = conn->remote_port; + } + Curl_safefree(data->state.aptr.host); + + ptr = Curl_checkheaders(data, "Host"); + if(ptr && (!data->state.this_is_a_follow || + strcasecompare(data->state.first_host, conn->host.name))) { +#if !defined(CURL_DISABLE_COOKIES) + /* If we have a given custom Host: header, we extract the host name in + order to possibly use it for cookie reasons later on. We only allow the + custom Host: header if this is NOT a redirect, as setting Host: in the + redirected request is being out on thin ice. Except if the host name + is the same as the first one! */ + char *cookiehost = Curl_copy_header_value(ptr); + if(!cookiehost) + return CURLE_OUT_OF_MEMORY; + if(!*cookiehost) + /* ignore empty data */ + free(cookiehost); + else { + /* If the host begins with '[', we start searching for the port after + the bracket has been closed */ + if(*cookiehost == '[') { + char *closingbracket; + /* since the 'cookiehost' is an allocated memory area that will be + freed later we cannot simply increment the pointer */ + memmove(cookiehost, cookiehost + 1, strlen(cookiehost) - 1); + closingbracket = strchr(cookiehost, ']'); + if(closingbracket) + *closingbracket = 0; + } + else { + int startsearch = 0; + char *colon = strchr(cookiehost + startsearch, ':'); + if(colon) + *colon = 0; /* The host must not include an embedded port number */ + } + Curl_safefree(data->state.aptr.cookiehost); + data->state.aptr.cookiehost = cookiehost; + } +#endif + + if(strcmp("Host:", ptr)) { + data->state.aptr.host = aprintf("Host:%s\r\n", &ptr[5]); + if(!data->state.aptr.host) + return CURLE_OUT_OF_MEMORY; + } + else + /* when clearing the header */ + data->state.aptr.host = NULL; + } + else { + /* When building Host: headers, we must put the host name within + [brackets] if the host name is a plain IPv6-address. RFC2732-style. */ + const char *host = conn->host.name; + + if(((conn->given->protocol&CURLPROTO_HTTPS) && + (conn->remote_port == PORT_HTTPS)) || + ((conn->given->protocol&CURLPROTO_HTTP) && + (conn->remote_port == PORT_HTTP)) ) + /* if(HTTPS on port 443) OR (HTTP on port 80) then don't include + the port number in the host string */ + data->state.aptr.host = aprintf("Host: %s%s%s\r\n", + conn->bits.ipv6_ip?"[":"", + host, + conn->bits.ipv6_ip?"]":""); + else + data->state.aptr.host = aprintf("Host: %s%s%s:%d\r\n", + conn->bits.ipv6_ip?"[":"", + host, + conn->bits.ipv6_ip?"]":"", + conn->remote_port); + + if(!data->state.aptr.host) + /* without Host: we can't make a nice request */ + return CURLE_OUT_OF_MEMORY; + } + return CURLE_OK; +} + +/* + * Append the request-target to the HTTP request + */ +CURLcode Curl_http_target(struct Curl_easy *data, + struct connectdata *conn, + struct dynbuf *r) +{ + CURLcode result = CURLE_OK; + const char *path = data->state.up.path; + const char *query = data->state.up.query; + + if(data->set.str[STRING_TARGET]) { + path = data->set.str[STRING_TARGET]; + query = NULL; + } + +#ifndef CURL_DISABLE_PROXY + if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) { + /* Using a proxy but does not tunnel through it */ + + /* The path sent to the proxy is in fact the entire URL. But if the remote + host is a IDN-name, we must make sure that the request we produce only + uses the encoded host name! */ + + /* and no fragment part */ + CURLUcode uc; + char *url; + CURLU *h = curl_url_dup(data->state.uh); + if(!h) + return CURLE_OUT_OF_MEMORY; + + if(conn->host.dispname != conn->host.name) { + uc = curl_url_set(h, CURLUPART_HOST, conn->host.name, 0); + if(uc) { + curl_url_cleanup(h); + return CURLE_OUT_OF_MEMORY; + } + } + uc = curl_url_set(h, CURLUPART_FRAGMENT, NULL, 0); + if(uc) { + curl_url_cleanup(h); + return CURLE_OUT_OF_MEMORY; + } + + if(strcasecompare("http", data->state.up.scheme)) { + /* when getting HTTP, we don't want the userinfo the URL */ + uc = curl_url_set(h, CURLUPART_USER, NULL, 0); + if(uc) { + curl_url_cleanup(h); + return CURLE_OUT_OF_MEMORY; + } + uc = curl_url_set(h, CURLUPART_PASSWORD, NULL, 0); + if(uc) { + curl_url_cleanup(h); + return CURLE_OUT_OF_MEMORY; + } + } + /* Extract the URL to use in the request. Store in STRING_TEMP_URL for + clean-up reasons if the function returns before the free() further + down. */ + uc = curl_url_get(h, CURLUPART_URL, &url, CURLU_NO_DEFAULT_PORT); + if(uc) { + curl_url_cleanup(h); + return CURLE_OUT_OF_MEMORY; + } + + curl_url_cleanup(h); + + /* target or url */ + result = Curl_dyn_add(r, data->set.str[STRING_TARGET]? + data->set.str[STRING_TARGET]:url); + free(url); + if(result) + return (result); + + if(strcasecompare("ftp", data->state.up.scheme)) { + if(data->set.proxy_transfer_mode) { + /* when doing ftp, append ;type= if not present */ + char *type = strstr(path, ";type="); + if(type && type[6] && type[7] == 0) { + switch(Curl_raw_toupper(type[6])) { + case 'A': + case 'D': + case 'I': + break; + default: + type = NULL; + } + } + if(!type) { + result = Curl_dyn_addf(r, ";type=%c", + data->state.prefer_ascii ? 'a' : 'i'); + if(result) + return result; + } + } + } + } + + else +#else + (void)conn; /* not used in disabled-proxy builds */ +#endif + { + result = Curl_dyn_add(r, path); + if(result) + return result; + if(query) + result = Curl_dyn_addf(r, "?%s", query); + } + + return result; +} + +CURLcode Curl_http_body(struct Curl_easy *data, struct connectdata *conn, + Curl_HttpReq httpreq, const char **tep) +{ + CURLcode result = CURLE_OK; + const char *ptr; + struct HTTP *http = data->req.p.http; + http->postsize = 0; + + switch(httpreq) { + case HTTPREQ_POST_MIME: + http->sendit = &data->set.mimepost; + break; + case HTTPREQ_POST_FORM: + /* Convert the form structure into a mime structure. */ + Curl_mime_cleanpart(&http->form); + result = Curl_getformdata(data, &http->form, data->set.httppost, + data->state.fread_func); + if(result) + return result; + http->sendit = &http->form; + break; + default: + http->sendit = NULL; + } + +#ifndef CURL_DISABLE_MIME + if(http->sendit) { + const char *cthdr = Curl_checkheaders(data, "Content-Type"); + + /* Read and seek body only. */ + http->sendit->flags |= MIME_BODY_ONLY; + + /* Prepare the mime structure headers & set content type. */ + + if(cthdr) + for(cthdr += 13; *cthdr == ' '; cthdr++) + ; + else if(http->sendit->kind == MIMEKIND_MULTIPART) + cthdr = "multipart/form-data"; + + curl_mime_headers(http->sendit, data->set.headers, 0); + result = Curl_mime_prepare_headers(http->sendit, cthdr, + NULL, MIMESTRATEGY_FORM); + curl_mime_headers(http->sendit, NULL, 0); + if(!result) + result = Curl_mime_rewind(http->sendit); + if(result) + return result; + http->postsize = Curl_mime_size(http->sendit); + } +#endif + + ptr = Curl_checkheaders(data, "Transfer-Encoding"); + if(ptr) { + /* Some kind of TE is requested, check if 'chunked' is chosen */ + data->req.upload_chunky = + Curl_compareheader(ptr, "Transfer-Encoding:", "chunked"); + } + else { + if((conn->handler->protocol & PROTO_FAMILY_HTTP) && + (((httpreq == HTTPREQ_POST_MIME || httpreq == HTTPREQ_POST_FORM) && + http->postsize < 0) || + ((data->set.upload || httpreq == HTTPREQ_POST) && + data->state.infilesize == -1))) { + if(conn->bits.authneg) + /* don't enable chunked during auth neg */ + ; + else if(Curl_use_http_1_1plus(data, conn)) { + if(conn->httpversion < 20) + /* HTTP, upload, unknown file size and not HTTP 1.0 */ + data->req.upload_chunky = TRUE; + } + else { + failf(data, "Chunky upload is not supported by HTTP 1.0"); + return CURLE_UPLOAD_FAILED; + } + } + else { + /* else, no chunky upload */ + data->req.upload_chunky = FALSE; + } + + if(data->req.upload_chunky) + *tep = "Transfer-Encoding: chunked\r\n"; + } + return result; +} + +CURLcode Curl_http_bodysend(struct Curl_easy *data, struct connectdata *conn, + struct dynbuf *r, Curl_HttpReq httpreq) +{ +#ifndef USE_HYPER + /* Hyper always handles the body separately */ + curl_off_t included_body = 0; +#endif + CURLcode result = CURLE_OK; + struct HTTP *http = data->req.p.http; + const char *ptr; + + /* If 'authdone' is FALSE, we must not set the write socket index to the + Curl_transfer() call below, as we're not ready to actually upload any + data yet. */ + + switch(httpreq) { + + case HTTPREQ_PUT: /* Let's PUT the data to the server! */ + + if(conn->bits.authneg) + http->postsize = 0; + else + http->postsize = data->state.infilesize; + + if((http->postsize != -1) && !data->req.upload_chunky && + (conn->bits.authneg || !Curl_checkheaders(data, "Content-Length"))) { + /* only add Content-Length if not uploading chunked */ + result = Curl_dyn_addf(r, "Content-Length: %" CURL_FORMAT_CURL_OFF_T + "\r\n", http->postsize); + if(result) + return result; + } + + if(http->postsize) { + result = expect100(data, conn, r); + if(result) + return result; + } + + /* end of headers */ + result = Curl_dyn_add(r, "\r\n"); + if(result) + return result; + + /* set the upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, http->postsize); + + /* this sends the buffer and frees all the buffer resources */ + result = Curl_buffer_send(r, data, &data->info.request_size, 0, + FIRSTSOCKET); + if(result) + failf(data, "Failed sending PUT request"); + else + /* prepare for transfer */ + Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, + http->postsize?FIRSTSOCKET:-1); + if(result) + return result; + break; + + case HTTPREQ_POST_FORM: + case HTTPREQ_POST_MIME: + /* This is form posting using mime data. */ + if(conn->bits.authneg) { + /* nothing to post! */ + result = Curl_dyn_add(r, "Content-Length: 0\r\n\r\n"); + if(result) + return result; + + result = Curl_buffer_send(r, data, &data->info.request_size, 0, + FIRSTSOCKET); + if(result) + failf(data, "Failed sending POST request"); + else + /* setup variables for the upcoming transfer */ + Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1); + break; + } + + data->state.infilesize = http->postsize; + + /* We only set Content-Length and allow a custom Content-Length if + we don't upload data chunked, as RFC2616 forbids us to set both + kinds of headers (Transfer-Encoding: chunked and Content-Length) */ + if(http->postsize != -1 && !data->req.upload_chunky && + (conn->bits.authneg || !Curl_checkheaders(data, "Content-Length"))) { + /* we allow replacing this header if not during auth negotiation, + although it isn't very wise to actually set your own */ + result = Curl_dyn_addf(r, + "Content-Length: %" CURL_FORMAT_CURL_OFF_T + "\r\n", http->postsize); + if(result) + return result; + } + +#ifndef CURL_DISABLE_MIME + /* Output mime-generated headers. */ + { + struct curl_slist *hdr; + + for(hdr = http->sendit->curlheaders; hdr; hdr = hdr->next) { + result = Curl_dyn_addf(r, "%s\r\n", hdr->data); + if(result) + return result; + } + } +#endif + + /* For really small posts we don't use Expect: headers at all, and for + the somewhat bigger ones we allow the app to disable it. Just make + sure that the expect100header is always set to the preferred value + here. */ + ptr = Curl_checkheaders(data, "Expect"); + if(ptr) { + data->state.expect100header = + Curl_compareheader(ptr, "Expect:", "100-continue"); + } + else if(http->postsize > EXPECT_100_THRESHOLD || http->postsize < 0) { + result = expect100(data, conn, r); + if(result) + return result; + } + else + data->state.expect100header = FALSE; + + /* make the request end in a true CRLF */ + result = Curl_dyn_add(r, "\r\n"); + if(result) + return result; + + /* set the upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, http->postsize); + + /* Read from mime structure. */ + data->state.fread_func = (curl_read_callback) Curl_mime_read; + data->state.in = (void *) http->sendit; + http->sending = HTTPSEND_BODY; + + /* this sends the buffer and frees all the buffer resources */ + result = Curl_buffer_send(r, data, &data->info.request_size, 0, + FIRSTSOCKET); + if(result) + failf(data, "Failed sending POST request"); + else + /* prepare for transfer */ + Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, + http->postsize?FIRSTSOCKET:-1); + if(result) + return result; + + break; + + case HTTPREQ_POST: + /* this is the simple POST, using x-www-form-urlencoded style */ + + if(conn->bits.authneg) + http->postsize = 0; + else + /* the size of the post body */ + http->postsize = data->state.infilesize; + + /* We only set Content-Length and allow a custom Content-Length if + we don't upload data chunked, as RFC2616 forbids us to set both + kinds of headers (Transfer-Encoding: chunked and Content-Length) */ + if((http->postsize != -1) && !data->req.upload_chunky && + (conn->bits.authneg || !Curl_checkheaders(data, "Content-Length"))) { + /* we allow replacing this header if not during auth negotiation, + although it isn't very wise to actually set your own */ + result = Curl_dyn_addf(r, "Content-Length: %" CURL_FORMAT_CURL_OFF_T + "\r\n", http->postsize); + if(result) + return result; + } + + if(!Curl_checkheaders(data, "Content-Type")) { + result = Curl_dyn_add(r, "Content-Type: application/" + "x-www-form-urlencoded\r\n"); + if(result) + return result; + } + + /* For really small posts we don't use Expect: headers at all, and for + the somewhat bigger ones we allow the app to disable it. Just make + sure that the expect100header is always set to the preferred value + here. */ + ptr = Curl_checkheaders(data, "Expect"); + if(ptr) { + data->state.expect100header = + Curl_compareheader(ptr, "Expect:", "100-continue"); + } + else if(http->postsize > EXPECT_100_THRESHOLD || http->postsize < 0) { + result = expect100(data, conn, r); + if(result) + return result; + } + else + data->state.expect100header = FALSE; + +#ifndef USE_HYPER + /* With Hyper the body is always passed on separately */ + if(data->set.postfields) { + + /* In HTTP2, we send request body in DATA frame regardless of + its size. */ + if(conn->httpversion != 20 && + !data->state.expect100header && + (http->postsize < MAX_INITIAL_POST_SIZE)) { + /* if we don't use expect: 100 AND + postsize is less than MAX_INITIAL_POST_SIZE + + then append the post data to the HTTP request header. This limit + is no magic limit but only set to prevent really huge POSTs to + get the data duplicated with malloc() and family. */ + + /* end of headers! */ + result = Curl_dyn_add(r, "\r\n"); + if(result) + return result; + + if(!data->req.upload_chunky) { + /* We're not sending it 'chunked', append it to the request + already now to reduce the number if send() calls */ + result = Curl_dyn_addn(r, data->set.postfields, + (size_t)http->postsize); + included_body = http->postsize; + } + else { + if(http->postsize) { + char chunk[16]; + /* Append the POST data chunky-style */ + msnprintf(chunk, sizeof(chunk), "%x\r\n", (int)http->postsize); + result = Curl_dyn_add(r, chunk); + if(!result) { + included_body = http->postsize + strlen(chunk); + result = Curl_dyn_addn(r, data->set.postfields, + (size_t)http->postsize); + if(!result) + result = Curl_dyn_add(r, "\r\n"); + included_body += 2; + } + } + if(!result) { + result = Curl_dyn_add(r, "\x30\x0d\x0a\x0d\x0a"); + /* 0 CR LF CR LF */ + included_body += 5; + } + } + if(result) + return result; + /* Make sure the progress information is accurate */ + Curl_pgrsSetUploadSize(data, http->postsize); + } + else { + /* A huge POST coming up, do data separate from the request */ + http->postdata = data->set.postfields; + + http->sending = HTTPSEND_BODY; + + data->state.fread_func = (curl_read_callback)readmoredata; + data->state.in = (void *)data; + + /* set the upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, http->postsize); + + /* end of headers! */ + result = Curl_dyn_add(r, "\r\n"); + if(result) + return result; + } + } + else +#endif + { + /* end of headers! */ + result = Curl_dyn_add(r, "\r\n"); + if(result) + return result; + + if(data->req.upload_chunky && conn->bits.authneg) { + /* Chunky upload is selected and we're negotiating auth still, send + end-of-data only */ + result = Curl_dyn_add(r, (char *)"\x30\x0d\x0a\x0d\x0a"); + /* 0 CR LF CR LF */ + if(result) + return result; + } + + else if(data->state.infilesize) { + /* set the upload size to the progress meter */ + Curl_pgrsSetUploadSize(data, http->postsize?http->postsize:-1); + + /* set the pointer to mark that we will send the post body using the + read callback, but only if we're not in authenticate negotiation */ + if(!conn->bits.authneg) + http->postdata = (char *)&http->postdata; + } + } + /* issue the request */ + result = Curl_buffer_send(r, data, &data->info.request_size, included_body, + FIRSTSOCKET); + + if(result) + failf(data, "Failed sending HTTP POST request"); + else + Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, + http->postdata?FIRSTSOCKET:-1); + break; + + default: + result = Curl_dyn_add(r, "\r\n"); + if(result) + return result; + + /* issue the request */ + result = Curl_buffer_send(r, data, &data->info.request_size, 0, + FIRSTSOCKET); + + if(result) + failf(data, "Failed sending HTTP request"); + else + /* HTTP GET/HEAD download: */ + Curl_setup_transfer(data, FIRSTSOCKET, -1, TRUE, -1); + } + + return result; +} + +#if !defined(CURL_DISABLE_COOKIES) +CURLcode Curl_http_cookies(struct Curl_easy *data, + struct connectdata *conn, + struct dynbuf *r) +{ + CURLcode result = CURLE_OK; + char *addcookies = NULL; + if(data->set.str[STRING_COOKIE] && !Curl_checkheaders(data, "Cookie")) + addcookies = data->set.str[STRING_COOKIE]; + + if(data->cookies || addcookies) { + struct Cookie *co = NULL; /* no cookies from start */ + int count = 0; + + if(data->cookies && data->state.cookie_engine) { + const char *host = data->state.aptr.cookiehost ? + data->state.aptr.cookiehost : conn->host.name; + const bool secure_context = + conn->handler->protocol&CURLPROTO_HTTPS || + strcasecompare("localhost", host) || + !strcmp(host, "127.0.0.1") || + !strcmp(host, "[::1]") ? TRUE : FALSE; + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); + co = Curl_cookie_getlist(data->cookies, host, data->state.up.path, + secure_context); + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); + } + if(co) { + struct Cookie *store = co; + /* now loop through all cookies that matched */ + while(co) { + if(co->value) { + if(0 == count) { + result = Curl_dyn_add(r, "Cookie: "); + if(result) + break; + } + result = Curl_dyn_addf(r, "%s%s=%s", count?"; ":"", + co->name, co->value); + if(result) + break; + count++; + } + co = co->next; /* next cookie please */ + } + Curl_cookie_freelist(store); + } + if(addcookies && !result) { + if(!count) + result = Curl_dyn_add(r, "Cookie: "); + if(!result) { + result = Curl_dyn_addf(r, "%s%s", count?"; ":"", addcookies); + count++; + } + } + if(count && !result) + result = Curl_dyn_add(r, "\r\n"); + + if(result) + return result; + } + return result; +} +#endif + +CURLcode Curl_http_range(struct Curl_easy *data, + Curl_HttpReq httpreq) +{ + if(data->state.use_range) { + /* + * A range is selected. We use different headers whether we're downloading + * or uploading and we always let customized headers override our internal + * ones if any such are specified. + */ + if(((httpreq == HTTPREQ_GET) || (httpreq == HTTPREQ_HEAD)) && + !Curl_checkheaders(data, "Range")) { + /* if a line like this was already allocated, free the previous one */ + free(data->state.aptr.rangeline); + data->state.aptr.rangeline = aprintf("Range: bytes=%s\r\n", + data->state.range); + } + else if((httpreq == HTTPREQ_POST || httpreq == HTTPREQ_PUT) && + !Curl_checkheaders(data, "Content-Range")) { + + /* if a line like this was already allocated, free the previous one */ + free(data->state.aptr.rangeline); + + if(data->set.set_resume_from < 0) { + /* Upload resume was asked for, but we don't know the size of the + remote part so we tell the server (and act accordingly) that we + upload the whole file (again) */ + data->state.aptr.rangeline = + aprintf("Content-Range: bytes 0-%" CURL_FORMAT_CURL_OFF_T + "/%" CURL_FORMAT_CURL_OFF_T "\r\n", + data->state.infilesize - 1, data->state.infilesize); + + } + else if(data->state.resume_from) { + /* This is because "resume" was selected */ + curl_off_t total_expected_size = + data->state.resume_from + data->state.infilesize; + data->state.aptr.rangeline = + aprintf("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T + "/%" CURL_FORMAT_CURL_OFF_T "\r\n", + data->state.range, total_expected_size-1, + total_expected_size); + } + else { + /* Range was selected and then we just pass the incoming range and + append total size */ + data->state.aptr.rangeline = + aprintf("Content-Range: bytes %s/%" CURL_FORMAT_CURL_OFF_T "\r\n", + data->state.range, data->state.infilesize); + } + if(!data->state.aptr.rangeline) + return CURLE_OUT_OF_MEMORY; + } + } + return CURLE_OK; +} + +CURLcode Curl_http_resume(struct Curl_easy *data, + struct connectdata *conn, + Curl_HttpReq httpreq) +{ + if((HTTPREQ_POST == httpreq || HTTPREQ_PUT == httpreq) && + data->state.resume_from) { + /********************************************************************** + * Resuming upload in HTTP means that we PUT or POST and that we have + * got a resume_from value set. The resume value has already created + * a Range: header that will be passed along. We need to "fast forward" + * the file the given number of bytes and decrease the assume upload + * file size before we continue this venture in the dark lands of HTTP. + * Resuming mime/form posting at an offset > 0 has no sense and is ignored. + *********************************************************************/ + + if(data->state.resume_from < 0) { + /* + * This is meant to get the size of the present remote-file by itself. + * We don't support this now. Bail out! + */ + data->state.resume_from = 0; + } + + if(data->state.resume_from && !data->state.this_is_a_follow) { + /* do we still game? */ + + /* Now, let's read off the proper amount of bytes from the + input. */ + int seekerr = CURL_SEEKFUNC_CANTSEEK; + if(conn->seek_func) { + Curl_set_in_callback(data, true); + seekerr = conn->seek_func(conn->seek_client, data->state.resume_from, + SEEK_SET); + Curl_set_in_callback(data, false); + } + + if(seekerr != CURL_SEEKFUNC_OK) { + curl_off_t passed = 0; + + if(seekerr != CURL_SEEKFUNC_CANTSEEK) { + failf(data, "Could not seek stream"); + return CURLE_READ_ERROR; + } + /* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */ + do { + size_t readthisamountnow = + (data->state.resume_from - passed > data->set.buffer_size) ? + (size_t)data->set.buffer_size : + curlx_sotouz(data->state.resume_from - passed); + + size_t actuallyread = + data->state.fread_func(data->state.buffer, 1, readthisamountnow, + data->state.in); + + passed += actuallyread; + if((actuallyread == 0) || (actuallyread > readthisamountnow)) { + /* this checks for greater-than only to make sure that the + CURL_READFUNC_ABORT return code still aborts */ + failf(data, "Could only read %" CURL_FORMAT_CURL_OFF_T + " bytes from the input", passed); + return CURLE_READ_ERROR; + } + } while(passed < data->state.resume_from); + } + + /* now, decrease the size of the read */ + if(data->state.infilesize>0) { + data->state.infilesize -= data->state.resume_from; + + if(data->state.infilesize <= 0) { + failf(data, "File already completely uploaded"); + return CURLE_PARTIAL_FILE; + } + } + /* we've passed, proceed as normal */ + } + } + return CURLE_OK; +} + +CURLcode Curl_http_firstwrite(struct Curl_easy *data, + struct connectdata *conn, + bool *done) +{ + struct SingleRequest *k = &data->req; + DEBUGASSERT(conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_RTSP)); + if(data->req.ignore_cl) { + k->size = k->maxdownload = -1; + } + else if(k->size != -1) { + /* We wait until after all headers have been received to set this so that + we know for sure Content-Length is valid. */ + if(data->set.max_filesize && + k->size > data->set.max_filesize) { + failf(data, "Maximum file size exceeded"); + return CURLE_FILESIZE_EXCEEDED; + } + Curl_pgrsSetDownloadSize(data, k->size); + } + + if(data->req.newurl) { + if(conn->bits.close) { + /* Abort after the headers if "follow Location" is set + and we're set to close anyway. */ + k->keepon &= ~KEEP_RECV; + *done = TRUE; + return CURLE_OK; + } + /* We have a new url to load, but since we want to be able to re-use this + connection properly, we read the full response in "ignore more" */ + k->ignorebody = TRUE; + infof(data, "Ignoring the response-body"); + } + if(data->state.resume_from && !k->content_range && + (data->state.httpreq == HTTPREQ_GET) && + !k->ignorebody) { + + if(k->size == data->state.resume_from) { + /* The resume point is at the end of file, consider this fine even if it + doesn't allow resume from here. */ + infof(data, "The entire document is already downloaded"); + connclose(conn, "already downloaded"); + /* Abort download */ + k->keepon &= ~KEEP_RECV; + *done = TRUE; + return CURLE_OK; + } + + /* we wanted to resume a download, although the server doesn't seem to + * support this and we did this with a GET (if it wasn't a GET we did a + * POST or PUT resume) */ + failf(data, "HTTP server doesn't seem to support " + "byte ranges. Cannot resume."); + return CURLE_RANGE_ERROR; + } + + if(data->set.timecondition && !data->state.range) { + /* A time condition has been set AND no ranges have been requested. This + seems to be what chapter 13.3.4 of RFC 2616 defines to be the correct + action for a HTTP/1.1 client */ + + if(!Curl_meets_timecondition(data, k->timeofdoc)) { + *done = TRUE; + /* We're simulating a http 304 from server so we return + what should have been returned from the server */ + data->info.httpcode = 304; + infof(data, "Simulate a HTTP 304 response!"); + /* we abort the transfer before it is completed == we ruin the + re-use ability. Close the connection */ + connclose(conn, "Simulated 304 handling"); + return CURLE_OK; + } + } /* we have a time condition */ + + return CURLE_OK; +} + +#ifdef HAVE_LIBZ +CURLcode Curl_transferencode(struct Curl_easy *data) +{ + if(!Curl_checkheaders(data, "TE") && + data->set.http_transfer_encoding) { + /* When we are to insert a TE: header in the request, we must also insert + TE in a Connection: header, so we need to merge the custom provided + Connection: header and prevent the original to get sent. Note that if + the user has inserted his/her own TE: header we don't do this magic + but then assume that the user will handle it all! */ + char *cptr = Curl_checkheaders(data, "Connection"); +#define TE_HEADER "TE: gzip\r\n" + + Curl_safefree(data->state.aptr.te); + + if(cptr) { + cptr = Curl_copy_header_value(cptr); + if(!cptr) + return CURLE_OUT_OF_MEMORY; + } + + /* Create the (updated) Connection: header */ + data->state.aptr.te = aprintf("Connection: %s%sTE\r\n" TE_HEADER, + cptr ? cptr : "", (cptr && *cptr) ? ", ":""); + + free(cptr); + if(!data->state.aptr.te) + return CURLE_OUT_OF_MEMORY; + } + return CURLE_OK; +} +#endif + +#ifndef USE_HYPER +/* + * Curl_http() gets called from the generic multi_do() function when a HTTP + * request is to be performed. This creates and sends a properly constructed + * HTTP request. + */ +CURLcode Curl_http(struct Curl_easy *data, bool *done) +{ + struct connectdata *conn = data->conn; + CURLcode result = CURLE_OK; + struct HTTP *http; + Curl_HttpReq httpreq; + const char *te = ""; /* transfer-encoding */ + const char *request; + const char *httpstring; + struct dynbuf req; + char *altused = NULL; + const char *p_accept; /* Accept: string */ + + /* Always consider the DO phase done after this function call, even if there + may be parts of the request that are not yet sent, since we can deal with + the rest of the request in the PERFORM phase. */ + *done = TRUE; + + if(conn->transport != TRNSPRT_QUIC) { + if(conn->httpversion < 20) { /* unless the connection is re-used and + already http2 */ + switch(conn->negnpn) { + case CURL_HTTP_VERSION_2: + conn->httpversion = 20; /* we know we're on HTTP/2 now */ + + result = Curl_http2_switched(data, NULL, 0); + if(result) + return result; + break; + case CURL_HTTP_VERSION_1_1: + /* continue with HTTP/1.1 when explicitly requested */ + break; + default: + /* Check if user wants to use HTTP/2 with clear TCP*/ +#ifdef USE_NGHTTP2 + if(data->state.httpwant == CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) { +#ifndef CURL_DISABLE_PROXY + if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) { + /* We don't support HTTP/2 proxies yet. Also it's debatable + whether or not this setting should apply to HTTP/2 proxies. */ + infof(data, "Ignoring HTTP/2 prior knowledge due to proxy"); + break; + } +#endif + DEBUGF(infof(data, "HTTP/2 over clean TCP")); + conn->httpversion = 20; + + result = Curl_http2_switched(data, NULL, 0); + if(result) + return result; + } +#endif + break; + } + } + else { + /* prepare for a http2 request */ + result = Curl_http2_setup(data, conn); + if(result) + return result; + } + } + http = data->req.p.http; + DEBUGASSERT(http); + + result = Curl_http_host(data, conn); + if(result) + return result; + + result = Curl_http_useragent(data); + if(result) + return result; + + Curl_http_method(data, conn, &request, &httpreq); + + /* setup the authentication headers */ + { + char *pq = NULL; + if(data->state.up.query) { + pq = aprintf("%s?%s", data->state.up.path, data->state.up.query); + if(!pq) + return CURLE_OUT_OF_MEMORY; + } + result = Curl_http_output_auth(data, conn, request, httpreq, + (pq ? pq : data->state.up.path), FALSE); + free(pq); + if(result) + return result; + } + + Curl_safefree(data->state.aptr.ref); + if(data->state.referer && !Curl_checkheaders(data, "Referer")) { + data->state.aptr.ref = aprintf("Referer: %s\r\n", data->state.referer); + if(!data->state.aptr.ref) + return CURLE_OUT_OF_MEMORY; + } + + if(!Curl_checkheaders(data, "Accept-Encoding") && + data->set.str[STRING_ENCODING]) { + Curl_safefree(data->state.aptr.accept_encoding); + data->state.aptr.accept_encoding = + aprintf("Accept-Encoding: %s\r\n", data->set.str[STRING_ENCODING]); + if(!data->state.aptr.accept_encoding) + return CURLE_OUT_OF_MEMORY; + } + else + Curl_safefree(data->state.aptr.accept_encoding); + +#ifdef HAVE_LIBZ + /* we only consider transfer-encoding magic if libz support is built-in */ + result = Curl_transferencode(data); + if(result) + return result; +#endif + + result = Curl_http_body(data, conn, httpreq, &te); + if(result) + return result; + + p_accept = Curl_checkheaders(data, "Accept")?NULL:"Accept: */*\r\n"; + + result = Curl_http_resume(data, conn, httpreq); + if(result) + return result; + + result = Curl_http_range(data, httpreq); + if(result) + return result; + + httpstring = get_http_string(data, conn); + + /* initialize a dynamic send-buffer */ + Curl_dyn_init(&req, DYN_HTTP_REQUEST); + + /* make sure the header buffer is reset - if there are leftovers from a + previous transfer */ + Curl_dyn_reset(&data->state.headerb); + + /* add the main request stuff */ + /* GET/HEAD/POST/PUT */ + result = Curl_dyn_addf(&req, "%s ", request); + if(!result) + result = Curl_http_target(data, conn, &req); + if(result) { + Curl_dyn_free(&req); + return result; + } + +#ifndef CURL_DISABLE_ALTSVC + if(conn->bits.altused && !Curl_checkheaders(data, "Alt-Used")) { + altused = aprintf("Alt-Used: %s:%d\r\n", + conn->conn_to_host.name, conn->conn_to_port); + if(!altused) { + Curl_dyn_free(&req); + return CURLE_OUT_OF_MEMORY; + } + } +#endif + result = + Curl_dyn_addf(&req, + " HTTP/%s\r\n" /* HTTP version */ + "%s" /* host */ + "%s" /* proxyuserpwd */ + "%s" /* userpwd */ + "%s" /* range */ + "%s" /* user agent */ + "%s" /* accept */ + "%s" /* TE: */ + "%s" /* accept-encoding */ + "%s" /* referer */ + "%s" /* Proxy-Connection */ + "%s" /* transfer-encoding */ + "%s",/* Alt-Used */ + + httpstring, + (data->state.aptr.host?data->state.aptr.host:""), + data->state.aptr.proxyuserpwd? + data->state.aptr.proxyuserpwd:"", + data->state.aptr.userpwd?data->state.aptr.userpwd:"", + (data->state.use_range && data->state.aptr.rangeline)? + data->state.aptr.rangeline:"", + (data->set.str[STRING_USERAGENT] && + *data->set.str[STRING_USERAGENT] && + data->state.aptr.uagent)? + data->state.aptr.uagent:"", + p_accept?p_accept:"", + data->state.aptr.te?data->state.aptr.te:"", + (data->set.str[STRING_ENCODING] && + *data->set.str[STRING_ENCODING] && + data->state.aptr.accept_encoding)? + data->state.aptr.accept_encoding:"", + (data->state.referer && data->state.aptr.ref)? + data->state.aptr.ref:"" /* Referer: */, +#ifndef CURL_DISABLE_PROXY + (conn->bits.httpproxy && + !conn->bits.tunnel_proxy && + !Curl_checkheaders(data, "Proxy-Connection") && + !Curl_checkProxyheaders(data, conn, "Proxy-Connection"))? + "Proxy-Connection: Keep-Alive\r\n":"", +#else + "", +#endif + te, + altused ? altused : "" + ); + + /* clear userpwd and proxyuserpwd to avoid re-using old credentials + * from re-used connections */ + Curl_safefree(data->state.aptr.userpwd); + Curl_safefree(data->state.aptr.proxyuserpwd); + free(altused); + + if(result) { + Curl_dyn_free(&req); + return result; + } + + if(!(conn->handler->flags&PROTOPT_SSL) && + conn->httpversion != 20 && + (data->state.httpwant == CURL_HTTP_VERSION_2)) { + /* append HTTP2 upgrade magic stuff to the HTTP request if it isn't done + over SSL */ + result = Curl_http2_request_upgrade(&req, data); + if(result) { + Curl_dyn_free(&req); + return result; + } + } + + result = Curl_http_cookies(data, conn, &req); + if(!result) + result = Curl_add_timecondition(data, &req); + if(!result) + result = Curl_add_custom_headers(data, FALSE, &req); + + if(!result) { + http->postdata = NULL; /* nothing to post at this point */ + if((httpreq == HTTPREQ_GET) || + (httpreq == HTTPREQ_HEAD)) + Curl_pgrsSetUploadSize(data, 0); /* nothing */ + + /* bodysend takes ownership of the 'req' memory on success */ + result = Curl_http_bodysend(data, conn, &req, httpreq); + } + if(result) { + Curl_dyn_free(&req); + return result; + } + + if((http->postsize > -1) && + (http->postsize <= data->req.writebytecount) && + (http->sending != HTTPSEND_REQUEST)) + data->req.upload_done = TRUE; + + if(data->req.writebytecount) { + /* if a request-body has been sent off, we make sure this progress is noted + properly */ + Curl_pgrsSetUploadCounter(data, data->req.writebytecount); + if(Curl_pgrsUpdate(data)) + result = CURLE_ABORTED_BY_CALLBACK; + + if(!http->postsize) { + /* already sent the entire request body, mark the "upload" as + complete */ + infof(data, "upload completely sent off: %" CURL_FORMAT_CURL_OFF_T + " out of %" CURL_FORMAT_CURL_OFF_T " bytes", + data->req.writebytecount, http->postsize); + data->req.upload_done = TRUE; + data->req.keepon &= ~KEEP_SEND; /* we're done writing */ + data->req.exp100 = EXP100_SEND_DATA; /* already sent */ + Curl_expire_done(data, EXPIRE_100_TIMEOUT); + } + } + + if((conn->httpversion == 20) && data->req.upload_chunky) + /* upload_chunky was set above to set up the request in a chunky fashion, + but is disabled here again to avoid that the chunked encoded version is + actually used when sending the request body over h2 */ + data->req.upload_chunky = FALSE; + return result; +} + +#endif /* USE_HYPER */ + +typedef enum { + STATUS_UNKNOWN, /* not enough data to tell yet */ + STATUS_DONE, /* a status line was read */ + STATUS_BAD /* not a status line */ +} statusline; + + +/* Check a string for a prefix. Check no more than 'len' bytes */ +static bool checkprefixmax(const char *prefix, const char *buffer, size_t len) +{ + size_t ch = CURLMIN(strlen(prefix), len); + return curl_strnequal(prefix, buffer, ch); +} + +/* + * checkhttpprefix() + * + * Returns TRUE if member of the list matches prefix of string + */ +static statusline +checkhttpprefix(struct Curl_easy *data, + const char *s, size_t len) +{ + struct curl_slist *head = data->set.http200aliases; + statusline rc = STATUS_BAD; + statusline onmatch = len >= 5? STATUS_DONE : STATUS_UNKNOWN; +#ifdef CURL_DOES_CONVERSIONS + /* convert from the network encoding using a scratch area */ + char *scratch = strdup(s); + if(NULL == scratch) { + failf(data, "Failed to allocate memory for conversion!"); + return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */ + } + if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s) + 1)) { + /* Curl_convert_from_network calls failf if unsuccessful */ + free(scratch); + return FALSE; /* can't return CURLE_foobar so return FALSE */ + } + s = scratch; +#endif /* CURL_DOES_CONVERSIONS */ + + while(head) { + if(checkprefixmax(head->data, s, len)) { + rc = onmatch; + break; + } + head = head->next; + } + + if((rc != STATUS_DONE) && (checkprefixmax("HTTP/", s, len))) + rc = onmatch; + +#ifdef CURL_DOES_CONVERSIONS + free(scratch); +#endif /* CURL_DOES_CONVERSIONS */ + return rc; +} + +#ifndef CURL_DISABLE_RTSP +static statusline +checkrtspprefix(struct Curl_easy *data, + const char *s, size_t len) +{ + statusline result = STATUS_BAD; + statusline onmatch = len >= 5? STATUS_DONE : STATUS_UNKNOWN; + +#ifdef CURL_DOES_CONVERSIONS + /* convert from the network encoding using a scratch area */ + char *scratch = strdup(s); + if(NULL == scratch) { + failf(data, "Failed to allocate memory for conversion!"); + return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */ + } + if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s) + 1)) { + /* Curl_convert_from_network calls failf if unsuccessful */ + result = FALSE; /* can't return CURLE_foobar so return FALSE */ + } + else if(checkprefixmax("RTSP/", scratch, len)) + result = onmatch; + free(scratch); +#else + (void)data; /* unused */ + if(checkprefixmax("RTSP/", s, len)) + result = onmatch; +#endif /* CURL_DOES_CONVERSIONS */ + + return result; +} +#endif /* CURL_DISABLE_RTSP */ + +static statusline +checkprotoprefix(struct Curl_easy *data, struct connectdata *conn, + const char *s, size_t len) +{ +#ifndef CURL_DISABLE_RTSP + if(conn->handler->protocol & CURLPROTO_RTSP) + return checkrtspprefix(data, s, len); +#else + (void)conn; +#endif /* CURL_DISABLE_RTSP */ + + return checkhttpprefix(data, s, len); +} + +/* + * Curl_http_header() parses a single response header. + */ +CURLcode Curl_http_header(struct Curl_easy *data, struct connectdata *conn, + char *headp) +{ + CURLcode result; + struct SingleRequest *k = &data->req; + /* Check for Content-Length: header lines to get size */ + if(!k->http_bodyless && + !data->set.ignorecl && checkprefix("Content-Length:", headp)) { + curl_off_t contentlength; + CURLofft offt = curlx_strtoofft(headp + strlen("Content-Length:"), + NULL, 10, &contentlength); + + if(offt == CURL_OFFT_OK) { + k->size = contentlength; + k->maxdownload = k->size; + } + else if(offt == CURL_OFFT_FLOW) { + /* out of range */ + if(data->set.max_filesize) { + failf(data, "Maximum file size exceeded"); + return CURLE_FILESIZE_EXCEEDED; + } + streamclose(conn, "overflow content-length"); + infof(data, "Overflow Content-Length: value!"); + } + else { + /* negative or just rubbish - bad HTTP */ + failf(data, "Invalid Content-Length: value"); + return CURLE_WEIRD_SERVER_REPLY; + } + } + /* check for Content-Type: header lines to get the MIME-type */ + else if(checkprefix("Content-Type:", headp)) { + char *contenttype = Curl_copy_header_value(headp); + if(!contenttype) + return CURLE_OUT_OF_MEMORY; + if(!*contenttype) + /* ignore empty data */ + free(contenttype); + else { + Curl_safefree(data->info.contenttype); + data->info.contenttype = contenttype; + } + } +#ifndef CURL_DISABLE_PROXY + else if((conn->httpversion == 10) && + conn->bits.httpproxy && + Curl_compareheader(headp, "Proxy-Connection:", "keep-alive")) { + /* + * When a HTTP/1.0 reply comes when using a proxy, the + * 'Proxy-Connection: keep-alive' line tells us the + * connection will be kept alive for our pleasure. + * Default action for 1.0 is to close. + */ + connkeep(conn, "Proxy-Connection keep-alive"); /* don't close */ + infof(data, "HTTP/1.0 proxy connection set to keep alive!"); + } + else if((conn->httpversion == 11) && + conn->bits.httpproxy && + Curl_compareheader(headp, "Proxy-Connection:", "close")) { + /* + * We get a HTTP/1.1 response from a proxy and it says it'll + * close down after this transfer. + */ + connclose(conn, "Proxy-Connection: asked to close after done"); + infof(data, "HTTP/1.1 proxy connection set close!"); + } +#endif + else if((conn->httpversion == 10) && + Curl_compareheader(headp, "Connection:", "keep-alive")) { + /* + * A HTTP/1.0 reply with the 'Connection: keep-alive' line + * tells us the connection will be kept alive for our + * pleasure. Default action for 1.0 is to close. + * + * [RFC2068, section 19.7.1] */ + connkeep(conn, "Connection keep-alive"); + infof(data, "HTTP/1.0 connection set to keep alive!"); + } + else if(Curl_compareheader(headp, "Connection:", "close")) { + /* + * [RFC 2616, section 8.1.2.1] + * "Connection: close" is HTTP/1.1 language and means that + * the connection will close when this request has been + * served. + */ + streamclose(conn, "Connection: close used"); + } + else if(!k->http_bodyless && checkprefix("Transfer-Encoding:", headp)) { + /* One or more encodings. We check for chunked and/or a compression + algorithm. */ + /* + * [RFC 2616, section 3.6.1] A 'chunked' transfer encoding + * means that the server will send a series of "chunks". Each + * chunk starts with line with info (including size of the + * coming block) (terminated with CRLF), then a block of data + * with the previously mentioned size. There can be any amount + * of chunks, and a chunk-data set to zero signals the + * end-of-chunks. */ + + result = Curl_build_unencoding_stack(data, + headp + strlen("Transfer-Encoding:"), + TRUE); + if(result) + return result; + if(!k->chunk) { + /* if this isn't chunked, only close can signal the end of this transfer + as Content-Length is said not to be trusted for transfer-encoding! */ + connclose(conn, "HTTP/1.1 transfer-encoding without chunks"); + k->ignore_cl = TRUE; + } + } + else if(!k->http_bodyless && checkprefix("Content-Encoding:", headp) && + data->set.str[STRING_ENCODING]) { + /* + * Process Content-Encoding. Look for the values: identity, + * gzip, deflate, compress, x-gzip and x-compress. x-gzip and + * x-compress are the same as gzip and compress. (Sec 3.5 RFC + * 2616). zlib cannot handle compress. However, errors are + * handled further down when the response body is processed + */ + result = Curl_build_unencoding_stack(data, + headp + strlen("Content-Encoding:"), + FALSE); + if(result) + return result; + } + else if(checkprefix("Retry-After:", headp)) { + /* Retry-After = HTTP-date / delay-seconds */ + curl_off_t retry_after = 0; /* zero for unknown or "now" */ + time_t date = Curl_getdate_capped(headp + strlen("Retry-After:")); + if(-1 == date) { + /* not a date, try it as a decimal number */ + (void)curlx_strtoofft(headp + strlen("Retry-After:"), + NULL, 10, &retry_after); + } + else + /* convert date to number of seconds into the future */ + retry_after = date - time(NULL); + data->info.retry_after = retry_after; /* store it */ + } + else if(!k->http_bodyless && checkprefix("Content-Range:", headp)) { + /* Content-Range: bytes [num]- + Content-Range: bytes: [num]- + Content-Range: [num]- + Content-Range: [asterisk]/[total] + + The second format was added since Sun's webserver + JavaWebServer/1.1.1 obviously sends the header this way! + The third added since some servers use that! + The forth means the requested range was unsatisfied. + */ + + char *ptr = headp + strlen("Content-Range:"); + + /* Move forward until first digit or asterisk */ + while(*ptr && !ISDIGIT(*ptr) && *ptr != '*') + ptr++; + + /* if it truly stopped on a digit */ + if(ISDIGIT(*ptr)) { + if(!curlx_strtoofft(ptr, NULL, 10, &k->offset)) { + if(data->state.resume_from == k->offset) + /* we asked for a resume and we got it */ + k->content_range = TRUE; + } + } + else + data->state.resume_from = 0; /* get everything */ + } +#if !defined(CURL_DISABLE_COOKIES) + else if(data->cookies && data->state.cookie_engine && + checkprefix("Set-Cookie:", headp)) { + /* If there is a custom-set Host: name, use it here, or else use real peer + host name. */ + const char *host = data->state.aptr.cookiehost? + data->state.aptr.cookiehost:conn->host.name; + const bool secure_context = + conn->handler->protocol&CURLPROTO_HTTPS || + strcasecompare("localhost", host) || + !strcmp(host, "127.0.0.1") || + !strcmp(host, "[::1]") ? TRUE : FALSE; + + Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, + CURL_LOCK_ACCESS_SINGLE); + Curl_cookie_add(data, data->cookies, TRUE, FALSE, + headp + strlen("Set-Cookie:"), host, + data->state.up.path, secure_context); + Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); + } +#endif + else if(!k->http_bodyless && checkprefix("Last-Modified:", headp) && + (data->set.timecondition || data->set.get_filetime) ) { + k->timeofdoc = Curl_getdate_capped(headp + strlen("Last-Modified:")); + if(data->set.get_filetime) + data->info.filetime = k->timeofdoc; + } + else if((checkprefix("WWW-Authenticate:", headp) && + (401 == k->httpcode)) || + (checkprefix("Proxy-authenticate:", headp) && + (407 == k->httpcode))) { + + bool proxy = (k->httpcode == 407) ? TRUE : FALSE; + char *auth = Curl_copy_header_value(headp); + if(!auth) + return CURLE_OUT_OF_MEMORY; + + result = Curl_http_input_auth(data, proxy, auth); + + free(auth); + + if(result) + return result; + } +#ifdef USE_SPNEGO + else if(checkprefix("Persistent-Auth:", headp)) { + struct negotiatedata *negdata = &conn->negotiate; + struct auth *authp = &data->state.authhost; + if(authp->picked == CURLAUTH_NEGOTIATE) { + char *persistentauth = Curl_copy_header_value(headp); + if(!persistentauth) + return CURLE_OUT_OF_MEMORY; + negdata->noauthpersist = checkprefix("false", persistentauth)? + TRUE:FALSE; + negdata->havenoauthpersist = TRUE; + infof(data, "Negotiate: noauthpersist -> %d, header part: %s", + negdata->noauthpersist, persistentauth); + free(persistentauth); + } + } +#endif + else if((k->httpcode >= 300 && k->httpcode < 400) && + checkprefix("Location:", headp) && + !data->req.location) { + /* this is the URL that the server advises us to use instead */ + char *location = Curl_copy_header_value(headp); + if(!location) + return CURLE_OUT_OF_MEMORY; + if(!*location) + /* ignore empty data */ + free(location); + else { + data->req.location = location; + + if(data->set.http_follow_location) { + DEBUGASSERT(!data->req.newurl); + data->req.newurl = strdup(data->req.location); /* clone */ + if(!data->req.newurl) + return CURLE_OUT_OF_MEMORY; + + /* some cases of POST and PUT etc needs to rewind the data + stream at this point */ + result = http_perhapsrewind(data, conn); + if(result) + return result; + } + } + } + +#ifndef CURL_DISABLE_HSTS + /* If enabled, the header is incoming and this is over HTTPS */ + else if(data->hsts && checkprefix("Strict-Transport-Security:", headp) && + (conn->handler->flags & PROTOPT_SSL)) { + CURLcode check = + Curl_hsts_parse(data->hsts, data->state.up.hostname, + headp + strlen("Strict-Transport-Security:")); + if(check) + infof(data, "Illegal STS header skipped"); +#ifdef DEBUGBUILD + else + infof(data, "Parsed STS header fine (%zu entries)", + data->hsts->list.size); +#endif + } +#endif +#ifndef CURL_DISABLE_ALTSVC + /* If enabled, the header is incoming and this is over HTTPS */ + else if(data->asi && checkprefix("Alt-Svc:", headp) && + ((conn->handler->flags & PROTOPT_SSL) || +#ifdef CURLDEBUG + /* allow debug builds to circumvent the HTTPS restriction */ + getenv("CURL_ALTSVC_HTTP") +#else + 0 +#endif + )) { + /* the ALPN of the current request */ + enum alpnid id = (conn->httpversion == 20) ? ALPN_h2 : ALPN_h1; + result = Curl_altsvc_parse(data, data->asi, + headp + strlen("Alt-Svc:"), + id, conn->host.name, + curlx_uitous(conn->remote_port)); + if(result) + return result; + } +#endif + else if(conn->handler->protocol & CURLPROTO_RTSP) { + result = Curl_rtsp_parseheader(data, headp); + if(result) + return result; + } + return CURLE_OK; +} + +/* + * Called after the first HTTP response line (the status line) has been + * received and parsed. + */ + +CURLcode Curl_http_statusline(struct Curl_easy *data, + struct connectdata *conn) +{ + struct SingleRequest *k = &data->req; + data->info.httpcode = k->httpcode; + + data->info.httpversion = conn->httpversion; + if(!data->state.httpversion || + data->state.httpversion > conn->httpversion) + /* store the lowest server version we encounter */ + data->state.httpversion = conn->httpversion; + + /* + * This code executes as part of processing the header. As a + * result, it's not totally clear how to interpret the + * response code yet as that depends on what other headers may + * be present. 401 and 407 may be errors, but may be OK + * depending on how authentication is working. Other codes + * are definitely errors, so give up here. + */ + if(data->state.resume_from && data->state.httpreq == HTTPREQ_GET && + k->httpcode == 416) { + /* "Requested Range Not Satisfiable", just proceed and + pretend this is no error */ + k->ignorebody = TRUE; /* Avoid appending error msg to good data. */ + } + + if(conn->httpversion == 10) { + /* Default action for HTTP/1.0 must be to close, unless + we get one of those fancy headers that tell us the + server keeps it open for us! */ + infof(data, "HTTP 1.0, assume close after body"); + connclose(conn, "HTTP/1.0 close after body"); + } + else if(conn->httpversion == 20 || + (k->upgr101 == UPGR101_REQUESTED && k->httpcode == 101)) { + DEBUGF(infof(data, "HTTP/2 found, allow multiplexing")); + /* HTTP/2 cannot avoid multiplexing since it is a core functionality + of the protocol */ + conn->bundle->multiuse = BUNDLE_MULTIPLEX; + } + else if(conn->httpversion >= 11 && + !conn->bits.close) { + /* If HTTP version is >= 1.1 and connection is persistent */ + DEBUGF(infof(data, + "HTTP 1.1 or later with persistent connection")); + } + + k->http_bodyless = k->httpcode >= 100 && k->httpcode < 200; + switch(k->httpcode) { + case 304: + /* (quote from RFC2616, section 10.3.5): The 304 response + * MUST NOT contain a message-body, and thus is always + * terminated by the first empty line after the header + * fields. */ + if(data->set.timecondition) + data->info.timecond = TRUE; + /* FALLTHROUGH */ + case 204: + /* (quote from RFC2616, section 10.2.5): The server has + * fulfilled the request but does not need to return an + * entity-body ... The 204 response MUST NOT include a + * message-body, and thus is always terminated by the first + * empty line after the header fields. */ + k->size = 0; + k->maxdownload = 0; + k->http_bodyless = TRUE; + break; + default: + break; + } + return CURLE_OK; +} + +/* + * Read any HTTP header lines from the server and pass them to the client app. + */ +CURLcode Curl_http_readwrite_headers(struct Curl_easy *data, + struct connectdata *conn, + ssize_t *nread, + bool *stop_reading) +{ + CURLcode result; + struct SingleRequest *k = &data->req; + ssize_t onread = *nread; + char *ostr = k->str; + char *headp; + char *str_start; + char *end_ptr; + + /* header line within buffer loop */ + do { + size_t rest_length; + size_t full_length; + int writetype; + + /* str_start is start of line within buf */ + str_start = k->str; + + /* data is in network encoding so use 0x0a instead of '\n' */ + end_ptr = memchr(str_start, 0x0a, *nread); + + if(!end_ptr) { + /* Not a complete header line within buffer, append the data to + the end of the headerbuff. */ + result = Curl_dyn_addn(&data->state.headerb, str_start, *nread); + if(result) + return result; + + if(!k->headerline) { + /* check if this looks like a protocol header */ + statusline st = + checkprotoprefix(data, conn, + Curl_dyn_ptr(&data->state.headerb), + Curl_dyn_len(&data->state.headerb)); + + if(st == STATUS_BAD) { + /* this is not the beginning of a protocol first header line */ + k->header = FALSE; + k->badheader = HEADER_ALLBAD; + streamclose(conn, "bad HTTP: No end-of-message indicator"); + if(!data->set.http09_allowed) { + failf(data, "Received HTTP/0.9 when not allowed"); + return CURLE_UNSUPPORTED_PROTOCOL; + } + break; + } + } + + break; /* read more and try again */ + } + + /* decrease the size of the remaining (supposed) header line */ + rest_length = (end_ptr - k->str) + 1; + *nread -= (ssize_t)rest_length; + + k->str = end_ptr + 1; /* move past new line */ + + full_length = k->str - str_start; + + result = Curl_dyn_addn(&data->state.headerb, str_start, full_length); + if(result) + return result; + + /**** + * We now have a FULL header line in 'headerb'. + *****/ + + if(!k->headerline) { + /* the first read header */ + statusline st = checkprotoprefix(data, conn, + Curl_dyn_ptr(&data->state.headerb), + Curl_dyn_len(&data->state.headerb)); + if(st == STATUS_BAD) { + streamclose(conn, "bad HTTP: No end-of-message indicator"); + /* this is not the beginning of a protocol first header line */ + if(!data->set.http09_allowed) { + failf(data, "Received HTTP/0.9 when not allowed"); + return CURLE_UNSUPPORTED_PROTOCOL; + } + k->header = FALSE; + if(*nread) + /* since there's more, this is a partial bad header */ + k->badheader = HEADER_PARTHEADER; + else { + /* this was all we read so it's all a bad header */ + k->badheader = HEADER_ALLBAD; + *nread = onread; + k->str = ostr; + return CURLE_OK; + } + break; + } + } + + /* headers are in network encoding so use 0x0a and 0x0d instead of '\n' + and '\r' */ + headp = Curl_dyn_ptr(&data->state.headerb); + if((0x0a == *headp) || (0x0d == *headp)) { + size_t headerlen; + /* Zero-length header line means end of headers! */ + +#ifdef CURL_DOES_CONVERSIONS + if(0x0d == *headp) { + *headp = '\r'; /* replace with CR in host encoding */ + headp++; /* pass the CR byte */ + } + if(0x0a == *headp) { + *headp = '\n'; /* replace with LF in host encoding */ + headp++; /* pass the LF byte */ + } +#else + if('\r' == *headp) + headp++; /* pass the \r byte */ + if('\n' == *headp) + headp++; /* pass the \n byte */ +#endif /* CURL_DOES_CONVERSIONS */ + + if(100 <= k->httpcode && 199 >= k->httpcode) { + /* "A user agent MAY ignore unexpected 1xx status responses." */ + switch(k->httpcode) { + case 100: + /* + * We have made a HTTP PUT or POST and this is 1.1-lingo + * that tells us that the server is OK with this and ready + * to receive the data. + * However, we'll get more headers now so we must get + * back into the header-parsing state! + */ + k->header = TRUE; + k->headerline = 0; /* restart the header line counter */ + + /* if we did wait for this do enable write now! */ + if(k->exp100 > EXP100_SEND_DATA) { + k->exp100 = EXP100_SEND_DATA; + k->keepon |= KEEP_SEND; + Curl_expire_done(data, EXPIRE_100_TIMEOUT); + } + break; + case 101: + /* Switching Protocols */ + if(k->upgr101 == UPGR101_REQUESTED) { + /* Switching to HTTP/2 */ + infof(data, "Received 101"); + k->upgr101 = UPGR101_RECEIVED; + + /* we'll get more headers (HTTP/2 response) */ + k->header = TRUE; + k->headerline = 0; /* restart the header line counter */ + + /* switch to http2 now. The bytes after response headers + are also processed here, otherwise they are lost. */ + result = Curl_http2_switched(data, k->str, *nread); + if(result) + return result; + *nread = 0; + } + else { + /* Switching to another protocol (e.g. WebSocket) */ + k->header = FALSE; /* no more header to parse! */ + } + break; + default: + /* the status code 1xx indicates a provisional response, so + we'll get another set of headers */ + k->header = TRUE; + k->headerline = 0; /* restart the header line counter */ + break; + } + } + else { + k->header = FALSE; /* no more header to parse! */ + + if((k->size == -1) && !k->chunk && !conn->bits.close && + (conn->httpversion == 11) && + !(conn->handler->protocol & CURLPROTO_RTSP) && + data->state.httpreq != HTTPREQ_HEAD) { + /* On HTTP 1.1, when connection is not to get closed, but no + Content-Length nor Transfer-Encoding chunked have been + received, according to RFC2616 section 4.4 point 5, we + assume that the server will close the connection to + signal the end of the document. */ + infof(data, "no chunk, no close, no size. Assume close to " + "signal end"); + streamclose(conn, "HTTP: No end-of-message indicator"); + } + } + + /* At this point we have some idea about the fate of the connection. + If we are closing the connection it may result auth failure. */ +#if defined(USE_NTLM) + if(conn->bits.close && + (((data->req.httpcode == 401) && + (conn->http_ntlm_state == NTLMSTATE_TYPE2)) || + ((data->req.httpcode == 407) && + (conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) { + infof(data, "Connection closure while negotiating auth (HTTP 1.0?)"); + data->state.authproblem = TRUE; + } +#endif +#if defined(USE_SPNEGO) + if(conn->bits.close && + (((data->req.httpcode == 401) && + (conn->http_negotiate_state == GSS_AUTHRECV)) || + ((data->req.httpcode == 407) && + (conn->proxy_negotiate_state == GSS_AUTHRECV)))) { + infof(data, "Connection closure while negotiating auth (HTTP 1.0?)"); + data->state.authproblem = TRUE; + } + if((conn->http_negotiate_state == GSS_AUTHDONE) && + (data->req.httpcode != 401)) { + conn->http_negotiate_state = GSS_AUTHSUCC; + } + if((conn->proxy_negotiate_state == GSS_AUTHDONE) && + (data->req.httpcode != 407)) { + conn->proxy_negotiate_state = GSS_AUTHSUCC; + } +#endif + + /* now, only output this if the header AND body are requested: + */ + writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + + headerlen = Curl_dyn_len(&data->state.headerb); + result = Curl_client_write(data, writetype, + Curl_dyn_ptr(&data->state.headerb), + headerlen); + if(result) + return result; + + data->info.header_size += (long)headerlen; + data->req.headerbytecount += (long)headerlen; + + /* + * When all the headers have been parsed, see if we should give + * up and return an error. + */ + if(http_should_fail(data)) { + failf(data, "The requested URL returned error: %d", + k->httpcode); + return CURLE_HTTP_RETURNED_ERROR; + } + + data->req.deductheadercount = + (100 <= k->httpcode && 199 >= k->httpcode)?data->req.headerbytecount:0; + + /* Curl_http_auth_act() checks what authentication methods + * that are available and decides which one (if any) to + * use. It will set 'newurl' if an auth method was picked. */ + result = Curl_http_auth_act(data); + + if(result) + return result; + + if(k->httpcode >= 300) { + if((!conn->bits.authneg) && !conn->bits.close && + !conn->bits.rewindaftersend) { + /* + * General treatment of errors when about to send data. Including : + * "417 Expectation Failed", while waiting for 100-continue. + * + * The check for close above is done simply because of something + * else has already deemed the connection to get closed then + * something else should've considered the big picture and we + * avoid this check. + * + * rewindaftersend indicates that something has told libcurl to + * continue sending even if it gets discarded + */ + + switch(data->state.httpreq) { + case HTTPREQ_PUT: + case HTTPREQ_POST: + case HTTPREQ_POST_FORM: + case HTTPREQ_POST_MIME: + /* We got an error response. If this happened before the whole + * request body has been sent we stop sending and mark the + * connection for closure after we've read the entire response. + */ + Curl_expire_done(data, EXPIRE_100_TIMEOUT); + if(!k->upload_done) { + if((k->httpcode == 417) && data->state.expect100header) { + /* 417 Expectation Failed - try again without the Expect + header */ + infof(data, "Got 417 while waiting for a 100"); + data->state.disableexpect = TRUE; + DEBUGASSERT(!data->req.newurl); + data->req.newurl = strdup(data->state.url); + Curl_done_sending(data, k); + } + else if(data->set.http_keep_sending_on_error) { + infof(data, "HTTP error before end of send, keep sending"); + if(k->exp100 > EXP100_SEND_DATA) { + k->exp100 = EXP100_SEND_DATA; + k->keepon |= KEEP_SEND; + } + } + else { + infof(data, "HTTP error before end of send, stop sending"); + streamclose(conn, "Stop sending data before everything sent"); + result = Curl_done_sending(data, k); + if(result) + return result; + k->upload_done = TRUE; + if(data->state.expect100header) + k->exp100 = EXP100_FAILED; + } + } + break; + + default: /* default label present to avoid compiler warnings */ + break; + } + } + + if(conn->bits.rewindaftersend) { + /* We rewind after a complete send, so thus we continue + sending now */ + infof(data, "Keep sending data to get tossed away!"); + k->keepon |= KEEP_SEND; + } + } + + if(!k->header) { + /* + * really end-of-headers. + * + * If we requested a "no body", this is a good time to get + * out and return home. + */ + if(data->set.opt_no_body) + *stop_reading = TRUE; +#ifndef CURL_DISABLE_RTSP + else if((conn->handler->protocol & CURLPROTO_RTSP) && + (data->set.rtspreq == RTSPREQ_DESCRIBE) && + (k->size <= -1)) + /* Respect section 4.4 of rfc2326: If the Content-Length header is + absent, a length 0 must be assumed. It will prevent libcurl from + hanging on DESCRIBE request that got refused for whatever + reason */ + *stop_reading = TRUE; +#endif + else { + /* If we know the expected size of this document, we set the + maximum download size to the size of the expected + document or else, we won't know when to stop reading! + + Note that we set the download maximum even if we read a + "Connection: close" header, to make sure that + "Content-Length: 0" still prevents us from attempting to + read the (missing) response-body. + */ + /* According to RFC2616 section 4.4, we MUST ignore + Content-Length: headers if we are now receiving data + using chunked Transfer-Encoding. + */ + if(k->chunk) + k->maxdownload = k->size = -1; + } + if(-1 != k->size) { + /* We do this operation even if no_body is true, since this + data might be retrieved later with curl_easy_getinfo() + and its CURLINFO_CONTENT_LENGTH_DOWNLOAD option. */ + + Curl_pgrsSetDownloadSize(data, k->size); + k->maxdownload = k->size; + } + + /* If max download size is *zero* (nothing) we already have + nothing and can safely return ok now! But for HTTP/2, we'd + like to call http2_handle_stream_close to properly close a + stream. In order to do this, we keep reading until we + close the stream. */ + if(0 == k->maxdownload +#if defined(USE_NGHTTP2) + && !((conn->handler->protocol & PROTO_FAMILY_HTTP) && + conn->httpversion == 20) +#endif + ) + *stop_reading = TRUE; + + if(*stop_reading) { + /* we make sure that this socket isn't read more now */ + k->keepon &= ~KEEP_RECV; + } + + Curl_debug(data, CURLINFO_HEADER_IN, str_start, headerlen); + break; /* exit header line loop */ + } + + /* We continue reading headers, reset the line-based header */ + Curl_dyn_reset(&data->state.headerb); + continue; + } + + /* + * Checks for special headers coming up. + */ + + if(!k->headerline++) { + /* This is the first header, it MUST be the error code line + or else we consider this to be the body right away! */ + int httpversion_major; + int rtspversion_major; + int nc = 0; +#ifdef CURL_DOES_CONVERSIONS +#define HEADER1 scratch +#define SCRATCHSIZE 21 + CURLcode res; + char scratch[SCRATCHSIZE + 1]; /* "HTTP/major.minor 123" */ + /* We can't really convert this yet because we don't know if it's the + 1st header line or the body. So we do a partial conversion into a + scratch area, leaving the data at 'headp' as-is. + */ + strncpy(&scratch[0], headp, SCRATCHSIZE); + scratch[SCRATCHSIZE] = 0; /* null terminate */ + res = Curl_convert_from_network(data, + &scratch[0], + SCRATCHSIZE); + if(res) + /* Curl_convert_from_network calls failf if unsuccessful */ + return res; +#else +#define HEADER1 headp /* no conversion needed, just use headp */ +#endif /* CURL_DOES_CONVERSIONS */ + + if(conn->handler->protocol & PROTO_FAMILY_HTTP) { + /* + * https://tools.ietf.org/html/rfc7230#section-3.1.2 + * + * The response code is always a three-digit number in HTTP as the spec + * says. We allow any three-digit number here, but we cannot make + * guarantees on future behaviors since it isn't within the protocol. + */ + char separator; + char twoorthree[2]; + int httpversion = 0; + char digit4 = 0; + nc = sscanf(HEADER1, + " HTTP/%1d.%1d%c%3d%c", + &httpversion_major, + &httpversion, + &separator, + &k->httpcode, + &digit4); + + if(nc == 1 && httpversion_major >= 2 && + 2 == sscanf(HEADER1, " HTTP/%1[23] %d", twoorthree, &k->httpcode)) { + conn->httpversion = 0; + nc = 4; + separator = ' '; + } + + /* There can only be a 4th response code digit stored in 'digit4' if + all the other fields were parsed and stored first, so nc is 5 when + digit4 a digit */ + else if(ISDIGIT(digit4)) { + failf(data, "Unsupported response code in HTTP response"); + return CURLE_UNSUPPORTED_PROTOCOL; + } + + if((nc >= 4) && (' ' == separator)) { + httpversion += 10 * httpversion_major; + switch(httpversion) { + case 10: + case 11: +#if defined(USE_NGHTTP2) || defined(USE_HYPER) + case 20: +#endif +#if defined(ENABLE_QUIC) + case 30: +#endif + conn->httpversion = (unsigned char)httpversion; + break; + default: + failf(data, "Unsupported HTTP version (%u.%d) in response", + httpversion/10, httpversion%10); + return CURLE_UNSUPPORTED_PROTOCOL; + } + + if(k->upgr101 == UPGR101_RECEIVED) { + /* supposedly upgraded to http2 now */ + if(conn->httpversion != 20) + infof(data, "Lying server, not serving HTTP/2"); + } + if(conn->httpversion < 20) { + conn->bundle->multiuse = BUNDLE_NO_MULTIUSE; + infof(data, "Mark bundle as not supporting multiuse"); + } + } + else if(!nc) { + /* this is the real world, not a Nirvana + NCSA 1.5.x returns this crap when asked for HTTP/1.1 + */ + nc = sscanf(HEADER1, " HTTP %3d", &k->httpcode); + conn->httpversion = 10; + + /* If user has set option HTTP200ALIASES, + compare header line against list of aliases + */ + if(!nc) { + statusline check = + checkhttpprefix(data, + Curl_dyn_ptr(&data->state.headerb), + Curl_dyn_len(&data->state.headerb)); + if(check == STATUS_DONE) { + nc = 1; + k->httpcode = 200; + conn->httpversion = 10; + } + } + } + else { + failf(data, "Unsupported HTTP version in response"); + return CURLE_UNSUPPORTED_PROTOCOL; + } + } + else if(conn->handler->protocol & CURLPROTO_RTSP) { + char separator; + int rtspversion; + nc = sscanf(HEADER1, + " RTSP/%1d.%1d%c%3d", + &rtspversion_major, + &rtspversion, + &separator, + &k->httpcode); + if((nc == 4) && (' ' == separator)) { + conn->httpversion = 11; /* For us, RTSP acts like HTTP 1.1 */ + } + else { + nc = 0; + } + } + + if(nc) { + result = Curl_http_statusline(data, conn); + if(result) + return result; + } + else { + k->header = FALSE; /* this is not a header line */ + break; + } + } + + result = Curl_convert_from_network(data, headp, strlen(headp)); + /* Curl_convert_from_network calls failf if unsuccessful */ + if(result) + return result; + + result = Curl_http_header(data, conn, headp); + if(result) + return result; + + /* + * End of header-checks. Write them to the client. + */ + + writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + + Curl_debug(data, CURLINFO_HEADER_IN, headp, + Curl_dyn_len(&data->state.headerb)); + + result = Curl_client_write(data, writetype, headp, + Curl_dyn_len(&data->state.headerb)); + if(result) + return result; + + data->info.header_size += Curl_dyn_len(&data->state.headerb); + data->req.headerbytecount += Curl_dyn_len(&data->state.headerb); + + Curl_dyn_reset(&data->state.headerb); + } + while(*k->str); /* header line within buffer */ + + /* We might have reached the end of the header part here, but + there might be a non-header part left in the end of the read + buffer. */ + + return CURLE_OK; +} + +#endif /* CURL_DISABLE_HTTP */ diff --git a/lib/http.rs b/lib/http.rs deleted file mode 100644 index 3fe7e3b..0000000 --- a/lib/http.rs +++ /dev/null @@ -1,7269 +0,0 @@ -use ::libc; -use ::c2rust_bitfields; -extern "C" { - pub type _IO_wide_data; - pub type _IO_codecvt; - pub type _IO_marker; - pub type Curl_URL; - pub type thread_data; - pub type TELNET; - pub type smb_request; - pub type ldapreqinfo; - pub type psl_ctx_st; - pub type curl_pushheaders; - pub type ldapconninfo; - pub type tftp_state_data; - pub type nghttp2_session; - pub type ssl_backend_data; - fn sscanf(_: *const libc::c_char, _: *const libc::c_char, _: ...) -> libc::c_int; - fn time(__timer: *mut time_t) -> time_t; - fn Curl_isdigit(c: libc::c_int) -> libc::c_int; - fn Curl_isspace(c: libc::c_int) -> libc::c_int; - fn curl_strnequal( - s1: *const libc::c_char, - s2: *const libc::c_char, - n: size_t, - ) -> libc::c_int; - fn curl_mime_headers( - part: *mut curl_mimepart, - headers: *mut curl_slist, - take_ownership: libc::c_int, - ) -> CURLcode; - fn memcpy( - _: *mut libc::c_void, - _: *const libc::c_void, - _: libc::c_ulong, - ) -> *mut libc::c_void; - fn memmove( - _: *mut libc::c_void, - _: *const libc::c_void, - _: libc::c_ulong, - ) -> *mut libc::c_void; - fn memchr( - _: *const libc::c_void, - _: libc::c_int, - _: libc::c_ulong, - ) -> *mut libc::c_void; - fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int; - fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; - fn strstr(_: *const libc::c_char, _: *const libc::c_char) -> *mut libc::c_char; - fn strlen(_: *const libc::c_char) -> libc::c_ulong; - fn curl_url_cleanup(handle: *mut CURLU); - fn curl_url_dup(in_0: *mut CURLU) -> *mut CURLU; - fn curl_url_get( - handle: *mut CURLU, - what: CURLUPart, - part: *mut *mut libc::c_char, - flags: libc::c_uint, - ) -> CURLUcode; - fn curl_url_set( - handle: *mut CURLU, - what: CURLUPart, - part: *const libc::c_char, - flags: libc::c_uint, - ) -> CURLUcode; - fn Curl_cookie_add( - data: *mut Curl_easy, - c: *mut CookieInfo, - header: bool, - noexpiry: bool, - lineptr: *mut libc::c_char, - domain: *const libc::c_char, - path: *const libc::c_char, - secure: bool, - ) -> *mut Cookie; - fn Curl_cookie_getlist( - c: *mut CookieInfo, - host: *const libc::c_char, - path: *const libc::c_char, - secure: bool, - ) -> *mut Cookie; - fn Curl_cookie_freelist(cookies: *mut Cookie); - fn Curl_getformdata( - data: *mut Curl_easy, - _: *mut curl_mimepart, - post: *mut curl_httppost, - fread_func: curl_read_callback, - ) -> CURLcode; - fn Curl_dyn_init(s: *mut dynbuf, toobig: size_t); - fn Curl_dyn_free(s: *mut dynbuf); - fn Curl_dyn_addn(s: *mut dynbuf, mem: *const libc::c_void, len: size_t) -> CURLcode; - fn Curl_dyn_add(s: *mut dynbuf, str: *const libc::c_char) -> CURLcode; - fn Curl_dyn_addf(s: *mut dynbuf, fmt: *const libc::c_char, _: ...) -> CURLcode; - fn Curl_dyn_reset(s: *mut dynbuf); - fn Curl_dyn_ptr(s: *const dynbuf) -> *mut libc::c_char; - fn Curl_dyn_len(s: *const dynbuf) -> size_t; - fn Curl_mime_initpart(part: *mut curl_mimepart, easy: *mut Curl_easy); - fn Curl_mime_cleanpart(part: *mut curl_mimepart); - fn Curl_mime_prepare_headers( - part: *mut curl_mimepart, - contenttype: *const libc::c_char, - disposition: *const libc::c_char, - strategy: mimestrategy, - ) -> CURLcode; - fn Curl_mime_size(part: *mut curl_mimepart) -> curl_off_t; - fn Curl_mime_read( - buffer: *mut libc::c_char, - size: size_t, - nitems: size_t, - instream: *mut libc::c_void, - ) -> size_t; - fn Curl_mime_rewind(part: *mut curl_mimepart) -> CURLcode; - fn Curl_rtsp_parseheader( - data: *mut Curl_easy, - header: *mut libc::c_char, - ) -> CURLcode; - fn Curl_checkheaders( - data: *const Curl_easy, - thisheader: *const libc::c_char, - ) -> *mut libc::c_char; - fn Curl_readrewind(data: *mut Curl_easy) -> CURLcode; - fn Curl_meets_timecondition(data: *mut Curl_easy, timeofdoc: time_t) -> bool; - fn Curl_get_upload_buffer(data: *mut Curl_easy) -> CURLcode; - fn Curl_done_sending(data: *mut Curl_easy, k: *mut SingleRequest) -> CURLcode; - fn Curl_setup_transfer( - data: *mut Curl_easy, - sockindex: libc::c_int, - size: curl_off_t, - getheader: bool, - writesockindex: libc::c_int, - ); - fn Curl_infof(_: *mut Curl_easy, fmt: *const libc::c_char, _: ...); - fn Curl_failf(_: *mut Curl_easy, fmt: *const libc::c_char, _: ...); - fn Curl_client_write( - data: *mut Curl_easy, - type_0: libc::c_int, - ptr: *mut libc::c_char, - len: size_t, - ) -> CURLcode; - fn Curl_write( - data: *mut Curl_easy, - sockfd: curl_socket_t, - mem: *const libc::c_void, - len: size_t, - written: *mut ssize_t, - ) -> CURLcode; - fn Curl_debug( - data: *mut Curl_easy, - type_0: curl_infotype, - ptr: *mut libc::c_char, - size: size_t, - ) -> libc::c_int; - fn Curl_pgrsSetDownloadSize(data: *mut Curl_easy, size: curl_off_t); - fn Curl_pgrsSetUploadSize(data: *mut Curl_easy, size: curl_off_t); - fn Curl_pgrsSetUploadCounter(data: *mut Curl_easy, size: curl_off_t); - fn Curl_pgrsUpdate(data: *mut Curl_easy) -> libc::c_int; - fn Curl_base64_encode( - data: *mut Curl_easy, - inputbuff: *const libc::c_char, - insize: size_t, - outptr: *mut *mut libc::c_char, - outlen: *mut size_t, - ) -> CURLcode; - fn Curl_auth_is_digest_supported() -> bool; - static mut Curl_ssl: *const Curl_ssl; - fn Curl_ssl_connect_nonblocking( - data: *mut Curl_easy, - conn: *mut connectdata, - isproxy: bool, - sockindex: libc::c_int, - done: *mut bool, - ) -> CURLcode; - fn Curl_input_digest( - data: *mut Curl_easy, - proxy: bool, - header: *const libc::c_char, - ) -> CURLcode; - fn Curl_output_digest( - data: *mut Curl_easy, - proxy: bool, - request: *const libc::c_uchar, - uripath: *const libc::c_uchar, - ) -> CURLcode; - fn Curl_output_aws_sigv4(data: *mut Curl_easy, proxy: bool) -> CURLcode; - fn Curl_share_lock( - _: *mut Curl_easy, - _: curl_lock_data, - _: curl_lock_access, - ) -> CURLSHcode; - fn Curl_share_unlock(_: *mut Curl_easy, _: curl_lock_data) -> CURLSHcode; - static Curl_wkday: [*const libc::c_char; 7]; - static Curl_month: [*const libc::c_char; 12]; - fn Curl_gmtime(intime: time_t, store: *mut tm) -> CURLcode; - fn Curl_getdate_capped(p: *const libc::c_char) -> time_t; - fn curlx_strtoofft( - str: *const libc::c_char, - endp: *mut *mut libc::c_char, - base: libc::c_int, - num: *mut curl_off_t, - ) -> CURLofft; - fn Curl_expire_done(data: *mut Curl_easy, id: expire_id); - fn Curl_set_in_callback(data: *mut Curl_easy, value: bool); - fn Curl_strcasecompare( - first: *const libc::c_char, - second: *const libc::c_char, - ) -> libc::c_int; - fn Curl_strncasecompare( - first: *const libc::c_char, - second: *const libc::c_char, - max: size_t, - ) -> libc::c_int; - fn Curl_raw_toupper(in_0: libc::c_char) -> libc::c_char; - fn Curl_build_unencoding_stack( - data: *mut Curl_easy, - enclist: *const libc::c_char, - maybechunked: libc::c_int, - ) -> CURLcode; - fn Curl_unencode_cleanup(data: *mut Curl_easy); - fn Curl_proxy_connect(data: *mut Curl_easy, sockindex: libc::c_int) -> CURLcode; - fn Curl_connect_ongoing(conn: *mut connectdata) -> bool; - fn curlx_sotouz(sonum: curl_off_t) -> size_t; - fn curlx_uitous(uinum: libc::c_uint) -> libc::c_ushort; - fn Curl_http2_request_upgrade(req: *mut dynbuf, data: *mut Curl_easy) -> CURLcode; - fn Curl_http2_setup(data: *mut Curl_easy, conn: *mut connectdata) -> CURLcode; - fn Curl_http2_switched( - data: *mut Curl_easy, - ptr: *const libc::c_char, - nread: size_t, - ) -> CURLcode; - fn Curl_http2_setup_conn(conn: *mut connectdata); - fn Curl_http2_setup_req(data: *mut Curl_easy); - fn Curl_http2_done(data: *mut Curl_easy, premature: bool); - fn Curl_conncontrol(conn: *mut connectdata, closeit: libc::c_int); - fn Curl_altsvc_parse( - data: *mut Curl_easy, - altsvc: *mut altsvcinfo, - value: *const libc::c_char, - srcalpn: alpnid, - srchost: *const libc::c_char, - srcport: libc::c_ushort, - ) -> CURLcode; - fn Curl_hsts_parse( - h: *mut hsts, - hostname: *const libc::c_char, - sts: *const libc::c_char, - ) -> CURLcode; - fn curl_msnprintf( - buffer: *mut libc::c_char, - maxlength: size_t, - format: *const libc::c_char, - _: ... - ) -> libc::c_int; - fn curl_maprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char; - static mut Curl_cmalloc: curl_malloc_callback; - static mut Curl_cfree: curl_free_callback; - static mut Curl_cstrdup: curl_strdup_callback; - static mut Curl_ccalloc: curl_calloc_callback; -} -pub type __uint8_t = libc::c_uchar; -pub type __int32_t = libc::c_int; -pub type __uint32_t = libc::c_uint; -pub type __off_t = libc::c_long; -pub type __off64_t = libc::c_long; -pub type __time_t = libc::c_long; -pub type __ssize_t = libc::c_long; -pub type __socklen_t = libc::c_uint; -pub type ssize_t = __ssize_t; -pub type time_t = __time_t; -pub type size_t = libc::c_ulong; -pub type int32_t = __int32_t; -pub type socklen_t = __socklen_t; -pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} -pub type curl_socklen_t = socklen_t; -pub type curl_off_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _IO_FILE { - pub _flags: libc::c_int, - pub _IO_read_ptr: *mut libc::c_char, - pub _IO_read_end: *mut libc::c_char, - pub _IO_read_base: *mut libc::c_char, - pub _IO_write_base: *mut libc::c_char, - pub _IO_write_ptr: *mut libc::c_char, - pub _IO_write_end: *mut libc::c_char, - pub _IO_buf_base: *mut libc::c_char, - pub _IO_buf_end: *mut libc::c_char, - pub _IO_save_base: *mut libc::c_char, - pub _IO_backup_base: *mut libc::c_char, - pub _IO_save_end: *mut libc::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: libc::c_int, - pub _flags2: libc::c_int, - pub _old_offset: __off_t, - pub _cur_column: libc::c_ushort, - pub _vtable_offset: libc::c_schar, - pub _shortbuf: [libc::c_char; 1], - pub _lock: *mut libc::c_void, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut libc::c_void, - pub __pad5: size_t, - pub _mode: libc::c_int, - pub _unused2: [libc::c_char; 20], -} -pub type _IO_lock_t = (); -pub type FILE = _IO_FILE; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tm { - pub tm_sec: libc::c_int, - pub tm_min: libc::c_int, - pub tm_hour: libc::c_int, - pub tm_mday: libc::c_int, - pub tm_mon: libc::c_int, - pub tm_year: libc::c_int, - pub tm_wday: libc::c_int, - pub tm_yday: libc::c_int, - pub tm_isdst: libc::c_int, - pub tm_gmtoff: libc::c_long, - pub tm_zone: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_easy { - pub magic: libc::c_uint, - pub next: *mut Curl_easy, - pub prev: *mut Curl_easy, - pub conn: *mut connectdata, - pub connect_queue: Curl_llist_element, - pub conn_queue: Curl_llist_element, - pub mstate: CURLMstate, - pub result: CURLcode, - pub msg: Curl_message, - pub sockets: [curl_socket_t; 5], - pub actions: [libc::c_uchar; 5], - pub numsocks: libc::c_int, - pub dns: Names, - pub multi: *mut Curl_multi, - pub multi_easy: *mut Curl_multi, - pub share: *mut Curl_share, - pub psl: *mut PslCache, - pub req: SingleRequest, - pub set: UserDefined, - pub cookies: *mut CookieInfo, - pub hsts: *mut hsts, - pub asi: *mut altsvcinfo, - pub progress: Progress, - pub state: UrlState, - pub wildcard: WildcardData, - pub info: PureInfo, - pub tsi: curl_tlssessioninfo, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} -pub type curl_sslbackend = libc::c_uint; -pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; -pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; -pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; -pub const CURLSSLBACKEND_MBEDTLS: curl_sslbackend = 11; -pub const CURLSSLBACKEND_AXTLS: curl_sslbackend = 10; -pub const CURLSSLBACKEND_SECURETRANSPORT: curl_sslbackend = 9; -pub const CURLSSLBACKEND_SCHANNEL: curl_sslbackend = 8; -pub const CURLSSLBACKEND_WOLFSSL: curl_sslbackend = 7; -pub const CURLSSLBACKEND_POLARSSL: curl_sslbackend = 6; -pub const CURLSSLBACKEND_GSKIT: curl_sslbackend = 5; -pub const CURLSSLBACKEND_OBSOLETE4: curl_sslbackend = 4; -pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; -pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; -pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; -pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; -pub const CURLPX_LAST: CURLproxycode = 34; -pub const CURLPX_USER_REJECTED: CURLproxycode = 33; -pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; -pub const CURLPX_UNKNOWN_FAIL: CURLproxycode = 31; -pub const CURLPX_SEND_REQUEST: CURLproxycode = 30; -pub const CURLPX_SEND_CONNECT: CURLproxycode = 29; -pub const CURLPX_SEND_AUTH: CURLproxycode = 28; -pub const CURLPX_RESOLVE_HOST: CURLproxycode = 27; -pub const CURLPX_REQUEST_FAILED: CURLproxycode = 26; -pub const CURLPX_REPLY_UNASSIGNED: CURLproxycode = 25; -pub const CURLPX_REPLY_TTL_EXPIRED: CURLproxycode = 24; -pub const CURLPX_REPLY_NOT_ALLOWED: CURLproxycode = 23; -pub const CURLPX_REPLY_NETWORK_UNREACHABLE: CURLproxycode = 22; -pub const CURLPX_REPLY_HOST_UNREACHABLE: CURLproxycode = 21; -pub const CURLPX_REPLY_GENERAL_SERVER_FAILURE: CURLproxycode = 20; -pub const CURLPX_REPLY_CONNECTION_REFUSED: CURLproxycode = 19; -pub const CURLPX_REPLY_COMMAND_NOT_SUPPORTED: CURLproxycode = 18; -pub const CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED: CURLproxycode = 17; -pub const CURLPX_RECV_REQACK: CURLproxycode = 16; -pub const CURLPX_RECV_CONNECT: CURLproxycode = 15; -pub const CURLPX_RECV_AUTH: CURLproxycode = 14; -pub const CURLPX_RECV_ADDRESS: CURLproxycode = 13; -pub const CURLPX_NO_AUTH: CURLproxycode = 12; -pub const CURLPX_LONG_USER: CURLproxycode = 11; -pub const CURLPX_LONG_PASSWD: CURLproxycode = 10; -pub const CURLPX_LONG_HOSTNAME: CURLproxycode = 9; -pub const CURLPX_IDENTD_DIFFER: CURLproxycode = 8; -pub const CURLPX_IDENTD: CURLproxycode = 7; -pub const CURLPX_GSSAPI_PROTECTION: CURLproxycode = 6; -pub const CURLPX_GSSAPI_PERMSG: CURLproxycode = 5; -pub const CURLPX_GSSAPI: CURLproxycode = 4; -pub const CURLPX_CLOSED: CURLproxycode = 3; -pub const CURLPX_BAD_VERSION: CURLproxycode = 2; -pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; -pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option:: ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option::< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void) -> (), ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; -pub const CURLWC_DONE: wildcard_states = 7; -pub const CURLWC_ERROR: wildcard_states = 6; -pub const CURLWC_SKIP: wildcard_states = 5; -pub const CURLWC_CLEAN: wildcard_states = 4; -pub const CURLWC_DOWNLOADING: wildcard_states = 3; -pub const CURLWC_MATCHING: wildcard_states = 2; -pub const CURLWC_INIT: wildcard_states = 1; -pub const CURLWC_CLEAR: wildcard_states = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UrlState { - pub conn_cache: *mut conncache, - pub keeps_speed: curltime, - pub lastconnect_id: libc::c_long, - pub headerb: dynbuf, - pub buffer: *mut libc::c_char, - pub ulbuf: *mut libc::c_char, - pub current_speed: curl_off_t, - pub first_host: *mut libc::c_char, - pub retrycount: libc::c_int, - pub first_remote_port: libc::c_int, - pub session: *mut Curl_ssl_session, - pub sessionage: libc::c_long, - pub tempwrite: [tempbuf; 3], - pub tempcount: libc::c_uint, - pub os_errno: libc::c_int, - pub scratch: *mut libc::c_char, - pub followlocation: libc::c_long, - pub prev_signal: Option:: ()>, - pub digest: digestdata, - pub proxydigest: digestdata, - pub authhost: auth, - pub authproxy: auth, - pub async_0: Curl_async, - pub expiretime: curltime, - pub timenode: Curl_tree, - pub timeoutlist: Curl_llist, - pub expires: [time_node; 13], - pub most_recent_ftp_entrypath: *mut libc::c_char, - pub httpwant: libc::c_uchar, - pub httpversion: libc::c_uchar, - #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] - pub prev_block_had_trailing_cr: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 5], - pub crlf_conversions: curl_off_t, - pub range: *mut libc::c_char, - pub resume_from: curl_off_t, - pub rtsp_next_client_CSeq: libc::c_long, - pub rtsp_next_server_CSeq: libc::c_long, - pub rtsp_CSeq_recv: libc::c_long, - pub infilesize: curl_off_t, - pub drain: size_t, - pub fread_func: curl_read_callback, - pub in_0: *mut libc::c_void, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub uh: *mut CURLU, - pub up: urlpieces, - pub httpreq: Curl_HttpReq, - pub url: *mut libc::c_char, - pub referer: *mut libc::c_char, - pub cookielist: *mut curl_slist, - pub resolve: *mut curl_slist, - pub trailers_bytes_sent: size_t, - pub trailers_buf: dynbuf, - pub trailers_state: trailers_state, - pub aptr: dynamically_allocated_data, - #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] - #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] - #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] - #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] - #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] - #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] - #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] - #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] - #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] - #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] - #[bitfield(name = "done", ty = "bit", bits = "12..=12")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] - #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] - #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] - #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] - #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] - #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] - #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: [u8; 3], - #[bitfield(padding)] - pub c2rust_padding_0: [u8; 5], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; -pub const TRAILERS_DONE: trailers_state = 3; -pub const TRAILERS_SENDING: trailers_state = 2; -pub const TRAILERS_INITIALIZED: trailers_state = 1; -pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; -pub const HTTPREQ_HEAD: Curl_HttpReq = 5; -pub const HTTPREQ_PUT: Curl_HttpReq = 4; -pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; -pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; -pub const HTTPREQ_POST: Curl_HttpReq = 1; -pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} -pub type CURLU = Curl_URL; -pub type curl_read_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; -pub const EXPIRE_LAST: expire_id = 13; -pub const EXPIRE_QUIC: expire_id = 12; -pub const EXPIRE_TOOFAST: expire_id = 11; -pub const EXPIRE_TIMEOUT: expire_id = 10; -pub const EXPIRE_SPEEDCHECK: expire_id = 9; -pub const EXPIRE_RUN_NOW: expire_id = 8; -pub const EXPIRE_MULTI_PENDING: expire_id = 7; -pub const EXPIRE_HAPPY_EYEBALLS: expire_id = 6; -pub const EXPIRE_HAPPY_EYEBALLS_DNS: expire_id = 5; -pub const EXPIRE_DNS_PER_NAME2: expire_id = 4; -pub const EXPIRE_DNS_PER_NAME: expire_id = 3; -pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; -pub const EXPIRE_ASYNC_NAME: expire_id = 1; -pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Curl_async { - pub hostname: *mut libc::c_char, - pub dns: *mut Curl_dns_entry, - pub tdata: *mut thread_data, - pub resolver: *mut libc::c_void, - pub port: libc::c_int, - pub status: libc::c_int, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - pub done: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl_session { - pub name: *mut libc::c_char, - pub conn_to_host: *mut libc::c_char, - pub scheme: *const libc::c_char, - pub sessionid: *mut libc::c_void, - pub idsize: size_t, - pub age: libc::c_long, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub ssl_config: ssl_primary_config, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_primary_config { - pub version: libc::c_long, - pub version_max: libc::c_long, - pub CApath: *mut libc::c_char, - pub CAfile: *mut libc::c_char, - pub issuercert: *mut libc::c_char, - pub clientcert: *mut libc::c_char, - pub random_file: *mut libc::c_char, - pub egdsocket: *mut libc::c_char, - pub cipher_list: *mut libc::c_char, - pub cipher_list13: *mut libc::c_char, - pub pinned_key: *mut libc::c_char, - pub cert_blob: *mut curl_blob, - pub ca_info_blob: *mut curl_blob, - pub issuercert_blob: *mut curl_blob, - pub curves: *mut libc::c_char, - #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] - #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] - #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] - #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] - pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct conncache { - pub hash: Curl_hash, - pub num_conn: size_t, - pub next_connection_id: libc::c_long, - pub last_cleanup: curltime, - pub closure_handle: *mut Curl_easy, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option:: ()>; -pub type comp_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, *mut libc::c_void, size_t) -> size_t, ->; -pub type hash_function = Option::< - unsafe extern "C" fn(*mut libc::c_void, size_t, size_t) -> size_t, ->; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct altsvcinfo { - pub filename: *mut libc::c_char, - pub list: Curl_llist, - pub flags: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hsts { - pub list: Curl_llist, - pub filename: *mut libc::c_char, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UserDefined { - pub err: *mut FILE, - pub debugdata: *mut libc::c_void, - pub errorbuffer: *mut libc::c_char, - pub proxyport: libc::c_long, - pub out: *mut libc::c_void, - pub in_set: *mut libc::c_void, - pub writeheader: *mut libc::c_void, - pub rtp_out: *mut libc::c_void, - pub use_port: libc::c_long, - pub httpauth: libc::c_ulong, - pub proxyauth: libc::c_ulong, - pub socks5auth: libc::c_ulong, - pub maxredirs: libc::c_long, - pub keep_post: libc::c_int, - pub postfields: *mut libc::c_void, - pub seek_func: curl_seek_callback, - pub postfieldsize: curl_off_t, - pub localport: libc::c_ushort, - pub localportrange: libc::c_int, - pub fwrite_func: curl_write_callback, - pub fwrite_header: curl_write_callback, - pub fwrite_rtp: curl_write_callback, - pub fread_func_set: curl_read_callback, - pub fprogress: curl_progress_callback, - pub fxferinfo: curl_xferinfo_callback, - pub fdebug: curl_debug_callback, - pub ioctl_func: curl_ioctl_callback, - pub fsockopt: curl_sockopt_callback, - pub sockopt_client: *mut libc::c_void, - pub fopensocket: curl_opensocket_callback, - pub opensocket_client: *mut libc::c_void, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub seek_client: *mut libc::c_void, - pub convfromnetwork: curl_conv_callback, - pub convtonetwork: curl_conv_callback, - pub convfromutf8: curl_conv_callback, - pub hsts_read: curl_hstsread_callback, - pub hsts_read_userp: *mut libc::c_void, - pub hsts_write: curl_hstswrite_callback, - pub hsts_write_userp: *mut libc::c_void, - pub progress_client: *mut libc::c_void, - pub ioctl_client: *mut libc::c_void, - pub timeout: libc::c_long, - pub connecttimeout: libc::c_long, - pub accepttimeout: libc::c_long, - pub happy_eyeballs_timeout: libc::c_long, - pub server_response_timeout: libc::c_long, - pub maxage_conn: libc::c_long, - pub tftp_blksize: libc::c_long, - pub filesize: curl_off_t, - pub low_speed_limit: libc::c_long, - pub low_speed_time: libc::c_long, - pub max_send_speed: curl_off_t, - pub max_recv_speed: curl_off_t, - pub set_resume_from: curl_off_t, - pub headers: *mut curl_slist, - pub proxyheaders: *mut curl_slist, - pub httppost: *mut curl_httppost, - pub mimepost: curl_mimepart, - pub quote: *mut curl_slist, - pub postquote: *mut curl_slist, - pub prequote: *mut curl_slist, - pub source_quote: *mut curl_slist, - pub source_prequote: *mut curl_slist, - pub source_postquote: *mut curl_slist, - pub telnet_options: *mut curl_slist, - pub resolve: *mut curl_slist, - pub connect_to: *mut curl_slist, - pub timecondition: curl_TimeCond, - pub proxytype: curl_proxytype, - pub timevalue: time_t, - pub method: Curl_HttpReq, - pub httpwant: libc::c_uchar, - pub ssl: ssl_config_data, - pub proxy_ssl: ssl_config_data, - pub general_ssl: ssl_general_config, - pub dns_cache_timeout: libc::c_long, - pub buffer_size: libc::c_long, - pub upload_buffer_size: libc::c_uint, - pub private_data: *mut libc::c_void, - pub http200aliases: *mut curl_slist, - pub ipver: libc::c_uchar, - pub max_filesize: curl_off_t, - pub ftp_filemethod: curl_ftpfile, - pub ftpsslauth: curl_ftpauth, - pub ftp_ccc: curl_ftpccc, - pub ftp_create_missing_dirs: libc::c_int, - pub ssh_keyfunc: curl_sshkeycallback, - pub ssh_keyfunc_userp: *mut libc::c_void, - pub use_netrc: CURL_NETRC_OPTION, - pub use_ssl: curl_usessl, - pub new_file_perms: libc::c_long, - pub new_directory_perms: libc::c_long, - pub ssh_auth_types: libc::c_long, - pub str_0: [*mut libc::c_char; 80], - pub blobs: [*mut curl_blob; 8], - pub scope_id: libc::c_uint, - pub allowed_protocols: libc::c_long, - pub redir_protocols: libc::c_long, - pub mail_rcpt: *mut curl_slist, - pub rtspreq: Curl_RtspReq, - pub rtspversion: libc::c_long, - pub chunk_bgn: curl_chunk_bgn_callback, - pub chunk_end: curl_chunk_end_callback, - pub fnmatch: curl_fnmatch_callback, - pub fnmatch_data: *mut libc::c_void, - pub gssapi_delegation: libc::c_long, - pub tcp_keepidle: libc::c_long, - pub tcp_keepintvl: libc::c_long, - pub maxconnects: size_t, - pub expect_100_timeout: libc::c_long, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub stream_dependents: *mut Curl_http2_dep, - pub resolver_start: curl_resolver_start_callback, - pub resolver_start_client: *mut libc::c_void, - pub upkeep_interval_ms: libc::c_long, - pub fmultidone: multidone_func, - pub dohfor: *mut Curl_easy, - pub uh: *mut CURLU, - pub trailer_data: *mut libc::c_void, - pub trailer_callback: curl_trailer_callback, - #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] - #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] - #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] - #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] - #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] - #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] - #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] - #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] - #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] - #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] - #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] - #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] - #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] - #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] - #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] - #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] - #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] - #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] - #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] - #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] - #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] - #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] - #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] - #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] - #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] - #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] - #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] - #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] - #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] - #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] - #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] - #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] - #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] - #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] - #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] - #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] - #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] - #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] - #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] - #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] - #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] - #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] - #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] - #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] - #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] - #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] - #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] - #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] - #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] - #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] - #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] - #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] - #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] - #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: [u8; 8], -} -pub type curl_trailer_callback = Option::< - unsafe extern "C" fn(*mut *mut curl_slist, *mut libc::c_void) -> libc::c_int, ->; -pub type multidone_func = Option::< - unsafe extern "C" fn(*mut Curl_easy, CURLcode) -> libc::c_int, ->; -pub type CURLcode = libc::c_uint; -pub const CURL_LAST: CURLcode = 99; -pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; -pub const CURLE_PROXY: CURLcode = 97; -pub const CURLE_QUIC_CONNECT_ERROR: CURLcode = 96; -pub const CURLE_HTTP3: CURLcode = 95; -pub const CURLE_AUTH_ERROR: CURLcode = 94; -pub const CURLE_RECURSIVE_API_CALL: CURLcode = 93; -pub const CURLE_HTTP2_STREAM: CURLcode = 92; -pub const CURLE_SSL_INVALIDCERTSTATUS: CURLcode = 91; -pub const CURLE_SSL_PINNEDPUBKEYNOTMATCH: CURLcode = 90; -pub const CURLE_NO_CONNECTION_AVAILABLE: CURLcode = 89; -pub const CURLE_CHUNK_FAILED: CURLcode = 88; -pub const CURLE_FTP_BAD_FILE_LIST: CURLcode = 87; -pub const CURLE_RTSP_SESSION_ERROR: CURLcode = 86; -pub const CURLE_RTSP_CSEQ_ERROR: CURLcode = 85; -pub const CURLE_FTP_PRET_FAILED: CURLcode = 84; -pub const CURLE_SSL_ISSUER_ERROR: CURLcode = 83; -pub const CURLE_SSL_CRL_BADFILE: CURLcode = 82; -pub const CURLE_AGAIN: CURLcode = 81; -pub const CURLE_SSL_SHUTDOWN_FAILED: CURLcode = 80; -pub const CURLE_SSH: CURLcode = 79; -pub const CURLE_REMOTE_FILE_NOT_FOUND: CURLcode = 78; -pub const CURLE_SSL_CACERT_BADFILE: CURLcode = 77; -pub const CURLE_CONV_REQD: CURLcode = 76; -pub const CURLE_CONV_FAILED: CURLcode = 75; -pub const CURLE_TFTP_NOSUCHUSER: CURLcode = 74; -pub const CURLE_REMOTE_FILE_EXISTS: CURLcode = 73; -pub const CURLE_TFTP_UNKNOWNID: CURLcode = 72; -pub const CURLE_TFTP_ILLEGAL: CURLcode = 71; -pub const CURLE_REMOTE_DISK_FULL: CURLcode = 70; -pub const CURLE_TFTP_PERM: CURLcode = 69; -pub const CURLE_TFTP_NOTFOUND: CURLcode = 68; -pub const CURLE_LOGIN_DENIED: CURLcode = 67; -pub const CURLE_SSL_ENGINE_INITFAILED: CURLcode = 66; -pub const CURLE_SEND_FAIL_REWIND: CURLcode = 65; -pub const CURLE_USE_SSL_FAILED: CURLcode = 64; -pub const CURLE_FILESIZE_EXCEEDED: CURLcode = 63; -pub const CURLE_LDAP_INVALID_URL: CURLcode = 62; -pub const CURLE_BAD_CONTENT_ENCODING: CURLcode = 61; -pub const CURLE_PEER_FAILED_VERIFICATION: CURLcode = 60; -pub const CURLE_SSL_CIPHER: CURLcode = 59; -pub const CURLE_SSL_CERTPROBLEM: CURLcode = 58; -pub const CURLE_OBSOLETE57: CURLcode = 57; -pub const CURLE_RECV_ERROR: CURLcode = 56; -pub const CURLE_SEND_ERROR: CURLcode = 55; -pub const CURLE_SSL_ENGINE_SETFAILED: CURLcode = 54; -pub const CURLE_SSL_ENGINE_NOTFOUND: CURLcode = 53; -pub const CURLE_GOT_NOTHING: CURLcode = 52; -pub const CURLE_OBSOLETE51: CURLcode = 51; -pub const CURLE_OBSOLETE50: CURLcode = 50; -pub const CURLE_SETOPT_OPTION_SYNTAX: CURLcode = 49; -pub const CURLE_UNKNOWN_OPTION: CURLcode = 48; -pub const CURLE_TOO_MANY_REDIRECTS: CURLcode = 47; -pub const CURLE_OBSOLETE46: CURLcode = 46; -pub const CURLE_INTERFACE_FAILED: CURLcode = 45; -pub const CURLE_OBSOLETE44: CURLcode = 44; -pub const CURLE_BAD_FUNCTION_ARGUMENT: CURLcode = 43; -pub const CURLE_ABORTED_BY_CALLBACK: CURLcode = 42; -pub const CURLE_FUNCTION_NOT_FOUND: CURLcode = 41; -pub const CURLE_OBSOLETE40: CURLcode = 40; -pub const CURLE_LDAP_SEARCH_FAILED: CURLcode = 39; -pub const CURLE_LDAP_CANNOT_BIND: CURLcode = 38; -pub const CURLE_FILE_COULDNT_READ_FILE: CURLcode = 37; -pub const CURLE_BAD_DOWNLOAD_RESUME: CURLcode = 36; -pub const CURLE_SSL_CONNECT_ERROR: CURLcode = 35; -pub const CURLE_HTTP_POST_ERROR: CURLcode = 34; -pub const CURLE_RANGE_ERROR: CURLcode = 33; -pub const CURLE_OBSOLETE32: CURLcode = 32; -pub const CURLE_FTP_COULDNT_USE_REST: CURLcode = 31; -pub const CURLE_FTP_PORT_FAILED: CURLcode = 30; -pub const CURLE_OBSOLETE29: CURLcode = 29; -pub const CURLE_OPERATION_TIMEDOUT: CURLcode = 28; -pub const CURLE_OUT_OF_MEMORY: CURLcode = 27; -pub const CURLE_READ_ERROR: CURLcode = 26; -pub const CURLE_UPLOAD_FAILED: CURLcode = 25; -pub const CURLE_OBSOLETE24: CURLcode = 24; -pub const CURLE_WRITE_ERROR: CURLcode = 23; -pub const CURLE_HTTP_RETURNED_ERROR: CURLcode = 22; -pub const CURLE_QUOTE_ERROR: CURLcode = 21; -pub const CURLE_OBSOLETE20: CURLcode = 20; -pub const CURLE_FTP_COULDNT_RETR_FILE: CURLcode = 19; -pub const CURLE_PARTIAL_FILE: CURLcode = 18; -pub const CURLE_FTP_COULDNT_SET_TYPE: CURLcode = 17; -pub const CURLE_HTTP2: CURLcode = 16; -pub const CURLE_FTP_CANT_GET_HOST: CURLcode = 15; -pub const CURLE_FTP_WEIRD_227_FORMAT: CURLcode = 14; -pub const CURLE_FTP_WEIRD_PASV_REPLY: CURLcode = 13; -pub const CURLE_FTP_ACCEPT_TIMEOUT: CURLcode = 12; -pub const CURLE_FTP_WEIRD_PASS_REPLY: CURLcode = 11; -pub const CURLE_FTP_ACCEPT_FAILED: CURLcode = 10; -pub const CURLE_REMOTE_ACCESS_DENIED: CURLcode = 9; -pub const CURLE_WEIRD_SERVER_REPLY: CURLcode = 8; -pub const CURLE_COULDNT_CONNECT: CURLcode = 7; -pub const CURLE_COULDNT_RESOLVE_HOST: CURLcode = 6; -pub const CURLE_COULDNT_RESOLVE_PROXY: CURLcode = 5; -pub const CURLE_NOT_BUILT_IN: CURLcode = 4; -pub const CURLE_URL_MALFORMAT: CURLcode = 3; -pub const CURLE_FAILED_INIT: CURLcode = 2; -pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; -pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_http2_dep { - pub next: *mut Curl_http2_dep, - pub data: *mut Curl_easy, -} -pub type curl_fnmatch_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void) -> libc::c_long, ->; -pub type curl_chunk_bgn_callback = Option::< - unsafe extern "C" fn( - *const libc::c_void, - *mut libc::c_void, - libc::c_int, - ) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; -pub const RTSPREQ_LAST: Curl_RtspReq = 12; -pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; -pub const RTSPREQ_RECORD: Curl_RtspReq = 10; -pub const RTSPREQ_SET_PARAMETER: Curl_RtspReq = 9; -pub const RTSPREQ_GET_PARAMETER: Curl_RtspReq = 8; -pub const RTSPREQ_TEARDOWN: Curl_RtspReq = 7; -pub const RTSPREQ_PAUSE: Curl_RtspReq = 6; -pub const RTSPREQ_PLAY: Curl_RtspReq = 5; -pub const RTSPREQ_SETUP: Curl_RtspReq = 4; -pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; -pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; -pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; -pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; -pub const CURLUSESSL_LAST: curl_usessl = 4; -pub const CURLUSESSL_ALL: curl_usessl = 3; -pub const CURLUSESSL_CONTROL: curl_usessl = 2; -pub const CURLUSESSL_TRY: curl_usessl = 1; -pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; -pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; -pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; -pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; -pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option::< - unsafe extern "C" fn( - *mut CURL, - *const curl_khkey, - *const curl_khkey, - curl_khmatch, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_khmatch = libc::c_uint; -pub const CURLKHMATCH_LAST: curl_khmatch = 3; -pub const CURLKHMATCH_MISSING: curl_khmatch = 2; -pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; -pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; -pub const CURLKHTYPE_ED25519: curl_khtype = 5; -pub const CURLKHTYPE_ECDSA: curl_khtype = 4; -pub const CURLKHTYPE_DSS: curl_khtype = 3; -pub const CURLKHTYPE_RSA: curl_khtype = 2; -pub const CURLKHTYPE_RSA1: curl_khtype = 1; -pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; -pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; -pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; -pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; -pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; -pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; -pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; -pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; -pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; -pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; -pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; -pub const FTPFILE_NOCWD: curl_ftpfile = 2; -pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_config_data { - pub primary: ssl_primary_config, - pub certverifyresult: libc::c_long, - pub CRLfile: *mut libc::c_char, - pub fsslctx: curl_ssl_ctx_callback, - pub fsslctxp: *mut libc::c_void, - pub cert_type: *mut libc::c_char, - pub key: *mut libc::c_char, - pub key_blob: *mut curl_blob, - pub key_type: *mut libc::c_char, - pub key_passwd: *mut libc::c_char, - #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] - #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] - #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] - #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] - #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] - #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] - #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] - #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type curl_ssl_ctx_callback = Option::< - unsafe extern "C" fn(*mut CURL, *mut libc::c_void, *mut libc::c_void) -> CURLcode, ->; -pub type curl_proxytype = libc::c_uint; -pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; -pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; -pub const CURLPROXY_SOCKS5: curl_proxytype = 5; -pub const CURLPROXY_SOCKS4: curl_proxytype = 4; -pub const CURLPROXY_HTTPS: curl_proxytype = 2; -pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; -pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; -pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; -pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; -pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; -pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; -pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mimepart { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mime, - pub nextpart: *mut curl_mimepart, - pub kind: mimekind, - pub flags: libc::c_uint, - pub data: *mut libc::c_char, - pub readfunc: curl_read_callback, - pub seekfunc: curl_seek_callback, - pub freefunc: curl_free_callback, - pub arg: *mut libc::c_void, - pub fp: *mut FILE, - pub curlheaders: *mut curl_slist, - pub userheaders: *mut curl_slist, - pub mimetype: *mut libc::c_char, - pub filename: *mut libc::c_char, - pub name: *mut libc::c_char, - pub datasize: curl_off_t, - pub state: mime_state, - pub encoder: *const mime_encoder, - pub encstate: mime_encoder_state, - pub lastreadstatus: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder { - pub name: *const libc::c_char, - pub encodefunc: Option::< - unsafe extern "C" fn( - *mut libc::c_char, - size_t, - bool, - *mut curl_mimepart, - ) -> size_t, - >, - pub sizefunc: Option:: curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, -} -pub type mimestate = libc::c_uint; -pub const MIMESTATE_LAST: mimestate = 9; -pub const MIMESTATE_END: mimestate = 8; -pub const MIMESTATE_CONTENT: mimestate = 7; -pub const MIMESTATE_BOUNDARY2: mimestate = 6; -pub const MIMESTATE_BOUNDARY1: mimestate = 5; -pub const MIMESTATE_BODY: mimestate = 4; -pub const MIMESTATE_EOH: mimestate = 3; -pub const MIMESTATE_USERHEADERS: mimestate = 2; -pub const MIMESTATE_CURLHEADERS: mimestate = 1; -pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option:: ()>; -pub type curl_seek_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_off_t, libc::c_int) -> libc::c_int, ->; -pub type mimekind = libc::c_uint; -pub const MIMEKIND_LAST: mimekind = 5; -pub const MIMEKIND_MULTIPART: mimekind = 4; -pub const MIMEKIND_CALLBACK: mimekind = 3; -pub const MIMEKIND_FILE: mimekind = 2; -pub const MIMEKIND_DATA: mimekind = 1; -pub const MIMEKIND_NONE: mimekind = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mime { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mimepart, - pub firstpart: *mut curl_mimepart, - pub lastpart: *mut curl_mimepart, - pub boundary: [libc::c_char; 41], - pub state: mime_state, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut curl_index, - *mut libc::c_void, - ) -> CURLSTScode, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; -pub const CURLSTS_FAIL: CURLSTScode = 2; -pub const CURLSTS_DONE: CURLSTScode = 1; -pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut libc::c_void, - ) -> CURLSTScode, ->; -pub type curl_conv_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t) -> CURLcode, ->; -pub type curl_closesocket_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t) -> libc::c_int, ->; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - curlsocktype, - *mut curl_sockaddr, - ) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; -pub const CURLSOCKTYPE_LAST: curlsocktype = 2; -pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; -pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = Option::< - unsafe extern "C" fn(*mut libc::c_void, curl_socket_t, curlsocktype) -> libc::c_int, ->; -pub type curl_ioctl_callback = Option::< - unsafe extern "C" fn(*mut CURL, libc::c_int, *mut libc::c_void) -> curlioerr, ->; -pub type curlioerr = libc::c_uint; -pub const CURLIOE_LAST: curlioerr = 3; -pub const CURLIOE_FAILRESTART: curlioerr = 2; -pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; -pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_infotype = libc::c_uint; -pub const CURLINFO_END: curl_infotype = 7; -pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; -pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; -pub const CURLINFO_DATA_OUT: curl_infotype = 4; -pub const CURLINFO_DATA_IN: curl_infotype = 3; -pub const CURLINFO_HEADER_OUT: curl_infotype = 2; -pub const CURLINFO_HEADER_IN: curl_infotype = 1; -pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, ->; -pub type curl_progress_callback = Option::< - unsafe extern "C" fn( - *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, - ) -> libc::c_int, ->; -pub type curl_write_callback = Option::< - unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, ->; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct SingleRequest { - pub size: curl_off_t, - pub maxdownload: curl_off_t, - pub bytecount: curl_off_t, - pub writebytecount: curl_off_t, - pub headerbytecount: curl_off_t, - pub deductheadercount: curl_off_t, - pub pendingheader: curl_off_t, - pub start: curltime, - pub now: curltime, - pub badheader: C2RustUnnamed_1, - pub headerline: libc::c_int, - pub str_0: *mut libc::c_char, - pub offset: curl_off_t, - pub httpcode: libc::c_int, - pub keepon: libc::c_int, - pub start100: curltime, - pub exp100: expect100, - pub upgr101: upgrade101, - pub writer_stack: *mut contenc_writer, - pub timeofdoc: time_t, - pub bodywrites: libc::c_long, - pub location: *mut libc::c_char, - pub newurl: *mut libc::c_char, - pub upload_present: ssize_t, - pub upload_fromhere: *mut libc::c_char, - pub p: C2RustUnnamed, - pub doh: *mut dohdata, - #[bitfield(name = "header", ty = "bit", bits = "0..=0")] - #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] - #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] - #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] - #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] - #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] - #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] - #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] - #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: [u8; 2], - #[bitfield(padding)] - pub c2rust_padding: [u8; 6], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dohdata { - pub headers: *mut curl_slist, - pub probe: [dnsprobe; 2], - pub pending: libc::c_uint, - pub port: libc::c_int, - pub host: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dnsprobe { - pub easy: *mut CURL, - pub dnstype: libc::c_int, - pub dohbuffer: [libc::c_uchar; 512], - pub dohlen: size_t, - pub serverdoh: dynbuf, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed { - pub file: *mut FILEPROTO, - pub ftp: *mut FTP, - pub http: *mut HTTP, - pub imap: *mut IMAP, - pub ldap: *mut ldapreqinfo, - pub mqtt: *mut MQTT, - pub pop3: *mut POP3, - pub rtsp: *mut RTSP, - pub smb: *mut smb_request, - pub smtp: *mut SMTP, - pub ssh: *mut SSHPROTO, - pub telnet: *mut TELNET, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; -pub const PPTRANSFER_NONE: curl_pp_transfer = 2; -pub const PPTRANSFER_INFO: curl_pp_transfer = 1; -pub const PPTRANSFER_BODY: curl_pp_transfer = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct RTSP { - pub http_wrapper: HTTP, - pub CSeq_sent: libc::c_long, - pub CSeq_recv: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HTTP { - pub sendit: *mut curl_mimepart, - pub postsize: curl_off_t, - pub postdata: *const libc::c_char, - pub p_pragma: *const libc::c_char, - pub form: curl_mimepart, - pub backup: back, - pub sending: C2RustUnnamed_0, - pub send_buffer: dynbuf, - pub stream_id: int32_t, - pub bodystarted: bool, - pub header_recvbuf: dynbuf, - pub nread_header_recvbuf: size_t, - pub trailer_recvbuf: dynbuf, - pub status_code: libc::c_int, - pub pausedata: *const uint8_t, - pub pauselen: size_t, - pub close_handled: bool, - pub push_headers: *mut *mut libc::c_char, - pub push_headers_used: size_t, - pub push_headers_alloc: size_t, - pub error: uint32_t, - pub closed: bool, - pub mem: *mut libc::c_char, - pub len: size_t, - pub memlen: size_t, - pub upload_mem: *const uint8_t, - pub upload_len: size_t, - pub upload_left: curl_off_t, -} -pub type uint8_t = __uint8_t; -pub type uint32_t = __uint32_t; -pub type C2RustUnnamed_0 = libc::c_uint; -pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; -pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; -pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct contenc_writer { - pub handler: *const content_encoding, - pub downstream: *mut contenc_writer, - pub params: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct content_encoding { - pub name: *const libc::c_char, - pub alias: *const libc::c_char, - pub init_writer: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut contenc_writer) -> CURLcode, - >, - pub unencode_write: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut contenc_writer, - *const libc::c_char, - size_t, - ) -> CURLcode, - >, - pub close_writer: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut contenc_writer) -> (), - >, - pub paramsize: size_t, -} -pub type upgrade101 = libc::c_uint; -pub const UPGR101_WORKING: upgrade101 = 3; -pub const UPGR101_RECEIVED: upgrade101 = 2; -pub const UPGR101_REQUESTED: upgrade101 = 1; -pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; -pub const EXP100_FAILED: expect100 = 3; -pub const EXP100_SENDING_REQUEST: expect100 = 2; -pub const EXP100_AWAITING_CONTINUE: expect100 = 1; -pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; -pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; -pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; -pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct PslCache { - pub psl: *const psl_ctx_t, - pub expires: time_t, - pub dynamic: bool, -} -pub type psl_ctx_t = psl_ctx_st; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_share { - pub magic: libc::c_uint, - pub specifier: libc::c_uint, - pub dirty: libc::c_uint, - pub lockfunc: curl_lock_function, - pub unlockfunc: curl_unlock_function, - pub clientdata: *mut libc::c_void, - pub conn_cache: conncache, - pub hostcache: Curl_hash, - pub cookies: *mut CookieInfo, - pub psl: PslCache, - pub sslsession: *mut Curl_ssl_session, - pub max_ssl_sessions: size_t, - pub sessionage: libc::c_long, -} -pub type curl_unlock_function = Option::< - unsafe extern "C" fn(*mut CURL, curl_lock_data, *mut libc::c_void) -> (), ->; -pub type curl_lock_data = libc::c_uint; -pub const CURL_LOCK_DATA_LAST: curl_lock_data = 7; -pub const CURL_LOCK_DATA_PSL: curl_lock_data = 6; -pub const CURL_LOCK_DATA_CONNECT: curl_lock_data = 5; -pub const CURL_LOCK_DATA_SSL_SESSION: curl_lock_data = 4; -pub const CURL_LOCK_DATA_DNS: curl_lock_data = 3; -pub const CURL_LOCK_DATA_COOKIE: curl_lock_data = 2; -pub const CURL_LOCK_DATA_SHARE: curl_lock_data = 1; -pub const CURL_LOCK_DATA_NONE: curl_lock_data = 0; -pub type curl_lock_function = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_lock_data, - curl_lock_access, - *mut libc::c_void, - ) -> (), ->; -pub type curl_lock_access = libc::c_uint; -pub const CURL_LOCK_ACCESS_LAST: curl_lock_access = 3; -pub const CURL_LOCK_ACCESS_SINGLE: curl_lock_access = 2; -pub const CURL_LOCK_ACCESS_SHARED: curl_lock_access = 1; -pub const CURL_LOCK_ACCESS_NONE: curl_lock_access = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_multi { - pub magic: libc::c_uint, - pub easyp: *mut Curl_easy, - pub easylp: *mut Curl_easy, - pub num_easy: libc::c_int, - pub num_alive: libc::c_int, - pub msglist: Curl_llist, - pub pending: Curl_llist, - pub socket_cb: curl_socket_callback, - pub socket_userp: *mut libc::c_void, - pub push_cb: curl_push_callback, - pub push_userp: *mut libc::c_void, - pub hostcache: Curl_hash, - pub psl: PslCache, - pub timetree: *mut Curl_tree, - pub sockhash: Curl_hash, - pub conn_cache: conncache, - pub maxconnects: libc::c_long, - pub max_host_connections: libc::c_long, - pub max_total_connections: libc::c_long, - pub timer_cb: curl_multi_timer_callback, - pub timer_userp: *mut libc::c_void, - pub timer_lastcall: curltime, - pub max_concurrent_streams: libc::c_uint, - pub wakeup_pair: [curl_socket_t; 2], - pub multiplexing: bool, - pub recheckstate: bool, - pub in_callback: bool, - pub ipv6_works: bool, -} -pub type curl_multi_timer_callback = Option::< - unsafe extern "C" fn(*mut CURLM, libc::c_long, *mut libc::c_void) -> libc::c_int, ->; -pub type CURLM = Curl_multi; -pub type curl_push_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - *mut CURL, - size_t, - *mut curl_pushheaders, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_socket_callback = Option::< - unsafe extern "C" fn( - *mut CURL, - curl_socket_t, - libc::c_int, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; -pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; -pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; -pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_message { - pub list: Curl_llist_element, - pub extmsg: CURLMsg, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CURLMsg { - pub msg: CURLMSG, - pub easy_handle: *mut CURL, - pub data: C2RustUnnamed_3, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_3 { - pub whatever: *mut libc::c_void, - pub result: CURLcode, -} -pub type CURLMSG = libc::c_uint; -pub const CURLMSG_LAST: CURLMSG = 2; -pub const CURLMSG_DONE: CURLMSG = 1; -pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; -pub const MSTATE_LAST: CURLMstate = 17; -pub const MSTATE_MSGSENT: CURLMstate = 16; -pub const MSTATE_COMPLETED: CURLMstate = 15; -pub const MSTATE_DONE: CURLMstate = 14; -pub const MSTATE_RATELIMITING: CURLMstate = 13; -pub const MSTATE_PERFORMING: CURLMstate = 12; -pub const MSTATE_DID: CURLMstate = 11; -pub const MSTATE_DOING_MORE: CURLMstate = 10; -pub const MSTATE_DOING: CURLMstate = 9; -pub const MSTATE_DO: CURLMstate = 8; -pub const MSTATE_PROTOCONNECTING: CURLMstate = 7; -pub const MSTATE_PROTOCONNECT: CURLMstate = 6; -pub const MSTATE_TUNNELING: CURLMstate = 5; -pub const MSTATE_CONNECTING: CURLMstate = 4; -pub const MSTATE_RESOLVING: CURLMstate = 3; -pub const MSTATE_CONNECT: CURLMstate = 2; -pub const MSTATE_PENDING: CURLMstate = 1; -pub const MSTATE_INIT: CURLMstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectdata { - pub cnnct: connstate, - pub bundle_node: Curl_llist_element, - pub chunk: Curl_chunker, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub connection_id: libc::c_long, - pub dns_entry: *mut Curl_dns_entry, - pub ip_addr: *mut Curl_addrinfo, - pub tempaddr: [*mut Curl_addrinfo; 2], - pub scope_id: libc::c_uint, - pub transport: C2RustUnnamed_6, - pub host: hostname, - pub hostname_resolve: *mut libc::c_char, - pub secondaryhostname: *mut libc::c_char, - pub conn_to_host: hostname, - pub socks_proxy: proxy_info, - pub http_proxy: proxy_info, - pub port: libc::c_int, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub secondary_port: libc::c_ushort, - pub primary_ip: [libc::c_char; 46], - pub ip_version: libc::c_uchar, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub options: *mut libc::c_char, - pub sasl_authzid: *mut libc::c_char, - pub httpversion: libc::c_uchar, - pub now: curltime, - pub created: curltime, - pub lastused: curltime, - pub sock: [curl_socket_t; 2], - pub tempsock: [curl_socket_t; 2], - pub tempfamily: [libc::c_int; 2], - pub recv: [Option::; 2], - pub send: [Option::; 2], - pub ssl: [ssl_connect_data; 2], - pub proxy_ssl: [ssl_connect_data; 2], - pub ssl_extra: *mut libc::c_void, - pub ssl_config: ssl_primary_config, - pub proxy_ssl_config: ssl_primary_config, - pub bits: ConnectBits, - pub num_addr: libc::c_int, - pub connecttime: curltime, - pub timeoutms_per_addr: [timediff_t; 2], - pub handler: *const Curl_handler, - pub given: *const Curl_handler, - pub keepalive: curltime, - pub sockfd: curl_socket_t, - pub writesockfd: curl_socket_t, - pub easyq: Curl_llist, - pub seek_func: curl_seek_callback, - pub seek_client: *mut libc::c_void, - pub trailer: dynbuf, - pub proto: C2RustUnnamed_5, - pub connect_state: *mut http_connect_state, - pub bundle: *mut connectbundle, - pub unix_domain_socket: *mut libc::c_char, - pub localdev: *mut libc::c_char, - pub localportrange: libc::c_int, - pub cselect_bits: libc::c_int, - pub waitfor: libc::c_int, - pub negnpn: libc::c_int, - pub localport: libc::c_ushort, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct http_connect_state { - pub http_proxy: HTTP, - pub prot_save: *mut HTTP, - pub rcvbuf: dynbuf, - pub req: dynbuf, - pub nsend: size_t, - pub keepon: keeponval, - pub cl: curl_off_t, - pub tunnel_state: C2RustUnnamed_4, - #[bitfield(name = "chunked_encoding", ty = "bit", bits = "0..=0")] - #[bitfield(name = "close_connection", ty = "bit", bits = "1..=1")] - pub chunked_encoding_close_connection: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type C2RustUnnamed_4 = libc::c_uint; -pub const TUNNEL_EXIT: C2RustUnnamed_4 = 3; -pub const TUNNEL_COMPLETE: C2RustUnnamed_4 = 2; -pub const TUNNEL_CONNECT: C2RustUnnamed_4 = 1; -pub const TUNNEL_INIT: C2RustUnnamed_4 = 0; -pub type keeponval = libc::c_uint; -pub const KEEPON_IGNORE: keeponval = 2; -pub const KEEPON_CONNECT: keeponval = 1; -pub const KEEPON_DONE: keeponval = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_5 { - pub ftpc: ftp_conn, - pub httpc: http_conn, - pub sshc: ssh_conn, - pub tftpc: *mut tftp_state_data, - pub imapc: imap_conn, - pub pop3c: pop3_conn, - pub smtpc: smtp_conn, - pub rtspc: rtsp_conn, - pub smbc: smb_conn, - pub rtmp: *mut libc::c_void, - pub ldapc: *mut ldapconninfo, - pub mqtt: mqtt_conn, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; -pub const MQTT_NOSTATE: mqttstate = 7; -pub const MQTT_PUB_REMAIN: mqttstate = 6; -pub const MQTT_PUBWAIT: mqttstate = 5; -pub const MQTT_SUBACK_COMING: mqttstate = 4; -pub const MQTT_SUBACK: mqttstate = 3; -pub const MQTT_CONNACK: mqttstate = 2; -pub const MQTT_REMAINING_LENGTH: mqttstate = 1; -pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; -pub const SMB_CONNECTED: smb_conn_state = 4; -pub const SMB_SETUP: smb_conn_state = 3; -pub const SMB_NEGOTIATE: smb_conn_state = 2; -pub const SMB_CONNECTING: smb_conn_state = 1; -pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smtp_conn { - pub pp: pingpong, - pub state: smtpstate, - pub ssldone: bool, - pub domain: *mut libc::c_char, - pub sasl: SASL, - pub tls_supported: bool, - pub size_supported: bool, - pub utf8_supported: bool, - pub auth_supported: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASL { - pub params: *const SASLproto, - pub state: saslstate, - pub authmechs: libc::c_ushort, - pub prefmech: libc::c_ushort, - pub authused: libc::c_ushort, - pub resetprefs: bool, - pub mutual_auth: bool, - pub force_ir: bool, -} -pub type saslstate = libc::c_uint; -pub const SASL_FINAL: saslstate = 17; -pub const SASL_CANCEL: saslstate = 16; -pub const SASL_GSASL: saslstate = 15; -pub const SASL_OAUTH2_RESP: saslstate = 14; -pub const SASL_OAUTH2: saslstate = 13; -pub const SASL_GSSAPI_NO_DATA: saslstate = 12; -pub const SASL_GSSAPI_TOKEN: saslstate = 11; -pub const SASL_GSSAPI: saslstate = 10; -pub const SASL_NTLM_TYPE2MSG: saslstate = 9; -pub const SASL_NTLM: saslstate = 8; -pub const SASL_DIGESTMD5_RESP: saslstate = 7; -pub const SASL_DIGESTMD5: saslstate = 6; -pub const SASL_CRAMMD5: saslstate = 5; -pub const SASL_EXTERNAL: saslstate = 4; -pub const SASL_LOGIN_PASSWD: saslstate = 3; -pub const SASL_LOGIN: saslstate = 2; -pub const SASL_PLAIN: saslstate = 1; -pub const SASL_STOP: saslstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASLproto { - pub service: *const libc::c_char, - pub contcode: libc::c_int, - pub finalcode: libc::c_int, - pub maxirlen: size_t, - pub sendauth: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - *const libc::c_char, - ) -> CURLcode, - >, - pub sendcont: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - ) -> CURLcode, - >, - pub getmessage: Option::< - unsafe extern "C" fn(*mut libc::c_char, *mut *mut libc::c_char) -> (), - >, -} -pub type smtpstate = libc::c_uint; -pub const SMTP_LAST: smtpstate = 13; -pub const SMTP_QUIT: smtpstate = 12; -pub const SMTP_POSTDATA: smtpstate = 11; -pub const SMTP_DATA: smtpstate = 10; -pub const SMTP_RCPT: smtpstate = 9; -pub const SMTP_MAIL: smtpstate = 8; -pub const SMTP_COMMAND: smtpstate = 7; -pub const SMTP_AUTH: smtpstate = 6; -pub const SMTP_UPGRADETLS: smtpstate = 5; -pub const SMTP_STARTTLS: smtpstate = 4; -pub const SMTP_HELO: smtpstate = 3; -pub const SMTP_EHLO: smtpstate = 2; -pub const SMTP_SERVERGREET: smtpstate = 1; -pub const SMTP_STOP: smtpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pingpong { - pub cache: *mut libc::c_char, - pub cache_size: size_t, - pub nread_resp: size_t, - pub linestart_resp: *mut libc::c_char, - pub pending_resp: bool, - pub sendthis: *mut libc::c_char, - pub sendleft: size_t, - pub sendsize: size_t, - pub response: curltime, - pub response_time: timediff_t, - pub sendbuf: dynbuf, - pub statemachine: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub endofresp: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - >, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pop3_conn { - pub pp: pingpong, - pub state: pop3state, - pub ssldone: bool, - pub tls_supported: bool, - pub eob: size_t, - pub strip: size_t, - pub sasl: SASL, - pub authtypes: libc::c_uint, - pub preftype: libc::c_uint, - pub apoptimestamp: *mut libc::c_char, -} -pub type pop3state = libc::c_uint; -pub const POP3_LAST: pop3state = 11; -pub const POP3_QUIT: pop3state = 10; -pub const POP3_COMMAND: pop3state = 9; -pub const POP3_PASS: pop3state = 8; -pub const POP3_USER: pop3state = 7; -pub const POP3_APOP: pop3state = 6; -pub const POP3_AUTH: pop3state = 5; -pub const POP3_UPGRADETLS: pop3state = 4; -pub const POP3_STARTTLS: pop3state = 3; -pub const POP3_CAPA: pop3state = 2; -pub const POP3_SERVERGREET: pop3state = 1; -pub const POP3_STOP: pop3state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct imap_conn { - pub pp: pingpong, - pub state: imapstate, - pub ssldone: bool, - pub preauth: bool, - pub sasl: SASL, - pub preftype: libc::c_uint, - pub cmdid: libc::c_uint, - pub resptag: [libc::c_char; 5], - pub tls_supported: bool, - pub login_disabled: bool, - pub ir_supported: bool, - pub mailbox: *mut libc::c_char, - pub mailbox_uidvalidity: *mut libc::c_char, - pub dyn_0: dynbuf, -} -pub type imapstate = libc::c_uint; -pub const IMAP_LAST: imapstate = 15; -pub const IMAP_LOGOUT: imapstate = 14; -pub const IMAP_SEARCH: imapstate = 13; -pub const IMAP_APPEND_FINAL: imapstate = 12; -pub const IMAP_APPEND: imapstate = 11; -pub const IMAP_FETCH_FINAL: imapstate = 10; -pub const IMAP_FETCH: imapstate = 9; -pub const IMAP_SELECT: imapstate = 8; -pub const IMAP_LIST: imapstate = 7; -pub const IMAP_LOGIN: imapstate = 6; -pub const IMAP_AUTHENTICATE: imapstate = 5; -pub const IMAP_UPGRADETLS: imapstate = 4; -pub const IMAP_STARTTLS: imapstate = 3; -pub const IMAP_CAPABILITY: imapstate = 2; -pub const IMAP_SERVERGREET: imapstate = 1; -pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; -pub const SSH_LAST: sshstate = 60; -pub const SSH_QUIT: sshstate = 59; -pub const SSH_SESSION_FREE: sshstate = 58; -pub const SSH_SESSION_DISCONNECT: sshstate = 57; -pub const SSH_SCP_CHANNEL_FREE: sshstate = 56; -pub const SSH_SCP_WAIT_CLOSE: sshstate = 55; -pub const SSH_SCP_WAIT_EOF: sshstate = 54; -pub const SSH_SCP_SEND_EOF: sshstate = 53; -pub const SSH_SCP_DONE: sshstate = 52; -pub const SSH_SCP_DOWNLOAD: sshstate = 51; -pub const SSH_SCP_DOWNLOAD_INIT: sshstate = 50; -pub const SSH_SCP_UPLOAD_INIT: sshstate = 49; -pub const SSH_SCP_TRANS_INIT: sshstate = 48; -pub const SSH_SFTP_SHUTDOWN: sshstate = 47; -pub const SSH_SFTP_CLOSE: sshstate = 46; -pub const SSH_SFTP_DOWNLOAD_STAT: sshstate = 45; -pub const SSH_SFTP_DOWNLOAD_INIT: sshstate = 44; -pub const SSH_SFTP_READDIR_DONE: sshstate = 43; -pub const SSH_SFTP_READDIR_BOTTOM: sshstate = 42; -pub const SSH_SFTP_READDIR_LINK: sshstate = 41; -pub const SSH_SFTP_READDIR: sshstate = 40; -pub const SSH_SFTP_READDIR_INIT: sshstate = 39; -pub const SSH_SFTP_CREATE_DIRS_MKDIR: sshstate = 38; -pub const SSH_SFTP_CREATE_DIRS: sshstate = 37; -pub const SSH_SFTP_CREATE_DIRS_INIT: sshstate = 36; -pub const SSH_SFTP_UPLOAD_INIT: sshstate = 35; -pub const SSH_SFTP_TRANS_INIT: sshstate = 34; -pub const SSH_SFTP_FILETIME: sshstate = 33; -pub const SSH_SFTP_GETINFO: sshstate = 32; -pub const SSH_SFTP_QUOTE_STATVFS: sshstate = 31; -pub const SSH_SFTP_QUOTE_UNLINK: sshstate = 30; -pub const SSH_SFTP_QUOTE_RMDIR: sshstate = 29; -pub const SSH_SFTP_QUOTE_RENAME: sshstate = 28; -pub const SSH_SFTP_QUOTE_MKDIR: sshstate = 27; -pub const SSH_SFTP_QUOTE_SYMLINK: sshstate = 26; -pub const SSH_SFTP_QUOTE_SETSTAT: sshstate = 25; -pub const SSH_SFTP_QUOTE_STAT: sshstate = 24; -pub const SSH_SFTP_NEXT_QUOTE: sshstate = 23; -pub const SSH_SFTP_QUOTE: sshstate = 22; -pub const SSH_SFTP_POSTQUOTE_INIT: sshstate = 21; -pub const SSH_SFTP_QUOTE_INIT: sshstate = 20; -pub const SSH_SFTP_REALPATH: sshstate = 19; -pub const SSH_SFTP_INIT: sshstate = 18; -pub const SSH_AUTH_DONE: sshstate = 17; -pub const SSH_AUTH_GSSAPI: sshstate = 16; -pub const SSH_AUTH_KEY: sshstate = 15; -pub const SSH_AUTH_KEY_INIT: sshstate = 14; -pub const SSH_AUTH_HOST: sshstate = 13; -pub const SSH_AUTH_HOST_INIT: sshstate = 12; -pub const SSH_AUTH_AGENT: sshstate = 11; -pub const SSH_AUTH_AGENT_LIST: sshstate = 10; -pub const SSH_AUTH_AGENT_INIT: sshstate = 9; -pub const SSH_AUTH_PASS: sshstate = 8; -pub const SSH_AUTH_PASS_INIT: sshstate = 7; -pub const SSH_AUTH_PKEY: sshstate = 6; -pub const SSH_AUTH_PKEY_INIT: sshstate = 5; -pub const SSH_AUTHLIST: sshstate = 4; -pub const SSH_HOSTKEY: sshstate = 3; -pub const SSH_S_STARTUP: sshstate = 2; -pub const SSH_INIT: sshstate = 1; -pub const SSH_STOP: sshstate = 0; -pub const SSH_NO_STATE: sshstate = -1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct http_conn { - pub binsettings: [uint8_t; 80], - pub binlen: size_t, - pub trnsfr: *mut Curl_easy, - pub h2: *mut nghttp2_session, - pub send_underlying: Option::, - pub recv_underlying: Option::, - pub inbuf: *mut libc::c_char, - pub inbuflen: size_t, - pub nread_inbuf: size_t, - pub pause_stream_id: int32_t, - pub drain_total: size_t, - pub settings: h2settings, - pub local_settings: [nghttp2_settings_entry; 3], - pub local_settings_num: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct nghttp2_settings_entry { - pub settings_id: int32_t, - pub value: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct h2settings { - pub max_concurrent_streams: uint32_t, - pub enable_push: bool, -} -pub type Curl_recv = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *mut libc::c_char, - size_t, - *mut CURLcode, -) -> ssize_t; -pub type Curl_send = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *const libc::c_void, - size_t, - *mut CURLcode, -) -> ssize_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_conn { - pub pp: pingpong, - pub entrypath: *mut libc::c_char, - pub file: *mut libc::c_char, - pub dirs: *mut *mut libc::c_char, - pub dirdepth: libc::c_int, - pub dont_check: bool, - pub ctl_valid: bool, - pub cwddone: bool, - pub cwdcount: libc::c_int, - pub cwdfail: bool, - pub wait_data_conn: bool, - pub newport: libc::c_ushort, - pub newhost: *mut libc::c_char, - pub prevpath: *mut libc::c_char, - pub transfertype: libc::c_char, - pub count1: libc::c_int, - pub count2: libc::c_int, - pub count3: libc::c_int, - pub state: ftpstate, - pub state_saved: ftpstate, - pub retr_size_saved: curl_off_t, - pub server_os: *mut libc::c_char, - pub known_filesize: curl_off_t, -} -pub type ftpstate = libc::c_uint; -pub const FTP_LAST: ftpstate = 35; -pub const FTP_QUIT: ftpstate = 34; -pub const FTP_STOR: ftpstate = 33; -pub const FTP_RETR: ftpstate = 32; -pub const FTP_LIST: ftpstate = 31; -pub const FTP_PASV: ftpstate = 30; -pub const FTP_PRET: ftpstate = 29; -pub const FTP_PORT: ftpstate = 28; -pub const FTP_RETR_REST: ftpstate = 27; -pub const FTP_REST: ftpstate = 26; -pub const FTP_STOR_SIZE: ftpstate = 25; -pub const FTP_RETR_SIZE: ftpstate = 24; -pub const FTP_SIZE: ftpstate = 23; -pub const FTP_STOR_TYPE: ftpstate = 22; -pub const FTP_RETR_TYPE: ftpstate = 21; -pub const FTP_LIST_TYPE: ftpstate = 20; -pub const FTP_TYPE: ftpstate = 19; -pub const FTP_MDTM: ftpstate = 18; -pub const FTP_MKD: ftpstate = 17; -pub const FTP_CWD: ftpstate = 16; -pub const FTP_POSTQUOTE: ftpstate = 15; -pub const FTP_STOR_PREQUOTE: ftpstate = 14; -pub const FTP_RETR_PREQUOTE: ftpstate = 13; -pub const FTP_QUOTE: ftpstate = 12; -pub const FTP_NAMEFMT: ftpstate = 11; -pub const FTP_SYST: ftpstate = 10; -pub const FTP_PWD: ftpstate = 9; -pub const FTP_CCC: ftpstate = 8; -pub const FTP_PROT: ftpstate = 7; -pub const FTP_PBSZ: ftpstate = 6; -pub const FTP_ACCT: ftpstate = 5; -pub const FTP_PASS: ftpstate = 4; -pub const FTP_USER: ftpstate = 3; -pub const FTP_AUTH: ftpstate = 2; -pub const FTP_WAIT220: ftpstate = 1; -pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_handler { - pub scheme: *const libc::c_char, - pub setup_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - >, - pub do_it: Option:: CURLcode>, - pub done: Option:: CURLcode>, - pub do_more: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, - >, - pub connect_it: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - >, - pub connecting: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - >, - pub doing: Option:: CURLcode>, - pub proto_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub doing_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub domore_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub perform_getsock: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - >, - pub disconnect: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, bool) -> CURLcode, - >, - pub readwrite: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut ssize_t, - *mut bool, - ) -> CURLcode, - >, - pub connection_check: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_uint, - ) -> libc::c_uint, - >, - pub attach: Option:: ()>, - pub defport: libc::c_int, - pub protocol: libc::c_uint, - pub family: libc::c_uint, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_connect_data { - pub state: ssl_connection_state, - pub connecting_state: ssl_connect_state, - pub backend: *mut ssl_backend_data, - #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] - pub use_0: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type ssl_connect_state = libc::c_uint; -pub const ssl_connect_done: ssl_connect_state = 5; -pub const ssl_connect_3: ssl_connect_state = 4; -pub const ssl_connect_2_writing: ssl_connect_state = 3; -pub const ssl_connect_2_reading: ssl_connect_state = 2; -pub const ssl_connect_2: ssl_connect_state = 1; -pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; -pub const ssl_connection_complete: ssl_connection_state = 2; -pub const ssl_connection_negotiating: ssl_connection_state = 1; -pub const ssl_connection_none: ssl_connection_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_6 = libc::c_uint; -pub const TRNSPRT_QUIC: C2RustUnnamed_6 = 5; -pub const TRNSPRT_UDP: C2RustUnnamed_6 = 4; -pub const TRNSPRT_TCP: C2RustUnnamed_6 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; -pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; -pub const CHUNK_TRAILER_CR: ChunkyState = 6; -pub const CHUNK_TRAILER: ChunkyState = 5; -pub const CHUNK_STOP: ChunkyState = 4; -pub const CHUNK_POSTLF: ChunkyState = 3; -pub const CHUNK_DATA: ChunkyState = 2; -pub const CHUNK_LF: ChunkyState = 1; -pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; -pub const CONNECT_DONE: connect_t = 17; -pub const CONNECT_REQ_READ_MORE: connect_t = 16; -pub const CONNECT_REQ_READ: connect_t = 15; -pub const CONNECT_REQ_SENDING: connect_t = 14; -pub const CONNECT_REQ_SEND: connect_t = 13; -pub const CONNECT_RESOLVE_REMOTE: connect_t = 12; -pub const CONNECT_RESOLVED: connect_t = 11; -pub const CONNECT_RESOLVING: connect_t = 10; -pub const CONNECT_REQ_INIT: connect_t = 9; -pub const CONNECT_AUTH_READ: connect_t = 8; -pub const CONNECT_AUTH_SEND: connect_t = 7; -pub const CONNECT_AUTH_INIT: connect_t = 6; -pub const CONNECT_GSSAPI_INIT: connect_t = 5; -pub const CONNECT_SOCKS_READ: connect_t = 4; -pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; -pub const CONNECT_SOCKS_SEND: connect_t = 2; -pub const CONNECT_SOCKS_INIT: connect_t = 1; -pub const CONNECT_INIT: connect_t = 0; -pub type curl_malloc_callback = Option::< - unsafe extern "C" fn(size_t) -> *mut libc::c_void, ->; -pub type curl_strdup_callback = Option::< - unsafe extern "C" fn(*const libc::c_char) -> *mut libc::c_char, ->; -pub type curl_calloc_callback = Option::< - unsafe extern "C" fn(size_t, size_t) -> *mut libc::c_void, ->; -pub type C2RustUnnamed_7 = libc::c_uint; -pub const CURL_HTTP_VERSION_LAST: C2RustUnnamed_7 = 31; -pub const CURL_HTTP_VERSION_3: C2RustUnnamed_7 = 30; -pub const CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE: C2RustUnnamed_7 = 5; -pub const CURL_HTTP_VERSION_2TLS: C2RustUnnamed_7 = 4; -pub const CURL_HTTP_VERSION_2_0: C2RustUnnamed_7 = 3; -pub const CURL_HTTP_VERSION_1_1: C2RustUnnamed_7 = 2; -pub const CURL_HTTP_VERSION_1_0: C2RustUnnamed_7 = 1; -pub const CURL_HTTP_VERSION_NONE: C2RustUnnamed_7 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_ssl_backend { - pub id: curl_sslbackend, - pub name: *const libc::c_char, -} -pub type CURLINFO = libc::c_uint; -pub const CURLINFO_LASTONE: CURLINFO = 60; -pub const CURLINFO_REFERER: CURLINFO = 1048636; -pub const CURLINFO_PROXY_ERROR: CURLINFO = 2097211; -pub const CURLINFO_EFFECTIVE_METHOD: CURLINFO = 1048634; -pub const CURLINFO_RETRY_AFTER: CURLINFO = 6291513; -pub const CURLINFO_APPCONNECT_TIME_T: CURLINFO = 6291512; -pub const CURLINFO_REDIRECT_TIME_T: CURLINFO = 6291511; -pub const CURLINFO_STARTTRANSFER_TIME_T: CURLINFO = 6291510; -pub const CURLINFO_PRETRANSFER_TIME_T: CURLINFO = 6291509; -pub const CURLINFO_CONNECT_TIME_T: CURLINFO = 6291508; -pub const CURLINFO_NAMELOOKUP_TIME_T: CURLINFO = 6291507; -pub const CURLINFO_TOTAL_TIME_T: CURLINFO = 6291506; -pub const CURLINFO_SCHEME: CURLINFO = 1048625; -pub const CURLINFO_PROTOCOL: CURLINFO = 2097200; -pub const CURLINFO_PROXY_SSL_VERIFYRESULT: CURLINFO = 2097199; -pub const CURLINFO_HTTP_VERSION: CURLINFO = 2097198; -pub const CURLINFO_TLS_SSL_PTR: CURLINFO = 4194349; -pub const CURLINFO_ACTIVESOCKET: CURLINFO = 5242924; -pub const CURLINFO_TLS_SESSION: CURLINFO = 4194347; -pub const CURLINFO_LOCAL_PORT: CURLINFO = 2097194; -pub const CURLINFO_LOCAL_IP: CURLINFO = 1048617; -pub const CURLINFO_PRIMARY_PORT: CURLINFO = 2097192; -pub const CURLINFO_RTSP_CSEQ_RECV: CURLINFO = 2097191; -pub const CURLINFO_RTSP_SERVER_CSEQ: CURLINFO = 2097190; -pub const CURLINFO_RTSP_CLIENT_CSEQ: CURLINFO = 2097189; -pub const CURLINFO_RTSP_SESSION_ID: CURLINFO = 1048612; -pub const CURLINFO_CONDITION_UNMET: CURLINFO = 2097187; -pub const CURLINFO_CERTINFO: CURLINFO = 4194338; -pub const CURLINFO_APPCONNECT_TIME: CURLINFO = 3145761; -pub const CURLINFO_PRIMARY_IP: CURLINFO = 1048608; -pub const CURLINFO_REDIRECT_URL: CURLINFO = 1048607; -pub const CURLINFO_FTP_ENTRY_PATH: CURLINFO = 1048606; -pub const CURLINFO_LASTSOCKET: CURLINFO = 2097181; -pub const CURLINFO_COOKIELIST: CURLINFO = 4194332; -pub const CURLINFO_SSL_ENGINES: CURLINFO = 4194331; -pub const CURLINFO_NUM_CONNECTS: CURLINFO = 2097178; -pub const CURLINFO_OS_ERRNO: CURLINFO = 2097177; -pub const CURLINFO_PROXYAUTH_AVAIL: CURLINFO = 2097176; -pub const CURLINFO_HTTPAUTH_AVAIL: CURLINFO = 2097175; -pub const CURLINFO_HTTP_CONNECTCODE: CURLINFO = 2097174; -pub const CURLINFO_PRIVATE: CURLINFO = 1048597; -pub const CURLINFO_REDIRECT_COUNT: CURLINFO = 2097172; -pub const CURLINFO_REDIRECT_TIME: CURLINFO = 3145747; -pub const CURLINFO_CONTENT_TYPE: CURLINFO = 1048594; -pub const CURLINFO_STARTTRANSFER_TIME: CURLINFO = 3145745; -pub const CURLINFO_CONTENT_LENGTH_UPLOAD_T: CURLINFO = 6291472; -pub const CURLINFO_CONTENT_LENGTH_UPLOAD: CURLINFO = 3145744; -pub const CURLINFO_CONTENT_LENGTH_DOWNLOAD_T: CURLINFO = 6291471; -pub const CURLINFO_CONTENT_LENGTH_DOWNLOAD: CURLINFO = 3145743; -pub const CURLINFO_FILETIME_T: CURLINFO = 6291470; -pub const CURLINFO_FILETIME: CURLINFO = 2097166; -pub const CURLINFO_SSL_VERIFYRESULT: CURLINFO = 2097165; -pub const CURLINFO_REQUEST_SIZE: CURLINFO = 2097164; -pub const CURLINFO_HEADER_SIZE: CURLINFO = 2097163; -pub const CURLINFO_SPEED_UPLOAD_T: CURLINFO = 6291466; -pub const CURLINFO_SPEED_UPLOAD: CURLINFO = 3145738; -pub const CURLINFO_SPEED_DOWNLOAD_T: CURLINFO = 6291465; -pub const CURLINFO_SPEED_DOWNLOAD: CURLINFO = 3145737; -pub const CURLINFO_SIZE_DOWNLOAD_T: CURLINFO = 6291464; -pub const CURLINFO_SIZE_DOWNLOAD: CURLINFO = 3145736; -pub const CURLINFO_SIZE_UPLOAD_T: CURLINFO = 6291463; -pub const CURLINFO_SIZE_UPLOAD: CURLINFO = 3145735; -pub const CURLINFO_PRETRANSFER_TIME: CURLINFO = 3145734; -pub const CURLINFO_CONNECT_TIME: CURLINFO = 3145733; -pub const CURLINFO_NAMELOOKUP_TIME: CURLINFO = 3145732; -pub const CURLINFO_TOTAL_TIME: CURLINFO = 3145731; -pub const CURLINFO_RESPONSE_CODE: CURLINFO = 2097154; -pub const CURLINFO_EFFECTIVE_URL: CURLINFO = 1048577; -pub const CURLINFO_NONE: CURLINFO = 0; -pub type CURLSHcode = libc::c_uint; -pub const CURLSHE_LAST: CURLSHcode = 6; -pub const CURLSHE_NOT_BUILT_IN: CURLSHcode = 5; -pub const CURLSHE_NOMEM: CURLSHcode = 4; -pub const CURLSHE_INVALID: CURLSHcode = 3; -pub const CURLSHE_IN_USE: CURLSHcode = 2; -pub const CURLSHE_BAD_OPTION: CURLSHcode = 1; -pub const CURLSHE_OK: CURLSHcode = 0; -pub type CURLUcode = libc::c_uint; -pub const CURLUE_NO_FRAGMENT: CURLUcode = 17; -pub const CURLUE_NO_QUERY: CURLUcode = 16; -pub const CURLUE_NO_PORT: CURLUcode = 15; -pub const CURLUE_NO_HOST: CURLUcode = 14; -pub const CURLUE_NO_OPTIONS: CURLUcode = 13; -pub const CURLUE_NO_PASSWORD: CURLUcode = 12; -pub const CURLUE_NO_USER: CURLUcode = 11; -pub const CURLUE_NO_SCHEME: CURLUcode = 10; -pub const CURLUE_UNKNOWN_PART: CURLUcode = 9; -pub const CURLUE_USER_NOT_ALLOWED: CURLUcode = 8; -pub const CURLUE_OUT_OF_MEMORY: CURLUcode = 7; -pub const CURLUE_URLDECODE: CURLUcode = 6; -pub const CURLUE_UNSUPPORTED_SCHEME: CURLUcode = 5; -pub const CURLUE_BAD_PORT_NUMBER: CURLUcode = 4; -pub const CURLUE_MALFORMED_INPUT: CURLUcode = 3; -pub const CURLUE_BAD_PARTPOINTER: CURLUcode = 2; -pub const CURLUE_BAD_HANDLE: CURLUcode = 1; -pub const CURLUE_OK: CURLUcode = 0; -pub type CURLUPart = libc::c_uint; -pub const CURLUPART_ZONEID: CURLUPart = 10; -pub const CURLUPART_FRAGMENT: CURLUPart = 9; -pub const CURLUPART_QUERY: CURLUPart = 8; -pub const CURLUPART_PATH: CURLUPart = 7; -pub const CURLUPART_PORT: CURLUPart = 6; -pub const CURLUPART_HOST: CURLUPart = 5; -pub const CURLUPART_OPTIONS: CURLUPart = 4; -pub const CURLUPART_PASSWORD: CURLUPart = 3; -pub const CURLUPART_USER: CURLUPart = 2; -pub const CURLUPART_SCHEME: CURLUPart = 1; -pub const CURLUPART_URL: CURLUPart = 0; -pub type mimestrategy = libc::c_uint; -pub const MIMESTRATEGY_LAST: mimestrategy = 2; -pub const MIMESTRATEGY_FORM: mimestrategy = 1; -pub const MIMESTRATEGY_MAIL: mimestrategy = 0; -pub const HEADER_CONNECT: proxy_use = 2; -pub const HEADER_PROXY: proxy_use = 1; -pub const HEADER_SERVER: proxy_use = 0; -pub type proxy_use = libc::c_uint; -pub const STRING_COOKIE: dupstring = 4; -pub const STRING_ENCODING: dupstring = 9; -pub const STRING_USERAGENT: dupstring = 38; -pub const STRING_TARGET: dupstring = 67; -pub const STRING_BEARER: dupstring = 65; -pub const STRING_CUSTOMREQUEST: dupstring = 6; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl { - pub info: curl_ssl_backend, - pub supports: libc::c_uint, - pub sizeof_ssl_backend_data: size_t, - pub init: Option:: libc::c_int>, - pub cleanup: Option:: ()>, - pub version: Option:: size_t>, - pub check_cxn: Option:: libc::c_int>, - pub shut_down: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_int, - ) -> libc::c_int, - >, - pub data_pending: Option::< - unsafe extern "C" fn(*const connectdata, libc::c_int) -> bool, - >, - pub random: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_uchar, size_t) -> CURLcode, - >, - pub cert_status_request: Option:: bool>, - pub connect_blocking: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_int) -> CURLcode, - >, - pub connect_nonblocking: Option::< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - libc::c_int, - *mut bool, - ) -> CURLcode, - >, - pub getsock: Option::< - unsafe extern "C" fn(*mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub get_internals: Option::< - unsafe extern "C" fn(*mut ssl_connect_data, CURLINFO) -> *mut libc::c_void, - >, - pub close_one: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_int) -> (), - >, - pub close_all: Option:: ()>, - pub session_free: Option:: ()>, - pub set_engine: Option::< - unsafe extern "C" fn(*mut Curl_easy, *const libc::c_char) -> CURLcode, - >, - pub set_engine_default: Option:: CURLcode>, - pub engines_list: Option:: *mut curl_slist>, - pub false_start: Option:: bool>, - pub sha256sum: Option::< - unsafe extern "C" fn( - *const libc::c_uchar, - size_t, - *mut libc::c_uchar, - size_t, - ) -> CURLcode, - >, - pub associate_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_int) -> (), - >, - pub disassociate_connection: Option::< - unsafe extern "C" fn(*mut Curl_easy, libc::c_int) -> (), - >, -} -pub type alpnid = libc::c_uint; -pub const ALPN_h3: alpnid = 32; -pub const ALPN_h2: alpnid = 16; -pub const ALPN_h1: alpnid = 8; -pub const ALPN_none: alpnid = 0; -pub type CURLofft = libc::c_uint; -pub const CURL_OFFT_INVAL: CURLofft = 2; -pub const CURL_OFFT_FLOW: CURLofft = 1; -pub const CURL_OFFT_OK: CURLofft = 0; -pub const STATUS_DONE: statusline = 1; -pub type statusline = libc::c_uint; -pub const STATUS_BAD: statusline = 2; -pub const STATUS_UNKNOWN: statusline = 0; -pub type dupstring = libc::c_uint; -pub const STRING_LAST: dupstring = 80; -pub const STRING_AWS_SIGV4: dupstring = 79; -pub const STRING_COPYPOSTFIELDS: dupstring = 78; -pub const STRING_LASTZEROTERMINATED: dupstring = 77; -pub const STRING_SSL_EC_CURVES: dupstring = 76; -pub const STRING_DNS_LOCAL_IP6: dupstring = 75; -pub const STRING_DNS_LOCAL_IP4: dupstring = 74; -pub const STRING_DNS_INTERFACE: dupstring = 73; -pub const STRING_DNS_SERVERS: dupstring = 72; -pub const STRING_SASL_AUTHZID: dupstring = 71; -pub const STRING_HSTS: dupstring = 70; -pub const STRING_ALTSVC: dupstring = 69; -pub const STRING_DOH: dupstring = 68; -pub const STRING_UNIX_SOCKET_PATH: dupstring = 66; -pub const STRING_TLSAUTH_PASSWORD_PROXY: dupstring = 64; -pub const STRING_TLSAUTH_PASSWORD: dupstring = 63; -pub const STRING_TLSAUTH_USERNAME_PROXY: dupstring = 62; -pub const STRING_TLSAUTH_USERNAME: dupstring = 61; -pub const STRING_MAIL_AUTH: dupstring = 60; -pub const STRING_MAIL_FROM: dupstring = 59; -pub const STRING_SERVICE_NAME: dupstring = 58; -pub const STRING_PROXY_SERVICE_NAME: dupstring = 57; -pub const STRING_SSH_KNOWNHOSTS: dupstring = 56; -pub const STRING_SSH_HOST_PUBLIC_KEY_MD5: dupstring = 55; -pub const STRING_SSH_PUBLIC_KEY: dupstring = 54; -pub const STRING_SSH_PRIVATE_KEY: dupstring = 53; -pub const STRING_RTSP_TRANSPORT: dupstring = 52; -pub const STRING_RTSP_STREAM_URI: dupstring = 51; -pub const STRING_RTSP_SESSION_ID: dupstring = 50; -pub const STRING_NOPROXY: dupstring = 49; -pub const STRING_PROXYPASSWORD: dupstring = 48; -pub const STRING_PROXYUSERNAME: dupstring = 47; -pub const STRING_OPTIONS: dupstring = 46; -pub const STRING_PASSWORD: dupstring = 45; -pub const STRING_USERNAME: dupstring = 44; -pub const STRING_SSL_ENGINE: dupstring = 43; -pub const STRING_SSL_ISSUERCERT_PROXY: dupstring = 42; -pub const STRING_SSL_ISSUERCERT: dupstring = 41; -pub const STRING_SSL_CRLFILE_PROXY: dupstring = 40; -pub const STRING_SSL_CRLFILE: dupstring = 39; -pub const STRING_SSL_RANDOM_FILE: dupstring = 37; -pub const STRING_SSL_EGDSOCKET: dupstring = 36; -pub const STRING_SSL_CIPHER13_LIST_PROXY: dupstring = 35; -pub const STRING_SSL_CIPHER13_LIST: dupstring = 34; -pub const STRING_SSL_CIPHER_LIST_PROXY: dupstring = 33; -pub const STRING_SSL_CIPHER_LIST: dupstring = 32; -pub const STRING_SSL_PINNEDPUBLICKEY_PROXY: dupstring = 31; -pub const STRING_SSL_PINNEDPUBLICKEY: dupstring = 30; -pub const STRING_SSL_CAFILE_PROXY: dupstring = 29; -pub const STRING_SSL_CAFILE: dupstring = 28; -pub const STRING_SSL_CAPATH_PROXY: dupstring = 27; -pub const STRING_SSL_CAPATH: dupstring = 26; -pub const STRING_SET_URL: dupstring = 25; -pub const STRING_SET_REFERER: dupstring = 24; -pub const STRING_SET_RANGE: dupstring = 23; -pub const STRING_PRE_PROXY: dupstring = 22; -pub const STRING_PROXY: dupstring = 21; -pub const STRING_NETRC_FILE: dupstring = 20; -pub const STRING_KRB_LEVEL: dupstring = 19; -pub const STRING_KEY_TYPE_PROXY: dupstring = 18; -pub const STRING_KEY_TYPE: dupstring = 17; -pub const STRING_KEY_PASSWD_PROXY: dupstring = 16; -pub const STRING_KEY_PASSWD: dupstring = 15; -pub const STRING_KEY_PROXY: dupstring = 14; -pub const STRING_KEY: dupstring = 13; -pub const STRING_FTPPORT: dupstring = 12; -pub const STRING_FTP_ALTERNATIVE_TO_USER: dupstring = 11; -pub const STRING_FTP_ACCOUNT: dupstring = 10; -pub const STRING_DEVICE: dupstring = 8; -pub const STRING_DEFAULT_PROTOCOL: dupstring = 7; -pub const STRING_COOKIEJAR: dupstring = 5; -pub const STRING_CERT_TYPE_PROXY: dupstring = 3; -pub const STRING_CERT_TYPE: dupstring = 2; -pub const STRING_CERT_PROXY: dupstring = 1; -pub const STRING_CERT: dupstring = 0; -#[no_mangle] -pub static mut Curl_handler_http: Curl_handler = unsafe { - { - let mut init = Curl_handler { - scheme: b"HTTP\0" as *const u8 as *const libc::c_char, - setup_connection: Some( - http_setup_conn - as unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - ), - do_it: Some( - Curl_http as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - done: Some( - Curl_http_done - as unsafe extern "C" fn(*mut Curl_easy, CURLcode, bool) -> CURLcode, - ), - do_more: None, - connect_it: Some( - Curl_http_connect - as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - connecting: None, - doing: None, - proto_getsock: None, - doing_getsock: Some( - http_getsock_do - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - domore_getsock: None, - perform_getsock: None, - disconnect: None, - readwrite: None, - connection_check: None, - attach: None, - defport: 80 as libc::c_int, - protocol: ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint, - family: ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint, - flags: ((1 as libc::c_int) << 7 as libc::c_int - | (1 as libc::c_int) << 13 as libc::c_int) as libc::c_uint, - }; - init - } -}; -#[no_mangle] -pub static mut Curl_handler_https: Curl_handler = unsafe { - { - let mut init = Curl_handler { - scheme: b"HTTPS\0" as *const u8 as *const libc::c_char, - setup_connection: Some( - http_setup_conn - as unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, - ), - do_it: Some( - Curl_http as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - done: Some( - Curl_http_done - as unsafe extern "C" fn(*mut Curl_easy, CURLcode, bool) -> CURLcode, - ), - do_more: None, - connect_it: Some( - Curl_http_connect - as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - connecting: Some( - https_connecting - as unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, - ), - doing: None, - proto_getsock: Some( - https_getsock - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - doing_getsock: Some( - http_getsock_do - as unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut curl_socket_t, - ) -> libc::c_int, - ), - domore_getsock: None, - perform_getsock: None, - disconnect: None, - readwrite: None, - connection_check: None, - attach: None, - defport: 443 as libc::c_int, - protocol: ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint, - family: ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint, - flags: ((1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 7 as libc::c_int - | (1 as libc::c_int) << 8 as libc::c_int - | (1 as libc::c_int) << 13 as libc::c_int) as libc::c_uint, - }; - init - } -}; -unsafe extern "C" fn http_setup_conn( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut http: *mut HTTP = 0 as *mut HTTP; - http = Curl_ccalloc - .expect( - "non-null function pointer", - )(1 as libc::c_int as size_t, ::std::mem::size_of::() as libc::c_ulong) - as *mut HTTP; - if http.is_null() { - return CURLE_OUT_OF_MEMORY; - } - Curl_mime_initpart(&mut (*http).form, data); - let ref mut fresh0 = (*data).req.p.http; - *fresh0 = http; - if (*data).state.httpwant as libc::c_int == CURL_HTTP_VERSION_3 as libc::c_int { - if (*(*conn).handler).flags - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint != 0 - { - (*conn).transport = TRNSPRT_QUIC; - } else { - Curl_failf( - data, - b"HTTP/3 requested for non-HTTPS URL\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_URL_MALFORMAT; - } - } else { - if (*conn).easyq.size == 0 { - Curl_http2_setup_conn(conn); - } - Curl_http2_setup_req(data); - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_checkProxyheaders( - mut data: *mut Curl_easy, - mut conn: *const connectdata, - mut thisheader: *const libc::c_char, -) -> *mut libc::c_char { - let mut head: *mut curl_slist = 0 as *mut curl_slist; - let mut thislen: size_t = strlen(thisheader); - head = if ((*conn).bits).proxy() as libc::c_int != 0 - && ((*data).set).sep_headers() as libc::c_int != 0 - { - (*data).set.proxyheaders - } else { - (*data).set.headers - }; - while !head.is_null() { - if Curl_strncasecompare((*head).data, thisheader, thislen) != 0 - && (*((*head).data).offset(thislen as isize) as libc::c_int == ':' as i32 - || *((*head).data).offset(thislen as isize) as libc::c_int == ';' as i32) - { - return (*head).data; - } - head = (*head).next; - } - return 0 as *mut libc::c_char; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_copy_header_value( - mut header: *const libc::c_char, -) -> *mut libc::c_char { - let mut start: *const libc::c_char = 0 as *const libc::c_char; - let mut end: *const libc::c_char = 0 as *const libc::c_char; - let mut value: *mut libc::c_char = 0 as *mut libc::c_char; - let mut len: size_t = 0; - while *header as libc::c_int != 0 && *header as libc::c_int != ':' as i32 { - header = header.offset(1); - } - if *header != 0 { - header = header.offset(1); - } - start = header; - while *start as libc::c_int != 0 - && Curl_isspace(*start as libc::c_uchar as libc::c_int) != 0 - { - start = start.offset(1); - } - end = strchr(start, '\r' as i32); - if end.is_null() { - end = strchr(start, '\n' as i32); - } - if end.is_null() { - end = strchr(start, '\u{0}' as i32); - } - if end.is_null() { - return 0 as *mut libc::c_char; - } - while end > start && Curl_isspace(*end as libc::c_uchar as libc::c_int) != 0 { - end = end.offset(-1); - } - len = (end.offset_from(start) as libc::c_long + 1 as libc::c_int as libc::c_long) - as size_t; - value = Curl_cmalloc - .expect( - "non-null function pointer", - )(len.wrapping_add(1 as libc::c_int as libc::c_ulong)) as *mut libc::c_char; - if value.is_null() { - return 0 as *mut libc::c_char; - } - memcpy(value as *mut libc::c_void, start as *const libc::c_void, len); - *value.offset(len as isize) = 0 as libc::c_int as libc::c_char; - return value; -} -unsafe extern "C" fn http_output_basic( - mut data: *mut Curl_easy, - mut proxy: bool, -) -> CURLcode { - let mut size: size_t = 0 as libc::c_int as size_t; - let mut authorization: *mut libc::c_char = 0 as *mut libc::c_char; - let mut userp: *mut *mut libc::c_char = 0 as *mut *mut libc::c_char; - let mut user: *const libc::c_char = 0 as *const libc::c_char; - let mut pwd: *const libc::c_char = 0 as *const libc::c_char; - let mut result: CURLcode = CURLE_OK; - let mut out: *mut libc::c_char = 0 as *mut libc::c_char; - if proxy { - userp = &mut (*data).state.aptr.proxyuserpwd; - user = (*data).state.aptr.proxyuser; - pwd = (*data).state.aptr.proxypasswd; - } else { - userp = &mut (*data).state.aptr.userpwd; - user = (*data).state.aptr.user; - pwd = (*data).state.aptr.passwd; - } - out = curl_maprintf( - b"%s:%s\0" as *const u8 as *const libc::c_char, - user, - if !pwd.is_null() { pwd } else { b"\0" as *const u8 as *const libc::c_char }, - ); - if out.is_null() { - return CURLE_OUT_OF_MEMORY; - } - result = Curl_base64_encode(data, out, strlen(out), &mut authorization, &mut size); - if !(result as u64 != 0) { - if authorization.is_null() { - result = CURLE_REMOTE_ACCESS_DENIED; - } else { - Curl_cfree.expect("non-null function pointer")(*userp as *mut libc::c_void); - *userp = curl_maprintf( - b"%sAuthorization: Basic %s\r\n\0" as *const u8 as *const libc::c_char, - if proxy as libc::c_int != 0 { - b"Proxy-\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - authorization, - ); - Curl_cfree - .expect("non-null function pointer")(authorization as *mut libc::c_void); - if (*userp).is_null() { - result = CURLE_OUT_OF_MEMORY; - } - } - } - Curl_cfree.expect("non-null function pointer")(out as *mut libc::c_void); - return result; -} -unsafe extern "C" fn http_output_bearer(mut data: *mut Curl_easy) -> CURLcode { - let mut userp: *mut *mut libc::c_char = 0 as *mut *mut libc::c_char; - let mut result: CURLcode = CURLE_OK; - userp = &mut (*data).state.aptr.userpwd; - Curl_cfree.expect("non-null function pointer")(*userp as *mut libc::c_void); - *userp = curl_maprintf( - b"Authorization: Bearer %s\r\n\0" as *const u8 as *const libc::c_char, - (*data).set.str_0[STRING_BEARER as libc::c_int as usize], - ); - if (*userp).is_null() { - result = CURLE_OUT_OF_MEMORY; - } - return result; -} -unsafe extern "C" fn pickoneauth(mut pick: *mut auth, mut mask: libc::c_ulong) -> bool { - let mut picked: bool = false; - let mut avail: libc::c_ulong = (*pick).avail & (*pick).want & mask; - picked = 1 as libc::c_int != 0; - if avail & (1 as libc::c_int as libc::c_ulong) << 2 as libc::c_int != 0 { - (*pick).picked = (1 as libc::c_int as libc::c_ulong) << 2 as libc::c_int; - } else if avail & (1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int != 0 { - (*pick).picked = (1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int; - } else if avail & (1 as libc::c_int as libc::c_ulong) << 1 as libc::c_int != 0 { - (*pick).picked = (1 as libc::c_int as libc::c_ulong) << 1 as libc::c_int; - } else if avail & (1 as libc::c_int as libc::c_ulong) << 3 as libc::c_int != 0 { - (*pick).picked = (1 as libc::c_int as libc::c_ulong) << 3 as libc::c_int; - } else if avail & (1 as libc::c_int as libc::c_ulong) << 5 as libc::c_int != 0 { - (*pick).picked = (1 as libc::c_int as libc::c_ulong) << 5 as libc::c_int; - } else if avail & (1 as libc::c_int as libc::c_ulong) << 0 as libc::c_int != 0 { - (*pick).picked = (1 as libc::c_int as libc::c_ulong) << 0 as libc::c_int; - } else if avail & (1 as libc::c_int as libc::c_ulong) << 7 as libc::c_int != 0 { - (*pick).picked = (1 as libc::c_int as libc::c_ulong) << 7 as libc::c_int; - } else { - (*pick).picked = ((1 as libc::c_int) << 30 as libc::c_int) as libc::c_ulong; - picked = 0 as libc::c_int != 0; - } - (*pick).avail = 0 as libc::c_int as libc::c_ulong; - return picked; -} -unsafe extern "C" fn http_perhapsrewind( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut http: *mut HTTP = (*data).req.p.http; - let mut bytessent: curl_off_t = 0; - let mut expectsend: curl_off_t = -(1 as libc::c_int) as curl_off_t; - if http.is_null() { - return CURLE_OK; - } - match (*data).state.httpreq as libc::c_uint { - 0 | 5 => return CURLE_OK, - _ => {} - } - bytessent = (*data).req.writebytecount; - if ((*conn).bits).authneg() != 0 { - expectsend = 0 as libc::c_int as curl_off_t; - } else if ((*conn).bits).protoconnstart() == 0 { - expectsend = 0 as libc::c_int as curl_off_t; - } else { - match (*data).state.httpreq as libc::c_uint { - 1 | 4 => { - if (*data).state.infilesize != -(1 as libc::c_int) as libc::c_long { - expectsend = (*data).state.infilesize; - } - } - 2 | 3 => { - expectsend = (*http).postsize; - } - _ => {} - } - } - let ref mut fresh1 = (*conn).bits; - (*fresh1).set_rewindaftersend(0 as libc::c_int as bit); - if expectsend == -(1 as libc::c_int) as libc::c_long || expectsend > bytessent { - Curl_conncontrol(conn, 2 as libc::c_int); - (*data).req.size = 0 as libc::c_int as curl_off_t; - } - if bytessent != 0 { - return Curl_readrewind(data); - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_auth_act(mut data: *mut Curl_easy) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut pickhost: bool = 0 as libc::c_int != 0; - let mut pickproxy: bool = 0 as libc::c_int != 0; - let mut result: CURLcode = CURLE_OK; - let mut authmask: libc::c_ulong = !(0 as libc::c_ulong); - if ((*data).set.str_0[STRING_BEARER as libc::c_int as usize]).is_null() { - authmask &= !((1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int); - } - if 100 as libc::c_int <= (*data).req.httpcode - && 199 as libc::c_int >= (*data).req.httpcode - { - return CURLE_OK; - } - if ((*data).state).authproblem() != 0 { - return (if ((*data).set).http_fail_on_error() as libc::c_int != 0 { - CURLE_HTTP_RETURNED_ERROR as libc::c_int - } else { - CURLE_OK as libc::c_int - }) as CURLcode; - } - if (((*conn).bits).user_passwd() as libc::c_int != 0 - || !((*data).set.str_0[STRING_BEARER as libc::c_int as usize]).is_null()) - && ((*data).req.httpcode == 401 as libc::c_int - || ((*conn).bits).authneg() as libc::c_int != 0 - && (*data).req.httpcode < 300 as libc::c_int) - { - pickhost = pickoneauth(&mut (*data).state.authhost, authmask); - if !pickhost { - let ref mut fresh2 = (*data).state; - (*fresh2).set_authproblem(1 as libc::c_int as bit); - } - if (*data).state.authhost.picked - == (1 as libc::c_int as libc::c_ulong) << 3 as libc::c_int - && (*conn).httpversion as libc::c_int > 11 as libc::c_int - { - Curl_infof( - data, - b"Forcing HTTP/1.1 for NTLM\0" as *const u8 as *const libc::c_char, - ); - Curl_conncontrol(conn, 1 as libc::c_int); - (*data) - .state - .httpwant = CURL_HTTP_VERSION_1_1 as libc::c_int as libc::c_uchar; - } - } - if ((*conn).bits).proxy_user_passwd() as libc::c_int != 0 - && ((*data).req.httpcode == 407 as libc::c_int - || ((*conn).bits).authneg() as libc::c_int != 0 - && (*data).req.httpcode < 300 as libc::c_int) - { - pickproxy = pickoneauth( - &mut (*data).state.authproxy, - authmask & !((1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int), - ); - if !pickproxy { - let ref mut fresh3 = (*data).state; - (*fresh3).set_authproblem(1 as libc::c_int as bit); - } - } - if pickhost as libc::c_int != 0 || pickproxy as libc::c_int != 0 { - if (*data).state.httpreq as libc::c_uint - != HTTPREQ_GET as libc::c_int as libc::c_uint - && (*data).state.httpreq as libc::c_uint - != HTTPREQ_HEAD as libc::c_int as libc::c_uint - && ((*conn).bits).rewindaftersend() == 0 - { - result = http_perhapsrewind(data, conn); - if result as u64 != 0 { - return result; - } - } - Curl_cfree - .expect( - "non-null function pointer", - )((*data).req.newurl as *mut libc::c_void); - let ref mut fresh4 = (*data).req.newurl; - *fresh4 = 0 as *mut libc::c_char; - let ref mut fresh5 = (*data).req.newurl; - *fresh5 = Curl_cstrdup.expect("non-null function pointer")((*data).state.url); - if ((*data).req.newurl).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } else if (*data).req.httpcode < 300 as libc::c_int - && ((*data).state.authhost).done() == 0 - && ((*conn).bits).authneg() as libc::c_int != 0 - { - if (*data).state.httpreq as libc::c_uint - != HTTPREQ_GET as libc::c_int as libc::c_uint - && (*data).state.httpreq as libc::c_uint - != HTTPREQ_HEAD as libc::c_int as libc::c_uint - { - let ref mut fresh6 = (*data).req.newurl; - *fresh6 = Curl_cstrdup - .expect("non-null function pointer")((*data).state.url); - if ((*data).req.newurl).is_null() { - return CURLE_OUT_OF_MEMORY; - } - let ref mut fresh7 = (*data).state.authhost; - (*fresh7).set_done(1 as libc::c_int as bit); - } - } - if http_should_fail(data) { - Curl_failf( - data, - b"The requested URL returned error: %d\0" as *const u8 - as *const libc::c_char, - (*data).req.httpcode, - ); - result = CURLE_HTTP_RETURNED_ERROR; - } - return result; -} -unsafe extern "C" fn output_auth_headers( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut authstatus: *mut auth, - mut request: *const libc::c_char, - mut path: *const libc::c_char, - mut proxy: bool, -) -> CURLcode { - let mut auth: *const libc::c_char = 0 as *const libc::c_char; - let mut result: CURLcode = CURLE_OK; - if (*authstatus).picked == (1 as libc::c_int as libc::c_ulong) << 7 as libc::c_int { - auth = b"AWS_SIGV4\0" as *const u8 as *const libc::c_char; - result = Curl_output_aws_sigv4(data, proxy); - if result as u64 != 0 { - return result; - } - } else if (*authstatus).picked - == (1 as libc::c_int as libc::c_ulong) << 1 as libc::c_int - { - auth = b"Digest\0" as *const u8 as *const libc::c_char; - result = Curl_output_digest( - data, - proxy, - request as *const libc::c_uchar, - path as *const libc::c_uchar, - ); - if result as u64 != 0 { - return result; - } - } else if (*authstatus).picked - == (1 as libc::c_int as libc::c_ulong) << 0 as libc::c_int - { - if proxy as libc::c_int != 0 - && ((*conn).bits).proxy_user_passwd() as libc::c_int != 0 - && (Curl_checkProxyheaders( - data, - conn, - b"Proxy-authorization\0" as *const u8 as *const libc::c_char, - )) - .is_null() - || !proxy && ((*conn).bits).user_passwd() as libc::c_int != 0 - && (Curl_checkheaders( - data, - b"Authorization\0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - auth = b"Basic\0" as *const u8 as *const libc::c_char; - result = http_output_basic(data, proxy); - if result as u64 != 0 { - return result; - } - } - (*authstatus).set_done(1 as libc::c_int as bit); - } - if (*authstatus).picked == (1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int { - if !proxy - && !((*data).set.str_0[STRING_BEARER as libc::c_int as usize]).is_null() - && (Curl_checkheaders( - data, - b"Authorization\0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - auth = b"Bearer\0" as *const u8 as *const libc::c_char; - result = http_output_bearer(data); - if result as u64 != 0 { - return result; - } - } - (*authstatus).set_done(1 as libc::c_int as bit); - } - if !auth.is_null() { - Curl_infof( - data, - b"%s auth using %s with user '%s'\0" as *const u8 as *const libc::c_char, - if proxy as libc::c_int != 0 { - b"Proxy\0" as *const u8 as *const libc::c_char - } else { - b"Server\0" as *const u8 as *const libc::c_char - }, - auth, - if proxy as libc::c_int != 0 { - if !((*data).state.aptr.proxyuser).is_null() { - (*data).state.aptr.proxyuser as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - } - } else if !((*data).state.aptr.user).is_null() { - (*data).state.aptr.user as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - (*authstatus) - .set_multipass( - (if (*authstatus).done() == 0 { - 1 as libc::c_int - } else { - 0 as libc::c_int - }) as bit, - ); - } else { - (*authstatus).set_multipass(0 as libc::c_int as bit); - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_output_auth( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut request: *const libc::c_char, - mut httpreq: Curl_HttpReq, - mut path: *const libc::c_char, - mut proxytunnel: bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut authhost: *mut auth = 0 as *mut auth; - let mut authproxy: *mut auth = 0 as *mut auth; - authhost = &mut (*data).state.authhost; - authproxy = &mut (*data).state.authproxy; - if ((*conn).bits).httpproxy() as libc::c_int != 0 - && ((*conn).bits).proxy_user_passwd() as libc::c_int != 0 - || ((*conn).bits).user_passwd() as libc::c_int != 0 - || !((*data).set.str_0[STRING_BEARER as libc::c_int as usize]).is_null() - {} else { - (*authhost).set_done(1 as libc::c_int as bit); - (*authproxy).set_done(1 as libc::c_int as bit); - return CURLE_OK; - } - if (*authhost).want != 0 && (*authhost).picked == 0 { - (*authhost).picked = (*authhost).want; - } - if (*authproxy).want != 0 && (*authproxy).picked == 0 { - (*authproxy).picked = (*authproxy).want; - } - if ((*conn).bits).httpproxy() as libc::c_int != 0 - && ((*conn).bits).tunnel_proxy() == proxytunnel as bit - { - result = output_auth_headers( - data, - conn, - authproxy, - request, - path, - 1 as libc::c_int != 0, - ); - if result as u64 != 0 { - return result; - } - } else { - (*authproxy).set_done(1 as libc::c_int as bit); - } - if ((*data).state).this_is_a_follow() == 0 - || ((*conn).bits).netrc() as libc::c_int != 0 - || ((*data).state.first_host).is_null() - || ((*data).set).allow_auth_to_other_hosts() as libc::c_int != 0 - || Curl_strcasecompare((*data).state.first_host, (*conn).host.name) != 0 - { - result = output_auth_headers( - data, - conn, - authhost, - request, - path, - 0 as libc::c_int != 0, - ); - } else { - (*authhost).set_done(1 as libc::c_int as bit); - } - if ((*authhost).multipass() as libc::c_int != 0 && (*authhost).done() == 0 - || (*authproxy).multipass() as libc::c_int != 0 && (*authproxy).done() == 0) - && httpreq as libc::c_uint != HTTPREQ_GET as libc::c_int as libc::c_uint - && httpreq as libc::c_uint != HTTPREQ_HEAD as libc::c_int as libc::c_uint - { - let ref mut fresh8 = (*conn).bits; - (*fresh8).set_authneg(1 as libc::c_int as bit); - } else { - let ref mut fresh9 = (*conn).bits; - (*fresh9).set_authneg(0 as libc::c_int as bit); - } - return result; -} -unsafe extern "C" fn is_valid_auth_separator(mut ch: libc::c_char) -> libc::c_int { - return (ch as libc::c_int == '\u{0}' as i32 || ch as libc::c_int == ',' as i32 - || Curl_isspace(ch as libc::c_uchar as libc::c_int) != 0) as libc::c_int; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_input_auth( - mut data: *mut Curl_easy, - mut proxy: bool, - mut auth: *const libc::c_char, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut availp: *mut libc::c_ulong = 0 as *mut libc::c_ulong; - let mut authp: *mut auth = 0 as *mut auth; - if proxy { - availp = &mut (*data).info.proxyauthavail; - authp = &mut (*data).state.authproxy; - } else { - availp = &mut (*data).info.httpauthavail; - authp = &mut (*data).state.authhost; - } - while *auth != 0 { - if curl_strnequal( - b"Digest\0" as *const u8 as *const libc::c_char, - auth, - strlen(b"Digest\0" as *const u8 as *const libc::c_char), - ) != 0 && is_valid_auth_separator(*auth.offset(6 as libc::c_int as isize)) != 0 - { - if (*authp).avail & (1 as libc::c_int as libc::c_ulong) << 1 as libc::c_int - != 0 as libc::c_int as libc::c_ulong - { - Curl_infof( - data, - b"Ignoring duplicate digest auth header.\0" as *const u8 - as *const libc::c_char, - ); - } else if Curl_auth_is_digest_supported() { - let mut result: CURLcode = CURLE_OK; - *availp |= (1 as libc::c_int as libc::c_ulong) << 1 as libc::c_int; - (*authp).avail - |= (1 as libc::c_int as libc::c_ulong) << 1 as libc::c_int; - result = Curl_input_digest(data, proxy, auth); - if result as u64 != 0 { - Curl_infof( - data, - b"Authentication problem. Ignoring this.\0" as *const u8 - as *const libc::c_char, - ); - let ref mut fresh10 = (*data).state; - (*fresh10).set_authproblem(1 as libc::c_int as bit); - } - } - } else if curl_strnequal( - b"Basic\0" as *const u8 as *const libc::c_char, - auth, - strlen(b"Basic\0" as *const u8 as *const libc::c_char), - ) != 0 - && is_valid_auth_separator(*auth.offset(5 as libc::c_int as isize)) != 0 - { - *availp |= (1 as libc::c_int as libc::c_ulong) << 0 as libc::c_int; - (*authp).avail |= (1 as libc::c_int as libc::c_ulong) << 0 as libc::c_int; - if (*authp).picked == (1 as libc::c_int as libc::c_ulong) << 0 as libc::c_int - { - (*authp).avail = 0 as libc::c_int as libc::c_ulong; - Curl_infof( - data, - b"Authentication problem. Ignoring this.\0" as *const u8 - as *const libc::c_char, - ); - let ref mut fresh11 = (*data).state; - (*fresh11).set_authproblem(1 as libc::c_int as bit); - } - } else if curl_strnequal( - b"Bearer\0" as *const u8 as *const libc::c_char, - auth, - strlen(b"Bearer\0" as *const u8 as *const libc::c_char), - ) != 0 - && is_valid_auth_separator(*auth.offset(6 as libc::c_int as isize)) != 0 - { - *availp |= (1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int; - (*authp).avail |= (1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int; - if (*authp).picked == (1 as libc::c_int as libc::c_ulong) << 6 as libc::c_int - { - (*authp).avail = 0 as libc::c_int as libc::c_ulong; - Curl_infof( - data, - b"Authentication problem. Ignoring this.\0" as *const u8 - as *const libc::c_char, - ); - let ref mut fresh12 = (*data).state; - (*fresh12).set_authproblem(1 as libc::c_int as bit); - } - } - while *auth as libc::c_int != 0 && *auth as libc::c_int != ',' as i32 { - auth = auth.offset(1); - } - if *auth as libc::c_int == ',' as i32 { - auth = auth.offset(1); - } - while *auth as libc::c_int != 0 - && Curl_isspace(*auth as libc::c_uchar as libc::c_int) != 0 - { - auth = auth.offset(1); - } - } - return CURLE_OK; -} -unsafe extern "C" fn http_should_fail(mut data: *mut Curl_easy) -> bool { - let mut httpcode: libc::c_int = 0; - httpcode = (*data).req.httpcode; - if ((*data).set).http_fail_on_error() == 0 { - return 0 as libc::c_int != 0; - } - if httpcode < 400 as libc::c_int { - return 0 as libc::c_int != 0; - } - if (*data).state.resume_from != 0 - && (*data).state.httpreq as libc::c_uint - == HTTPREQ_GET as libc::c_int as libc::c_uint - && httpcode == 416 as libc::c_int - { - return 0 as libc::c_int != 0; - } - if httpcode != 401 as libc::c_int && httpcode != 407 as libc::c_int { - return 1 as libc::c_int != 0; - } - if httpcode == 401 as libc::c_int && ((*(*data).conn).bits).user_passwd() == 0 { - return 1 as libc::c_int != 0; - } - if httpcode == 407 as libc::c_int && ((*(*data).conn).bits).proxy_user_passwd() == 0 - { - return 1 as libc::c_int != 0; - } - return ((*data).state).authproblem() != 0; -} -unsafe extern "C" fn readmoredata( - mut buffer: *mut libc::c_char, - mut size: size_t, - mut nitems: size_t, - mut userp: *mut libc::c_void, -) -> size_t { - let mut data: *mut Curl_easy = userp as *mut Curl_easy; - let mut http: *mut HTTP = (*data).req.p.http; - let mut fullsize: size_t = size.wrapping_mul(nitems); - if (*http).postsize == 0 { - return 0 as libc::c_int as size_t; - } - let ref mut fresh13 = (*data).req; - (*fresh13) - .set_forbidchunk( - (if (*http).sending as libc::c_uint - == HTTPSEND_REQUEST as libc::c_int as libc::c_uint - { - 1 as libc::c_int - } else { - 0 as libc::c_int - }) as bit, - ); - if (*data).set.max_send_speed != 0 - && (*data).set.max_send_speed < fullsize as curl_off_t - && (*data).set.max_send_speed < (*http).postsize - { - fullsize = (*data).set.max_send_speed as size_t; - } else if (*http).postsize <= fullsize as curl_off_t { - memcpy( - buffer as *mut libc::c_void, - (*http).postdata as *const libc::c_void, - (*http).postsize as size_t, - ); - fullsize = (*http).postsize as size_t; - if (*http).backup.postsize != 0 { - let ref mut fresh14 = (*http).postdata; - *fresh14 = (*http).backup.postdata; - (*http).postsize = (*http).backup.postsize; - let ref mut fresh15 = (*data).state.fread_func; - *fresh15 = (*http).backup.fread_func; - let ref mut fresh16 = (*data).state.in_0; - *fresh16 = (*http).backup.fread_in; - let ref mut fresh17 = (*http).sending; - *fresh17 += 1; - (*http).backup.postsize = 0 as libc::c_int as curl_off_t; - } else { - (*http).postsize = 0 as libc::c_int as curl_off_t; - } - return fullsize; - } - memcpy( - buffer as *mut libc::c_void, - (*http).postdata as *const libc::c_void, - fullsize, - ); - let ref mut fresh18 = (*http).postdata; - *fresh18 = (*fresh18).offset(fullsize as isize); - let ref mut fresh19 = (*http).postsize; - *fresh19 = (*fresh19 as libc::c_ulong).wrapping_sub(fullsize) as curl_off_t - as curl_off_t; - return fullsize; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_buffer_send( - mut in_0: *mut dynbuf, - mut data: *mut Curl_easy, - mut bytes_written: *mut curl_off_t, - mut included_body_bytes: curl_off_t, - mut socketindex: libc::c_int, -) -> CURLcode { - let mut amount: ssize_t = 0; - let mut result: CURLcode = CURLE_OK; - let mut ptr: *mut libc::c_char = 0 as *mut libc::c_char; - let mut size: size_t = 0; - let mut conn: *mut connectdata = (*data).conn; - let mut http: *mut HTTP = (*data).req.p.http; - let mut sendsize: size_t = 0; - let mut sockfd: curl_socket_t = 0; - let mut headersize: size_t = 0; - sockfd = (*conn).sock[socketindex as usize]; - ptr = Curl_dyn_ptr(in_0); - size = Curl_dyn_len(in_0); - headersize = size.wrapping_sub(included_body_bytes as size_t); - result = CURLE_OK as libc::c_int as CURLcode; - if result as u64 != 0 { - Curl_dyn_free(in_0); - return result; - } - if ((*(*conn).handler).flags - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint != 0 - || (*conn).http_proxy.proxytype as libc::c_uint - == CURLPROXY_HTTPS as libc::c_int as libc::c_uint) - && (*conn).httpversion as libc::c_int != 20 as libc::c_int - { - if (*data).set.max_send_speed != 0 - && included_body_bytes > (*data).set.max_send_speed - { - let mut overflow: curl_off_t = included_body_bytes - - (*data).set.max_send_speed; - sendsize = size.wrapping_sub(overflow as size_t); - } else { - sendsize = size; - } - result = Curl_get_upload_buffer(data); - if result as u64 != 0 { - Curl_dyn_free(in_0); - return result; - } - if sendsize > (*data).set.upload_buffer_size as size_t { - sendsize = (*data).set.upload_buffer_size as size_t; - } - memcpy( - (*data).state.ulbuf as *mut libc::c_void, - ptr as *const libc::c_void, - sendsize, - ); - ptr = (*data).state.ulbuf; - } else if (*data).set.max_send_speed != 0 - && included_body_bytes > (*data).set.max_send_speed - { - let mut overflow_0: curl_off_t = included_body_bytes - - (*data).set.max_send_speed; - sendsize = size.wrapping_sub(overflow_0 as size_t); - } else { - sendsize = size; - } - result = Curl_write(data, sockfd, ptr as *const libc::c_void, sendsize, &mut amount); - if result as u64 == 0 { - let mut headlen: size_t = if amount as size_t > headersize { - headersize - } else { - amount as size_t - }; - let mut bodylen: size_t = (amount as libc::c_ulong).wrapping_sub(headlen); - Curl_debug(data, CURLINFO_HEADER_OUT, ptr, headlen); - if bodylen != 0 { - Curl_debug(data, CURLINFO_DATA_OUT, ptr.offset(headlen as isize), bodylen); - } - *bytes_written += amount; - if !http.is_null() { - let ref mut fresh20 = (*data).req.writebytecount; - *fresh20 = (*fresh20 as libc::c_ulong).wrapping_add(bodylen) as curl_off_t - as curl_off_t; - Curl_pgrsSetUploadCounter(data, (*data).req.writebytecount); - if amount as size_t != size { - size = (size as libc::c_ulong).wrapping_sub(amount as libc::c_ulong) - as size_t as size_t; - ptr = (Curl_dyn_ptr(in_0)).offset(amount as isize); - let ref mut fresh21 = (*http).backup.fread_func; - *fresh21 = (*data).state.fread_func; - let ref mut fresh22 = (*http).backup.fread_in; - *fresh22 = (*data).state.in_0; - let ref mut fresh23 = (*http).backup.postdata; - *fresh23 = (*http).postdata; - (*http).backup.postsize = (*http).postsize; - let ref mut fresh24 = (*data).state.fread_func; - *fresh24 = ::std::mem::transmute::< - Option::< - unsafe extern "C" fn( - *mut libc::c_char, - size_t, - size_t, - *mut libc::c_void, - ) -> size_t, - >, - curl_read_callback, - >( - Some( - readmoredata - as unsafe extern "C" fn( - *mut libc::c_char, - size_t, - size_t, - *mut libc::c_void, - ) -> size_t, - ), - ); - let ref mut fresh25 = (*data).state.in_0; - *fresh25 = data as *mut libc::c_void; - let ref mut fresh26 = (*http).postdata; - *fresh26 = ptr; - (*http).postsize = size as curl_off_t; - (*data) - .req - .pendingheader = headersize.wrapping_sub(headlen) as curl_off_t; - (*http).send_buffer = *in_0; - (*http).sending = HTTPSEND_REQUEST; - return CURLE_OK; - } - (*http).sending = HTTPSEND_BODY; - } else if amount as size_t != size { - return CURLE_SEND_ERROR - } - } - Curl_dyn_free(in_0); - (*data).req.pendingheader = 0 as libc::c_int as curl_off_t; - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_compareheader( - mut headerline: *const libc::c_char, - mut header: *const libc::c_char, - mut content: *const libc::c_char, -) -> bool { - let mut hlen: size_t = strlen(header); - let mut clen: size_t = 0; - let mut len: size_t = 0; - let mut start: *const libc::c_char = 0 as *const libc::c_char; - let mut end: *const libc::c_char = 0 as *const libc::c_char; - if Curl_strncasecompare(headerline, header, hlen) == 0 { - return 0 as libc::c_int != 0; - } - start = &*headerline.offset(hlen as isize) as *const libc::c_char; - while *start as libc::c_int != 0 - && Curl_isspace(*start as libc::c_uchar as libc::c_int) != 0 - { - start = start.offset(1); - } - end = strchr(start, '\r' as i32); - if end.is_null() { - end = strchr(start, '\n' as i32); - if end.is_null() { - end = strchr(start, '\u{0}' as i32); - } - } - len = end.offset_from(start) as libc::c_long as size_t; - clen = strlen(content); - while len >= clen { - if Curl_strncasecompare(start, content, clen) != 0 { - return 1 as libc::c_int != 0; - } - len = len.wrapping_sub(1); - start = start.offset(1); - } - return 0 as libc::c_int != 0; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_connect( - mut data: *mut Curl_easy, - mut done: *mut bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - Curl_conncontrol(conn, 0 as libc::c_int); - result = Curl_proxy_connect(data, 0 as libc::c_int); - if result as u64 != 0 { - return result; - } - if ((*conn).bits).proxy_connect_closed() != 0 { - return CURLE_OK; - } - if (*conn).http_proxy.proxytype as libc::c_uint - == CURLPROXY_HTTPS as libc::c_int as libc::c_uint - && !(*conn).bits.proxy_ssl_connected[0 as libc::c_int as usize] - { - return CURLE_OK; - } - if Curl_connect_ongoing(conn) { - return CURLE_OK; - } - if ((*data).set).haproxyprotocol() != 0 { - result = add_haproxy_protocol_header(data); - if result as u64 != 0 { - return result; - } - } - if (*(*conn).given).protocol - & ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint != 0 - { - result = https_connecting(data, done); - if result as u64 != 0 { - return result; - } - } else { - *done = 1 as libc::c_int != 0; - } - return CURLE_OK; -} -unsafe extern "C" fn http_getsock_do( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut socks: *mut curl_socket_t, -) -> libc::c_int { - *socks.offset(0 as libc::c_int as isize) = (*conn).sock[0 as libc::c_int as usize]; - return (1 as libc::c_int) << 16 as libc::c_int + 0 as libc::c_int; -} -unsafe extern "C" fn add_haproxy_protocol_header(mut data: *mut Curl_easy) -> CURLcode { - let mut req: dynbuf = dynbuf { - bufr: 0 as *mut libc::c_char, - leng: 0, - allc: 0, - toobig: 0, - }; - let mut result: CURLcode = CURLE_OK; - let mut tcp_version: *const libc::c_char = 0 as *const libc::c_char; - Curl_dyn_init(&mut req, 2048 as libc::c_int as size_t); - if !((*(*data).conn).unix_domain_socket).is_null() { - result = Curl_dyn_add( - &mut req, - b"PROXY UNKNOWN\r\n\0" as *const u8 as *const libc::c_char, - ); - } else { - tcp_version = if ((*(*data).conn).bits).ipv6() as libc::c_int != 0 { - b"TCP6\0" as *const u8 as *const libc::c_char - } else { - b"TCP4\0" as *const u8 as *const libc::c_char - }; - result = Curl_dyn_addf( - &mut req as *mut dynbuf, - b"PROXY %s %s %s %i %i\r\n\0" as *const u8 as *const libc::c_char, - tcp_version, - ((*data).info.conn_local_ip).as_mut_ptr(), - ((*data).info.conn_primary_ip).as_mut_ptr(), - (*data).info.conn_local_port, - (*data).info.conn_primary_port, - ); - } - if result as u64 == 0 { - result = Curl_buffer_send( - &mut req, - data, - &mut (*data).info.request_size, - 0 as libc::c_int as curl_off_t, - 0 as libc::c_int, - ); - } - return result; -} -unsafe extern "C" fn https_connecting( - mut data: *mut Curl_easy, - mut done: *mut bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - result = Curl_ssl_connect_nonblocking( - data, - conn, - 0 as libc::c_int != 0, - 0 as libc::c_int, - done, - ); - if result as u64 != 0 { - Curl_conncontrol(conn, 1 as libc::c_int); - } - return result; -} -unsafe extern "C" fn https_getsock( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut socks: *mut curl_socket_t, -) -> libc::c_int { - if (*(*conn).handler).flags - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint != 0 - { - return ((*Curl_ssl).getsock).expect("non-null function pointer")(conn, socks); - } - return 0 as libc::c_int; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_done( - mut data: *mut Curl_easy, - mut status: CURLcode, - mut premature: bool, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut http: *mut HTTP = (*data).req.p.http; - let ref mut fresh27 = (*data).state.authhost; - (*fresh27).set_multipass(0 as libc::c_int as bit); - let ref mut fresh28 = (*data).state.authproxy; - (*fresh28).set_multipass(0 as libc::c_int as bit); - Curl_unencode_cleanup(data); - let ref mut fresh29 = (*conn).seek_func; - *fresh29 = (*data).set.seek_func; - let ref mut fresh30 = (*conn).seek_client; - *fresh30 = (*data).set.seek_client; - if http.is_null() { - return CURLE_OK; - } - Curl_dyn_free(&mut (*http).send_buffer); - Curl_http2_done(data, premature); - Curl_mime_cleanpart(&mut (*http).form); - Curl_dyn_reset(&mut (*data).state.headerb); - if status as u64 != 0 { - return status; - } - if !premature && ((*conn).bits).retry() == 0 && ((*data).set).connect_only() == 0 - && (*data).req.bytecount + (*data).req.headerbytecount - - (*data).req.deductheadercount <= 0 as libc::c_int as libc::c_long - { - Curl_failf( - data, - b"Empty reply from server\0" as *const u8 as *const libc::c_char, - ); - Curl_conncontrol(conn, 2 as libc::c_int); - return CURLE_GOT_NOTHING; - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_use_http_1_1plus( - mut data: *const Curl_easy, - mut conn: *const connectdata, -) -> bool { - if (*data).state.httpversion as libc::c_int == 10 as libc::c_int - || (*conn).httpversion as libc::c_int == 10 as libc::c_int - { - return 0 as libc::c_int != 0; - } - if (*data).state.httpwant as libc::c_int == CURL_HTTP_VERSION_1_0 as libc::c_int - && (*conn).httpversion as libc::c_int <= 10 as libc::c_int - { - return 0 as libc::c_int != 0; - } - return (*data).state.httpwant as libc::c_int == CURL_HTTP_VERSION_NONE as libc::c_int - || (*data).state.httpwant as libc::c_int >= CURL_HTTP_VERSION_1_1 as libc::c_int; -} -unsafe extern "C" fn get_http_string( - mut data: *const Curl_easy, - mut conn: *const connectdata, -) -> *const libc::c_char { - if !((*conn).proto.httpc.h2).is_null() { - return b"2\0" as *const u8 as *const libc::c_char; - } - if Curl_use_http_1_1plus(data, conn) { - return b"1.1\0" as *const u8 as *const libc::c_char; - } - return b"1.0\0" as *const u8 as *const libc::c_char; -} -unsafe extern "C" fn expect100( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut req: *mut dynbuf, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let ref mut fresh31 = (*data).state; - (*fresh31).set_expect100header(0 as libc::c_int as bit); - if ((*data).state).disableexpect() == 0 - && Curl_use_http_1_1plus(data, conn) as libc::c_int != 0 - && ((*conn).httpversion as libc::c_int) < 20 as libc::c_int - { - let mut ptr: *const libc::c_char = Curl_checkheaders( - data, - b"Expect\0" as *const u8 as *const libc::c_char, - ); - if !ptr.is_null() { - let ref mut fresh32 = (*data).state; - (*fresh32) - .set_expect100header( - Curl_compareheader( - ptr, - b"Expect:\0" as *const u8 as *const libc::c_char, - b"100-continue\0" as *const u8 as *const libc::c_char, - ) as bit, - ); - } else { - result = Curl_dyn_add( - req, - b"Expect: 100-continue\r\n\0" as *const u8 as *const libc::c_char, - ); - if result as u64 == 0 { - let ref mut fresh33 = (*data).state; - (*fresh33).set_expect100header(1 as libc::c_int as bit); - } - } - } - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_compile_trailers( - mut trailers: *mut curl_slist, - mut b: *mut dynbuf, - mut handle: *mut Curl_easy, -) -> CURLcode { - let mut ptr: *mut libc::c_char = 0 as *mut libc::c_char; - let mut result: CURLcode = CURLE_OK; - let mut endofline_native: *const libc::c_char = 0 as *const libc::c_char; - let mut endofline_network: *const libc::c_char = 0 as *const libc::c_char; - if ((*handle).state).prefer_ascii() as libc::c_int != 0 - || ((*handle).set).crlf() as libc::c_int != 0 - { - endofline_native = b"\n\0" as *const u8 as *const libc::c_char; - endofline_network = b"\n\0" as *const u8 as *const libc::c_char; - } else { - endofline_native = b"\r\n\0" as *const u8 as *const libc::c_char; - endofline_network = b"\r\n\0" as *const u8 as *const libc::c_char; - } - while !trailers.is_null() { - ptr = strchr((*trailers).data, ':' as i32); - if !ptr.is_null() - && *ptr.offset(1 as libc::c_int as isize) as libc::c_int == ' ' as i32 - { - result = Curl_dyn_add(b, (*trailers).data); - if result as u64 != 0 { - return result; - } - result = Curl_dyn_add(b, endofline_native); - if result as u64 != 0 { - return result; - } - } else { - Curl_infof( - handle, - b"Malformatted trailing header ! Skipping trailer.\0" as *const u8 - as *const libc::c_char, - ); - } - trailers = (*trailers).next; - } - result = Curl_dyn_add(b, endofline_network); - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_add_custom_headers( - mut data: *mut Curl_easy, - mut is_connect: bool, - mut req: *mut dynbuf, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut ptr: *mut libc::c_char = 0 as *mut libc::c_char; - let mut h: [*mut curl_slist; 2] = [0 as *mut curl_slist; 2]; - let mut headers: *mut curl_slist = 0 as *mut curl_slist; - let mut numlists: libc::c_int = 1 as libc::c_int; - let mut i: libc::c_int = 0; - let mut proxy: proxy_use = HEADER_SERVER; - if is_connect { - proxy = HEADER_CONNECT; - } else { - proxy = (if ((*conn).bits).httpproxy() as libc::c_int != 0 - && ((*conn).bits).tunnel_proxy() == 0 - { - HEADER_PROXY as libc::c_int - } else { - HEADER_SERVER as libc::c_int - }) as proxy_use; - } - match proxy as libc::c_uint { - 0 => { - h[0 as libc::c_int as usize] = (*data).set.headers; - } - 1 => { - h[0 as libc::c_int as usize] = (*data).set.headers; - if ((*data).set).sep_headers() != 0 { - h[1 as libc::c_int as usize] = (*data).set.proxyheaders; - numlists += 1; - } - } - 2 => { - if ((*data).set).sep_headers() != 0 { - h[0 as libc::c_int as usize] = (*data).set.proxyheaders; - } else { - h[0 as libc::c_int as usize] = (*data).set.headers; - } - } - _ => {} - } - i = 0 as libc::c_int; - while i < numlists { - headers = h[i as usize]; - while !headers.is_null() { - let mut semicolonp: *mut libc::c_char = 0 as *mut libc::c_char; - ptr = strchr((*headers).data, ':' as i32); - if ptr.is_null() { - let mut optr: *mut libc::c_char = 0 as *mut libc::c_char; - ptr = strchr((*headers).data, ';' as i32); - if !ptr.is_null() { - optr = ptr; - ptr = ptr.offset(1); - while *ptr as libc::c_int != 0 - && Curl_isspace(*ptr as libc::c_uchar as libc::c_int) != 0 - { - ptr = ptr.offset(1); - } - if *ptr != 0 { - optr = 0 as *mut libc::c_char; - } else { - ptr = ptr.offset(-1); - if *ptr as libc::c_int == ';' as i32 { - semicolonp = Curl_cstrdup - .expect("non-null function pointer")((*headers).data); - if semicolonp.is_null() { - Curl_dyn_free(req); - return CURLE_OUT_OF_MEMORY; - } - *semicolonp - .offset( - ptr.offset_from((*headers).data) as libc::c_long as isize, - ) = ':' as i32 as libc::c_char; - optr = &mut *semicolonp - .offset( - ptr.offset_from((*headers).data) as libc::c_long as isize, - ) as *mut libc::c_char; - } - } - ptr = optr; - } - } - if !ptr.is_null() { - ptr = ptr.offset(1); - while *ptr as libc::c_int != 0 - && Curl_isspace(*ptr as libc::c_uchar as libc::c_int) != 0 - { - ptr = ptr.offset(1); - } - if *ptr as libc::c_int != 0 || !semicolonp.is_null() { - let mut result: CURLcode = CURLE_OK; - let mut compare: *mut libc::c_char = if !semicolonp.is_null() { - semicolonp - } else { - (*headers).data - }; - if !(!((*data).state.aptr.host).is_null() - && curl_strnequal( - b"Host:\0" as *const u8 as *const libc::c_char, - compare, - strlen(b"Host:\0" as *const u8 as *const libc::c_char), - ) != 0) - { - if !((*data).state.httpreq as libc::c_uint - == HTTPREQ_POST_FORM as libc::c_int as libc::c_uint - && curl_strnequal( - b"Content-Type:\0" as *const u8 as *const libc::c_char, - compare, - strlen( - b"Content-Type:\0" as *const u8 as *const libc::c_char, - ), - ) != 0) - { - if !((*data).state.httpreq as libc::c_uint - == HTTPREQ_POST_MIME as libc::c_int as libc::c_uint - && curl_strnequal( - b"Content-Type:\0" as *const u8 as *const libc::c_char, - compare, - strlen( - b"Content-Type:\0" as *const u8 as *const libc::c_char, - ), - ) != 0) - { - if !(((*conn).bits).authneg() as libc::c_int != 0 - && curl_strnequal( - b"Content-Length:\0" as *const u8 as *const libc::c_char, - compare, - strlen( - b"Content-Length:\0" as *const u8 as *const libc::c_char, - ), - ) != 0) - { - if !(!((*data).state.aptr.te).is_null() - && curl_strnequal( - b"Connection:\0" as *const u8 as *const libc::c_char, - compare, - strlen(b"Connection:\0" as *const u8 as *const libc::c_char), - ) != 0) - { - if !((*conn).httpversion as libc::c_int >= 20 as libc::c_int - && curl_strnequal( - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - compare, - strlen( - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - ), - ) != 0) - { - if !((curl_strnequal( - b"Authorization:\0" as *const u8 as *const libc::c_char, - compare, - strlen( - b"Authorization:\0" as *const u8 as *const libc::c_char, - ), - ) != 0 - || curl_strnequal( - b"Cookie:\0" as *const u8 as *const libc::c_char, - compare, - strlen(b"Cookie:\0" as *const u8 as *const libc::c_char), - ) != 0) - && (((*data).state).this_is_a_follow() as libc::c_int != 0 - && !((*data).state.first_host).is_null() - && ((*data).set).allow_auth_to_other_hosts() == 0 - && Curl_strcasecompare( - (*data).state.first_host, - (*conn).host.name, - ) == 0)) - { - result = Curl_dyn_addf( - req, - b"%s\r\n\0" as *const u8 as *const libc::c_char, - compare, - ); - } - } - } - } - } - } - } - if !semicolonp.is_null() { - Curl_cfree - .expect( - "non-null function pointer", - )(semicolonp as *mut libc::c_void); - } - if result as u64 != 0 { - return result; - } - } - } - headers = (*headers).next; - } - i += 1; - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_add_timecondition( - mut data: *mut Curl_easy, - mut req: *mut dynbuf, -) -> CURLcode { - let mut tm: *const tm = 0 as *const tm; - let mut keeptime: tm = tm { - tm_sec: 0, - tm_min: 0, - tm_hour: 0, - tm_mday: 0, - tm_mon: 0, - tm_year: 0, - tm_wday: 0, - tm_yday: 0, - tm_isdst: 0, - tm_gmtoff: 0, - tm_zone: 0 as *const libc::c_char, - }; - let mut result: CURLcode = CURLE_OK; - let mut datestr: [libc::c_char; 80] = [0; 80]; - let mut condp: *const libc::c_char = 0 as *const libc::c_char; - if (*data).set.timecondition as libc::c_uint - == CURL_TIMECOND_NONE as libc::c_int as libc::c_uint - { - return CURLE_OK; - } - result = Curl_gmtime((*data).set.timevalue, &mut keeptime); - if result as u64 != 0 { - Curl_failf(data, b"Invalid TIMEVALUE\0" as *const u8 as *const libc::c_char); - return result; - } - tm = &mut keeptime; - match (*data).set.timecondition as libc::c_uint { - 1 => { - condp = b"If-Modified-Since\0" as *const u8 as *const libc::c_char; - } - 2 => { - condp = b"If-Unmodified-Since\0" as *const u8 as *const libc::c_char; - } - 3 => { - condp = b"Last-Modified\0" as *const u8 as *const libc::c_char; - } - _ => return CURLE_BAD_FUNCTION_ARGUMENT, - } - if !(Curl_checkheaders(data, condp)).is_null() { - return CURLE_OK; - } - curl_msnprintf( - datestr.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 80]>() as libc::c_ulong, - b"%s: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n\0" as *const u8 - as *const libc::c_char, - condp, - Curl_wkday[(if (*tm).tm_wday != 0 { - (*tm).tm_wday - 1 as libc::c_int - } else { - 6 as libc::c_int - }) as usize], - (*tm).tm_mday, - Curl_month[(*tm).tm_mon as usize], - (*tm).tm_year + 1900 as libc::c_int, - (*tm).tm_hour, - (*tm).tm_min, - (*tm).tm_sec, - ); - result = Curl_dyn_add(req, datestr.as_mut_ptr()); - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_method( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut method: *mut *const libc::c_char, - mut reqp: *mut Curl_HttpReq, -) { - let mut httpreq: Curl_HttpReq = (*data).state.httpreq; - let mut request: *const libc::c_char = 0 as *const libc::c_char; - if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int - | (1 as libc::c_int) << 2 as libc::c_int) as libc::c_uint != 0 - && ((*data).set).upload() as libc::c_int != 0 - { - httpreq = HTTPREQ_PUT; - } - if !((*data).set.str_0[STRING_CUSTOMREQUEST as libc::c_int as usize]).is_null() { - request = (*data).set.str_0[STRING_CUSTOMREQUEST as libc::c_int as usize]; - } else if ((*data).set).opt_no_body() != 0 { - request = b"HEAD\0" as *const u8 as *const libc::c_char; - } else { - match httpreq as libc::c_uint { - 1 | 2 | 3 => { - request = b"POST\0" as *const u8 as *const libc::c_char; - } - 4 => { - request = b"PUT\0" as *const u8 as *const libc::c_char; - } - 5 => { - request = b"HEAD\0" as *const u8 as *const libc::c_char; - } - 0 | _ => { - request = b"GET\0" as *const u8 as *const libc::c_char; - } - } - } - *method = request; - *reqp = httpreq; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_useragent(mut data: *mut Curl_easy) -> CURLcode { - if !(Curl_checkheaders(data, b"User-Agent\0" as *const u8 as *const libc::c_char)) - .is_null() - { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.uagent as *mut libc::c_void); - let ref mut fresh34 = (*data).state.aptr.uagent; - *fresh34 = 0 as *mut libc::c_char; - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_host( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut ptr: *const libc::c_char = 0 as *const libc::c_char; - if ((*data).state).this_is_a_follow() == 0 { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.first_host as *mut libc::c_void); - let ref mut fresh35 = (*data).state.first_host; - *fresh35 = Curl_cstrdup.expect("non-null function pointer")((*conn).host.name); - if ((*data).state.first_host).is_null() { - return CURLE_OUT_OF_MEMORY; - } - (*data).state.first_remote_port = (*conn).remote_port; - } - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.host as *mut libc::c_void); - let ref mut fresh36 = (*data).state.aptr.host; - *fresh36 = 0 as *mut libc::c_char; - ptr = Curl_checkheaders(data, b"Host\0" as *const u8 as *const libc::c_char); - if !ptr.is_null() - && (((*data).state).this_is_a_follow() == 0 - || Curl_strcasecompare((*data).state.first_host, (*conn).host.name) != 0) - { - let mut cookiehost: *mut libc::c_char = Curl_copy_header_value(ptr); - if cookiehost.is_null() { - return CURLE_OUT_OF_MEMORY; - } - if *cookiehost == 0 { - Curl_cfree - .expect("non-null function pointer")(cookiehost as *mut libc::c_void); - } else { - if *cookiehost as libc::c_int == '[' as i32 { - let mut closingbracket: *mut libc::c_char = 0 as *mut libc::c_char; - memmove( - cookiehost as *mut libc::c_void, - cookiehost.offset(1 as libc::c_int as isize) as *const libc::c_void, - (strlen(cookiehost)).wrapping_sub(1 as libc::c_int as libc::c_ulong), - ); - closingbracket = strchr(cookiehost, ']' as i32); - if !closingbracket.is_null() { - *closingbracket = 0 as libc::c_int as libc::c_char; - } - } else { - let mut startsearch: libc::c_int = 0 as libc::c_int; - let mut colon: *mut libc::c_char = strchr( - cookiehost.offset(startsearch as isize), - ':' as i32, - ); - if !colon.is_null() { - *colon = 0 as libc::c_int as libc::c_char; - } - } - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.cookiehost as *mut libc::c_void); - let ref mut fresh37 = (*data).state.aptr.cookiehost; - *fresh37 = 0 as *mut libc::c_char; - let ref mut fresh38 = (*data).state.aptr.cookiehost; - *fresh38 = cookiehost; - } - if strcmp(b"Host:\0" as *const u8 as *const libc::c_char, ptr) != 0 { - let ref mut fresh39 = (*data).state.aptr.host; - *fresh39 = curl_maprintf( - b"Host:%s\r\n\0" as *const u8 as *const libc::c_char, - &*ptr.offset(5 as libc::c_int as isize) as *const libc::c_char, - ); - if ((*data).state.aptr.host).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } else { - let ref mut fresh40 = (*data).state.aptr.host; - *fresh40 = 0 as *mut libc::c_char; - } - } else { - let mut host: *const libc::c_char = (*conn).host.name; - if (*(*conn).given).protocol - & ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint != 0 - && (*conn).remote_port == 443 as libc::c_int - || (*(*conn).given).protocol - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint != 0 - && (*conn).remote_port == 80 as libc::c_int - { - let ref mut fresh41 = (*data).state.aptr.host; - *fresh41 = curl_maprintf( - b"Host: %s%s%s\r\n\0" as *const u8 as *const libc::c_char, - if ((*conn).bits).ipv6_ip() as libc::c_int != 0 { - b"[\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - host, - if ((*conn).bits).ipv6_ip() as libc::c_int != 0 { - b"]\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - } else { - let ref mut fresh42 = (*data).state.aptr.host; - *fresh42 = curl_maprintf( - b"Host: %s%s%s:%d\r\n\0" as *const u8 as *const libc::c_char, - if ((*conn).bits).ipv6_ip() as libc::c_int != 0 { - b"[\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - host, - if ((*conn).bits).ipv6_ip() as libc::c_int != 0 { - b"]\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - (*conn).remote_port, - ); - } - if ((*data).state.aptr.host).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_target( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut r: *mut dynbuf, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut path: *const libc::c_char = (*data).state.up.path; - let mut query: *const libc::c_char = (*data).state.up.query; - if !((*data).set.str_0[STRING_TARGET as libc::c_int as usize]).is_null() { - path = (*data).set.str_0[STRING_TARGET as libc::c_int as usize]; - query = 0 as *const libc::c_char; - } - if ((*conn).bits).httpproxy() as libc::c_int != 0 - && ((*conn).bits).tunnel_proxy() == 0 - { - let mut uc: CURLUcode = CURLUE_OK; - let mut url: *mut libc::c_char = 0 as *mut libc::c_char; - let mut h: *mut CURLU = curl_url_dup((*data).state.uh); - if h.is_null() { - return CURLE_OUT_OF_MEMORY; - } - if (*conn).host.dispname != (*conn).host.name as *const libc::c_char { - uc = curl_url_set( - h, - CURLUPART_HOST, - (*conn).host.name, - 0 as libc::c_int as libc::c_uint, - ); - if uc as u64 != 0 { - curl_url_cleanup(h); - return CURLE_OUT_OF_MEMORY; - } - } - uc = curl_url_set( - h, - CURLUPART_FRAGMENT, - 0 as *const libc::c_char, - 0 as libc::c_int as libc::c_uint, - ); - if uc as u64 != 0 { - curl_url_cleanup(h); - return CURLE_OUT_OF_MEMORY; - } - if Curl_strcasecompare( - b"http\0" as *const u8 as *const libc::c_char, - (*data).state.up.scheme, - ) != 0 - { - uc = curl_url_set( - h, - CURLUPART_USER, - 0 as *const libc::c_char, - 0 as libc::c_int as libc::c_uint, - ); - if uc as u64 != 0 { - curl_url_cleanup(h); - return CURLE_OUT_OF_MEMORY; - } - uc = curl_url_set( - h, - CURLUPART_PASSWORD, - 0 as *const libc::c_char, - 0 as libc::c_int as libc::c_uint, - ); - if uc as u64 != 0 { - curl_url_cleanup(h); - return CURLE_OUT_OF_MEMORY; - } - } - uc = curl_url_get( - h, - CURLUPART_URL, - &mut url, - ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint, - ); - if uc as u64 != 0 { - curl_url_cleanup(h); - return CURLE_OUT_OF_MEMORY; - } - curl_url_cleanup(h); - result = Curl_dyn_add( - r, - if !((*data).set.str_0[STRING_TARGET as libc::c_int as usize]).is_null() { - (*data).set.str_0[STRING_TARGET as libc::c_int as usize] - } else { - url - }, - ); - Curl_cfree.expect("non-null function pointer")(url as *mut libc::c_void); - if result as u64 != 0 { - return result; - } - if Curl_strcasecompare( - b"ftp\0" as *const u8 as *const libc::c_char, - (*data).state.up.scheme, - ) != 0 - { - if ((*data).set).proxy_transfer_mode() != 0 { - let mut type_0: *mut libc::c_char = strstr( - path, - b";type=\0" as *const u8 as *const libc::c_char, - ); - if !type_0.is_null() - && *type_0.offset(6 as libc::c_int as isize) as libc::c_int != 0 - && *type_0.offset(7 as libc::c_int as isize) as libc::c_int - == 0 as libc::c_int - { - match Curl_raw_toupper(*type_0.offset(6 as libc::c_int as isize)) - as libc::c_int - { - 65 | 68 | 73 => {} - _ => { - type_0 = 0 as *mut libc::c_char; - } - } - } - if type_0.is_null() { - result = Curl_dyn_addf( - r, - b";type=%c\0" as *const u8 as *const libc::c_char, - if ((*data).state).prefer_ascii() as libc::c_int != 0 { - 'a' as i32 - } else { - 'i' as i32 - }, - ); - if result as u64 != 0 { - return result; - } - } - } - } - } else { - result = Curl_dyn_add(r, path); - if result as u64 != 0 { - return result; - } - if !query.is_null() { - result = Curl_dyn_addf( - r, - b"?%s\0" as *const u8 as *const libc::c_char, - query, - ); - } - } - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_body( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut httpreq: Curl_HttpReq, - mut tep: *mut *const libc::c_char, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut ptr: *const libc::c_char = 0 as *const libc::c_char; - let mut http: *mut HTTP = (*data).req.p.http; - (*http).postsize = 0 as libc::c_int as curl_off_t; - match httpreq as libc::c_uint { - 3 => { - let ref mut fresh43 = (*http).sendit; - *fresh43 = &mut (*data).set.mimepost; - } - 2 => { - Curl_mime_cleanpart(&mut (*http).form); - result = Curl_getformdata( - data, - &mut (*http).form, - (*data).set.httppost, - (*data).state.fread_func, - ); - if result as u64 != 0 { - return result; - } - let ref mut fresh44 = (*http).sendit; - *fresh44 = &mut (*http).form; - } - _ => { - let ref mut fresh45 = (*http).sendit; - *fresh45 = 0 as *mut curl_mimepart; - } - } - if !((*http).sendit).is_null() { - let mut cthdr: *const libc::c_char = Curl_checkheaders( - data, - b"Content-Type\0" as *const u8 as *const libc::c_char, - ); - (*(*http).sendit).flags - |= ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint; - if !cthdr.is_null() { - cthdr = cthdr.offset(13 as libc::c_int as isize); - while *cthdr as libc::c_int == ' ' as i32 { - cthdr = cthdr.offset(1); - } - } else if (*(*http).sendit).kind as libc::c_uint - == MIMEKIND_MULTIPART as libc::c_int as libc::c_uint - { - cthdr = b"multipart/form-data\0" as *const u8 as *const libc::c_char; - } - curl_mime_headers((*http).sendit, (*data).set.headers, 0 as libc::c_int); - result = Curl_mime_prepare_headers( - (*http).sendit, - cthdr, - 0 as *const libc::c_char, - MIMESTRATEGY_FORM, - ); - curl_mime_headers((*http).sendit, 0 as *mut curl_slist, 0 as libc::c_int); - if result as u64 == 0 { - result = Curl_mime_rewind((*http).sendit); - } - if result as u64 != 0 { - return result; - } - (*http).postsize = Curl_mime_size((*http).sendit); - } - ptr = Curl_checkheaders( - data, - b"Transfer-Encoding\0" as *const u8 as *const libc::c_char, - ); - if !ptr.is_null() { - let ref mut fresh46 = (*data).req; - (*fresh46) - .set_upload_chunky( - Curl_compareheader( - ptr, - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - b"chunked\0" as *const u8 as *const libc::c_char, - ) as bit, - ); - } else { - if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint != 0 - && ((httpreq as libc::c_uint - == HTTPREQ_POST_MIME as libc::c_int as libc::c_uint - || httpreq as libc::c_uint - == HTTPREQ_POST_FORM as libc::c_int as libc::c_uint) - && (*http).postsize < 0 as libc::c_int as libc::c_long - || (((*data).set).upload() as libc::c_int != 0 - || httpreq as libc::c_uint - == HTTPREQ_POST as libc::c_int as libc::c_uint) - && (*data).state.infilesize == -(1 as libc::c_int) as libc::c_long) - { - if !(((*conn).bits).authneg() != 0) { - if Curl_use_http_1_1plus(data, conn) { - if ((*conn).httpversion as libc::c_int) < 20 as libc::c_int { - let ref mut fresh47 = (*data).req; - (*fresh47).set_upload_chunky(1 as libc::c_int as bit); - } - } else { - Curl_failf( - data, - b"Chunky upload is not supported by HTTP 1.0\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_UPLOAD_FAILED; - } - } - } else { - let ref mut fresh48 = (*data).req; - (*fresh48).set_upload_chunky(0 as libc::c_int as bit); - } - if ((*data).req).upload_chunky() != 0 { - *tep = b"Transfer-Encoding: chunked\r\n\0" as *const u8 - as *const libc::c_char; - } - } - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_bodysend( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut r: *mut dynbuf, - mut httpreq: Curl_HttpReq, -) -> CURLcode { - let mut included_body: curl_off_t = 0 as libc::c_int as curl_off_t; - let mut result: CURLcode = CURLE_OK; - let mut http: *mut HTTP = (*data).req.p.http; - let mut ptr: *const libc::c_char = 0 as *const libc::c_char; - match httpreq as libc::c_uint { - 4 => { - if ((*conn).bits).authneg() != 0 { - (*http).postsize = 0 as libc::c_int as curl_off_t; - } else { - (*http).postsize = (*data).state.infilesize; - } - if (*http).postsize != -(1 as libc::c_int) as libc::c_long - && ((*data).req).upload_chunky() == 0 - && (((*conn).bits).authneg() as libc::c_int != 0 - || (Curl_checkheaders( - data, - b"Content-Length\0" as *const u8 as *const libc::c_char, - )) - .is_null()) - { - result = Curl_dyn_addf( - r, - b"Content-Length: %ld\r\n\0" as *const u8 as *const libc::c_char, - (*http).postsize, - ); - if result as u64 != 0 { - return result; - } - } - if (*http).postsize != 0 { - result = expect100(data, conn, r); - if result as u64 != 0 { - return result; - } - } - result = Curl_dyn_add(r, b"\r\n\0" as *const u8 as *const libc::c_char); - if result as u64 != 0 { - return result; - } - Curl_pgrsSetUploadSize(data, (*http).postsize); - result = Curl_buffer_send( - r, - data, - &mut (*data).info.request_size, - 0 as libc::c_int as curl_off_t, - 0 as libc::c_int, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failed sending PUT request\0" as *const u8 as *const libc::c_char, - ); - } else { - Curl_setup_transfer( - data, - 0 as libc::c_int, - -(1 as libc::c_int) as curl_off_t, - 1 as libc::c_int != 0, - if (*http).postsize != 0 { - 0 as libc::c_int - } else { - -(1 as libc::c_int) - }, - ); - } - if result as u64 != 0 { - return result; - } - } - 2 | 3 => { - if ((*conn).bits).authneg() != 0 { - result = Curl_dyn_add( - r, - b"Content-Length: 0\r\n\r\n\0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - return result; - } - result = Curl_buffer_send( - r, - data, - &mut (*data).info.request_size, - 0 as libc::c_int as curl_off_t, - 0 as libc::c_int, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failed sending POST request\0" as *const u8 - as *const libc::c_char, - ); - } else { - Curl_setup_transfer( - data, - 0 as libc::c_int, - -(1 as libc::c_int) as curl_off_t, - 1 as libc::c_int != 0, - -(1 as libc::c_int), - ); - } - } else { - (*data).state.infilesize = (*http).postsize; - if (*http).postsize != -(1 as libc::c_int) as libc::c_long - && ((*data).req).upload_chunky() == 0 - && (((*conn).bits).authneg() as libc::c_int != 0 - || (Curl_checkheaders( - data, - b"Content-Length\0" as *const u8 as *const libc::c_char, - )) - .is_null()) - { - result = Curl_dyn_addf( - r, - b"Content-Length: %ld\r\n\0" as *const u8 as *const libc::c_char, - (*http).postsize, - ); - if result as u64 != 0 { - return result; - } - } - let mut hdr: *mut curl_slist = 0 as *mut curl_slist; - hdr = (*(*http).sendit).curlheaders; - while !hdr.is_null() { - result = Curl_dyn_addf( - r, - b"%s\r\n\0" as *const u8 as *const libc::c_char, - (*hdr).data, - ); - if result as u64 != 0 { - return result; - } - hdr = (*hdr).next; - } - ptr = Curl_checkheaders( - data, - b"Expect\0" as *const u8 as *const libc::c_char, - ); - if !ptr.is_null() { - let ref mut fresh49 = (*data).state; - (*fresh49) - .set_expect100header( - Curl_compareheader( - ptr, - b"Expect:\0" as *const u8 as *const libc::c_char, - b"100-continue\0" as *const u8 as *const libc::c_char, - ) as bit, - ); - } else if (*http).postsize - > (1024 as libc::c_int * 1024 as libc::c_int) as libc::c_long - || (*http).postsize < 0 as libc::c_int as libc::c_long - { - result = expect100(data, conn, r); - if result as u64 != 0 { - return result; - } - } else { - let ref mut fresh50 = (*data).state; - (*fresh50).set_expect100header(0 as libc::c_int as bit); - } - result = Curl_dyn_add(r, b"\r\n\0" as *const u8 as *const libc::c_char); - if result as u64 != 0 { - return result; - } - Curl_pgrsSetUploadSize(data, (*http).postsize); - let ref mut fresh51 = (*data).state.fread_func; - *fresh51 = ::std::mem::transmute::< - Option::< - unsafe extern "C" fn( - *mut libc::c_char, - size_t, - size_t, - *mut libc::c_void, - ) -> size_t, - >, - curl_read_callback, - >( - Some( - Curl_mime_read - as unsafe extern "C" fn( - *mut libc::c_char, - size_t, - size_t, - *mut libc::c_void, - ) -> size_t, - ), - ); - let ref mut fresh52 = (*data).state.in_0; - *fresh52 = (*http).sendit as *mut libc::c_void; - (*http).sending = HTTPSEND_BODY; - result = Curl_buffer_send( - r, - data, - &mut (*data).info.request_size, - 0 as libc::c_int as curl_off_t, - 0 as libc::c_int, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failed sending POST request\0" as *const u8 - as *const libc::c_char, - ); - } else { - Curl_setup_transfer( - data, - 0 as libc::c_int, - -(1 as libc::c_int) as curl_off_t, - 1 as libc::c_int != 0, - if (*http).postsize != 0 { - 0 as libc::c_int - } else { - -(1 as libc::c_int) - }, - ); - } - if result as u64 != 0 { - return result; - } - } - } - 1 => { - if ((*conn).bits).authneg() != 0 { - (*http).postsize = 0 as libc::c_int as curl_off_t; - } else { - (*http).postsize = (*data).state.infilesize; - } - if (*http).postsize != -(1 as libc::c_int) as libc::c_long - && ((*data).req).upload_chunky() == 0 - && (((*conn).bits).authneg() as libc::c_int != 0 - || (Curl_checkheaders( - data, - b"Content-Length\0" as *const u8 as *const libc::c_char, - )) - .is_null()) - { - result = Curl_dyn_addf( - r, - b"Content-Length: %ld\r\n\0" as *const u8 as *const libc::c_char, - (*http).postsize, - ); - if result as u64 != 0 { - return result; - } - } - if (Curl_checkheaders( - data, - b"Content-Type\0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - result = Curl_dyn_add( - r, - b"Content-Type: application/x-www-form-urlencoded\r\n\0" as *const u8 - as *const libc::c_char, - ); - if result as u64 != 0 { - return result; - } - } - ptr = Curl_checkheaders( - data, - b"Expect\0" as *const u8 as *const libc::c_char, - ); - if !ptr.is_null() { - let ref mut fresh53 = (*data).state; - (*fresh53) - .set_expect100header( - Curl_compareheader( - ptr, - b"Expect:\0" as *const u8 as *const libc::c_char, - b"100-continue\0" as *const u8 as *const libc::c_char, - ) as bit, - ); - } else if (*http).postsize - > (1024 as libc::c_int * 1024 as libc::c_int) as libc::c_long - || (*http).postsize < 0 as libc::c_int as libc::c_long - { - result = expect100(data, conn, r); - if result as u64 != 0 { - return result; - } - } else { - let ref mut fresh54 = (*data).state; - (*fresh54).set_expect100header(0 as libc::c_int as bit); - } - if !((*data).set.postfields).is_null() { - if (*conn).httpversion as libc::c_int != 20 as libc::c_int - && ((*data).state).expect100header() == 0 - && (*http).postsize - < (64 as libc::c_int * 1024 as libc::c_int) as libc::c_long - { - result = Curl_dyn_add( - r, - b"\r\n\0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - return result; - } - if ((*data).req).upload_chunky() == 0 { - result = Curl_dyn_addn( - r, - (*data).set.postfields, - (*http).postsize as size_t, - ); - included_body = (*http).postsize; - } else { - if (*http).postsize != 0 { - let mut chunk: [libc::c_char; 16] = [0; 16]; - curl_msnprintf( - chunk.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 16]>() - as libc::c_ulong, - b"%x\r\n\0" as *const u8 as *const libc::c_char, - (*http).postsize as libc::c_int, - ); - result = Curl_dyn_add(r, chunk.as_mut_ptr()); - if result as u64 == 0 { - included_body = ((*http).postsize as libc::c_ulong) - .wrapping_add(strlen(chunk.as_mut_ptr())) as curl_off_t; - result = Curl_dyn_addn( - r, - (*data).set.postfields, - (*http).postsize as size_t, - ); - if result as u64 == 0 { - result = Curl_dyn_add( - r, - b"\r\n\0" as *const u8 as *const libc::c_char, - ); - } - included_body += 2 as libc::c_int as libc::c_long; - } - } - if result as u64 == 0 { - result = Curl_dyn_add( - r, - b"0\r\n\r\n\0" as *const u8 as *const libc::c_char, - ); - included_body += 5 as libc::c_int as libc::c_long; - } - } - if result as u64 != 0 { - return result; - } - Curl_pgrsSetUploadSize(data, (*http).postsize); - } else { - let ref mut fresh55 = (*http).postdata; - *fresh55 = (*data).set.postfields as *const libc::c_char; - (*http).sending = HTTPSEND_BODY; - let ref mut fresh56 = (*data).state.fread_func; - *fresh56 = ::std::mem::transmute::< - Option::< - unsafe extern "C" fn( - *mut libc::c_char, - size_t, - size_t, - *mut libc::c_void, - ) -> size_t, - >, - curl_read_callback, - >( - Some( - readmoredata - as unsafe extern "C" fn( - *mut libc::c_char, - size_t, - size_t, - *mut libc::c_void, - ) -> size_t, - ), - ); - let ref mut fresh57 = (*data).state.in_0; - *fresh57 = data as *mut libc::c_void; - Curl_pgrsSetUploadSize(data, (*http).postsize); - result = Curl_dyn_add( - r, - b"\r\n\0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - return result; - } - } - } else { - result = Curl_dyn_add(r, b"\r\n\0" as *const u8 as *const libc::c_char); - if result as u64 != 0 { - return result; - } - if ((*data).req).upload_chunky() as libc::c_int != 0 - && ((*conn).bits).authneg() as libc::c_int != 0 - { - result = Curl_dyn_add( - r, - b"0\r\n\r\n\0" as *const u8 as *const libc::c_char - as *mut libc::c_char, - ); - if result as u64 != 0 { - return result; - } - } else if (*data).state.infilesize != 0 { - Curl_pgrsSetUploadSize( - data, - if (*http).postsize != 0 { - (*http).postsize - } else { - -(1 as libc::c_int) as libc::c_long - }, - ); - if ((*conn).bits).authneg() == 0 { - let ref mut fresh58 = (*http).postdata; - *fresh58 = &mut (*http).postdata as *mut *const libc::c_char - as *mut libc::c_char; - } - } - } - result = Curl_buffer_send( - r, - data, - &mut (*data).info.request_size, - included_body, - 0 as libc::c_int, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failed sending HTTP POST request\0" as *const u8 - as *const libc::c_char, - ); - } else { - Curl_setup_transfer( - data, - 0 as libc::c_int, - -(1 as libc::c_int) as curl_off_t, - 1 as libc::c_int != 0, - if !((*http).postdata).is_null() { - 0 as libc::c_int - } else { - -(1 as libc::c_int) - }, - ); - } - } - _ => { - result = Curl_dyn_add(r, b"\r\n\0" as *const u8 as *const libc::c_char); - if result as u64 != 0 { - return result; - } - result = Curl_buffer_send( - r, - data, - &mut (*data).info.request_size, - 0 as libc::c_int as curl_off_t, - 0 as libc::c_int, - ); - if result as u64 != 0 { - Curl_failf( - data, - b"Failed sending HTTP request\0" as *const u8 as *const libc::c_char, - ); - } else { - Curl_setup_transfer( - data, - 0 as libc::c_int, - -(1 as libc::c_int) as curl_off_t, - 1 as libc::c_int != 0, - -(1 as libc::c_int), - ); - } - } - } - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_cookies( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut r: *mut dynbuf, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut addcookies: *mut libc::c_char = 0 as *mut libc::c_char; - if !((*data).set.str_0[STRING_COOKIE as libc::c_int as usize]).is_null() - && (Curl_checkheaders(data, b"Cookie\0" as *const u8 as *const libc::c_char)) - .is_null() - { - addcookies = (*data).set.str_0[STRING_COOKIE as libc::c_int as usize]; - } - if !((*data).cookies).is_null() || !addcookies.is_null() { - let mut co: *mut Cookie = 0 as *mut Cookie; - let mut count: libc::c_int = 0 as libc::c_int; - if !((*data).cookies).is_null() - && ((*data).state).cookie_engine() as libc::c_int != 0 - { - let mut host: *const libc::c_char = if !((*data).state.aptr.cookiehost) - .is_null() - { - (*data).state.aptr.cookiehost - } else { - (*conn).host.name - }; - let secure_context: bool = if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint != 0 - || Curl_strcasecompare( - b"localhost\0" as *const u8 as *const libc::c_char, - host, - ) != 0 - || strcmp(host, b"127.0.0.1\0" as *const u8 as *const libc::c_char) == 0 - || strcmp(host, b"[::1]\0" as *const u8 as *const libc::c_char) == 0 - { - 1 as libc::c_int - } else { - 0 as libc::c_int - } != 0; - Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); - co = Curl_cookie_getlist( - (*data).cookies, - host, - (*data).state.up.path, - secure_context, - ); - Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); - } - if !co.is_null() { - let mut store: *mut Cookie = co; - while !co.is_null() { - if !((*co).value).is_null() { - if 0 as libc::c_int == count { - result = Curl_dyn_add( - r, - b"Cookie: \0" as *const u8 as *const libc::c_char, - ); - if result as u64 != 0 { - break; - } - } - result = Curl_dyn_addf( - r, - b"%s%s=%s\0" as *const u8 as *const libc::c_char, - if count != 0 { - b"; \0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - (*co).name, - (*co).value, - ); - if result as u64 != 0 { - break; - } - count += 1; - } - co = (*co).next; - } - Curl_cookie_freelist(store); - } - if !addcookies.is_null() && result as u64 == 0 { - if count == 0 { - result = Curl_dyn_add( - r, - b"Cookie: \0" as *const u8 as *const libc::c_char, - ); - } - if result as u64 == 0 { - result = Curl_dyn_addf( - r, - b"%s%s\0" as *const u8 as *const libc::c_char, - if count != 0 { - b"; \0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - addcookies, - ); - count += 1; - } - } - if count != 0 && result as u64 == 0 { - result = Curl_dyn_add(r, b"\r\n\0" as *const u8 as *const libc::c_char); - } - if result as u64 != 0 { - return result; - } - } - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_range( - mut data: *mut Curl_easy, - mut httpreq: Curl_HttpReq, -) -> CURLcode { - if ((*data).state).use_range() != 0 { - if (httpreq as libc::c_uint == HTTPREQ_GET as libc::c_int as libc::c_uint - || httpreq as libc::c_uint == HTTPREQ_HEAD as libc::c_int as libc::c_uint) - && (Curl_checkheaders(data, b"Range\0" as *const u8 as *const libc::c_char)) - .is_null() - { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.rangeline as *mut libc::c_void); - let ref mut fresh59 = (*data).state.aptr.rangeline; - *fresh59 = curl_maprintf( - b"Range: bytes=%s\r\n\0" as *const u8 as *const libc::c_char, - (*data).state.range, - ); - } else if (httpreq as libc::c_uint == HTTPREQ_POST as libc::c_int as libc::c_uint - || httpreq as libc::c_uint == HTTPREQ_PUT as libc::c_int as libc::c_uint) - && (Curl_checkheaders( - data, - b"Content-Range\0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.rangeline as *mut libc::c_void); - if (*data).set.set_resume_from < 0 as libc::c_int as libc::c_long { - let ref mut fresh60 = (*data).state.aptr.rangeline; - *fresh60 = curl_maprintf( - b"Content-Range: bytes 0-%ld/%ld\r\n\0" as *const u8 - as *const libc::c_char, - (*data).state.infilesize - 1 as libc::c_int as libc::c_long, - (*data).state.infilesize, - ); - } else if (*data).state.resume_from != 0 { - let mut total_expected_size: curl_off_t = (*data).state.resume_from - + (*data).state.infilesize; - let ref mut fresh61 = (*data).state.aptr.rangeline; - *fresh61 = curl_maprintf( - b"Content-Range: bytes %s%ld/%ld\r\n\0" as *const u8 - as *const libc::c_char, - (*data).state.range, - total_expected_size - 1 as libc::c_int as libc::c_long, - total_expected_size, - ); - } else { - let ref mut fresh62 = (*data).state.aptr.rangeline; - *fresh62 = curl_maprintf( - b"Content-Range: bytes %s/%ld\r\n\0" as *const u8 - as *const libc::c_char, - (*data).state.range, - (*data).state.infilesize, - ); - } - if ((*data).state.aptr.rangeline).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_resume( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut httpreq: Curl_HttpReq, -) -> CURLcode { - if (HTTPREQ_POST as libc::c_int as libc::c_uint == httpreq as libc::c_uint - || HTTPREQ_PUT as libc::c_int as libc::c_uint == httpreq as libc::c_uint) - && (*data).state.resume_from != 0 - { - if (*data).state.resume_from < 0 as libc::c_int as libc::c_long { - (*data).state.resume_from = 0 as libc::c_int as curl_off_t; - } - if (*data).state.resume_from != 0 && ((*data).state).this_is_a_follow() == 0 { - let mut seekerr: libc::c_int = 2 as libc::c_int; - if ((*conn).seek_func).is_some() { - Curl_set_in_callback(data, 1 as libc::c_int != 0); - seekerr = ((*conn).seek_func) - .expect( - "non-null function pointer", - )((*conn).seek_client, (*data).state.resume_from, 0 as libc::c_int); - Curl_set_in_callback(data, 0 as libc::c_int != 0); - } - if seekerr != 0 as libc::c_int { - let mut passed: curl_off_t = 0 as libc::c_int as curl_off_t; - if seekerr != 2 as libc::c_int { - Curl_failf( - data, - b"Could not seek stream\0" as *const u8 as *const libc::c_char, - ); - return CURLE_READ_ERROR; - } - loop { - let mut readthisamountnow: size_t = if (*data).state.resume_from - - passed > (*data).set.buffer_size - { - (*data).set.buffer_size as size_t - } else { - curlx_sotouz((*data).state.resume_from - passed) - }; - let mut actuallyread: size_t = ((*data).state.fread_func) - .expect( - "non-null function pointer", - )( - (*data).state.buffer, - 1 as libc::c_int as size_t, - readthisamountnow, - (*data).state.in_0, - ); - passed = (passed as libc::c_ulong).wrapping_add(actuallyread) - as curl_off_t as curl_off_t; - if actuallyread == 0 as libc::c_int as libc::c_ulong - || actuallyread > readthisamountnow - { - Curl_failf( - data, - b"Could only read %ld bytes from the input\0" as *const u8 - as *const libc::c_char, - passed, - ); - return CURLE_READ_ERROR; - } - if !(passed < (*data).state.resume_from) { - break; - } - } - } - if (*data).state.infilesize > 0 as libc::c_int as libc::c_long { - let ref mut fresh63 = (*data).state.infilesize; - *fresh63 -= (*data).state.resume_from; - if (*data).state.infilesize <= 0 as libc::c_int as libc::c_long { - Curl_failf( - data, - b"File already completely uploaded\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_PARTIAL_FILE; - } - } - } - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_firstwrite( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut done: *mut bool, -) -> CURLcode { - let mut k: *mut SingleRequest = &mut (*data).req; - if ((*data).req).ignore_cl() != 0 { - let ref mut fresh64 = (*k).maxdownload; - *fresh64 = -(1 as libc::c_int) as curl_off_t; - (*k).size = *fresh64; - } else if (*k).size != -(1 as libc::c_int) as libc::c_long { - if (*data).set.max_filesize != 0 && (*k).size > (*data).set.max_filesize { - Curl_failf( - data, - b"Maximum file size exceeded\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FILESIZE_EXCEEDED; - } - Curl_pgrsSetDownloadSize(data, (*k).size); - } - if !((*data).req.newurl).is_null() { - if ((*conn).bits).close() != 0 { - (*k).keepon &= !((1 as libc::c_int) << 0 as libc::c_int); - *done = 1 as libc::c_int != 0; - return CURLE_OK; - } - (*k).set_ignorebody(1 as libc::c_int as bit); - Curl_infof( - data, - b"Ignoring the response-body\0" as *const u8 as *const libc::c_char, - ); - } - if (*data).state.resume_from != 0 && (*k).content_range() == 0 - && (*data).state.httpreq as libc::c_uint - == HTTPREQ_GET as libc::c_int as libc::c_uint && (*k).ignorebody() == 0 - { - if (*k).size == (*data).state.resume_from { - Curl_infof( - data, - b"The entire document is already downloaded\0" as *const u8 - as *const libc::c_char, - ); - Curl_conncontrol(conn, 1 as libc::c_int); - (*k).keepon &= !((1 as libc::c_int) << 0 as libc::c_int); - *done = 1 as libc::c_int != 0; - return CURLE_OK; - } - Curl_failf( - data, - b"HTTP server doesn't seem to support byte ranges. Cannot resume.\0" - as *const u8 as *const libc::c_char, - ); - return CURLE_RANGE_ERROR; - } - if (*data).set.timecondition as libc::c_uint != 0 && ((*data).state.range).is_null() - { - if !Curl_meets_timecondition(data, (*k).timeofdoc) { - *done = 1 as libc::c_int != 0; - (*data).info.httpcode = 304 as libc::c_int; - Curl_infof( - data, - b"Simulate a HTTP 304 response!\0" as *const u8 as *const libc::c_char, - ); - Curl_conncontrol(conn, 1 as libc::c_int); - return CURLE_OK; - } - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_transferencode(mut data: *mut Curl_easy) -> CURLcode { - if (Curl_checkheaders(data, b"TE\0" as *const u8 as *const libc::c_char)).is_null() - && ((*data).set).http_transfer_encoding() as libc::c_int != 0 - { - let mut cptr: *mut libc::c_char = Curl_checkheaders( - data, - b"Connection\0" as *const u8 as *const libc::c_char, - ); - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.te as *mut libc::c_void); - let ref mut fresh65 = (*data).state.aptr.te; - *fresh65 = 0 as *mut libc::c_char; - if !cptr.is_null() { - cptr = Curl_copy_header_value(cptr); - if cptr.is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - let ref mut fresh66 = (*data).state.aptr.te; - *fresh66 = curl_maprintf( - b"Connection: %s%sTE\r\nTE: gzip\r\n\0" as *const u8 as *const libc::c_char, - if !cptr.is_null() { - cptr as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !cptr.is_null() && *cptr as libc::c_int != 0 { - b", \0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - Curl_cfree.expect("non-null function pointer")(cptr as *mut libc::c_void); - if ((*data).state.aptr.te).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http( - mut data: *mut Curl_easy, - mut done: *mut bool, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut result: CURLcode = CURLE_OK; - let mut http: *mut HTTP = 0 as *mut HTTP; - let mut httpreq: Curl_HttpReq = HTTPREQ_GET; - let mut te: *const libc::c_char = b"\0" as *const u8 as *const libc::c_char; - let mut request: *const libc::c_char = 0 as *const libc::c_char; - let mut httpstring: *const libc::c_char = 0 as *const libc::c_char; - let mut req: dynbuf = dynbuf { - bufr: 0 as *mut libc::c_char, - leng: 0, - allc: 0, - toobig: 0, - }; - let mut altused: *mut libc::c_char = 0 as *mut libc::c_char; - let mut p_accept: *const libc::c_char = 0 as *const libc::c_char; - *done = 1 as libc::c_int != 0; - if (*conn).transport as libc::c_uint != TRNSPRT_QUIC as libc::c_int as libc::c_uint { - if ((*conn).httpversion as libc::c_int) < 20 as libc::c_int { - match (*conn).negnpn { - 3 => { - (*conn).httpversion = 20 as libc::c_int as libc::c_uchar; - result = Curl_http2_switched( - data, - 0 as *const libc::c_char, - 0 as libc::c_int as size_t, - ); - if result as u64 != 0 { - return result; - } - } - 2 => {} - _ => { - if (*data).state.httpwant as libc::c_int - == CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE as libc::c_int - { - if ((*conn).bits).httpproxy() as libc::c_int != 0 - && ((*conn).bits).tunnel_proxy() == 0 - { - Curl_infof( - data, - b"Ignoring HTTP/2 prior knowledge due to proxy\0" - as *const u8 as *const libc::c_char, - ); - } else { - (*conn).httpversion = 20 as libc::c_int as libc::c_uchar; - result = Curl_http2_switched( - data, - 0 as *const libc::c_char, - 0 as libc::c_int as size_t, - ); - if result as u64 != 0 { - return result; - } - } - } - } - } - } else { - result = Curl_http2_setup(data, conn); - if result as u64 != 0 { - return result; - } - } - } - http = (*data).req.p.http; - result = Curl_http_host(data, conn); - if result as u64 != 0 { - return result; - } - result = Curl_http_useragent(data); - if result as u64 != 0 { - return result; - } - Curl_http_method(data, conn, &mut request, &mut httpreq); - let mut pq: *mut libc::c_char = 0 as *mut libc::c_char; - if !((*data).state.up.query).is_null() { - pq = curl_maprintf( - b"%s?%s\0" as *const u8 as *const libc::c_char, - (*data).state.up.path, - (*data).state.up.query, - ); - if pq.is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - result = Curl_http_output_auth( - data, - conn, - request, - httpreq, - if !pq.is_null() { pq } else { (*data).state.up.path }, - 0 as libc::c_int != 0, - ); - Curl_cfree.expect("non-null function pointer")(pq as *mut libc::c_void); - if result as u64 != 0 { - return result; - } - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.ref_0 as *mut libc::c_void); - let ref mut fresh67 = (*data).state.aptr.ref_0; - *fresh67 = 0 as *mut libc::c_char; - if !((*data).state.referer).is_null() - && (Curl_checkheaders(data, b"Referer\0" as *const u8 as *const libc::c_char)) - .is_null() - { - let ref mut fresh68 = (*data).state.aptr.ref_0; - *fresh68 = curl_maprintf( - b"Referer: %s\r\n\0" as *const u8 as *const libc::c_char, - (*data).state.referer, - ); - if ((*data).state.aptr.ref_0).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } - if (Curl_checkheaders( - data, - b"Accept-Encoding\0" as *const u8 as *const libc::c_char, - )) - .is_null() - && !((*data).set.str_0[STRING_ENCODING as libc::c_int as usize]).is_null() - { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.accept_encoding as *mut libc::c_void); - let ref mut fresh69 = (*data).state.aptr.accept_encoding; - *fresh69 = 0 as *mut libc::c_char; - let ref mut fresh70 = (*data).state.aptr.accept_encoding; - *fresh70 = curl_maprintf( - b"Accept-Encoding: %s\r\n\0" as *const u8 as *const libc::c_char, - (*data).set.str_0[STRING_ENCODING as libc::c_int as usize], - ); - if ((*data).state.aptr.accept_encoding).is_null() { - return CURLE_OUT_OF_MEMORY; - } - } else { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.accept_encoding as *mut libc::c_void); - let ref mut fresh71 = (*data).state.aptr.accept_encoding; - *fresh71 = 0 as *mut libc::c_char; - } - result = Curl_transferencode(data); - if result as u64 != 0 { - return result; - } - result = Curl_http_body(data, conn, httpreq, &mut te); - if result as u64 != 0 { - return result; - } - p_accept = if !(Curl_checkheaders( - data, - b"Accept\0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - 0 as *const libc::c_char - } else { - b"Accept: */*\r\n\0" as *const u8 as *const libc::c_char - }; - result = Curl_http_resume(data, conn, httpreq); - if result as u64 != 0 { - return result; - } - result = Curl_http_range(data, httpreq); - if result as u64 != 0 { - return result; - } - httpstring = get_http_string(data, conn); - Curl_dyn_init(&mut req, (1024 as libc::c_int * 1024 as libc::c_int) as size_t); - Curl_dyn_reset(&mut (*data).state.headerb); - result = Curl_dyn_addf( - &mut req as *mut dynbuf, - b"%s \0" as *const u8 as *const libc::c_char, - request, - ); - if result as u64 == 0 { - result = Curl_http_target(data, conn, &mut req); - } - if result as u64 != 0 { - Curl_dyn_free(&mut req); - return result; - } - if ((*conn).bits).altused() as libc::c_int != 0 - && (Curl_checkheaders(data, b"Alt-Used\0" as *const u8 as *const libc::c_char)) - .is_null() - { - altused = curl_maprintf( - b"Alt-Used: %s:%d\r\n\0" as *const u8 as *const libc::c_char, - (*conn).conn_to_host.name, - (*conn).conn_to_port, - ); - if altused.is_null() { - Curl_dyn_free(&mut req); - return CURLE_OUT_OF_MEMORY; - } - } - result = Curl_dyn_addf( - &mut req as *mut dynbuf, - b" HTTP/%s\r\n%s%s%s%s%s%s%s%s%s%s%s%s\0" as *const u8 as *const libc::c_char, - httpstring, - if !((*data).state.aptr.host).is_null() { - (*data).state.aptr.host as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !((*data).state.aptr.proxyuserpwd).is_null() { - (*data).state.aptr.proxyuserpwd as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !((*data).state.aptr.userpwd).is_null() { - (*data).state.aptr.userpwd as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if ((*data).state).use_range() as libc::c_int != 0 - && !((*data).state.aptr.rangeline).is_null() - { - (*data).state.aptr.rangeline as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !((*data).set.str_0[STRING_USERAGENT as libc::c_int as usize]).is_null() - && *(*data).set.str_0[STRING_USERAGENT as libc::c_int as usize] - as libc::c_int != 0 && !((*data).state.aptr.uagent).is_null() - { - (*data).state.aptr.uagent as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !p_accept.is_null() { - p_accept - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !((*data).state.aptr.te).is_null() { - (*data).state.aptr.te as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !((*data).set.str_0[STRING_ENCODING as libc::c_int as usize]).is_null() - && *(*data).set.str_0[STRING_ENCODING as libc::c_int as usize] as libc::c_int - != 0 && !((*data).state.aptr.accept_encoding).is_null() - { - (*data).state.aptr.accept_encoding as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !((*data).state.referer).is_null() && !((*data).state.aptr.ref_0).is_null() { - (*data).state.aptr.ref_0 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if ((*conn).bits).httpproxy() as libc::c_int != 0 - && ((*conn).bits).tunnel_proxy() == 0 - && (Curl_checkheaders( - data, - b"Proxy-Connection\0" as *const u8 as *const libc::c_char, - )) - .is_null() - && (Curl_checkProxyheaders( - data, - conn, - b"Proxy-Connection\0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - b"Proxy-Connection: Keep-Alive\r\n\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - te, - if !altused.is_null() { - altused as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.userpwd as *mut libc::c_void); - let ref mut fresh72 = (*data).state.aptr.userpwd; - *fresh72 = 0 as *mut libc::c_char; - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.proxyuserpwd as *mut libc::c_void); - let ref mut fresh73 = (*data).state.aptr.proxyuserpwd; - *fresh73 = 0 as *mut libc::c_char; - Curl_cfree.expect("non-null function pointer")(altused as *mut libc::c_void); - if result as u64 != 0 { - Curl_dyn_free(&mut req); - return result; - } - if (*(*conn).handler).flags - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint == 0 - && (*conn).httpversion as libc::c_int != 20 as libc::c_int - && (*data).state.httpwant as libc::c_int == CURL_HTTP_VERSION_2_0 as libc::c_int - { - result = Curl_http2_request_upgrade(&mut req, data); - if result as u64 != 0 { - Curl_dyn_free(&mut req); - return result; - } - } - result = Curl_http_cookies(data, conn, &mut req); - if result as u64 == 0 { - result = Curl_add_timecondition(data, &mut req); - } - if result as u64 == 0 { - result = Curl_add_custom_headers(data, 0 as libc::c_int != 0, &mut req); - } - if result as u64 == 0 { - let ref mut fresh74 = (*http).postdata; - *fresh74 = 0 as *const libc::c_char; - if httpreq as libc::c_uint == HTTPREQ_GET as libc::c_int as libc::c_uint - || httpreq as libc::c_uint == HTTPREQ_HEAD as libc::c_int as libc::c_uint - { - Curl_pgrsSetUploadSize(data, 0 as libc::c_int as curl_off_t); - } - result = Curl_http_bodysend(data, conn, &mut req, httpreq); - } - if result as u64 != 0 { - Curl_dyn_free(&mut req); - return result; - } - if (*http).postsize > -(1 as libc::c_int) as libc::c_long - && (*http).postsize <= (*data).req.writebytecount - && (*http).sending as libc::c_uint - != HTTPSEND_REQUEST as libc::c_int as libc::c_uint - { - let ref mut fresh75 = (*data).req; - (*fresh75).set_upload_done(1 as libc::c_int as bit); - } - if (*data).req.writebytecount != 0 { - Curl_pgrsSetUploadCounter(data, (*data).req.writebytecount); - if Curl_pgrsUpdate(data) != 0 { - result = CURLE_ABORTED_BY_CALLBACK; - } - if (*http).postsize == 0 { - Curl_infof( - data, - b"upload completely sent off: %ld out of %ld bytes\0" as *const u8 - as *const libc::c_char, - (*data).req.writebytecount, - (*http).postsize, - ); - let ref mut fresh76 = (*data).req; - (*fresh76).set_upload_done(1 as libc::c_int as bit); - (*data).req.keepon &= !((1 as libc::c_int) << 1 as libc::c_int); - (*data).req.exp100 = EXP100_SEND_DATA; - Curl_expire_done(data, EXPIRE_100_TIMEOUT); - } - } - if (*conn).httpversion as libc::c_int == 20 as libc::c_int - && ((*data).req).upload_chunky() as libc::c_int != 0 - { - let ref mut fresh77 = (*data).req; - (*fresh77).set_upload_chunky(0 as libc::c_int as bit); - } - return result; -} -unsafe extern "C" fn checkprefixmax( - mut prefix: *const libc::c_char, - mut buffer: *const libc::c_char, - mut len: size_t, -) -> bool { - let mut ch: size_t = if strlen(prefix) < len { strlen(prefix) } else { len }; - return curl_strnequal(prefix, buffer, ch) != 0; -} -unsafe extern "C" fn checkhttpprefix( - mut data: *mut Curl_easy, - mut s: *const libc::c_char, - mut len: size_t, -) -> statusline { - let mut head: *mut curl_slist = (*data).set.http200aliases; - let mut rc: statusline = STATUS_BAD; - let mut onmatch: statusline = (if len >= 5 as libc::c_int as libc::c_ulong { - STATUS_DONE as libc::c_int - } else { - STATUS_UNKNOWN as libc::c_int - }) as statusline; - while !head.is_null() { - if checkprefixmax((*head).data, s, len) { - rc = onmatch; - break; - } else { - head = (*head).next; - } - } - if rc as libc::c_uint != STATUS_DONE as libc::c_int as libc::c_uint - && checkprefixmax(b"HTTP/\0" as *const u8 as *const libc::c_char, s, len) - as libc::c_int != 0 - { - rc = onmatch; - } - return rc; -} -unsafe extern "C" fn checkrtspprefix( - mut data: *mut Curl_easy, - mut s: *const libc::c_char, - mut len: size_t, -) -> statusline { - let mut result: statusline = STATUS_BAD; - let mut onmatch: statusline = (if len >= 5 as libc::c_int as libc::c_ulong { - STATUS_DONE as libc::c_int - } else { - STATUS_UNKNOWN as libc::c_int - }) as statusline; - if checkprefixmax(b"RTSP/\0" as *const u8 as *const libc::c_char, s, len) { - result = onmatch; - } - return result; -} -unsafe extern "C" fn checkprotoprefix( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut s: *const libc::c_char, - mut len: size_t, -) -> statusline { - if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 18 as libc::c_int) as libc::c_uint != 0 - { - return checkrtspprefix(data, s, len); - } - return checkhttpprefix(data, s, len); -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_header( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut headp: *mut libc::c_char, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut k: *mut SingleRequest = &mut (*data).req; - if (*k).http_bodyless() == 0 && ((*data).set).ignorecl() == 0 - && curl_strnequal( - b"Content-Length:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Content-Length:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - let mut contentlength: curl_off_t = 0; - let mut offt: CURLofft = curlx_strtoofft( - headp - .offset( - strlen(b"Content-Length:\0" as *const u8 as *const libc::c_char) - as isize, - ), - 0 as *mut *mut libc::c_char, - 10 as libc::c_int, - &mut contentlength, - ); - if offt as libc::c_uint == CURL_OFFT_OK as libc::c_int as libc::c_uint { - (*k).size = contentlength; - (*k).maxdownload = (*k).size; - } else if offt as libc::c_uint == CURL_OFFT_FLOW as libc::c_int as libc::c_uint { - if (*data).set.max_filesize != 0 { - Curl_failf( - data, - b"Maximum file size exceeded\0" as *const u8 as *const libc::c_char, - ); - return CURLE_FILESIZE_EXCEEDED; - } - Curl_conncontrol(conn, 2 as libc::c_int); - Curl_infof( - data, - b"Overflow Content-Length: value!\0" as *const u8 as *const libc::c_char, - ); - } else { - Curl_failf( - data, - b"Invalid Content-Length: value\0" as *const u8 as *const libc::c_char, - ); - return CURLE_WEIRD_SERVER_REPLY; - } - } else if curl_strnequal( - b"Content-Type:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Content-Type:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - let mut contenttype: *mut libc::c_char = Curl_copy_header_value(headp); - if contenttype.is_null() { - return CURLE_OUT_OF_MEMORY; - } - if *contenttype == 0 { - Curl_cfree - .expect("non-null function pointer")(contenttype as *mut libc::c_void); - } else { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).info.contenttype as *mut libc::c_void); - let ref mut fresh78 = (*data).info.contenttype; - *fresh78 = 0 as *mut libc::c_char; - let ref mut fresh79 = (*data).info.contenttype; - *fresh79 = contenttype; - } - } else if (*conn).httpversion as libc::c_int == 10 as libc::c_int - && ((*conn).bits).httpproxy() as libc::c_int != 0 - && Curl_compareheader( - headp, - b"Proxy-Connection:\0" as *const u8 as *const libc::c_char, - b"keep-alive\0" as *const u8 as *const libc::c_char, - ) as libc::c_int != 0 - { - Curl_conncontrol(conn, 0 as libc::c_int); - Curl_infof( - data, - b"HTTP/1.0 proxy connection set to keep alive!\0" as *const u8 - as *const libc::c_char, - ); - } else if (*conn).httpversion as libc::c_int == 11 as libc::c_int - && ((*conn).bits).httpproxy() as libc::c_int != 0 - && Curl_compareheader( - headp, - b"Proxy-Connection:\0" as *const u8 as *const libc::c_char, - b"close\0" as *const u8 as *const libc::c_char, - ) as libc::c_int != 0 - { - Curl_conncontrol(conn, 1 as libc::c_int); - Curl_infof( - data, - b"HTTP/1.1 proxy connection set close!\0" as *const u8 as *const libc::c_char, - ); - } else if (*conn).httpversion as libc::c_int == 10 as libc::c_int - && Curl_compareheader( - headp, - b"Connection:\0" as *const u8 as *const libc::c_char, - b"keep-alive\0" as *const u8 as *const libc::c_char, - ) as libc::c_int != 0 - { - Curl_conncontrol(conn, 0 as libc::c_int); - Curl_infof( - data, - b"HTTP/1.0 connection set to keep alive!\0" as *const u8 - as *const libc::c_char, - ); - } else if Curl_compareheader( - headp, - b"Connection:\0" as *const u8 as *const libc::c_char, - b"close\0" as *const u8 as *const libc::c_char, - ) { - Curl_conncontrol(conn, 2 as libc::c_int); - } else if (*k).http_bodyless() == 0 - && curl_strnequal( - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - result = Curl_build_unencoding_stack( - data, - headp - .offset( - strlen(b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char) - as isize, - ), - 1 as libc::c_int, - ); - if result as u64 != 0 { - return result; - } - if (*k).chunk() == 0 { - Curl_conncontrol(conn, 1 as libc::c_int); - (*k).set_ignore_cl(1 as libc::c_int as bit); - } - } else if (*k).http_bodyless() == 0 - && curl_strnequal( - b"Content-Encoding:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Content-Encoding:\0" as *const u8 as *const libc::c_char), - ) != 0 - && !((*data).set.str_0[STRING_ENCODING as libc::c_int as usize]).is_null() - { - result = Curl_build_unencoding_stack( - data, - headp - .offset( - strlen(b"Content-Encoding:\0" as *const u8 as *const libc::c_char) - as isize, - ), - 0 as libc::c_int, - ); - if result as u64 != 0 { - return result; - } - } else if curl_strnequal( - b"Retry-After:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Retry-After:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - let mut retry_after: curl_off_t = 0 as libc::c_int as curl_off_t; - let mut date: time_t = Curl_getdate_capped( - headp - .offset( - strlen(b"Retry-After:\0" as *const u8 as *const libc::c_char) - as isize, - ), - ); - if -(1 as libc::c_int) as libc::c_long == date { - curlx_strtoofft( - headp - .offset( - strlen(b"Retry-After:\0" as *const u8 as *const libc::c_char) - as isize, - ), - 0 as *mut *mut libc::c_char, - 10 as libc::c_int, - &mut retry_after, - ); - } else { - retry_after = date - time(0 as *mut time_t); - } - (*data).info.retry_after = retry_after; - } else if (*k).http_bodyless() == 0 - && curl_strnequal( - b"Content-Range:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Content-Range:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - let mut ptr: *mut libc::c_char = headp - .offset( - strlen(b"Content-Range:\0" as *const u8 as *const libc::c_char) as isize, - ); - while *ptr as libc::c_int != 0 - && Curl_isdigit(*ptr as libc::c_uchar as libc::c_int) == 0 - && *ptr as libc::c_int != '*' as i32 - { - ptr = ptr.offset(1); - } - if Curl_isdigit(*ptr as libc::c_uchar as libc::c_int) != 0 { - if curlx_strtoofft( - ptr, - 0 as *mut *mut libc::c_char, - 10 as libc::c_int, - &mut (*k).offset, - ) as u64 == 0 - { - if (*data).state.resume_from == (*k).offset { - (*k).set_content_range(1 as libc::c_int as bit); - } - } - } else { - (*data).state.resume_from = 0 as libc::c_int as curl_off_t; - } - } else if !((*data).cookies).is_null() - && ((*data).state).cookie_engine() as libc::c_int != 0 - && curl_strnequal( - b"Set-Cookie:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Set-Cookie:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - let mut host: *const libc::c_char = if !((*data).state.aptr.cookiehost).is_null() - { - (*data).state.aptr.cookiehost - } else { - (*conn).host.name - }; - let secure_context: bool = if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint != 0 - || Curl_strcasecompare( - b"localhost\0" as *const u8 as *const libc::c_char, - host, - ) != 0 - || strcmp(host, b"127.0.0.1\0" as *const u8 as *const libc::c_char) == 0 - || strcmp(host, b"[::1]\0" as *const u8 as *const libc::c_char) == 0 - { - 1 as libc::c_int - } else { - 0 as libc::c_int - } != 0; - Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); - Curl_cookie_add( - data, - (*data).cookies, - 1 as libc::c_int != 0, - 0 as libc::c_int != 0, - headp - .offset( - strlen(b"Set-Cookie:\0" as *const u8 as *const libc::c_char) as isize, - ), - host, - (*data).state.up.path, - secure_context, - ); - Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); - } else if (*k).http_bodyless() == 0 - && curl_strnequal( - b"Last-Modified:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Last-Modified:\0" as *const u8 as *const libc::c_char), - ) != 0 - && ((*data).set.timecondition as libc::c_uint != 0 - || ((*data).set).get_filetime() as libc::c_int != 0) - { - (*k) - .timeofdoc = Curl_getdate_capped( - headp - .offset( - strlen(b"Last-Modified:\0" as *const u8 as *const libc::c_char) - as isize, - ), - ); - if ((*data).set).get_filetime() != 0 { - (*data).info.filetime = (*k).timeofdoc; - } - } else if curl_strnequal( - b"WWW-Authenticate:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"WWW-Authenticate:\0" as *const u8 as *const libc::c_char), - ) != 0 && 401 as libc::c_int == (*k).httpcode - || curl_strnequal( - b"Proxy-authenticate:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Proxy-authenticate:\0" as *const u8 as *const libc::c_char), - ) != 0 && 407 as libc::c_int == (*k).httpcode - { - let mut proxy: bool = if (*k).httpcode == 407 as libc::c_int { - 1 as libc::c_int - } else { - 0 as libc::c_int - } != 0; - let mut auth: *mut libc::c_char = Curl_copy_header_value(headp); - if auth.is_null() { - return CURLE_OUT_OF_MEMORY; - } - result = Curl_http_input_auth(data, proxy, auth); - Curl_cfree.expect("non-null function pointer")(auth as *mut libc::c_void); - if result as u64 != 0 { - return result; - } - } else if (*k).httpcode >= 300 as libc::c_int && (*k).httpcode < 400 as libc::c_int - && curl_strnequal( - b"Location:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Location:\0" as *const u8 as *const libc::c_char), - ) != 0 && ((*data).req.location).is_null() - { - let mut location: *mut libc::c_char = Curl_copy_header_value(headp); - if location.is_null() { - return CURLE_OUT_OF_MEMORY; - } - if *location == 0 { - Curl_cfree - .expect("non-null function pointer")(location as *mut libc::c_void); - } else { - let ref mut fresh80 = (*data).req.location; - *fresh80 = location; - if ((*data).set).http_follow_location() != 0 { - let ref mut fresh81 = (*data).req.newurl; - *fresh81 = Curl_cstrdup - .expect("non-null function pointer")((*data).req.location); - if ((*data).req.newurl).is_null() { - return CURLE_OUT_OF_MEMORY; - } - result = http_perhapsrewind(data, conn); - if result as u64 != 0 { - return result; - } - } - } - } else if !((*data).hsts).is_null() - && curl_strnequal( - b"Strict-Transport-Security:\0" as *const u8 as *const libc::c_char, - headp, - strlen( - b"Strict-Transport-Security:\0" as *const u8 as *const libc::c_char, - ), - ) != 0 - && (*(*conn).handler).flags - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint != 0 - { - let mut check: CURLcode = Curl_hsts_parse( - (*data).hsts, - (*data).state.up.hostname, - headp - .offset( - strlen( - b"Strict-Transport-Security:\0" as *const u8 - as *const libc::c_char, - ) as isize, - ), - ); - if check as u64 != 0 { - Curl_infof( - data, - b"Illegal STS header skipped\0" as *const u8 as *const libc::c_char, - ); - } - } else if !((*data).asi).is_null() - && curl_strnequal( - b"Alt-Svc:\0" as *const u8 as *const libc::c_char, - headp, - strlen(b"Alt-Svc:\0" as *const u8 as *const libc::c_char), - ) != 0 - && ((*(*conn).handler).flags - & ((1 as libc::c_int) << 0 as libc::c_int) as libc::c_uint != 0 - || 0 as libc::c_int != 0) - { - let mut id: alpnid = (if (*conn).httpversion as libc::c_int == 20 as libc::c_int - { - ALPN_h2 as libc::c_int - } else { - ALPN_h1 as libc::c_int - }) as alpnid; - result = Curl_altsvc_parse( - data, - (*data).asi, - headp - .offset( - strlen(b"Alt-Svc:\0" as *const u8 as *const libc::c_char) as isize, - ), - id, - (*conn).host.name, - curlx_uitous((*conn).remote_port as libc::c_uint), - ); - if result as u64 != 0 { - return result; - } - } else if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 18 as libc::c_int) as libc::c_uint != 0 - { - result = Curl_rtsp_parseheader(data, headp); - if result as u64 != 0 { - return result; - } - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_statusline( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, -) -> CURLcode { - let mut k: *mut SingleRequest = &mut (*data).req; - (*data).info.httpcode = (*k).httpcode; - (*data).info.httpversion = (*conn).httpversion as libc::c_int; - if (*data).state.httpversion == 0 - || (*data).state.httpversion as libc::c_int > (*conn).httpversion as libc::c_int - { - (*data).state.httpversion = (*conn).httpversion; - } - if (*data).state.resume_from != 0 - && (*data).state.httpreq as libc::c_uint - == HTTPREQ_GET as libc::c_int as libc::c_uint - && (*k).httpcode == 416 as libc::c_int - { - (*k).set_ignorebody(1 as libc::c_int as bit); - } - if (*conn).httpversion as libc::c_int == 10 as libc::c_int { - Curl_infof( - data, - b"HTTP 1.0, assume close after body\0" as *const u8 as *const libc::c_char, - ); - Curl_conncontrol(conn, 1 as libc::c_int); - } else if (*conn).httpversion as libc::c_int == 20 as libc::c_int - || (*k).upgr101 as libc::c_uint - == UPGR101_REQUESTED as libc::c_int as libc::c_uint - && (*k).httpcode == 101 as libc::c_int - { - (*(*conn).bundle).multiuse = 2 as libc::c_int; - } else { - (*conn).httpversion as libc::c_int >= 11 as libc::c_int - && ((*conn).bits).close() == 0; - } - (*k) - .set_http_bodyless( - ((*k).httpcode >= 100 as libc::c_int && (*k).httpcode < 200 as libc::c_int) - as libc::c_int as bit, - ); - let mut current_block_25: u64; - match (*k).httpcode { - 304 => { - if (*data).set.timecondition as u64 != 0 { - let ref mut fresh82 = (*data).info; - (*fresh82).set_timecond(1 as libc::c_int as bit); - } - current_block_25 = 13210731283975436821; - } - 204 => { - current_block_25 = 13210731283975436821; - } - _ => { - current_block_25 = 14763689060501151050; - } - } - match current_block_25 { - 13210731283975436821 => { - (*k).size = 0 as libc::c_int as curl_off_t; - (*k).maxdownload = 0 as libc::c_int as curl_off_t; - (*k).set_http_bodyless(1 as libc::c_int as bit); - } - _ => {} - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_readwrite_headers( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut nread: *mut ssize_t, - mut stop_reading: *mut bool, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut k: *mut SingleRequest = &mut (*data).req; - let mut onread: ssize_t = *nread; - let mut ostr: *mut libc::c_char = (*k).str_0; - let mut headp: *mut libc::c_char = 0 as *mut libc::c_char; - let mut str_start: *mut libc::c_char = 0 as *mut libc::c_char; - let mut end_ptr: *mut libc::c_char = 0 as *mut libc::c_char; - loop { - let mut rest_length: size_t = 0; - let mut full_length: size_t = 0; - let mut writetype: libc::c_int = 0; - str_start = (*k).str_0; - end_ptr = memchr( - str_start as *const libc::c_void, - 0xa as libc::c_int, - *nread as libc::c_ulong, - ) as *mut libc::c_char; - if end_ptr.is_null() { - result = Curl_dyn_addn( - &mut (*data).state.headerb, - str_start as *const libc::c_void, - *nread as size_t, - ); - if result as u64 != 0 { - return result; - } - if !((*k).headerline == 0) { - break; - } - let mut st: statusline = checkprotoprefix( - data, - conn, - Curl_dyn_ptr(&mut (*data).state.headerb), - Curl_dyn_len(&mut (*data).state.headerb), - ); - if !(st as libc::c_uint == STATUS_BAD as libc::c_int as libc::c_uint) { - break; - } - (*k).set_header(0 as libc::c_int as bit); - (*k).badheader = HEADER_ALLBAD; - Curl_conncontrol(conn, 2 as libc::c_int); - if ((*data).set).http09_allowed() == 0 { - Curl_failf( - data, - b"Received HTTP/0.9 when not allowed\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_UNSUPPORTED_PROTOCOL; - } - break; - } else { - rest_length = (end_ptr.offset_from((*k).str_0) as libc::c_long - + 1 as libc::c_int as libc::c_long) as size_t; - *nread -= rest_length as ssize_t; - let ref mut fresh83 = (*k).str_0; - *fresh83 = end_ptr.offset(1 as libc::c_int as isize); - full_length = ((*k).str_0).offset_from(str_start) as libc::c_long as size_t; - result = Curl_dyn_addn( - &mut (*data).state.headerb, - str_start as *const libc::c_void, - full_length, - ); - if result as u64 != 0 { - return result; - } - if (*k).headerline == 0 { - let mut st_0: statusline = checkprotoprefix( - data, - conn, - Curl_dyn_ptr(&mut (*data).state.headerb), - Curl_dyn_len(&mut (*data).state.headerb), - ); - if st_0 as libc::c_uint == STATUS_BAD as libc::c_int as libc::c_uint { - Curl_conncontrol(conn, 2 as libc::c_int); - if ((*data).set).http09_allowed() == 0 { - Curl_failf( - data, - b"Received HTTP/0.9 when not allowed\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_UNSUPPORTED_PROTOCOL; - } - (*k).set_header(0 as libc::c_int as bit); - if *nread != 0 { - (*k).badheader = HEADER_PARTHEADER; - } else { - (*k).badheader = HEADER_ALLBAD; - *nread = onread; - let ref mut fresh84 = (*k).str_0; - *fresh84 = ostr; - return CURLE_OK; - } - break; - } - } - headp = Curl_dyn_ptr(&mut (*data).state.headerb); - if 0xa as libc::c_int == *headp as libc::c_int - || 0xd as libc::c_int == *headp as libc::c_int - { - let mut headerlen: size_t = 0; - if '\r' as i32 == *headp as libc::c_int { - headp = headp.offset(1); - } - if '\n' as i32 == *headp as libc::c_int { - headp = headp.offset(1); - } - if 100 as libc::c_int <= (*k).httpcode - && 199 as libc::c_int >= (*k).httpcode - { - match (*k).httpcode { - 100 => { - (*k).set_header(1 as libc::c_int as bit); - (*k).headerline = 0 as libc::c_int; - if (*k).exp100 as libc::c_uint - > EXP100_SEND_DATA as libc::c_int as libc::c_uint - { - (*k).exp100 = EXP100_SEND_DATA; - (*k).keepon |= (1 as libc::c_int) << 1 as libc::c_int; - Curl_expire_done(data, EXPIRE_100_TIMEOUT); - } - } - 101 => { - if (*k).upgr101 as libc::c_uint - == UPGR101_REQUESTED as libc::c_int as libc::c_uint - { - Curl_infof( - data, - b"Received 101\0" as *const u8 as *const libc::c_char, - ); - (*k).upgr101 = UPGR101_RECEIVED; - (*k).set_header(1 as libc::c_int as bit); - (*k).headerline = 0 as libc::c_int; - result = Curl_http2_switched( - data, - (*k).str_0, - *nread as size_t, - ); - if result as u64 != 0 { - return result; - } - *nread = 0 as libc::c_int as ssize_t; - } else { - (*k).set_header(0 as libc::c_int as bit); - } - } - _ => { - (*k).set_header(1 as libc::c_int as bit); - (*k).headerline = 0 as libc::c_int; - } - } - } else { - (*k).set_header(0 as libc::c_int as bit); - if (*k).size == -(1 as libc::c_int) as libc::c_long - && (*k).chunk() == 0 && ((*conn).bits).close() == 0 - && (*conn).httpversion as libc::c_int == 11 as libc::c_int - && (*(*conn).handler).protocol - & ((1 as libc::c_int) << 18 as libc::c_int) as libc::c_uint - == 0 - && (*data).state.httpreq as libc::c_uint - != HTTPREQ_HEAD as libc::c_int as libc::c_uint - { - Curl_infof( - data, - b"no chunk, no close, no size. Assume close to signal end\0" - as *const u8 as *const libc::c_char, - ); - Curl_conncontrol(conn, 2 as libc::c_int); - } - } - writetype = (1 as libc::c_int) << 1 as libc::c_int; - if ((*data).set).include_header() != 0 { - writetype |= (1 as libc::c_int) << 0 as libc::c_int; - } - headerlen = Curl_dyn_len(&mut (*data).state.headerb); - result = Curl_client_write( - data, - writetype, - Curl_dyn_ptr(&mut (*data).state.headerb), - headerlen, - ); - if result as u64 != 0 { - return result; - } - let ref mut fresh85 = (*data).info.header_size; - *fresh85 += headerlen as libc::c_long; - let ref mut fresh86 = (*data).req.headerbytecount; - *fresh86 += headerlen as libc::c_long; - if http_should_fail(data) { - Curl_failf( - data, - b"The requested URL returned error: %d\0" as *const u8 - as *const libc::c_char, - (*k).httpcode, - ); - return CURLE_HTTP_RETURNED_ERROR; - } - (*data) - .req - .deductheadercount = if 100 as libc::c_int <= (*k).httpcode - && 199 as libc::c_int >= (*k).httpcode - { - (*data).req.headerbytecount - } else { - 0 as libc::c_int as libc::c_long - }; - result = Curl_http_auth_act(data); - if result as u64 != 0 { - return result; - } - if (*k).httpcode >= 300 as libc::c_int { - if ((*conn).bits).authneg() == 0 && ((*conn).bits).close() == 0 - && ((*conn).bits).rewindaftersend() == 0 - { - match (*data).state.httpreq as libc::c_uint { - 4 | 1 | 2 | 3 => { - Curl_expire_done(data, EXPIRE_100_TIMEOUT); - if (*k).upload_done() == 0 { - if (*k).httpcode == 417 as libc::c_int - && ((*data).state).expect100header() as libc::c_int != 0 - { - Curl_infof( - data, - b"Got 417 while waiting for a 100\0" as *const u8 - as *const libc::c_char, - ); - let ref mut fresh87 = (*data).state; - (*fresh87).set_disableexpect(1 as libc::c_int as bit); - let ref mut fresh88 = (*data).req.newurl; - *fresh88 = Curl_cstrdup - .expect("non-null function pointer")((*data).state.url); - Curl_done_sending(data, k); - } else if ((*data).set).http_keep_sending_on_error() != 0 { - Curl_infof( - data, - b"HTTP error before end of send, keep sending\0" - as *const u8 as *const libc::c_char, - ); - if (*k).exp100 as libc::c_uint - > EXP100_SEND_DATA as libc::c_int as libc::c_uint - { - (*k).exp100 = EXP100_SEND_DATA; - (*k).keepon |= (1 as libc::c_int) << 1 as libc::c_int; - } - } else { - Curl_infof( - data, - b"HTTP error before end of send, stop sending\0" - as *const u8 as *const libc::c_char, - ); - Curl_conncontrol(conn, 2 as libc::c_int); - result = Curl_done_sending(data, k); - if result as u64 != 0 { - return result; - } - (*k).set_upload_done(1 as libc::c_int as bit); - if ((*data).state).expect100header() != 0 { - (*k).exp100 = EXP100_FAILED; - } - } - } - } - _ => {} - } - } - if ((*conn).bits).rewindaftersend() != 0 { - Curl_infof( - data, - b"Keep sending data to get tossed away!\0" as *const u8 - as *const libc::c_char, - ); - (*k).keepon |= (1 as libc::c_int) << 1 as libc::c_int; - } - } - if (*k).header() == 0 { - if ((*data).set).opt_no_body() != 0 { - *stop_reading = 1 as libc::c_int != 0; - } else if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 18 as libc::c_int) as libc::c_uint - != 0 - && (*data).set.rtspreq as libc::c_uint - == RTSPREQ_DESCRIBE as libc::c_int as libc::c_uint - && (*k).size <= -(1 as libc::c_int) as libc::c_long - { - *stop_reading = 1 as libc::c_int != 0; - } else if (*k).chunk() != 0 { - let ref mut fresh89 = (*k).size; - *fresh89 = -(1 as libc::c_int) as curl_off_t; - (*k).maxdownload = *fresh89; - } - if -(1 as libc::c_int) as libc::c_long != (*k).size { - Curl_pgrsSetDownloadSize(data, (*k).size); - (*k).maxdownload = (*k).size; - } - if 0 as libc::c_int as libc::c_long == (*k).maxdownload - && !((*(*conn).handler).protocol - & ((1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint - != 0 - && (*conn).httpversion as libc::c_int == 20 as libc::c_int) - { - *stop_reading = 1 as libc::c_int != 0; - } - if *stop_reading { - (*k).keepon &= !((1 as libc::c_int) << 0 as libc::c_int); - } - Curl_debug(data, CURLINFO_HEADER_IN, str_start, headerlen); - break; - } else { - Curl_dyn_reset(&mut (*data).state.headerb); - } - } else { - let ref mut fresh90 = (*k).headerline; - let fresh91 = *fresh90; - *fresh90 = *fresh90 + 1; - if fresh91 == 0 { - let mut httpversion_major: libc::c_int = 0; - let mut rtspversion_major: libc::c_int = 0; - let mut nc: libc::c_int = 0 as libc::c_int; - if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 0 as libc::c_int - | (1 as libc::c_int) << 1 as libc::c_int) as libc::c_uint - != 0 - { - let mut separator: libc::c_char = 0; - let mut twoorthree: [libc::c_char; 2] = [0; 2]; - let mut httpversion: libc::c_int = 0 as libc::c_int; - let mut digit4: libc::c_char = 0 as libc::c_int as libc::c_char; - nc = sscanf( - headp, - b" HTTP/%1d.%1d%c%3d%c\0" as *const u8 - as *const libc::c_char, - &mut httpversion_major as *mut libc::c_int, - &mut httpversion as *mut libc::c_int, - &mut separator as *mut libc::c_char, - &mut (*k).httpcode as *mut libc::c_int, - &mut digit4 as *mut libc::c_char, - ); - if nc == 1 as libc::c_int - && httpversion_major >= 2 as libc::c_int - && 2 as libc::c_int - == sscanf( - headp, - b" HTTP/%1[23] %d\0" as *const u8 as *const libc::c_char, - twoorthree.as_mut_ptr(), - &mut (*k).httpcode as *mut libc::c_int, - ) - { - (*conn).httpversion = 0 as libc::c_int as libc::c_uchar; - nc = 4 as libc::c_int; - separator = ' ' as i32 as libc::c_char; - } else if Curl_isdigit(digit4 as libc::c_uchar as libc::c_int) - != 0 - { - Curl_failf( - data, - b"Unsupported response code in HTTP response\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_UNSUPPORTED_PROTOCOL; - } - if nc >= 4 as libc::c_int - && ' ' as i32 == separator as libc::c_int - { - httpversion += 10 as libc::c_int * httpversion_major; - match httpversion { - 10 | 11 | 20 => { - (*conn).httpversion = httpversion as libc::c_uchar; - } - _ => { - Curl_failf( - data, - b"Unsupported HTTP version (%u.%d) in response\0" - as *const u8 as *const libc::c_char, - httpversion / 10 as libc::c_int, - httpversion % 10 as libc::c_int, - ); - return CURLE_UNSUPPORTED_PROTOCOL; - } - } - if (*k).upgr101 as libc::c_uint - == UPGR101_RECEIVED as libc::c_int as libc::c_uint - { - if (*conn).httpversion as libc::c_int != 20 as libc::c_int { - Curl_infof( - data, - b"Lying server, not serving HTTP/2\0" as *const u8 - as *const libc::c_char, - ); - } - } - if ((*conn).httpversion as libc::c_int) < 20 as libc::c_int { - (*(*conn).bundle).multiuse = -(1 as libc::c_int); - Curl_infof( - data, - b"Mark bundle as not supporting multiuse\0" as *const u8 - as *const libc::c_char, - ); - } - } else if nc == 0 { - nc = sscanf( - headp, - b" HTTP %3d\0" as *const u8 as *const libc::c_char, - &mut (*k).httpcode as *mut libc::c_int, - ); - (*conn).httpversion = 10 as libc::c_int as libc::c_uchar; - if nc == 0 { - let mut check: statusline = checkhttpprefix( - data, - Curl_dyn_ptr(&mut (*data).state.headerb), - Curl_dyn_len(&mut (*data).state.headerb), - ); - if check as libc::c_uint - == STATUS_DONE as libc::c_int as libc::c_uint - { - nc = 1 as libc::c_int; - (*k).httpcode = 200 as libc::c_int; - (*conn).httpversion = 10 as libc::c_int as libc::c_uchar; - } - } - } else { - Curl_failf( - data, - b"Unsupported HTTP version in response\0" as *const u8 - as *const libc::c_char, - ); - return CURLE_UNSUPPORTED_PROTOCOL; - } - } else if (*(*conn).handler).protocol - & ((1 as libc::c_int) << 18 as libc::c_int) as libc::c_uint - != 0 - { - let mut separator_0: libc::c_char = 0; - let mut rtspversion: libc::c_int = 0; - nc = sscanf( - headp, - b" RTSP/%1d.%1d%c%3d\0" as *const u8 as *const libc::c_char, - &mut rtspversion_major as *mut libc::c_int, - &mut rtspversion as *mut libc::c_int, - &mut separator_0 as *mut libc::c_char, - &mut (*k).httpcode as *mut libc::c_int, - ); - if nc == 4 as libc::c_int - && ' ' as i32 == separator_0 as libc::c_int - { - (*conn).httpversion = 11 as libc::c_int as libc::c_uchar; - } else { - nc = 0 as libc::c_int; - } - } - if nc != 0 { - result = Curl_http_statusline(data, conn); - if result as u64 != 0 { - return result; - } - } else { - (*k).set_header(0 as libc::c_int as bit); - break; - } - } - result = CURLE_OK as libc::c_int as CURLcode; - if result as u64 != 0 { - return result; - } - result = Curl_http_header(data, conn, headp); - if result as u64 != 0 { - return result; - } - writetype = (1 as libc::c_int) << 1 as libc::c_int; - if ((*data).set).include_header() != 0 { - writetype |= (1 as libc::c_int) << 0 as libc::c_int; - } - Curl_debug( - data, - CURLINFO_HEADER_IN, - headp, - Curl_dyn_len(&mut (*data).state.headerb), - ); - result = Curl_client_write( - data, - writetype, - headp, - Curl_dyn_len(&mut (*data).state.headerb), - ); - if result as u64 != 0 { - return result; - } - let ref mut fresh92 = (*data).info.header_size; - *fresh92 = (*fresh92 as libc::c_ulong) - .wrapping_add(Curl_dyn_len(&mut (*data).state.headerb)) as curl_off_t - as curl_off_t; - let ref mut fresh93 = (*data).req.headerbytecount; - *fresh93 = (*fresh93 as libc::c_ulong) - .wrapping_add(Curl_dyn_len(&mut (*data).state.headerb)) as curl_off_t - as curl_off_t; - Curl_dyn_reset(&mut (*data).state.headerb); - } - if !(*(*k).str_0 != 0) { - break; - } - } - } - return CURLE_OK; -} diff --git a/lib/http_aws_sigv4.c b/lib/http_aws_sigv4.c new file mode 100644 index 0000000..02663ab --- /dev/null +++ b/lib/http_aws_sigv4.c @@ -0,0 +1,394 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) + +#include "urldata.h" +#include "strcase.h" +#include "strdup.h" +#include "vauth/vauth.h" +#include "vauth/digest.h" +#include "http_aws_sigv4.h" +#include "curl_sha256.h" +#include "transfer.h" + +#include "strcase.h" +#include "parsedate.h" +#include "sendf.h" + +#include + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" + +#define HMAC_SHA256(k, kl, d, dl, o) \ + do { \ + ret = Curl_hmacit(Curl_HMAC_SHA256, \ + (unsigned char *)k, \ + (unsigned int)kl, \ + (unsigned char *)d, \ + (unsigned int)dl, o); \ + if(ret != CURLE_OK) { \ + goto fail; \ + } \ + } while(0) + +static void sha256_to_hex(char *dst, unsigned char *sha, size_t dst_l) +{ + int i; + + DEBUGASSERT(dst_l >= 65); + for(i = 0; i < 32; ++i) { + curl_msnprintf(dst + (i * 2), dst_l - (i * 2), "%02x", sha[i]); + } +} + +CURLcode Curl_output_aws_sigv4(struct Curl_easy *data, bool proxy) +{ + CURLcode ret = CURLE_OUT_OF_MEMORY; + struct connectdata *conn = data->conn; + size_t len; + const char *tmp0; + const char *tmp1; + char *provider0_low = NULL; + char *provider0_up = NULL; + char *provider1_low = NULL; + char *provider1_mid = NULL; + char *region = NULL; + char *service = NULL; + const char *hostname = conn->host.name; +#ifdef DEBUGBUILD + char *force_timestamp; +#endif + time_t clock; + struct tm tm; + char timestamp[17]; + char date[9]; + const char *content_type = Curl_checkheaders(data, "Content-Type"); + char *canonical_headers = NULL; + char *signed_headers = NULL; + Curl_HttpReq httpreq; + const char *method; + const char *post_data = data->set.postfields ? data->set.postfields : ""; + unsigned char sha_hash[32]; + char sha_hex[65]; + char *canonical_request = NULL; + char *request_type = NULL; + char *credential_scope = NULL; + char *str_to_sign = NULL; + const char *user = data->state.aptr.user ? data->state.aptr.user : ""; + const char *passwd = data->state.aptr.passwd ? data->state.aptr.passwd : ""; + char *secret = NULL; + unsigned char tmp_sign0[32] = {0}; + unsigned char tmp_sign1[32] = {0}; + char *auth_headers = NULL; + + DEBUGASSERT(!proxy); + (void)proxy; + + if(Curl_checkheaders(data, "Authorization")) { + /* Authorization already present, Bailing out */ + return CURLE_OK; + } + + /* + * Parameters parsing + * Google and Outscale use the same OSC or GOOG, + * but Amazon uses AWS and AMZ for header arguments. + * AWS is the default because most of non-amazon providers + * are still using aws:amz as a prefix. + */ + tmp0 = data->set.str[STRING_AWS_SIGV4] ? + data->set.str[STRING_AWS_SIGV4] : "aws:amz"; + tmp1 = strchr(tmp0, ':'); + len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0); + if(len < 1) { + infof(data, "first provider can't be empty"); + ret = CURLE_BAD_FUNCTION_ARGUMENT; + goto fail; + } + provider0_low = malloc(len + 1); + provider0_up = malloc(len + 1); + if(!provider0_low || !provider0_up) { + goto fail; + } + Curl_strntolower(provider0_low, tmp0, len); + provider0_low[len] = '\0'; + Curl_strntoupper(provider0_up, tmp0, len); + provider0_up[len] = '\0'; + + if(tmp1) { + tmp0 = tmp1 + 1; + tmp1 = strchr(tmp0, ':'); + len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0); + if(len < 1) { + infof(data, "second provider can't be empty"); + ret = CURLE_BAD_FUNCTION_ARGUMENT; + goto fail; + } + provider1_low = malloc(len + 1); + provider1_mid = malloc(len + 1); + if(!provider1_low || !provider1_mid) { + goto fail; + } + Curl_strntolower(provider1_low, tmp0, len); + provider1_low[len] = '\0'; + Curl_strntolower(provider1_mid, tmp0, len); + provider1_mid[0] = Curl_raw_toupper(provider1_mid[0]); + provider1_mid[len] = '\0'; + + if(tmp1) { + tmp0 = tmp1 + 1; + tmp1 = strchr(tmp0, ':'); + len = tmp1 ? (size_t)(tmp1 - tmp0) : strlen(tmp0); + if(len < 1) { + infof(data, "region can't be empty"); + ret = CURLE_BAD_FUNCTION_ARGUMENT; + goto fail; + } + region = Curl_memdup(tmp0, len + 1); + if(!region) { + goto fail; + } + region[len] = '\0'; + + if(tmp1) { + tmp0 = tmp1 + 1; + service = strdup(tmp0); + if(!service) { + goto fail; + } + if(strlen(service) < 1) { + infof(data, "service can't be empty"); + ret = CURLE_BAD_FUNCTION_ARGUMENT; + goto fail; + } + } + } + } + else { + provider1_low = Curl_memdup(provider0_low, len + 1); + provider1_mid = Curl_memdup(provider0_low, len + 1); + if(!provider1_low || !provider1_mid) { + goto fail; + } + provider1_mid[0] = Curl_raw_toupper(provider1_mid[0]); + } + + if(!service) { + tmp0 = hostname; + tmp1 = strchr(tmp0, '.'); + len = tmp1 - tmp0; + if(!tmp1 || len < 1) { + infof(data, "service missing in parameters or hostname"); + ret = CURLE_URL_MALFORMAT; + goto fail; + } + service = Curl_memdup(tmp0, len + 1); + if(!service) { + goto fail; + } + service[len] = '\0'; + + if(!region) { + tmp0 = tmp1 + 1; + tmp1 = strchr(tmp0, '.'); + len = tmp1 - tmp0; + if(!tmp1 || len < 1) { + infof(data, "region missing in parameters or hostname"); + ret = CURLE_URL_MALFORMAT; + goto fail; + } + region = Curl_memdup(tmp0, len + 1); + if(!region) { + goto fail; + } + region[len] = '\0'; + } + } + +#ifdef DEBUGBUILD + force_timestamp = getenv("CURL_FORCETIME"); + if(force_timestamp) + clock = 0; + else + time(&clock); +#else + time(&clock); +#endif + ret = Curl_gmtime(clock, &tm); + if(ret != CURLE_OK) { + goto fail; + } + if(!strftime(timestamp, sizeof(timestamp), "%Y%m%dT%H%M%SZ", &tm)) { + goto fail; + } + memcpy(date, timestamp, sizeof(date)); + date[sizeof(date) - 1] = 0; + + if(content_type) { + content_type = strchr(content_type, ':'); + if(!content_type) { + ret = CURLE_FAILED_INIT; + goto fail; + } + content_type++; + /* Skip whitespace now */ + while(*content_type == ' ' || *content_type == '\t') + ++content_type; + + canonical_headers = curl_maprintf("content-type:%s\n" + "host:%s\n" + "x-%s-date:%s\n", + content_type, + hostname, + provider1_low, timestamp); + signed_headers = curl_maprintf("content-type;host;x-%s-date", + provider1_low); + } + else { + canonical_headers = curl_maprintf("host:%s\n" + "x-%s-date:%s\n", + hostname, + provider1_low, timestamp); + signed_headers = curl_maprintf("host;x-%s-date", provider1_low); + } + + if(!canonical_headers || !signed_headers) { + goto fail; + } + + Curl_sha256it(sha_hash, + (const unsigned char *) post_data, strlen(post_data)); + sha256_to_hex(sha_hex, sha_hash, sizeof(sha_hex)); + + Curl_http_method(data, conn, &method, &httpreq); + + canonical_request = + curl_maprintf("%s\n" /* HTTPRequestMethod */ + "%s\n" /* CanonicalURI */ + "%s\n" /* CanonicalQueryString */ + "%s\n" /* CanonicalHeaders */ + "%s\n" /* SignedHeaders */ + "%s", /* HashedRequestPayload in hex */ + method, + data->state.up.path, + data->state.up.query ? data->state.up.query : "", + canonical_headers, + signed_headers, + sha_hex); + if(!canonical_request) { + goto fail; + } + + request_type = curl_maprintf("%s4_request", provider0_low); + if(!request_type) { + goto fail; + } + + credential_scope = curl_maprintf("%s/%s/%s/%s", + date, region, service, request_type); + if(!credential_scope) { + goto fail; + } + + Curl_sha256it(sha_hash, (unsigned char *) canonical_request, + strlen(canonical_request)); + sha256_to_hex(sha_hex, sha_hash, sizeof(sha_hex)); + + /* + * Google allow to use rsa key instead of HMAC, so this code might change + * In the furure, but for now we support only HMAC version + */ + str_to_sign = curl_maprintf("%s4-HMAC-SHA256\n" /* Algorithm */ + "%s\n" /* RequestDateTime */ + "%s\n" /* CredentialScope */ + "%s", /* HashedCanonicalRequest in hex */ + provider0_up, + timestamp, + credential_scope, + sha_hex); + if(!str_to_sign) { + goto fail; + } + + secret = curl_maprintf("%s4%s", provider0_up, passwd); + if(!secret) { + goto fail; + } + + HMAC_SHA256(secret, strlen(secret), + date, strlen(date), tmp_sign0); + HMAC_SHA256(tmp_sign0, sizeof(tmp_sign0), + region, strlen(region), tmp_sign1); + HMAC_SHA256(tmp_sign1, sizeof(tmp_sign1), + service, strlen(service), tmp_sign0); + HMAC_SHA256(tmp_sign0, sizeof(tmp_sign0), + request_type, strlen(request_type), tmp_sign1); + HMAC_SHA256(tmp_sign1, sizeof(tmp_sign1), + str_to_sign, strlen(str_to_sign), tmp_sign0); + + sha256_to_hex(sha_hex, tmp_sign0, sizeof(sha_hex)); + + auth_headers = curl_maprintf("Authorization: %s4-HMAC-SHA256 " + "Credential=%s/%s, " + "SignedHeaders=%s, " + "Signature=%s\r\n" + "X-%s-Date: %s\r\n", + provider0_up, + user, + credential_scope, + signed_headers, + sha_hex, + provider1_mid, + timestamp); + if(!auth_headers) { + goto fail; + } + + Curl_safefree(data->state.aptr.userpwd); + data->state.aptr.userpwd = auth_headers; + data->state.authhost.done = TRUE; + ret = CURLE_OK; + +fail: + free(provider0_low); + free(provider0_up); + free(provider1_low); + free(provider1_mid); + free(region); + free(service); + free(canonical_headers); + free(signed_headers); + free(canonical_request); + free(request_type); + free(credential_scope); + free(str_to_sign); + free(secret); + return ret; +} + +#endif /* !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) */ diff --git a/lib/http_aws_sigv4.rs b/lib/http_aws_sigv4.rs deleted file mode 100644 index cfab252..0000000 --- a/lib/http_aws_sigv4.rs +++ /dev/null @@ -1,3071 +0,0 @@ -#![allow( - dead_code, - mutable_transmutes, - non_camel_case_types, - non_snake_case, - non_upper_case_globals, - unused_assignments, - unused_mut -)] -#![register_tool(c2rust)] -#![feature(extern_types, register_tool)] -extern "C" { - pub type _IO_wide_data; - pub type _IO_codecvt; - pub type _IO_marker; - pub type Curl_URL; - pub type thread_data; - pub type altsvcinfo; - pub type hsts; - pub type TELNET; - pub type smb_request; - pub type ldapreqinfo; - pub type contenc_writer; - pub type psl_ctx_st; - pub type Curl_share; - pub type curl_pushheaders; - pub type http_connect_state; - pub type ldapconninfo; - pub type tftp_state_data; - pub type nghttp2_session; - pub type ssl_backend_data; - fn memcpy(_: *mut libc::c_void, _: *const libc::c_void, _: libc::c_ulong) -> *mut libc::c_void; - fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; - fn strlen(_: *const libc::c_char) -> libc::c_ulong; - fn time(__timer: *mut time_t) -> time_t; - fn strftime( - __s: *mut libc::c_char, - __maxsize: size_t, - __format: *const libc::c_char, - __tp: *const tm, - ) -> size_t; - fn Curl_http_method( - data: *mut Curl_easy, - conn: *mut connectdata, - method: *mut *const libc::c_char, - _: *mut Curl_HttpReq, - ); - fn Curl_raw_toupper(in_0: libc::c_char) -> libc::c_char; - fn Curl_strntoupper(dest: *mut libc::c_char, src: *const libc::c_char, n: size_t); - fn Curl_strntolower(dest: *mut libc::c_char, src: *const libc::c_char, n: size_t); - fn Curl_memdup(src: *const libc::c_void, buffer_length: size_t) -> *mut libc::c_void; - static Curl_HMAC_SHA256: [HMAC_params; 1]; - fn Curl_sha256it(outbuffer: *mut libc::c_uchar, input: *const libc::c_uchar, len: size_t); - fn Curl_hmacit( - hashparams: *const HMAC_params, - key: *const libc::c_uchar, - keylen: size_t, - data: *const libc::c_uchar, - datalen: size_t, - output: *mut libc::c_uchar, - ) -> CURLcode; - fn Curl_checkheaders( - data: *const Curl_easy, - thisheader: *const libc::c_char, - ) -> *mut libc::c_char; - fn Curl_gmtime(intime: time_t, store: *mut tm) -> CURLcode; - fn Curl_infof(_: *mut Curl_easy, fmt: *const libc::c_char, _: ...); - fn curl_msnprintf( - buffer: *mut libc::c_char, - maxlength: size_t, - format: *const libc::c_char, - _: ... - ) -> libc::c_int; - fn curl_maprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char; - static mut Curl_cmalloc: curl_malloc_callback; - static mut Curl_cfree: curl_free_callback; - static mut Curl_cstrdup: curl_strdup_callback; -} -pub type __uint8_t = libc::c_uchar; -pub type __int32_t = libc::c_int; -pub type __uint32_t = libc::c_uint; -pub type __off_t = libc::c_long; -pub type __off64_t = libc::c_long; -pub type __pid_t = libc::c_int; -pub type __time_t = libc::c_long; -pub type __ssize_t = libc::c_long; -pub type __socklen_t = libc::c_uint; -pub type pid_t = __pid_t; -pub type ssize_t = __ssize_t; -pub type time_t = __time_t; -pub type size_t = libc::c_ulong; -pub type int32_t = __int32_t; -pub type socklen_t = __socklen_t; -pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} -pub type curl_socklen_t = socklen_t; -pub type curl_off_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _IO_FILE { - pub _flags: libc::c_int, - pub _IO_read_ptr: *mut libc::c_char, - pub _IO_read_end: *mut libc::c_char, - pub _IO_read_base: *mut libc::c_char, - pub _IO_write_base: *mut libc::c_char, - pub _IO_write_ptr: *mut libc::c_char, - pub _IO_write_end: *mut libc::c_char, - pub _IO_buf_base: *mut libc::c_char, - pub _IO_buf_end: *mut libc::c_char, - pub _IO_save_base: *mut libc::c_char, - pub _IO_backup_base: *mut libc::c_char, - pub _IO_save_end: *mut libc::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: libc::c_int, - pub _flags2: libc::c_int, - pub _old_offset: __off_t, - pub _cur_column: libc::c_ushort, - pub _vtable_offset: libc::c_schar, - pub _shortbuf: [libc::c_char; 1], - pub _lock: *mut libc::c_void, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut libc::c_void, - pub __pad5: size_t, - pub _mode: libc::c_int, - pub _unused2: [libc::c_char; 20], -} -pub type _IO_lock_t = (); -pub type FILE = _IO_FILE; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tm { - pub tm_sec: libc::c_int, - pub tm_min: libc::c_int, - pub tm_hour: libc::c_int, - pub tm_mday: libc::c_int, - pub tm_mon: libc::c_int, - pub tm_year: libc::c_int, - pub tm_wday: libc::c_int, - pub tm_yday: libc::c_int, - pub tm_isdst: libc::c_int, - pub tm_gmtoff: libc::c_long, - pub tm_zone: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_easy { - pub magic: libc::c_uint, - pub next: *mut Curl_easy, - pub prev: *mut Curl_easy, - pub conn: *mut connectdata, - pub connect_queue: Curl_llist_element, - pub conn_queue: Curl_llist_element, - pub mstate: CURLMstate, - pub result: CURLcode, - pub msg: Curl_message, - pub sockets: [curl_socket_t; 5], - pub actions: [libc::c_uchar; 5], - pub numsocks: libc::c_int, - pub dns: Names, - pub multi: *mut Curl_multi, - pub multi_easy: *mut Curl_multi, - pub share: *mut Curl_share, - pub psl: *mut PslCache, - pub req: SingleRequest, - pub set: UserDefined, - pub cookies: *mut CookieInfo, - pub hsts: *mut hsts, - pub asi: *mut altsvcinfo, - pub progress: Progress, - pub state: UrlState, - pub wildcard: WildcardData, - pub info: PureInfo, - pub tsi: curl_tlssessioninfo, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} -pub type curl_sslbackend = libc::c_uint; -pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; -pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; -pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; -pub const CURLSSLBACKEND_MBEDTLS: curl_sslbackend = 11; -pub const CURLSSLBACKEND_AXTLS: curl_sslbackend = 10; -pub const CURLSSLBACKEND_SECURETRANSPORT: curl_sslbackend = 9; -pub const CURLSSLBACKEND_SCHANNEL: curl_sslbackend = 8; -pub const CURLSSLBACKEND_WOLFSSL: curl_sslbackend = 7; -pub const CURLSSLBACKEND_POLARSSL: curl_sslbackend = 6; -pub const CURLSSLBACKEND_GSKIT: curl_sslbackend = 5; -pub const CURLSSLBACKEND_OBSOLETE4: curl_sslbackend = 4; -pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; -pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; -pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; -pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; -pub const CURLPX_LAST: CURLproxycode = 34; -pub const CURLPX_USER_REJECTED: CURLproxycode = 33; -pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; -pub const CURLPX_UNKNOWN_FAIL: CURLproxycode = 31; -pub const CURLPX_SEND_REQUEST: CURLproxycode = 30; -pub const CURLPX_SEND_CONNECT: CURLproxycode = 29; -pub const CURLPX_SEND_AUTH: CURLproxycode = 28; -pub const CURLPX_RESOLVE_HOST: CURLproxycode = 27; -pub const CURLPX_REQUEST_FAILED: CURLproxycode = 26; -pub const CURLPX_REPLY_UNASSIGNED: CURLproxycode = 25; -pub const CURLPX_REPLY_TTL_EXPIRED: CURLproxycode = 24; -pub const CURLPX_REPLY_NOT_ALLOWED: CURLproxycode = 23; -pub const CURLPX_REPLY_NETWORK_UNREACHABLE: CURLproxycode = 22; -pub const CURLPX_REPLY_HOST_UNREACHABLE: CURLproxycode = 21; -pub const CURLPX_REPLY_GENERAL_SERVER_FAILURE: CURLproxycode = 20; -pub const CURLPX_REPLY_CONNECTION_REFUSED: CURLproxycode = 19; -pub const CURLPX_REPLY_COMMAND_NOT_SUPPORTED: CURLproxycode = 18; -pub const CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED: CURLproxycode = 17; -pub const CURLPX_RECV_REQACK: CURLproxycode = 16; -pub const CURLPX_RECV_CONNECT: CURLproxycode = 15; -pub const CURLPX_RECV_AUTH: CURLproxycode = 14; -pub const CURLPX_RECV_ADDRESS: CURLproxycode = 13; -pub const CURLPX_NO_AUTH: CURLproxycode = 12; -pub const CURLPX_LONG_USER: CURLproxycode = 11; -pub const CURLPX_LONG_PASSWD: CURLproxycode = 10; -pub const CURLPX_LONG_HOSTNAME: CURLproxycode = 9; -pub const CURLPX_IDENTD_DIFFER: CURLproxycode = 8; -pub const CURLPX_IDENTD: CURLproxycode = 7; -pub const CURLPX_GSSAPI_PROTECTION: CURLproxycode = 6; -pub const CURLPX_GSSAPI_PERMSG: CURLproxycode = 5; -pub const CURLPX_GSSAPI: CURLproxycode = 4; -pub const CURLPX_CLOSED: CURLproxycode = 3; -pub const CURLPX_BAD_VERSION: CURLproxycode = 2; -pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; -pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; -pub const CURLWC_DONE: wildcard_states = 7; -pub const CURLWC_ERROR: wildcard_states = 6; -pub const CURLWC_SKIP: wildcard_states = 5; -pub const CURLWC_CLEAN: wildcard_states = 4; -pub const CURLWC_DOWNLOADING: wildcard_states = 3; -pub const CURLWC_MATCHING: wildcard_states = 2; -pub const CURLWC_INIT: wildcard_states = 1; -pub const CURLWC_CLEAR: wildcard_states = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UrlState { - pub conn_cache: *mut conncache, - pub keeps_speed: curltime, - pub lastconnect_id: libc::c_long, - pub headerb: dynbuf, - pub buffer: *mut libc::c_char, - pub ulbuf: *mut libc::c_char, - pub current_speed: curl_off_t, - pub first_host: *mut libc::c_char, - pub retrycount: libc::c_int, - pub first_remote_port: libc::c_int, - pub session: *mut Curl_ssl_session, - pub sessionage: libc::c_long, - pub tempwrite: [tempbuf; 3], - pub tempcount: libc::c_uint, - pub os_errno: libc::c_int, - pub scratch: *mut libc::c_char, - pub followlocation: libc::c_long, - pub prev_signal: Option ()>, - pub digest: digestdata, - pub proxydigest: digestdata, - pub authhost: auth, - pub authproxy: auth, - pub async_0: Curl_async, - pub engine: *mut libc::c_void, - pub expiretime: curltime, - pub timenode: Curl_tree, - pub timeoutlist: Curl_llist, - pub expires: [time_node; 13], - pub most_recent_ftp_entrypath: *mut libc::c_char, - pub httpwant: libc::c_uchar, - pub httpversion: libc::c_uchar, - #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] - pub prev_block_had_trailing_cr: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 5], - pub crlf_conversions: curl_off_t, - pub range: *mut libc::c_char, - pub resume_from: curl_off_t, - pub rtsp_next_client_CSeq: libc::c_long, - pub rtsp_next_server_CSeq: libc::c_long, - pub rtsp_CSeq_recv: libc::c_long, - pub infilesize: curl_off_t, - pub drain: size_t, - pub fread_func: curl_read_callback, - pub in_0: *mut libc::c_void, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub uh: *mut CURLU, - pub up: urlpieces, - pub httpreq: Curl_HttpReq, - pub url: *mut libc::c_char, - pub referer: *mut libc::c_char, - pub cookielist: *mut curl_slist, - pub resolve: *mut curl_slist, - pub trailers_bytes_sent: size_t, - pub trailers_buf: dynbuf, - pub trailers_state: trailers_state, - pub aptr: dynamically_allocated_data, - #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] - #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] - #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] - #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] - #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] - #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] - #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] - #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] - #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] - #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] - #[bitfield(name = "done", ty = "bit", bits = "12..=12")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] - #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] - #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] - #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] - #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] - #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] - #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: - [u8; 3], - #[bitfield(padding)] - pub c2rust_padding_0: [u8; 5], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; -pub const TRAILERS_DONE: trailers_state = 3; -pub const TRAILERS_SENDING: trailers_state = 2; -pub const TRAILERS_INITIALIZED: trailers_state = 1; -pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; -pub const HTTPREQ_HEAD: Curl_HttpReq = 5; -pub const HTTPREQ_PUT: Curl_HttpReq = 4; -pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; -pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; -pub const HTTPREQ_POST: Curl_HttpReq = 1; -pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} -pub type CURLU = Curl_URL; -pub type curl_read_callback = - Option size_t>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; -pub const EXPIRE_LAST: expire_id = 13; -pub const EXPIRE_QUIC: expire_id = 12; -pub const EXPIRE_TOOFAST: expire_id = 11; -pub const EXPIRE_TIMEOUT: expire_id = 10; -pub const EXPIRE_SPEEDCHECK: expire_id = 9; -pub const EXPIRE_RUN_NOW: expire_id = 8; -pub const EXPIRE_MULTI_PENDING: expire_id = 7; -pub const EXPIRE_HAPPY_EYEBALLS: expire_id = 6; -pub const EXPIRE_HAPPY_EYEBALLS_DNS: expire_id = 5; -pub const EXPIRE_DNS_PER_NAME2: expire_id = 4; -pub const EXPIRE_DNS_PER_NAME: expire_id = 3; -pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; -pub const EXPIRE_ASYNC_NAME: expire_id = 1; -pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Curl_async { - pub hostname: *mut libc::c_char, - pub dns: *mut Curl_dns_entry, - pub tdata: *mut thread_data, - pub resolver: *mut libc::c_void, - pub port: libc::c_int, - pub status: libc::c_int, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - pub done: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl_session { - pub name: *mut libc::c_char, - pub conn_to_host: *mut libc::c_char, - pub scheme: *const libc::c_char, - pub sessionid: *mut libc::c_void, - pub idsize: size_t, - pub age: libc::c_long, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub ssl_config: ssl_primary_config, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_primary_config { - pub version: libc::c_long, - pub version_max: libc::c_long, - pub CApath: *mut libc::c_char, - pub CAfile: *mut libc::c_char, - pub issuercert: *mut libc::c_char, - pub clientcert: *mut libc::c_char, - pub random_file: *mut libc::c_char, - pub egdsocket: *mut libc::c_char, - pub cipher_list: *mut libc::c_char, - pub cipher_list13: *mut libc::c_char, - pub pinned_key: *mut libc::c_char, - pub cert_blob: *mut curl_blob, - pub ca_info_blob: *mut curl_blob, - pub issuercert_blob: *mut curl_blob, - pub curves: *mut libc::c_char, - #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] - #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] - #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] - #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] - pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct conncache { - pub hash: Curl_hash, - pub num_conn: size_t, - pub next_connection_id: libc::c_long, - pub last_cleanup: curltime, - pub closure_handle: *mut Curl_easy, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option ()>; -pub type comp_function = - Option size_t>; -pub type hash_function = Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UserDefined { - pub err: *mut FILE, - pub debugdata: *mut libc::c_void, - pub errorbuffer: *mut libc::c_char, - pub proxyport: libc::c_long, - pub out: *mut libc::c_void, - pub in_set: *mut libc::c_void, - pub writeheader: *mut libc::c_void, - pub rtp_out: *mut libc::c_void, - pub use_port: libc::c_long, - pub httpauth: libc::c_ulong, - pub proxyauth: libc::c_ulong, - pub socks5auth: libc::c_ulong, - pub maxredirs: libc::c_long, - pub keep_post: libc::c_int, - pub postfields: *mut libc::c_void, - pub seek_func: curl_seek_callback, - pub postfieldsize: curl_off_t, - pub localport: libc::c_ushort, - pub localportrange: libc::c_int, - pub fwrite_func: curl_write_callback, - pub fwrite_header: curl_write_callback, - pub fwrite_rtp: curl_write_callback, - pub fread_func_set: curl_read_callback, - pub fprogress: curl_progress_callback, - pub fxferinfo: curl_xferinfo_callback, - pub fdebug: curl_debug_callback, - pub ioctl_func: curl_ioctl_callback, - pub fsockopt: curl_sockopt_callback, - pub sockopt_client: *mut libc::c_void, - pub fopensocket: curl_opensocket_callback, - pub opensocket_client: *mut libc::c_void, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub seek_client: *mut libc::c_void, - pub convfromnetwork: curl_conv_callback, - pub convtonetwork: curl_conv_callback, - pub convfromutf8: curl_conv_callback, - pub hsts_read: curl_hstsread_callback, - pub hsts_read_userp: *mut libc::c_void, - pub hsts_write: curl_hstswrite_callback, - pub hsts_write_userp: *mut libc::c_void, - pub progress_client: *mut libc::c_void, - pub ioctl_client: *mut libc::c_void, - pub timeout: libc::c_long, - pub connecttimeout: libc::c_long, - pub accepttimeout: libc::c_long, - pub happy_eyeballs_timeout: libc::c_long, - pub server_response_timeout: libc::c_long, - pub maxage_conn: libc::c_long, - pub tftp_blksize: libc::c_long, - pub filesize: curl_off_t, - pub low_speed_limit: libc::c_long, - pub low_speed_time: libc::c_long, - pub max_send_speed: curl_off_t, - pub max_recv_speed: curl_off_t, - pub set_resume_from: curl_off_t, - pub headers: *mut curl_slist, - pub proxyheaders: *mut curl_slist, - pub httppost: *mut curl_httppost, - pub mimepost: curl_mimepart, - pub quote: *mut curl_slist, - pub postquote: *mut curl_slist, - pub prequote: *mut curl_slist, - pub source_quote: *mut curl_slist, - pub source_prequote: *mut curl_slist, - pub source_postquote: *mut curl_slist, - pub telnet_options: *mut curl_slist, - pub resolve: *mut curl_slist, - pub connect_to: *mut curl_slist, - pub timecondition: curl_TimeCond, - pub proxytype: curl_proxytype, - pub timevalue: time_t, - pub method: Curl_HttpReq, - pub httpwant: libc::c_uchar, - pub ssl: ssl_config_data, - pub proxy_ssl: ssl_config_data, - pub general_ssl: ssl_general_config, - pub dns_cache_timeout: libc::c_long, - pub buffer_size: libc::c_long, - pub upload_buffer_size: libc::c_uint, - pub private_data: *mut libc::c_void, - pub http200aliases: *mut curl_slist, - pub ipver: libc::c_uchar, - pub max_filesize: curl_off_t, - pub ftp_filemethod: curl_ftpfile, - pub ftpsslauth: curl_ftpauth, - pub ftp_ccc: curl_ftpccc, - pub ftp_create_missing_dirs: libc::c_int, - pub ssh_keyfunc: curl_sshkeycallback, - pub ssh_keyfunc_userp: *mut libc::c_void, - pub use_netrc: CURL_NETRC_OPTION, - pub use_ssl: curl_usessl, - pub new_file_perms: libc::c_long, - pub new_directory_perms: libc::c_long, - pub ssh_auth_types: libc::c_long, - pub str_0: [*mut libc::c_char; 80], - pub blobs: [*mut curl_blob; 8], - pub scope_id: libc::c_uint, - pub allowed_protocols: libc::c_long, - pub redir_protocols: libc::c_long, - pub mail_rcpt: *mut curl_slist, - pub rtspreq: Curl_RtspReq, - pub rtspversion: libc::c_long, - pub chunk_bgn: curl_chunk_bgn_callback, - pub chunk_end: curl_chunk_end_callback, - pub fnmatch: curl_fnmatch_callback, - pub fnmatch_data: *mut libc::c_void, - pub gssapi_delegation: libc::c_long, - pub tcp_keepidle: libc::c_long, - pub tcp_keepintvl: libc::c_long, - pub maxconnects: size_t, - pub expect_100_timeout: libc::c_long, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub stream_dependents: *mut Curl_http2_dep, - pub resolver_start: curl_resolver_start_callback, - pub resolver_start_client: *mut libc::c_void, - pub upkeep_interval_ms: libc::c_long, - pub fmultidone: multidone_func, - pub dohfor: *mut Curl_easy, - pub uh: *mut CURLU, - pub trailer_data: *mut libc::c_void, - pub trailer_callback: curl_trailer_callback, - #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] - #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] - #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] - #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] - #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] - #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] - #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] - #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] - #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] - #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] - #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] - #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] - #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] - #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] - #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] - #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] - #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] - #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] - #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] - #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] - #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] - #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] - #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] - #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] - #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] - #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] - #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] - #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] - #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] - #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] - #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] - #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] - #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] - #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] - #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] - #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] - #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] - #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] - #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] - #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] - #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] - #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] - #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] - #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] - #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] - #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] - #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] - #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] - #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] - #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] - #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] - #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] - #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] - #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: - [u8; 8], -} -pub type curl_trailer_callback = - Option libc::c_int>; -pub type multidone_func = Option libc::c_int>; -pub type CURLcode = libc::c_uint; -pub const CURL_LAST: CURLcode = 99; -pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; -pub const CURLE_PROXY: CURLcode = 97; -pub const CURLE_QUIC_CONNECT_ERROR: CURLcode = 96; -pub const CURLE_HTTP3: CURLcode = 95; -pub const CURLE_AUTH_ERROR: CURLcode = 94; -pub const CURLE_RECURSIVE_API_CALL: CURLcode = 93; -pub const CURLE_HTTP2_STREAM: CURLcode = 92; -pub const CURLE_SSL_INVALIDCERTSTATUS: CURLcode = 91; -pub const CURLE_SSL_PINNEDPUBKEYNOTMATCH: CURLcode = 90; -pub const CURLE_NO_CONNECTION_AVAILABLE: CURLcode = 89; -pub const CURLE_CHUNK_FAILED: CURLcode = 88; -pub const CURLE_FTP_BAD_FILE_LIST: CURLcode = 87; -pub const CURLE_RTSP_SESSION_ERROR: CURLcode = 86; -pub const CURLE_RTSP_CSEQ_ERROR: CURLcode = 85; -pub const CURLE_FTP_PRET_FAILED: CURLcode = 84; -pub const CURLE_SSL_ISSUER_ERROR: CURLcode = 83; -pub const CURLE_SSL_CRL_BADFILE: CURLcode = 82; -pub const CURLE_AGAIN: CURLcode = 81; -pub const CURLE_SSL_SHUTDOWN_FAILED: CURLcode = 80; -pub const CURLE_SSH: CURLcode = 79; -pub const CURLE_REMOTE_FILE_NOT_FOUND: CURLcode = 78; -pub const CURLE_SSL_CACERT_BADFILE: CURLcode = 77; -pub const CURLE_CONV_REQD: CURLcode = 76; -pub const CURLE_CONV_FAILED: CURLcode = 75; -pub const CURLE_TFTP_NOSUCHUSER: CURLcode = 74; -pub const CURLE_REMOTE_FILE_EXISTS: CURLcode = 73; -pub const CURLE_TFTP_UNKNOWNID: CURLcode = 72; -pub const CURLE_TFTP_ILLEGAL: CURLcode = 71; -pub const CURLE_REMOTE_DISK_FULL: CURLcode = 70; -pub const CURLE_TFTP_PERM: CURLcode = 69; -pub const CURLE_TFTP_NOTFOUND: CURLcode = 68; -pub const CURLE_LOGIN_DENIED: CURLcode = 67; -pub const CURLE_SSL_ENGINE_INITFAILED: CURLcode = 66; -pub const CURLE_SEND_FAIL_REWIND: CURLcode = 65; -pub const CURLE_USE_SSL_FAILED: CURLcode = 64; -pub const CURLE_FILESIZE_EXCEEDED: CURLcode = 63; -pub const CURLE_LDAP_INVALID_URL: CURLcode = 62; -pub const CURLE_BAD_CONTENT_ENCODING: CURLcode = 61; -pub const CURLE_PEER_FAILED_VERIFICATION: CURLcode = 60; -pub const CURLE_SSL_CIPHER: CURLcode = 59; -pub const CURLE_SSL_CERTPROBLEM: CURLcode = 58; -pub const CURLE_OBSOLETE57: CURLcode = 57; -pub const CURLE_RECV_ERROR: CURLcode = 56; -pub const CURLE_SEND_ERROR: CURLcode = 55; -pub const CURLE_SSL_ENGINE_SETFAILED: CURLcode = 54; -pub const CURLE_SSL_ENGINE_NOTFOUND: CURLcode = 53; -pub const CURLE_GOT_NOTHING: CURLcode = 52; -pub const CURLE_OBSOLETE51: CURLcode = 51; -pub const CURLE_OBSOLETE50: CURLcode = 50; -pub const CURLE_SETOPT_OPTION_SYNTAX: CURLcode = 49; -pub const CURLE_UNKNOWN_OPTION: CURLcode = 48; -pub const CURLE_TOO_MANY_REDIRECTS: CURLcode = 47; -pub const CURLE_OBSOLETE46: CURLcode = 46; -pub const CURLE_INTERFACE_FAILED: CURLcode = 45; -pub const CURLE_OBSOLETE44: CURLcode = 44; -pub const CURLE_BAD_FUNCTION_ARGUMENT: CURLcode = 43; -pub const CURLE_ABORTED_BY_CALLBACK: CURLcode = 42; -pub const CURLE_FUNCTION_NOT_FOUND: CURLcode = 41; -pub const CURLE_OBSOLETE40: CURLcode = 40; -pub const CURLE_LDAP_SEARCH_FAILED: CURLcode = 39; -pub const CURLE_LDAP_CANNOT_BIND: CURLcode = 38; -pub const CURLE_FILE_COULDNT_READ_FILE: CURLcode = 37; -pub const CURLE_BAD_DOWNLOAD_RESUME: CURLcode = 36; -pub const CURLE_SSL_CONNECT_ERROR: CURLcode = 35; -pub const CURLE_HTTP_POST_ERROR: CURLcode = 34; -pub const CURLE_RANGE_ERROR: CURLcode = 33; -pub const CURLE_OBSOLETE32: CURLcode = 32; -pub const CURLE_FTP_COULDNT_USE_REST: CURLcode = 31; -pub const CURLE_FTP_PORT_FAILED: CURLcode = 30; -pub const CURLE_OBSOLETE29: CURLcode = 29; -pub const CURLE_OPERATION_TIMEDOUT: CURLcode = 28; -pub const CURLE_OUT_OF_MEMORY: CURLcode = 27; -pub const CURLE_READ_ERROR: CURLcode = 26; -pub const CURLE_UPLOAD_FAILED: CURLcode = 25; -pub const CURLE_OBSOLETE24: CURLcode = 24; -pub const CURLE_WRITE_ERROR: CURLcode = 23; -pub const CURLE_HTTP_RETURNED_ERROR: CURLcode = 22; -pub const CURLE_QUOTE_ERROR: CURLcode = 21; -pub const CURLE_OBSOLETE20: CURLcode = 20; -pub const CURLE_FTP_COULDNT_RETR_FILE: CURLcode = 19; -pub const CURLE_PARTIAL_FILE: CURLcode = 18; -pub const CURLE_FTP_COULDNT_SET_TYPE: CURLcode = 17; -pub const CURLE_HTTP2: CURLcode = 16; -pub const CURLE_FTP_CANT_GET_HOST: CURLcode = 15; -pub const CURLE_FTP_WEIRD_227_FORMAT: CURLcode = 14; -pub const CURLE_FTP_WEIRD_PASV_REPLY: CURLcode = 13; -pub const CURLE_FTP_ACCEPT_TIMEOUT: CURLcode = 12; -pub const CURLE_FTP_WEIRD_PASS_REPLY: CURLcode = 11; -pub const CURLE_FTP_ACCEPT_FAILED: CURLcode = 10; -pub const CURLE_REMOTE_ACCESS_DENIED: CURLcode = 9; -pub const CURLE_WEIRD_SERVER_REPLY: CURLcode = 8; -pub const CURLE_COULDNT_CONNECT: CURLcode = 7; -pub const CURLE_COULDNT_RESOLVE_HOST: CURLcode = 6; -pub const CURLE_COULDNT_RESOLVE_PROXY: CURLcode = 5; -pub const CURLE_NOT_BUILT_IN: CURLcode = 4; -pub const CURLE_URL_MALFORMAT: CURLcode = 3; -pub const CURLE_FAILED_INIT: CURLcode = 2; -pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; -pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void, *mut libc::c_void) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_http2_dep { - pub next: *mut Curl_http2_dep, - pub data: *mut Curl_easy, -} -pub type curl_fnmatch_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option libc::c_long>; -pub type curl_chunk_bgn_callback = Option< - unsafe extern "C" fn(*const libc::c_void, *mut libc::c_void, libc::c_int) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; -pub const RTSPREQ_LAST: Curl_RtspReq = 12; -pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; -pub const RTSPREQ_RECORD: Curl_RtspReq = 10; -pub const RTSPREQ_SET_PARAMETER: Curl_RtspReq = 9; -pub const RTSPREQ_GET_PARAMETER: Curl_RtspReq = 8; -pub const RTSPREQ_TEARDOWN: Curl_RtspReq = 7; -pub const RTSPREQ_PAUSE: Curl_RtspReq = 6; -pub const RTSPREQ_PLAY: Curl_RtspReq = 5; -pub const RTSPREQ_SETUP: Curl_RtspReq = 4; -pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; -pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; -pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; -pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; -pub const CURLUSESSL_LAST: curl_usessl = 4; -pub const CURLUSESSL_ALL: curl_usessl = 3; -pub const CURLUSESSL_CONTROL: curl_usessl = 2; -pub const CURLUSESSL_TRY: curl_usessl = 1; -pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; -pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; -pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; -pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; -pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option< - unsafe extern "C" fn( - *mut CURL, - *const curl_khkey, - *const curl_khkey, - curl_khmatch, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_khmatch = libc::c_uint; -pub const CURLKHMATCH_LAST: curl_khmatch = 3; -pub const CURLKHMATCH_MISSING: curl_khmatch = 2; -pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; -pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; -pub const CURLKHTYPE_ED25519: curl_khtype = 5; -pub const CURLKHTYPE_ECDSA: curl_khtype = 4; -pub const CURLKHTYPE_DSS: curl_khtype = 3; -pub const CURLKHTYPE_RSA: curl_khtype = 2; -pub const CURLKHTYPE_RSA1: curl_khtype = 1; -pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; -pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; -pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; -pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; -pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; -pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; -pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; -pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; -pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; -pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; -pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; -pub const FTPFILE_NOCWD: curl_ftpfile = 2; -pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_config_data { - pub primary: ssl_primary_config, - pub certverifyresult: libc::c_long, - pub CRLfile: *mut libc::c_char, - pub fsslctx: curl_ssl_ctx_callback, - pub fsslctxp: *mut libc::c_void, - pub cert_type: *mut libc::c_char, - pub key: *mut libc::c_char, - pub key_blob: *mut curl_blob, - pub key_type: *mut libc::c_char, - pub key_passwd: *mut libc::c_char, - pub username: *mut libc::c_char, - pub password: *mut libc::c_char, - pub authtype: CURL_TLSAUTH, - #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] - #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] - #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] - #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] - #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] - #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] - #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] - #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: - [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type CURL_TLSAUTH = libc::c_uint; -pub const CURL_TLSAUTH_LAST: CURL_TLSAUTH = 2; -pub const CURL_TLSAUTH_SRP: CURL_TLSAUTH = 1; -pub const CURL_TLSAUTH_NONE: CURL_TLSAUTH = 0; -pub type curl_ssl_ctx_callback = - Option CURLcode>; -pub type curl_proxytype = libc::c_uint; -pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; -pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; -pub const CURLPROXY_SOCKS5: curl_proxytype = 5; -pub const CURLPROXY_SOCKS4: curl_proxytype = 4; -pub const CURLPROXY_HTTPS: curl_proxytype = 2; -pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; -pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; -pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; -pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; -pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; -pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; -pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mimepart { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mime, - pub nextpart: *mut curl_mimepart, - pub kind: mimekind, - pub flags: libc::c_uint, - pub data: *mut libc::c_char, - pub readfunc: curl_read_callback, - pub seekfunc: curl_seek_callback, - pub freefunc: curl_free_callback, - pub arg: *mut libc::c_void, - pub fp: *mut FILE, - pub curlheaders: *mut curl_slist, - pub userheaders: *mut curl_slist, - pub mimetype: *mut libc::c_char, - pub filename: *mut libc::c_char, - pub name: *mut libc::c_char, - pub datasize: curl_off_t, - pub state: mime_state, - pub encoder: *const mime_encoder, - pub encstate: mime_encoder_state, - pub lastreadstatus: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder { - pub name: *const libc::c_char, - pub encodefunc: - Option size_t>, - pub sizefunc: Option curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, -} -pub type mimestate = libc::c_uint; -pub const MIMESTATE_LAST: mimestate = 9; -pub const MIMESTATE_END: mimestate = 8; -pub const MIMESTATE_CONTENT: mimestate = 7; -pub const MIMESTATE_BOUNDARY2: mimestate = 6; -pub const MIMESTATE_BOUNDARY1: mimestate = 5; -pub const MIMESTATE_BODY: mimestate = 4; -pub const MIMESTATE_EOH: mimestate = 3; -pub const MIMESTATE_USERHEADERS: mimestate = 2; -pub const MIMESTATE_CURLHEADERS: mimestate = 1; -pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option ()>; -pub type curl_seek_callback = - Option libc::c_int>; -pub type mimekind = libc::c_uint; -pub const MIMEKIND_LAST: mimekind = 5; -pub const MIMEKIND_MULTIPART: mimekind = 4; -pub const MIMEKIND_CALLBACK: mimekind = 3; -pub const MIMEKIND_FILE: mimekind = 2; -pub const MIMEKIND_DATA: mimekind = 1; -pub const MIMEKIND_NONE: mimekind = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mime { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mimepart, - pub firstpart: *mut curl_mimepart, - pub lastpart: *mut curl_mimepart, - pub boundary: [libc::c_char; 41], - pub state: mime_state, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut curl_index, - *mut libc::c_void, - ) -> CURLSTScode, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; -pub const CURLSTS_FAIL: CURLSTScode = 2; -pub const CURLSTS_DONE: CURLSTScode = 1; -pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = - Option CURLSTScode>; -pub type curl_conv_callback = Option CURLcode>; -pub type curl_closesocket_callback = - Option libc::c_int>; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, curlsocktype, *mut curl_sockaddr) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; -pub const CURLSOCKTYPE_LAST: curlsocktype = 2; -pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; -pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = - Option libc::c_int>; -pub type curl_ioctl_callback = - Option curlioerr>; -pub type curlioerr = libc::c_uint; -pub const CURLIOE_LAST: curlioerr = 3; -pub const CURLIOE_FAILRESTART: curlioerr = 2; -pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; -pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_infotype = libc::c_uint; -pub const CURLINFO_END: curl_infotype = 7; -pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; -pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; -pub const CURLINFO_DATA_OUT: curl_infotype = 4; -pub const CURLINFO_DATA_IN: curl_infotype = 3; -pub const CURLINFO_HEADER_OUT: curl_infotype = 2; -pub const CURLINFO_HEADER_IN: curl_infotype = 1; -pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, ->; -pub type curl_progress_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, - ) -> libc::c_int, ->; -pub type curl_write_callback = - Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct SingleRequest { - pub size: curl_off_t, - pub maxdownload: curl_off_t, - pub bytecount: curl_off_t, - pub writebytecount: curl_off_t, - pub headerbytecount: curl_off_t, - pub deductheadercount: curl_off_t, - pub pendingheader: curl_off_t, - pub start: curltime, - pub now: curltime, - pub badheader: C2RustUnnamed_1, - pub headerline: libc::c_int, - pub str_0: *mut libc::c_char, - pub offset: curl_off_t, - pub httpcode: libc::c_int, - pub keepon: libc::c_int, - pub start100: curltime, - pub exp100: expect100, - pub upgr101: upgrade101, - pub writer_stack: *mut contenc_writer, - pub timeofdoc: time_t, - pub bodywrites: libc::c_long, - pub location: *mut libc::c_char, - pub newurl: *mut libc::c_char, - pub upload_present: ssize_t, - pub upload_fromhere: *mut libc::c_char, - pub p: C2RustUnnamed, - pub doh: *mut dohdata, - #[bitfield(name = "header", ty = "bit", bits = "0..=0")] - #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] - #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] - #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] - #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] - #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] - #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] - #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] - #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: - [u8; 2], - #[bitfield(padding)] - pub c2rust_padding: [u8; 6], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dohdata { - pub headers: *mut curl_slist, - pub probe: [dnsprobe; 2], - pub pending: libc::c_uint, - pub port: libc::c_int, - pub host: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dnsprobe { - pub easy: *mut CURL, - pub dnstype: libc::c_int, - pub dohbuffer: [libc::c_uchar; 512], - pub dohlen: size_t, - pub serverdoh: dynbuf, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed { - pub file: *mut FILEPROTO, - pub ftp: *mut FTP, - pub http: *mut HTTP, - pub imap: *mut IMAP, - pub ldap: *mut ldapreqinfo, - pub mqtt: *mut MQTT, - pub pop3: *mut POP3, - pub rtsp: *mut RTSP, - pub smb: *mut smb_request, - pub smtp: *mut SMTP, - pub ssh: *mut SSHPROTO, - pub telnet: *mut TELNET, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; -pub const PPTRANSFER_NONE: curl_pp_transfer = 2; -pub const PPTRANSFER_INFO: curl_pp_transfer = 1; -pub const PPTRANSFER_BODY: curl_pp_transfer = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct RTSP { - pub http_wrapper: HTTP, - pub CSeq_sent: libc::c_long, - pub CSeq_recv: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HTTP { - pub sendit: *mut curl_mimepart, - pub postsize: curl_off_t, - pub postdata: *const libc::c_char, - pub p_pragma: *const libc::c_char, - pub form: curl_mimepart, - pub backup: back, - pub sending: C2RustUnnamed_0, - pub send_buffer: dynbuf, - pub stream_id: int32_t, - pub bodystarted: bool, - pub header_recvbuf: dynbuf, - pub nread_header_recvbuf: size_t, - pub trailer_recvbuf: dynbuf, - pub status_code: libc::c_int, - pub pausedata: *const uint8_t, - pub pauselen: size_t, - pub close_handled: bool, - pub push_headers: *mut *mut libc::c_char, - pub push_headers_used: size_t, - pub push_headers_alloc: size_t, - pub error: uint32_t, - pub closed: bool, - pub mem: *mut libc::c_char, - pub len: size_t, - pub memlen: size_t, - pub upload_mem: *const uint8_t, - pub upload_len: size_t, - pub upload_left: curl_off_t, -} -pub type uint8_t = __uint8_t; -pub type uint32_t = __uint32_t; -pub type C2RustUnnamed_0 = libc::c_uint; -pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; -pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; -pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -pub type upgrade101 = libc::c_uint; -pub const UPGR101_WORKING: upgrade101 = 3; -pub const UPGR101_RECEIVED: upgrade101 = 2; -pub const UPGR101_REQUESTED: upgrade101 = 1; -pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; -pub const EXP100_FAILED: expect100 = 3; -pub const EXP100_SENDING_REQUEST: expect100 = 2; -pub const EXP100_AWAITING_CONTINUE: expect100 = 1; -pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; -pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; -pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; -pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct PslCache { - pub psl: *const psl_ctx_t, - pub expires: time_t, - pub dynamic: bool, -} -pub type psl_ctx_t = psl_ctx_st; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_multi { - pub magic: libc::c_uint, - pub easyp: *mut Curl_easy, - pub easylp: *mut Curl_easy, - pub num_easy: libc::c_int, - pub num_alive: libc::c_int, - pub msglist: Curl_llist, - pub pending: Curl_llist, - pub socket_cb: curl_socket_callback, - pub socket_userp: *mut libc::c_void, - pub push_cb: curl_push_callback, - pub push_userp: *mut libc::c_void, - pub hostcache: Curl_hash, - pub psl: PslCache, - pub timetree: *mut Curl_tree, - pub sockhash: Curl_hash, - pub conn_cache: conncache, - pub maxconnects: libc::c_long, - pub max_host_connections: libc::c_long, - pub max_total_connections: libc::c_long, - pub timer_cb: curl_multi_timer_callback, - pub timer_userp: *mut libc::c_void, - pub timer_lastcall: curltime, - pub max_concurrent_streams: libc::c_uint, - pub wakeup_pair: [curl_socket_t; 2], - pub multiplexing: bool, - pub recheckstate: bool, - pub in_callback: bool, - pub ipv6_works: bool, - pub ssl_seeded: bool, -} -pub type curl_multi_timer_callback = - Option libc::c_int>; -pub type CURLM = Curl_multi; -pub type curl_push_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut CURL, - size_t, - *mut curl_pushheaders, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_socket_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_socket_t, - libc::c_int, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; -pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; -pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; -pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_message { - pub list: Curl_llist_element, - pub extmsg: CURLMsg, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CURLMsg { - pub msg: CURLMSG, - pub easy_handle: *mut CURL, - pub data: C2RustUnnamed_3, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_3 { - pub whatever: *mut libc::c_void, - pub result: CURLcode, -} -pub type CURLMSG = libc::c_uint; -pub const CURLMSG_LAST: CURLMSG = 2; -pub const CURLMSG_DONE: CURLMSG = 1; -pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; -pub const MSTATE_LAST: CURLMstate = 17; -pub const MSTATE_MSGSENT: CURLMstate = 16; -pub const MSTATE_COMPLETED: CURLMstate = 15; -pub const MSTATE_DONE: CURLMstate = 14; -pub const MSTATE_RATELIMITING: CURLMstate = 13; -pub const MSTATE_PERFORMING: CURLMstate = 12; -pub const MSTATE_DID: CURLMstate = 11; -pub const MSTATE_DOING_MORE: CURLMstate = 10; -pub const MSTATE_DOING: CURLMstate = 9; -pub const MSTATE_DO: CURLMstate = 8; -pub const MSTATE_PROTOCONNECTING: CURLMstate = 7; -pub const MSTATE_PROTOCONNECT: CURLMstate = 6; -pub const MSTATE_TUNNELING: CURLMstate = 5; -pub const MSTATE_CONNECTING: CURLMstate = 4; -pub const MSTATE_RESOLVING: CURLMstate = 3; -pub const MSTATE_CONNECT: CURLMstate = 2; -pub const MSTATE_PENDING: CURLMstate = 1; -pub const MSTATE_INIT: CURLMstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectdata { - pub cnnct: connstate, - pub bundle_node: Curl_llist_element, - pub chunk: Curl_chunker, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub connection_id: libc::c_long, - pub dns_entry: *mut Curl_dns_entry, - pub ip_addr: *mut Curl_addrinfo, - pub tempaddr: [*mut Curl_addrinfo; 2], - pub scope_id: libc::c_uint, - pub transport: C2RustUnnamed_5, - pub host: hostname, - pub hostname_resolve: *mut libc::c_char, - pub secondaryhostname: *mut libc::c_char, - pub conn_to_host: hostname, - pub socks_proxy: proxy_info, - pub http_proxy: proxy_info, - pub port: libc::c_int, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub secondary_port: libc::c_ushort, - pub primary_ip: [libc::c_char; 46], - pub ip_version: libc::c_uchar, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub options: *mut libc::c_char, - pub sasl_authzid: *mut libc::c_char, - pub httpversion: libc::c_uchar, - pub now: curltime, - pub created: curltime, - pub lastused: curltime, - pub sock: [curl_socket_t; 2], - pub tempsock: [curl_socket_t; 2], - pub tempfamily: [libc::c_int; 2], - pub recv: [Option; 2], - pub send: [Option; 2], - pub ssl: [ssl_connect_data; 2], - pub proxy_ssl: [ssl_connect_data; 2], - pub ssl_extra: *mut libc::c_void, - pub ssl_config: ssl_primary_config, - pub proxy_ssl_config: ssl_primary_config, - pub bits: ConnectBits, - pub num_addr: libc::c_int, - pub connecttime: curltime, - pub timeoutms_per_addr: [timediff_t; 2], - pub handler: *const Curl_handler, - pub given: *const Curl_handler, - pub keepalive: curltime, - pub sockfd: curl_socket_t, - pub writesockfd: curl_socket_t, - pub easyq: Curl_llist, - pub seek_func: curl_seek_callback, - pub seek_client: *mut libc::c_void, - pub http_ntlm_state: curlntlm, - pub proxy_ntlm_state: curlntlm, - pub ntlm: ntlmdata, - pub proxyntlm: ntlmdata, - pub trailer: dynbuf, - pub proto: C2RustUnnamed_4, - pub connect_state: *mut http_connect_state, - pub bundle: *mut connectbundle, - pub unix_domain_socket: *mut libc::c_char, - pub localdev: *mut libc::c_char, - pub localportrange: libc::c_int, - pub cselect_bits: libc::c_int, - pub waitfor: libc::c_int, - pub negnpn: libc::c_int, - pub localport: libc::c_ushort, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_4 { - pub ftpc: ftp_conn, - pub httpc: http_conn, - pub sshc: ssh_conn, - pub tftpc: *mut tftp_state_data, - pub imapc: imap_conn, - pub pop3c: pop3_conn, - pub smtpc: smtp_conn, - pub rtspc: rtsp_conn, - pub smbc: smb_conn, - pub rtmp: *mut libc::c_void, - pub ldapc: *mut ldapconninfo, - pub mqtt: mqtt_conn, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; -pub const MQTT_NOSTATE: mqttstate = 7; -pub const MQTT_PUB_REMAIN: mqttstate = 6; -pub const MQTT_PUBWAIT: mqttstate = 5; -pub const MQTT_SUBACK_COMING: mqttstate = 4; -pub const MQTT_SUBACK: mqttstate = 3; -pub const MQTT_CONNACK: mqttstate = 2; -pub const MQTT_REMAINING_LENGTH: mqttstate = 1; -pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; -pub const SMB_CONNECTED: smb_conn_state = 4; -pub const SMB_SETUP: smb_conn_state = 3; -pub const SMB_NEGOTIATE: smb_conn_state = 2; -pub const SMB_CONNECTING: smb_conn_state = 1; -pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smtp_conn { - pub pp: pingpong, - pub state: smtpstate, - pub ssldone: bool, - pub domain: *mut libc::c_char, - pub sasl: SASL, - pub tls_supported: bool, - pub size_supported: bool, - pub utf8_supported: bool, - pub auth_supported: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASL { - pub params: *const SASLproto, - pub state: saslstate, - pub authmechs: libc::c_ushort, - pub prefmech: libc::c_ushort, - pub authused: libc::c_ushort, - pub resetprefs: bool, - pub mutual_auth: bool, - pub force_ir: bool, -} -pub type saslstate = libc::c_uint; -pub const SASL_FINAL: saslstate = 17; -pub const SASL_CANCEL: saslstate = 16; -pub const SASL_GSASL: saslstate = 15; -pub const SASL_OAUTH2_RESP: saslstate = 14; -pub const SASL_OAUTH2: saslstate = 13; -pub const SASL_GSSAPI_NO_DATA: saslstate = 12; -pub const SASL_GSSAPI_TOKEN: saslstate = 11; -pub const SASL_GSSAPI: saslstate = 10; -pub const SASL_NTLM_TYPE2MSG: saslstate = 9; -pub const SASL_NTLM: saslstate = 8; -pub const SASL_DIGESTMD5_RESP: saslstate = 7; -pub const SASL_DIGESTMD5: saslstate = 6; -pub const SASL_CRAMMD5: saslstate = 5; -pub const SASL_EXTERNAL: saslstate = 4; -pub const SASL_LOGIN_PASSWD: saslstate = 3; -pub const SASL_LOGIN: saslstate = 2; -pub const SASL_PLAIN: saslstate = 1; -pub const SASL_STOP: saslstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASLproto { - pub service: *const libc::c_char, - pub contcode: libc::c_int, - pub finalcode: libc::c_int, - pub maxirlen: size_t, - pub sendauth: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - *const libc::c_char, - ) -> CURLcode, - >, - pub sendcont: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *const libc::c_char) -> CURLcode, - >, - pub getmessage: Option ()>, -} -pub type smtpstate = libc::c_uint; -pub const SMTP_LAST: smtpstate = 13; -pub const SMTP_QUIT: smtpstate = 12; -pub const SMTP_POSTDATA: smtpstate = 11; -pub const SMTP_DATA: smtpstate = 10; -pub const SMTP_RCPT: smtpstate = 9; -pub const SMTP_MAIL: smtpstate = 8; -pub const SMTP_COMMAND: smtpstate = 7; -pub const SMTP_AUTH: smtpstate = 6; -pub const SMTP_UPGRADETLS: smtpstate = 5; -pub const SMTP_STARTTLS: smtpstate = 4; -pub const SMTP_HELO: smtpstate = 3; -pub const SMTP_EHLO: smtpstate = 2; -pub const SMTP_SERVERGREET: smtpstate = 1; -pub const SMTP_STOP: smtpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pingpong { - pub cache: *mut libc::c_char, - pub cache_size: size_t, - pub nread_resp: size_t, - pub linestart_resp: *mut libc::c_char, - pub pending_resp: bool, - pub sendthis: *mut libc::c_char, - pub sendleft: size_t, - pub sendsize: size_t, - pub response: curltime, - pub response_time: timediff_t, - pub sendbuf: dynbuf, - pub statemachine: Option CURLcode>, - pub endofresp: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - >, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pop3_conn { - pub pp: pingpong, - pub state: pop3state, - pub ssldone: bool, - pub tls_supported: bool, - pub eob: size_t, - pub strip: size_t, - pub sasl: SASL, - pub authtypes: libc::c_uint, - pub preftype: libc::c_uint, - pub apoptimestamp: *mut libc::c_char, -} -pub type pop3state = libc::c_uint; -pub const POP3_LAST: pop3state = 11; -pub const POP3_QUIT: pop3state = 10; -pub const POP3_COMMAND: pop3state = 9; -pub const POP3_PASS: pop3state = 8; -pub const POP3_USER: pop3state = 7; -pub const POP3_APOP: pop3state = 6; -pub const POP3_AUTH: pop3state = 5; -pub const POP3_UPGRADETLS: pop3state = 4; -pub const POP3_STARTTLS: pop3state = 3; -pub const POP3_CAPA: pop3state = 2; -pub const POP3_SERVERGREET: pop3state = 1; -pub const POP3_STOP: pop3state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct imap_conn { - pub pp: pingpong, - pub state: imapstate, - pub ssldone: bool, - pub preauth: bool, - pub sasl: SASL, - pub preftype: libc::c_uint, - pub cmdid: libc::c_uint, - pub resptag: [libc::c_char; 5], - pub tls_supported: bool, - pub login_disabled: bool, - pub ir_supported: bool, - pub mailbox: *mut libc::c_char, - pub mailbox_uidvalidity: *mut libc::c_char, - pub dyn_0: dynbuf, -} -pub type imapstate = libc::c_uint; -pub const IMAP_LAST: imapstate = 15; -pub const IMAP_LOGOUT: imapstate = 14; -pub const IMAP_SEARCH: imapstate = 13; -pub const IMAP_APPEND_FINAL: imapstate = 12; -pub const IMAP_APPEND: imapstate = 11; -pub const IMAP_FETCH_FINAL: imapstate = 10; -pub const IMAP_FETCH: imapstate = 9; -pub const IMAP_SELECT: imapstate = 8; -pub const IMAP_LIST: imapstate = 7; -pub const IMAP_LOGIN: imapstate = 6; -pub const IMAP_AUTHENTICATE: imapstate = 5; -pub const IMAP_UPGRADETLS: imapstate = 4; -pub const IMAP_STARTTLS: imapstate = 3; -pub const IMAP_CAPABILITY: imapstate = 2; -pub const IMAP_SERVERGREET: imapstate = 1; -pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; -pub const SSH_LAST: sshstate = 60; -pub const SSH_QUIT: sshstate = 59; -pub const SSH_SESSION_FREE: sshstate = 58; -pub const SSH_SESSION_DISCONNECT: sshstate = 57; -pub const SSH_SCP_CHANNEL_FREE: sshstate = 56; -pub const SSH_SCP_WAIT_CLOSE: sshstate = 55; -pub const SSH_SCP_WAIT_EOF: sshstate = 54; -pub const SSH_SCP_SEND_EOF: sshstate = 53; -pub const SSH_SCP_DONE: sshstate = 52; -pub const SSH_SCP_DOWNLOAD: sshstate = 51; -pub const SSH_SCP_DOWNLOAD_INIT: sshstate = 50; -pub const SSH_SCP_UPLOAD_INIT: sshstate = 49; -pub const SSH_SCP_TRANS_INIT: sshstate = 48; -pub const SSH_SFTP_SHUTDOWN: sshstate = 47; -pub const SSH_SFTP_CLOSE: sshstate = 46; -pub const SSH_SFTP_DOWNLOAD_STAT: sshstate = 45; -pub const SSH_SFTP_DOWNLOAD_INIT: sshstate = 44; -pub const SSH_SFTP_READDIR_DONE: sshstate = 43; -pub const SSH_SFTP_READDIR_BOTTOM: sshstate = 42; -pub const SSH_SFTP_READDIR_LINK: sshstate = 41; -pub const SSH_SFTP_READDIR: sshstate = 40; -pub const SSH_SFTP_READDIR_INIT: sshstate = 39; -pub const SSH_SFTP_CREATE_DIRS_MKDIR: sshstate = 38; -pub const SSH_SFTP_CREATE_DIRS: sshstate = 37; -pub const SSH_SFTP_CREATE_DIRS_INIT: sshstate = 36; -pub const SSH_SFTP_UPLOAD_INIT: sshstate = 35; -pub const SSH_SFTP_TRANS_INIT: sshstate = 34; -pub const SSH_SFTP_FILETIME: sshstate = 33; -pub const SSH_SFTP_GETINFO: sshstate = 32; -pub const SSH_SFTP_QUOTE_STATVFS: sshstate = 31; -pub const SSH_SFTP_QUOTE_UNLINK: sshstate = 30; -pub const SSH_SFTP_QUOTE_RMDIR: sshstate = 29; -pub const SSH_SFTP_QUOTE_RENAME: sshstate = 28; -pub const SSH_SFTP_QUOTE_MKDIR: sshstate = 27; -pub const SSH_SFTP_QUOTE_SYMLINK: sshstate = 26; -pub const SSH_SFTP_QUOTE_SETSTAT: sshstate = 25; -pub const SSH_SFTP_QUOTE_STAT: sshstate = 24; -pub const SSH_SFTP_NEXT_QUOTE: sshstate = 23; -pub const SSH_SFTP_QUOTE: sshstate = 22; -pub const SSH_SFTP_POSTQUOTE_INIT: sshstate = 21; -pub const SSH_SFTP_QUOTE_INIT: sshstate = 20; -pub const SSH_SFTP_REALPATH: sshstate = 19; -pub const SSH_SFTP_INIT: sshstate = 18; -pub const SSH_AUTH_DONE: sshstate = 17; -pub const SSH_AUTH_GSSAPI: sshstate = 16; -pub const SSH_AUTH_KEY: sshstate = 15; -pub const SSH_AUTH_KEY_INIT: sshstate = 14; -pub const SSH_AUTH_HOST: sshstate = 13; -pub const SSH_AUTH_HOST_INIT: sshstate = 12; -pub const SSH_AUTH_AGENT: sshstate = 11; -pub const SSH_AUTH_AGENT_LIST: sshstate = 10; -pub const SSH_AUTH_AGENT_INIT: sshstate = 9; -pub const SSH_AUTH_PASS: sshstate = 8; -pub const SSH_AUTH_PASS_INIT: sshstate = 7; -pub const SSH_AUTH_PKEY: sshstate = 6; -pub const SSH_AUTH_PKEY_INIT: sshstate = 5; -pub const SSH_AUTHLIST: sshstate = 4; -pub const SSH_HOSTKEY: sshstate = 3; -pub const SSH_S_STARTUP: sshstate = 2; -pub const SSH_INIT: sshstate = 1; -pub const SSH_STOP: sshstate = 0; -pub const SSH_NO_STATE: sshstate = -1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct http_conn { - pub binsettings: [uint8_t; 80], - pub binlen: size_t, - pub trnsfr: *mut Curl_easy, - pub h2: *mut nghttp2_session, - pub send_underlying: Option, - pub recv_underlying: Option, - pub inbuf: *mut libc::c_char, - pub inbuflen: size_t, - pub nread_inbuf: size_t, - pub pause_stream_id: int32_t, - pub drain_total: size_t, - pub settings: h2settings, - pub local_settings: [nghttp2_settings_entry; 3], - pub local_settings_num: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct nghttp2_settings_entry { - pub settings_id: int32_t, - pub value: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct h2settings { - pub max_concurrent_streams: uint32_t, - pub enable_push: bool, -} -pub type Curl_recv = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *mut libc::c_char, - size_t, - *mut CURLcode, -) -> ssize_t; -pub type Curl_send = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *const libc::c_void, - size_t, - *mut CURLcode, -) -> ssize_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_conn { - pub pp: pingpong, - pub entrypath: *mut libc::c_char, - pub file: *mut libc::c_char, - pub dirs: *mut *mut libc::c_char, - pub dirdepth: libc::c_int, - pub dont_check: bool, - pub ctl_valid: bool, - pub cwddone: bool, - pub cwdcount: libc::c_int, - pub cwdfail: bool, - pub wait_data_conn: bool, - pub newport: libc::c_ushort, - pub newhost: *mut libc::c_char, - pub prevpath: *mut libc::c_char, - pub transfertype: libc::c_char, - pub count1: libc::c_int, - pub count2: libc::c_int, - pub count3: libc::c_int, - pub state: ftpstate, - pub state_saved: ftpstate, - pub retr_size_saved: curl_off_t, - pub server_os: *mut libc::c_char, - pub known_filesize: curl_off_t, -} -pub type ftpstate = libc::c_uint; -pub const FTP_LAST: ftpstate = 35; -pub const FTP_QUIT: ftpstate = 34; -pub const FTP_STOR: ftpstate = 33; -pub const FTP_RETR: ftpstate = 32; -pub const FTP_LIST: ftpstate = 31; -pub const FTP_PASV: ftpstate = 30; -pub const FTP_PRET: ftpstate = 29; -pub const FTP_PORT: ftpstate = 28; -pub const FTP_RETR_REST: ftpstate = 27; -pub const FTP_REST: ftpstate = 26; -pub const FTP_STOR_SIZE: ftpstate = 25; -pub const FTP_RETR_SIZE: ftpstate = 24; -pub const FTP_SIZE: ftpstate = 23; -pub const FTP_STOR_TYPE: ftpstate = 22; -pub const FTP_RETR_TYPE: ftpstate = 21; -pub const FTP_LIST_TYPE: ftpstate = 20; -pub const FTP_TYPE: ftpstate = 19; -pub const FTP_MDTM: ftpstate = 18; -pub const FTP_MKD: ftpstate = 17; -pub const FTP_CWD: ftpstate = 16; -pub const FTP_POSTQUOTE: ftpstate = 15; -pub const FTP_STOR_PREQUOTE: ftpstate = 14; -pub const FTP_RETR_PREQUOTE: ftpstate = 13; -pub const FTP_QUOTE: ftpstate = 12; -pub const FTP_NAMEFMT: ftpstate = 11; -pub const FTP_SYST: ftpstate = 10; -pub const FTP_PWD: ftpstate = 9; -pub const FTP_CCC: ftpstate = 8; -pub const FTP_PROT: ftpstate = 7; -pub const FTP_PBSZ: ftpstate = 6; -pub const FTP_ACCT: ftpstate = 5; -pub const FTP_PASS: ftpstate = 4; -pub const FTP_USER: ftpstate = 3; -pub const FTP_AUTH: ftpstate = 2; -pub const FTP_WAIT220: ftpstate = 1; -pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ntlmdata { - pub flags: libc::c_uint, - pub nonce: [libc::c_uchar; 8], - pub target_info_len: libc::c_uint, - pub target_info: *mut libc::c_void, - pub ntlm_auth_hlpr_socket: curl_socket_t, - pub ntlm_auth_hlpr_pid: pid_t, - pub challenge: *mut libc::c_char, - pub response: *mut libc::c_char, -} -pub type curlntlm = libc::c_uint; -pub const NTLMSTATE_LAST: curlntlm = 4; -pub const NTLMSTATE_TYPE3: curlntlm = 3; -pub const NTLMSTATE_TYPE2: curlntlm = 2; -pub const NTLMSTATE_TYPE1: curlntlm = 1; -pub const NTLMSTATE_NONE: curlntlm = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_handler { - pub scheme: *const libc::c_char, - pub setup_connection: - Option CURLcode>, - pub do_it: Option CURLcode>, - pub done: Option CURLcode>, - pub do_more: Option CURLcode>, - pub connect_it: Option CURLcode>, - pub connecting: Option CURLcode>, - pub doing: Option CURLcode>, - pub proto_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub doing_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub domore_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub perform_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub disconnect: - Option CURLcode>, - pub readwrite: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut ssize_t, *mut bool) -> CURLcode, - >, - pub connection_check: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_uint) -> libc::c_uint, - >, - pub attach: Option ()>, - pub defport: libc::c_int, - pub protocol: libc::c_uint, - pub family: libc::c_uint, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: - [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_connect_data { - pub state: ssl_connection_state, - pub connecting_state: ssl_connect_state, - pub backend: *mut ssl_backend_data, - #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] - pub use_0: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type ssl_connect_state = libc::c_uint; -pub const ssl_connect_done: ssl_connect_state = 5; -pub const ssl_connect_3: ssl_connect_state = 4; -pub const ssl_connect_2_writing: ssl_connect_state = 3; -pub const ssl_connect_2_reading: ssl_connect_state = 2; -pub const ssl_connect_2: ssl_connect_state = 1; -pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; -pub const ssl_connection_complete: ssl_connection_state = 2; -pub const ssl_connection_negotiating: ssl_connection_state = 1; -pub const ssl_connection_none: ssl_connection_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_5 = libc::c_uint; -pub const TRNSPRT_QUIC: C2RustUnnamed_5 = 5; -pub const TRNSPRT_UDP: C2RustUnnamed_5 = 4; -pub const TRNSPRT_TCP: C2RustUnnamed_5 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; -pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; -pub const CHUNK_TRAILER_CR: ChunkyState = 6; -pub const CHUNK_TRAILER: ChunkyState = 5; -pub const CHUNK_STOP: ChunkyState = 4; -pub const CHUNK_POSTLF: ChunkyState = 3; -pub const CHUNK_DATA: ChunkyState = 2; -pub const CHUNK_LF: ChunkyState = 1; -pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; -pub const CONNECT_DONE: connect_t = 17; -pub const CONNECT_REQ_READ_MORE: connect_t = 16; -pub const CONNECT_REQ_READ: connect_t = 15; -pub const CONNECT_REQ_SENDING: connect_t = 14; -pub const CONNECT_REQ_SEND: connect_t = 13; -pub const CONNECT_RESOLVE_REMOTE: connect_t = 12; -pub const CONNECT_RESOLVED: connect_t = 11; -pub const CONNECT_RESOLVING: connect_t = 10; -pub const CONNECT_REQ_INIT: connect_t = 9; -pub const CONNECT_AUTH_READ: connect_t = 8; -pub const CONNECT_AUTH_SEND: connect_t = 7; -pub const CONNECT_AUTH_INIT: connect_t = 6; -pub const CONNECT_GSSAPI_INIT: connect_t = 5; -pub const CONNECT_SOCKS_READ: connect_t = 4; -pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; -pub const CONNECT_SOCKS_SEND: connect_t = 2; -pub const CONNECT_SOCKS_INIT: connect_t = 1; -pub const CONNECT_INIT: connect_t = 0; -pub type curl_malloc_callback = Option *mut libc::c_void>; -pub type curl_strdup_callback = - Option *mut libc::c_char>; -pub type dupstring = libc::c_uint; -pub const STRING_LAST: dupstring = 80; -pub const STRING_AWS_SIGV4: dupstring = 79; -pub const STRING_COPYPOSTFIELDS: dupstring = 78; -pub const STRING_LASTZEROTERMINATED: dupstring = 77; -pub const STRING_SSL_EC_CURVES: dupstring = 76; -pub const STRING_DNS_LOCAL_IP6: dupstring = 75; -pub const STRING_DNS_LOCAL_IP4: dupstring = 74; -pub const STRING_DNS_INTERFACE: dupstring = 73; -pub const STRING_DNS_SERVERS: dupstring = 72; -pub const STRING_SASL_AUTHZID: dupstring = 71; -pub const STRING_HSTS: dupstring = 70; -pub const STRING_ALTSVC: dupstring = 69; -pub const STRING_DOH: dupstring = 68; -pub const STRING_TARGET: dupstring = 67; -pub const STRING_UNIX_SOCKET_PATH: dupstring = 66; -pub const STRING_BEARER: dupstring = 65; -pub const STRING_TLSAUTH_PASSWORD_PROXY: dupstring = 64; -pub const STRING_TLSAUTH_PASSWORD: dupstring = 63; -pub const STRING_TLSAUTH_USERNAME_PROXY: dupstring = 62; -pub const STRING_TLSAUTH_USERNAME: dupstring = 61; -pub const STRING_MAIL_AUTH: dupstring = 60; -pub const STRING_MAIL_FROM: dupstring = 59; -pub const STRING_SERVICE_NAME: dupstring = 58; -pub const STRING_PROXY_SERVICE_NAME: dupstring = 57; -pub const STRING_SSH_KNOWNHOSTS: dupstring = 56; -pub const STRING_SSH_HOST_PUBLIC_KEY_MD5: dupstring = 55; -pub const STRING_SSH_PUBLIC_KEY: dupstring = 54; -pub const STRING_SSH_PRIVATE_KEY: dupstring = 53; -pub const STRING_RTSP_TRANSPORT: dupstring = 52; -pub const STRING_RTSP_STREAM_URI: dupstring = 51; -pub const STRING_RTSP_SESSION_ID: dupstring = 50; -pub const STRING_NOPROXY: dupstring = 49; -pub const STRING_PROXYPASSWORD: dupstring = 48; -pub const STRING_PROXYUSERNAME: dupstring = 47; -pub const STRING_OPTIONS: dupstring = 46; -pub const STRING_PASSWORD: dupstring = 45; -pub const STRING_USERNAME: dupstring = 44; -pub const STRING_SSL_ENGINE: dupstring = 43; -pub const STRING_SSL_ISSUERCERT_PROXY: dupstring = 42; -pub const STRING_SSL_ISSUERCERT: dupstring = 41; -pub const STRING_SSL_CRLFILE_PROXY: dupstring = 40; -pub const STRING_SSL_CRLFILE: dupstring = 39; -pub const STRING_USERAGENT: dupstring = 38; -pub const STRING_SSL_RANDOM_FILE: dupstring = 37; -pub const STRING_SSL_EGDSOCKET: dupstring = 36; -pub const STRING_SSL_CIPHER13_LIST_PROXY: dupstring = 35; -pub const STRING_SSL_CIPHER13_LIST: dupstring = 34; -pub const STRING_SSL_CIPHER_LIST_PROXY: dupstring = 33; -pub const STRING_SSL_CIPHER_LIST: dupstring = 32; -pub const STRING_SSL_PINNEDPUBLICKEY_PROXY: dupstring = 31; -pub const STRING_SSL_PINNEDPUBLICKEY: dupstring = 30; -pub const STRING_SSL_CAFILE_PROXY: dupstring = 29; -pub const STRING_SSL_CAFILE: dupstring = 28; -pub const STRING_SSL_CAPATH_PROXY: dupstring = 27; -pub const STRING_SSL_CAPATH: dupstring = 26; -pub const STRING_SET_URL: dupstring = 25; -pub const STRING_SET_REFERER: dupstring = 24; -pub const STRING_SET_RANGE: dupstring = 23; -pub const STRING_PRE_PROXY: dupstring = 22; -pub const STRING_PROXY: dupstring = 21; -pub const STRING_NETRC_FILE: dupstring = 20; -pub const STRING_KRB_LEVEL: dupstring = 19; -pub const STRING_KEY_TYPE_PROXY: dupstring = 18; -pub const STRING_KEY_TYPE: dupstring = 17; -pub const STRING_KEY_PASSWD_PROXY: dupstring = 16; -pub const STRING_KEY_PASSWD: dupstring = 15; -pub const STRING_KEY_PROXY: dupstring = 14; -pub const STRING_KEY: dupstring = 13; -pub const STRING_FTPPORT: dupstring = 12; -pub const STRING_FTP_ALTERNATIVE_TO_USER: dupstring = 11; -pub const STRING_FTP_ACCOUNT: dupstring = 10; -pub const STRING_ENCODING: dupstring = 9; -pub const STRING_DEVICE: dupstring = 8; -pub const STRING_DEFAULT_PROTOCOL: dupstring = 7; -pub const STRING_CUSTOMREQUEST: dupstring = 6; -pub const STRING_COOKIEJAR: dupstring = 5; -pub const STRING_COOKIE: dupstring = 4; -pub const STRING_CERT_TYPE_PROXY: dupstring = 3; -pub const STRING_CERT_TYPE: dupstring = 2; -pub const STRING_CERT_PROXY: dupstring = 1; -pub const STRING_CERT: dupstring = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HMAC_params { - pub hmac_hinit: HMAC_hinit_func, - pub hmac_hupdate: HMAC_hupdate_func, - pub hmac_hfinal: HMAC_hfinal_func, - pub hmac_ctxtsize: libc::c_uint, - pub hmac_maxkeylen: libc::c_uint, - pub hmac_resultlen: libc::c_uint, -} -pub type HMAC_hfinal_func = - Option ()>; -pub type HMAC_hupdate_func = - Option ()>; -pub type HMAC_hinit_func = Option ()>; -unsafe extern "C" fn sha256_to_hex( - mut dst: *mut libc::c_char, - mut sha: *mut libc::c_uchar, - mut dst_l: size_t, -) { - let mut i: libc::c_int = 0; - i = 0 as libc::c_int; - while i < 32 as libc::c_int { - curl_msnprintf( - dst.offset((i * 2 as libc::c_int) as isize), - dst_l.wrapping_sub((i * 2 as libc::c_int) as libc::c_ulong), - b"%02x\0" as *const u8 as *const libc::c_char, - *sha.offset(i as isize) as libc::c_int, - ); - i += 1; - } -} -#[no_mangle] -pub unsafe extern "C" fn Curl_output_aws_sigv4( - mut data: *mut Curl_easy, - mut proxy: bool, -) -> CURLcode { - let mut current_block: u64; - let mut ret: CURLcode = CURLE_OUT_OF_MEMORY; - let mut conn: *mut connectdata = (*data).conn; - let mut len: size_t = 0; - let mut tmp0: *const libc::c_char = 0 as *const libc::c_char; - let mut tmp1: *const libc::c_char = 0 as *const libc::c_char; - let mut provider0_low: *mut libc::c_char = 0 as *mut libc::c_char; - let mut provider0_up: *mut libc::c_char = 0 as *mut libc::c_char; - let mut provider1_low: *mut libc::c_char = 0 as *mut libc::c_char; - let mut provider1_mid: *mut libc::c_char = 0 as *mut libc::c_char; - let mut region: *mut libc::c_char = 0 as *mut libc::c_char; - let mut service: *mut libc::c_char = 0 as *mut libc::c_char; - let mut hostname: *const libc::c_char = (*conn).host.name; - let mut clock: time_t = 0; - let mut tm: tm = tm { - tm_sec: 0, - tm_min: 0, - tm_hour: 0, - tm_mday: 0, - tm_mon: 0, - tm_year: 0, - tm_wday: 0, - tm_yday: 0, - tm_isdst: 0, - tm_gmtoff: 0, - tm_zone: 0 as *const libc::c_char, - }; - let mut timestamp: [libc::c_char; 17] = [0; 17]; - let mut date: [libc::c_char; 9] = [0; 9]; - let mut content_type: *const libc::c_char = - Curl_checkheaders(data, b"Content-Type\0" as *const u8 as *const libc::c_char); - let mut canonical_headers: *mut libc::c_char = 0 as *mut libc::c_char; - let mut signed_headers: *mut libc::c_char = 0 as *mut libc::c_char; - let mut httpreq: Curl_HttpReq = HTTPREQ_GET; - let mut method: *const libc::c_char = 0 as *const libc::c_char; - let mut post_data: *const libc::c_char = (if !((*data).set.postfields).is_null() { - (*data).set.postfields - } else { - b"\0" as *const u8 as *const libc::c_char as *const libc::c_void - }) as *const libc::c_char; - let mut sha_hash: [libc::c_uchar; 32] = [0; 32]; - let mut sha_hex: [libc::c_char; 65] = [0; 65]; - let mut canonical_request: *mut libc::c_char = 0 as *mut libc::c_char; - let mut request_type: *mut libc::c_char = 0 as *mut libc::c_char; - let mut credential_scope: *mut libc::c_char = 0 as *mut libc::c_char; - let mut str_to_sign: *mut libc::c_char = 0 as *mut libc::c_char; - let mut user: *const libc::c_char = if !((*data).state.aptr.user).is_null() { - (*data).state.aptr.user as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }; - let mut passwd: *const libc::c_char = if !((*data).state.aptr.passwd).is_null() { - (*data).state.aptr.passwd as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }; - let mut secret: *mut libc::c_char = 0 as *mut libc::c_char; - let mut tmp_sign0: [libc::c_uchar; 32] = [ - 0 as libc::c_int as libc::c_uchar, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ]; - let mut tmp_sign1: [libc::c_uchar; 32] = [ - 0 as libc::c_int as libc::c_uchar, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - ]; - let mut auth_headers: *mut libc::c_char = 0 as *mut libc::c_char; - if !(Curl_checkheaders(data, b"Authorization\0" as *const u8 as *const libc::c_char)).is_null() - { - return CURLE_OK; - } - tmp0 = if !((*data).set.str_0[STRING_AWS_SIGV4 as libc::c_int as usize]).is_null() { - (*data).set.str_0[STRING_AWS_SIGV4 as libc::c_int as usize] as *const libc::c_char - } else { - b"aws:amz\0" as *const u8 as *const libc::c_char - }; - tmp1 = strchr(tmp0, ':' as i32); - len = if !tmp1.is_null() { - tmp1.offset_from(tmp0) as libc::c_long as size_t - } else { - strlen(tmp0) - }; - if len < 1 as libc::c_int as libc::c_ulong { - Curl_infof( - data, - b"first provider can't be empty\0" as *const u8 as *const libc::c_char, - ); - ret = CURLE_BAD_FUNCTION_ARGUMENT; - } else { - provider0_low = Curl_cmalloc.expect("non-null function pointer")( - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - provider0_up = Curl_cmalloc.expect("non-null function pointer")( - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if !(provider0_low.is_null() || provider0_up.is_null()) { - Curl_strntolower(provider0_low, tmp0, len); - *provider0_low.offset(len as isize) = '\u{0}' as i32 as libc::c_char; - Curl_strntoupper(provider0_up, tmp0, len); - *provider0_up.offset(len as isize) = '\u{0}' as i32 as libc::c_char; - if !tmp1.is_null() { - tmp0 = tmp1.offset(1 as libc::c_int as isize); - tmp1 = strchr(tmp0, ':' as i32); - len = if !tmp1.is_null() { - tmp1.offset_from(tmp0) as libc::c_long as size_t - } else { - strlen(tmp0) - }; - if len < 1 as libc::c_int as libc::c_ulong { - Curl_infof( - data, - b"second provider can't be empty\0" as *const u8 as *const libc::c_char, - ); - ret = CURLE_BAD_FUNCTION_ARGUMENT; - current_block = 3666925641672342302; - } else { - provider1_low = Curl_cmalloc.expect("non-null function pointer")( - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - provider1_mid = Curl_cmalloc.expect("non-null function pointer")( - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if provider1_low.is_null() || provider1_mid.is_null() { - current_block = 3666925641672342302; - } else { - Curl_strntolower(provider1_low, tmp0, len); - *provider1_low.offset(len as isize) = '\u{0}' as i32 as libc::c_char; - Curl_strntolower(provider1_mid, tmp0, len); - *provider1_mid.offset(0 as libc::c_int as isize) = - Curl_raw_toupper(*provider1_mid.offset(0 as libc::c_int as isize)); - *provider1_mid.offset(len as isize) = '\u{0}' as i32 as libc::c_char; - if !tmp1.is_null() { - tmp0 = tmp1.offset(1 as libc::c_int as isize); - tmp1 = strchr(tmp0, ':' as i32); - len = if !tmp1.is_null() { - tmp1.offset_from(tmp0) as libc::c_long as size_t - } else { - strlen(tmp0) - }; - if len < 1 as libc::c_int as libc::c_ulong { - Curl_infof( - data, - b"region can't be empty\0" as *const u8 as *const libc::c_char, - ); - ret = CURLE_BAD_FUNCTION_ARGUMENT; - current_block = 3666925641672342302; - } else { - region = Curl_memdup( - tmp0 as *const libc::c_void, - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if region.is_null() { - current_block = 3666925641672342302; - } else { - *region.offset(len as isize) = '\u{0}' as i32 as libc::c_char; - if !tmp1.is_null() { - tmp0 = tmp1.offset(1 as libc::c_int as isize); - service = - Curl_cstrdup.expect("non-null function pointer")(tmp0); - if service.is_null() { - current_block = 3666925641672342302; - } else if strlen(service) - < 1 as libc::c_int as libc::c_ulong - { - Curl_infof( - data, - b"service can't be empty\0" as *const u8 - as *const libc::c_char, - ); - ret = CURLE_BAD_FUNCTION_ARGUMENT; - current_block = 3666925641672342302; - } else { - current_block = 11052029508375673978; - } - } else { - current_block = 11052029508375673978; - } - } - } - } else { - current_block = 11052029508375673978; - } - } - } - } else { - provider1_low = Curl_memdup( - provider0_low as *const libc::c_void, - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - provider1_mid = Curl_memdup( - provider0_low as *const libc::c_void, - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if provider1_low.is_null() || provider1_mid.is_null() { - current_block = 3666925641672342302; - } else { - *provider1_mid.offset(0 as libc::c_int as isize) = - Curl_raw_toupper(*provider1_mid.offset(0 as libc::c_int as isize)); - current_block = 11052029508375673978; - } - } - match current_block { - 3666925641672342302 => {} - _ => { - if service.is_null() { - tmp0 = hostname; - tmp1 = strchr(tmp0, '.' as i32); - len = tmp1.offset_from(tmp0) as libc::c_long as size_t; - if tmp1.is_null() || len < 1 as libc::c_int as libc::c_ulong { - Curl_infof( - data, - b"service missing in parameters or hostname\0" as *const u8 - as *const libc::c_char, - ); - ret = CURLE_URL_MALFORMAT; - current_block = 3666925641672342302; - } else { - service = Curl_memdup( - tmp0 as *const libc::c_void, - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) as *mut libc::c_char; - if service.is_null() { - current_block = 3666925641672342302; - } else { - *service.offset(len as isize) = '\u{0}' as i32 as libc::c_char; - if region.is_null() { - tmp0 = tmp1.offset(1 as libc::c_int as isize); - tmp1 = strchr(tmp0, '.' as i32); - len = tmp1.offset_from(tmp0) as libc::c_long as size_t; - if tmp1.is_null() || len < 1 as libc::c_int as libc::c_ulong { - Curl_infof( - data, - b"region missing in parameters or hostname\0" - as *const u8 - as *const libc::c_char, - ); - ret = CURLE_URL_MALFORMAT; - current_block = 3666925641672342302; - } else { - region = Curl_memdup( - tmp0 as *const libc::c_void, - len.wrapping_add(1 as libc::c_int as libc::c_ulong), - ) - as *mut libc::c_char; - if region.is_null() { - current_block = 3666925641672342302; - } else { - *region.offset(len as isize) = - '\u{0}' as i32 as libc::c_char; - current_block = 6040267449472925966; - } - } - } else { - current_block = 6040267449472925966; - } - } - } - } else { - current_block = 6040267449472925966; - } - match current_block { - 3666925641672342302 => {} - _ => { - time(&mut clock); - ret = Curl_gmtime(clock, &mut tm); - if !(ret as libc::c_uint != CURLE_OK as libc::c_int as libc::c_uint) { - if !(strftime( - timestamp.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 17]>() as libc::c_ulong, - b"%Y%m%dT%H%M%SZ\0" as *const u8 as *const libc::c_char, - &mut tm, - ) == 0) - { - memcpy( - date.as_mut_ptr() as *mut libc::c_void, - timestamp.as_mut_ptr() as *const libc::c_void, - ::std::mem::size_of::<[libc::c_char; 9]>() as libc::c_ulong, - ); - date[(::std::mem::size_of::<[libc::c_char; 9]>() - as libc::c_ulong) - .wrapping_sub(1 as libc::c_int as libc::c_ulong) - as usize] = 0 as libc::c_int as libc::c_char; - if !content_type.is_null() { - content_type = strchr(content_type, ':' as i32); - if content_type.is_null() { - ret = CURLE_FAILED_INIT; - current_block = 3666925641672342302; - } else { - content_type = content_type.offset(1); - while *content_type as libc::c_int == ' ' as i32 - || *content_type as libc::c_int == '\t' as i32 - { - content_type = content_type.offset(1); - } - canonical_headers = curl_maprintf( - b"content-type:%s\nhost:%s\nx-%s-date:%s\n\0" - as *const u8 - as *const libc::c_char, - content_type, - hostname, - provider1_low, - timestamp.as_mut_ptr(), - ); - signed_headers = curl_maprintf( - b"content-type;host;x-%s-date\0" as *const u8 - as *const libc::c_char, - provider1_low, - ); - current_block = 5248622017361056354; - } - } else { - canonical_headers = curl_maprintf( - b"host:%s\nx-%s-date:%s\n\0" as *const u8 - as *const libc::c_char, - hostname, - provider1_low, - timestamp.as_mut_ptr(), - ); - signed_headers = curl_maprintf( - b"host;x-%s-date\0" as *const u8 as *const libc::c_char, - provider1_low, - ); - current_block = 5248622017361056354; - } - match current_block { - 3666925641672342302 => {} - _ => { - if !(canonical_headers.is_null() - || signed_headers.is_null()) - { - Curl_sha256it( - sha_hash.as_mut_ptr(), - post_data as *const libc::c_uchar, - strlen(post_data), - ); - sha256_to_hex( - sha_hex.as_mut_ptr(), - sha_hash.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 65]>() - as libc::c_ulong, - ); - Curl_http_method( - data, - conn, - &mut method, - &mut httpreq, - ); - canonical_request = curl_maprintf( - b"%s\n%s\n%s\n%s\n%s\n%s\0" as *const u8 - as *const libc::c_char, - method, - (*data).state.up.path, - if !((*data).state.up.query).is_null() { - (*data).state.up.query - as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - canonical_headers, - signed_headers, - sha_hex.as_mut_ptr(), - ); - if !canonical_request.is_null() { - request_type = curl_maprintf( - b"%s4_request\0" as *const u8 - as *const libc::c_char, - provider0_low, - ); - if !request_type.is_null() { - credential_scope = curl_maprintf( - b"%s/%s/%s/%s\0" as *const u8 - as *const libc::c_char, - date.as_mut_ptr(), - region, - service, - request_type, - ); - if !credential_scope.is_null() { - Curl_sha256it( - sha_hash.as_mut_ptr(), - canonical_request - as *mut libc::c_uchar, - strlen(canonical_request), - ); - sha256_to_hex( - sha_hex.as_mut_ptr(), - sha_hash.as_mut_ptr(), - ::std::mem::size_of::< - [libc::c_char; 65], - >( - ) - as libc::c_ulong, - ); - str_to_sign = curl_maprintf( - b"%s4-HMAC-SHA256\n%s\n%s\n%s\0" - as *const u8 - as *const libc::c_char, - provider0_up, - timestamp.as_mut_ptr(), - credential_scope, - sha_hex.as_mut_ptr(), - ); - if !str_to_sign.is_null() { - secret = curl_maprintf( - b"%s4%s\0" as *const u8 - as *const libc::c_char, - provider0_up, - passwd, - ); - if !secret.is_null() { - ret = Curl_hmacit( - Curl_HMAC_SHA256.as_ptr(), - secret - as *mut libc::c_uchar, - strlen(secret) - as libc::c_uint - as size_t, - date.as_mut_ptr() - as *mut libc::c_uchar, - strlen(date.as_mut_ptr()) - as libc::c_uint - as size_t, - tmp_sign0.as_mut_ptr(), - ); - if !(ret as libc::c_uint - != CURLE_OK as libc::c_int - as libc::c_uint) - { - ret = Curl_hmacit( - Curl_HMAC_SHA256.as_ptr(), - tmp_sign0.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_uchar; 32]>() - as libc::c_ulong as libc::c_uint as size_t, - region as *mut libc::c_uchar, - strlen(region) as libc::c_uint as size_t, - tmp_sign1.as_mut_ptr(), - ); - if !(ret as libc::c_uint - != CURLE_OK - as libc::c_int - as libc::c_uint) - { - ret = Curl_hmacit( - Curl_HMAC_SHA256.as_ptr(), - tmp_sign1.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_uchar; 32]>() - as libc::c_ulong as libc::c_uint as size_t, - service as *mut libc::c_uchar, - strlen(service) as libc::c_uint as size_t, - tmp_sign0.as_mut_ptr(), - ); - if !(ret - as libc::c_uint - != CURLE_OK - as libc::c_int - as libc::c_uint) - { - ret = Curl_hmacit( - Curl_HMAC_SHA256.as_ptr(), - tmp_sign0.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_uchar; 32]>() - as libc::c_ulong as libc::c_uint as size_t, - request_type as *mut libc::c_uchar, - strlen(request_type) as libc::c_uint as size_t, - tmp_sign1.as_mut_ptr(), - ); - if !(ret as libc::c_uint - != CURLE_OK as libc::c_int as libc::c_uint) - { - ret = Curl_hmacit( - Curl_HMAC_SHA256.as_ptr(), - tmp_sign1.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_uchar; 32]>() - as libc::c_ulong as libc::c_uint as size_t, - str_to_sign as *mut libc::c_uchar, - strlen(str_to_sign) as libc::c_uint as size_t, - tmp_sign0.as_mut_ptr(), - ); - if !(ret as libc::c_uint - != CURLE_OK as libc::c_int as libc::c_uint) - { - sha256_to_hex( - sha_hex.as_mut_ptr(), - tmp_sign0.as_mut_ptr(), - ::std::mem::size_of::<[libc::c_char; 65]>() as libc::c_ulong, - ); - auth_headers = curl_maprintf( - b"Authorization: %s4-HMAC-SHA256 Credential=%s/%s, SignedHeaders=%s, Signature=%s\r\nX-%s-Date: %s\r\n\0" - as *const u8 as *const libc::c_char, - provider0_up, - user, - credential_scope, - signed_headers, - sha_hex.as_mut_ptr(), - provider1_mid, - timestamp.as_mut_ptr(), - ); - if !auth_headers.is_null() { - Curl_cfree - .expect( - "non-null function pointer", - )((*data).state.aptr.userpwd as *mut libc::c_void); - let ref mut fresh0 = (*data).state.aptr.userpwd; - *fresh0 = 0 as *mut libc::c_char; - let ref mut fresh1 = (*data).state.aptr.userpwd; - *fresh1 = auth_headers; - let ref mut fresh2 = (*data).state.authhost; - (*fresh2).set_done(1 as libc::c_int as bit); - ret = CURLE_OK; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - Curl_cfree.expect("non-null function pointer")(provider0_low as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(provider0_up as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(provider1_low as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(provider1_mid as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(region as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(service as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(canonical_headers as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(signed_headers as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(canonical_request as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(request_type as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(credential_scope as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(str_to_sign as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(secret as *mut libc::c_void); - return ret; -} diff --git a/lib/http_chunks.c b/lib/http_chunks.c new file mode 100644 index 0000000..beb9695 --- /dev/null +++ b/lib/http_chunks.c @@ -0,0 +1,343 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#ifndef CURL_DISABLE_HTTP + +#include "urldata.h" /* it includes http_chunks.h */ +#include "sendf.h" /* for the client write stuff */ +#include "dynbuf.h" +#include "content_encoding.h" +#include "http.h" +#include "non-ascii.h" /* for Curl_convert_to_network prototype */ +#include "strtoofft.h" +#include "warnless.h" + +/* The last #include files should be: */ +#include "curl_memory.h" +#include "memdebug.h" + +/* + * Chunk format (simplified): + * + * [ chunk extension ] CRLF + * CRLF + * + * Highlights from RFC2616 section 3.6 say: + + The chunked encoding modifies the body of a message in order to + transfer it as a series of chunks, each with its own size indicator, + followed by an OPTIONAL trailer containing entity-header fields. This + allows dynamically produced content to be transferred along with the + information necessary for the recipient to verify that it has + received the full message. + + Chunked-Body = *chunk + last-chunk + trailer + CRLF + + chunk = chunk-size [ chunk-extension ] CRLF + chunk-data CRLF + chunk-size = 1*HEX + last-chunk = 1*("0") [ chunk-extension ] CRLF + + chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) + chunk-ext-name = token + chunk-ext-val = token | quoted-string + chunk-data = chunk-size(OCTET) + trailer = *(entity-header CRLF) + + The chunk-size field is a string of hex digits indicating the size of + the chunk. The chunked encoding is ended by any chunk whose size is + zero, followed by the trailer, which is terminated by an empty line. + + */ + +#ifdef CURL_DOES_CONVERSIONS +/* Check for an ASCII hex digit. + We avoid the use of ISXDIGIT to accommodate non-ASCII hosts. */ +static bool isxdigit_ascii(char digit) +{ + return (digit >= 0x30 && digit <= 0x39) /* 0-9 */ + || (digit >= 0x41 && digit <= 0x46) /* A-F */ + || (digit >= 0x61 && digit <= 0x66); /* a-f */ +} +#else +#define isxdigit_ascii(x) Curl_isxdigit(x) +#endif + +void Curl_httpchunk_init(struct Curl_easy *data) +{ + struct connectdata *conn = data->conn; + struct Curl_chunker *chunk = &conn->chunk; + chunk->hexindex = 0; /* start at 0 */ + chunk->state = CHUNK_HEX; /* we get hex first! */ + Curl_dyn_init(&conn->trailer, DYN_H1_TRAILER); +} + +/* + * chunk_read() returns a OK for normal operations, or a positive return code + * for errors. STOP means this sequence of chunks is complete. The 'wrote' + * argument is set to tell the caller how many bytes we actually passed to the + * client (for byte-counting and whatever). + * + * The states and the state-machine is further explained in the header file. + * + * This function always uses ASCII hex values to accommodate non-ASCII hosts. + * For example, 0x0d and 0x0a are used instead of '\r' and '\n'. + */ +CHUNKcode Curl_httpchunk_read(struct Curl_easy *data, + char *datap, + ssize_t datalen, + ssize_t *wrotep, + CURLcode *extrap) +{ + CURLcode result = CURLE_OK; + struct connectdata *conn = data->conn; + struct Curl_chunker *ch = &conn->chunk; + struct SingleRequest *k = &data->req; + size_t piece; + curl_off_t length = (curl_off_t)datalen; + size_t *wrote = (size_t *)wrotep; + + *wrote = 0; /* nothing's written yet */ + + /* the original data is written to the client, but we go on with the + chunk read process, to properly calculate the content length*/ + if(data->set.http_te_skip && !k->ignorebody) { + result = Curl_client_write(data, CLIENTWRITE_BODY, datap, datalen); + if(result) { + *extrap = result; + return CHUNKE_PASSTHRU_ERROR; + } + } + + while(length) { + switch(ch->state) { + case CHUNK_HEX: + if(isxdigit_ascii(*datap)) { + if(ch->hexindex < CHUNK_MAXNUM_LEN) { + ch->hexbuffer[ch->hexindex] = *datap; + datap++; + length--; + ch->hexindex++; + } + else { + return CHUNKE_TOO_LONG_HEX; /* longer hex than we support */ + } + } + else { + char *endptr; + if(0 == ch->hexindex) + /* This is illegal data, we received junk where we expected + a hexadecimal digit. */ + return CHUNKE_ILLEGAL_HEX; + + /* length and datap are unmodified */ + ch->hexbuffer[ch->hexindex] = 0; + + /* convert to host encoding before calling strtoul */ + result = Curl_convert_from_network(data, ch->hexbuffer, ch->hexindex); + if(result) { + /* Curl_convert_from_network calls failf if unsuccessful */ + /* Treat it as a bad hex character */ + return CHUNKE_ILLEGAL_HEX; + } + + if(curlx_strtoofft(ch->hexbuffer, &endptr, 16, &ch->datasize)) + return CHUNKE_ILLEGAL_HEX; + ch->state = CHUNK_LF; /* now wait for the CRLF */ + } + break; + + case CHUNK_LF: + /* waiting for the LF after a chunk size */ + if(*datap == 0x0a) { + /* we're now expecting data to come, unless size was zero! */ + if(0 == ch->datasize) { + ch->state = CHUNK_TRAILER; /* now check for trailers */ + } + else + ch->state = CHUNK_DATA; + } + + datap++; + length--; + break; + + case CHUNK_DATA: + /* We expect 'datasize' of data. We have 'length' right now, it can be + more or less than 'datasize'. Get the smallest piece. + */ + piece = curlx_sotouz((ch->datasize >= length)?length:ch->datasize); + + /* Write the data portion available */ + if(!data->set.http_te_skip && !k->ignorebody) { + if(!data->set.http_ce_skip && k->writer_stack) + result = Curl_unencode_write(data, k->writer_stack, datap, piece); + else + result = Curl_client_write(data, CLIENTWRITE_BODY, datap, piece); + + if(result) { + *extrap = result; + return CHUNKE_PASSTHRU_ERROR; + } + } + + *wrote += piece; + ch->datasize -= piece; /* decrease amount left to expect */ + datap += piece; /* move read pointer forward */ + length -= piece; /* decrease space left in this round */ + + if(0 == ch->datasize) + /* end of data this round, we now expect a trailing CRLF */ + ch->state = CHUNK_POSTLF; + break; + + case CHUNK_POSTLF: + if(*datap == 0x0a) { + /* The last one before we go back to hex state and start all over. */ + Curl_httpchunk_init(data); /* sets state back to CHUNK_HEX */ + } + else if(*datap != 0x0d) + return CHUNKE_BAD_CHUNK; + datap++; + length--; + break; + + case CHUNK_TRAILER: + if((*datap == 0x0d) || (*datap == 0x0a)) { + char *tr = Curl_dyn_ptr(&conn->trailer); + /* this is the end of a trailer, but if the trailer was zero bytes + there was no trailer and we move on */ + + if(tr) { + size_t trlen; + result = Curl_dyn_add(&conn->trailer, (char *)"\x0d\x0a"); + if(result) + return CHUNKE_OUT_OF_MEMORY; + + tr = Curl_dyn_ptr(&conn->trailer); + trlen = Curl_dyn_len(&conn->trailer); + /* Convert to host encoding before calling Curl_client_write */ + result = Curl_convert_from_network(data, tr, trlen); + if(result) + /* Curl_convert_from_network calls failf if unsuccessful */ + /* Treat it as a bad chunk */ + return CHUNKE_BAD_CHUNK; + + if(!data->set.http_te_skip) { + result = Curl_client_write(data, CLIENTWRITE_HEADER, tr, trlen); + if(result) { + *extrap = result; + return CHUNKE_PASSTHRU_ERROR; + } + } + Curl_dyn_reset(&conn->trailer); + ch->state = CHUNK_TRAILER_CR; + if(*datap == 0x0a) + /* already on the LF */ + break; + } + else { + /* no trailer, we're on the final CRLF pair */ + ch->state = CHUNK_TRAILER_POSTCR; + break; /* don't advance the pointer */ + } + } + else { + result = Curl_dyn_addn(&conn->trailer, datap, 1); + if(result) + return CHUNKE_OUT_OF_MEMORY; + } + datap++; + length--; + break; + + case CHUNK_TRAILER_CR: + if(*datap == 0x0a) { + ch->state = CHUNK_TRAILER_POSTCR; + datap++; + length--; + } + else + return CHUNKE_BAD_CHUNK; + break; + + case CHUNK_TRAILER_POSTCR: + /* We enter this state when a CR should arrive so we expect to + have to first pass a CR before we wait for LF */ + if((*datap != 0x0d) && (*datap != 0x0a)) { + /* not a CR then it must be another header in the trailer */ + ch->state = CHUNK_TRAILER; + break; + } + if(*datap == 0x0d) { + /* skip if CR */ + datap++; + length--; + } + /* now wait for the final LF */ + ch->state = CHUNK_STOP; + break; + + case CHUNK_STOP: + if(*datap == 0x0a) { + length--; + + /* Record the length of any data left in the end of the buffer + even if there's no more chunks to read */ + ch->datasize = curlx_sotouz(length); + + return CHUNKE_STOP; /* return stop */ + } + else + return CHUNKE_BAD_CHUNK; + } + } + return CHUNKE_OK; +} + +const char *Curl_chunked_strerror(CHUNKcode code) +{ + switch(code) { + default: + return "OK"; + case CHUNKE_TOO_LONG_HEX: + return "Too long hexadecimal number"; + case CHUNKE_ILLEGAL_HEX: + return "Illegal or missing hexadecimal sequence"; + case CHUNKE_BAD_CHUNK: + return "Malformed encoding found"; + case CHUNKE_PASSTHRU_ERROR: + DEBUGASSERT(0); /* never used */ + return ""; + case CHUNKE_BAD_ENCODING: + return "Bad content-encoding found"; + case CHUNKE_OUT_OF_MEMORY: + return "Out of memory"; + } +} + +#endif /* CURL_DISABLE_HTTP */ diff --git a/lib/http_chunks.rs b/lib/http_chunks.rs deleted file mode 100644 index 0270c18..0000000 --- a/lib/http_chunks.rs +++ /dev/null @@ -1,2584 +0,0 @@ -#![allow( - dead_code, - mutable_transmutes, - non_camel_case_types, - non_snake_case, - non_upper_case_globals, - unused_assignments, - unused_mut -)] -#![register_tool(c2rust)] -#![feature(extern_types, register_tool)] -extern "C" { - pub type _IO_wide_data; - pub type _IO_codecvt; - pub type _IO_marker; - pub type Curl_URL; - pub type thread_data; - pub type altsvcinfo; - pub type hsts; - pub type TELNET; - pub type smb_request; - pub type ldapreqinfo; - pub type psl_ctx_st; - pub type Curl_share; - pub type curl_pushheaders; - pub type http_connect_state; - pub type ldapconninfo; - pub type tftp_state_data; - pub type nghttp2_session; - pub type ssl_backend_data; - fn Curl_isxdigit(c: libc::c_int) -> libc::c_int; - fn Curl_dyn_init(s: *mut dynbuf, toobig: size_t); - fn Curl_dyn_addn(s: *mut dynbuf, mem: *const libc::c_void, len: size_t) -> CURLcode; - fn Curl_dyn_reset(s: *mut dynbuf); - fn Curl_dyn_ptr(s: *const dynbuf) -> *mut libc::c_char; - fn Curl_dyn_len(s: *const dynbuf) -> size_t; - fn Curl_dyn_add(s: *mut dynbuf, str: *const libc::c_char) -> CURLcode; - fn Curl_client_write( - data: *mut Curl_easy, - type_0: libc::c_int, - ptr: *mut libc::c_char, - len: size_t, - ) -> CURLcode; - fn Curl_unencode_write( - data: *mut Curl_easy, - writer: *mut contenc_writer, - buf: *const libc::c_char, - nbytes: size_t, - ) -> CURLcode; - fn curlx_strtoofft( - str: *const libc::c_char, - endp: *mut *mut libc::c_char, - base: libc::c_int, - num: *mut curl_off_t, - ) -> CURLofft; - fn curlx_sotouz(sonum: curl_off_t) -> size_t; -} -pub type __uint8_t = libc::c_uchar; -pub type __int32_t = libc::c_int; -pub type __uint32_t = libc::c_uint; -pub type __off_t = libc::c_long; -pub type __off64_t = libc::c_long; -pub type __pid_t = libc::c_int; -pub type __time_t = libc::c_long; -pub type __ssize_t = libc::c_long; -pub type __socklen_t = libc::c_uint; -pub type pid_t = __pid_t; -pub type ssize_t = __ssize_t; -pub type time_t = __time_t; -pub type size_t = libc::c_ulong; -pub type int32_t = __int32_t; -pub type socklen_t = __socklen_t; -pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} -pub type curl_socklen_t = socklen_t; -pub type curl_off_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _IO_FILE { - pub _flags: libc::c_int, - pub _IO_read_ptr: *mut libc::c_char, - pub _IO_read_end: *mut libc::c_char, - pub _IO_read_base: *mut libc::c_char, - pub _IO_write_base: *mut libc::c_char, - pub _IO_write_ptr: *mut libc::c_char, - pub _IO_write_end: *mut libc::c_char, - pub _IO_buf_base: *mut libc::c_char, - pub _IO_buf_end: *mut libc::c_char, - pub _IO_save_base: *mut libc::c_char, - pub _IO_backup_base: *mut libc::c_char, - pub _IO_save_end: *mut libc::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: libc::c_int, - pub _flags2: libc::c_int, - pub _old_offset: __off_t, - pub _cur_column: libc::c_ushort, - pub _vtable_offset: libc::c_schar, - pub _shortbuf: [libc::c_char; 1], - pub _lock: *mut libc::c_void, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut libc::c_void, - pub __pad5: size_t, - pub _mode: libc::c_int, - pub _unused2: [libc::c_char; 20], -} -pub type _IO_lock_t = (); -pub type FILE = _IO_FILE; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_easy { - pub magic: libc::c_uint, - pub next: *mut Curl_easy, - pub prev: *mut Curl_easy, - pub conn: *mut connectdata, - pub connect_queue: Curl_llist_element, - pub conn_queue: Curl_llist_element, - pub mstate: CURLMstate, - pub result: CURLcode, - pub msg: Curl_message, - pub sockets: [curl_socket_t; 5], - pub actions: [libc::c_uchar; 5], - pub numsocks: libc::c_int, - pub dns: Names, - pub multi: *mut Curl_multi, - pub multi_easy: *mut Curl_multi, - pub share: *mut Curl_share, - pub psl: *mut PslCache, - pub req: SingleRequest, - pub set: UserDefined, - pub cookies: *mut CookieInfo, - pub hsts: *mut hsts, - pub asi: *mut altsvcinfo, - pub progress: Progress, - pub state: UrlState, - pub wildcard: WildcardData, - pub info: PureInfo, - pub tsi: curl_tlssessioninfo, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} -pub type curl_sslbackend = libc::c_uint; -pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; -pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; -pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; -pub const CURLSSLBACKEND_MBEDTLS: curl_sslbackend = 11; -pub const CURLSSLBACKEND_AXTLS: curl_sslbackend = 10; -pub const CURLSSLBACKEND_SECURETRANSPORT: curl_sslbackend = 9; -pub const CURLSSLBACKEND_SCHANNEL: curl_sslbackend = 8; -pub const CURLSSLBACKEND_WOLFSSL: curl_sslbackend = 7; -pub const CURLSSLBACKEND_POLARSSL: curl_sslbackend = 6; -pub const CURLSSLBACKEND_GSKIT: curl_sslbackend = 5; -pub const CURLSSLBACKEND_OBSOLETE4: curl_sslbackend = 4; -pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; -pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; -pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; -pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; -pub const CURLPX_LAST: CURLproxycode = 34; -pub const CURLPX_USER_REJECTED: CURLproxycode = 33; -pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; -pub const CURLPX_UNKNOWN_FAIL: CURLproxycode = 31; -pub const CURLPX_SEND_REQUEST: CURLproxycode = 30; -pub const CURLPX_SEND_CONNECT: CURLproxycode = 29; -pub const CURLPX_SEND_AUTH: CURLproxycode = 28; -pub const CURLPX_RESOLVE_HOST: CURLproxycode = 27; -pub const CURLPX_REQUEST_FAILED: CURLproxycode = 26; -pub const CURLPX_REPLY_UNASSIGNED: CURLproxycode = 25; -pub const CURLPX_REPLY_TTL_EXPIRED: CURLproxycode = 24; -pub const CURLPX_REPLY_NOT_ALLOWED: CURLproxycode = 23; -pub const CURLPX_REPLY_NETWORK_UNREACHABLE: CURLproxycode = 22; -pub const CURLPX_REPLY_HOST_UNREACHABLE: CURLproxycode = 21; -pub const CURLPX_REPLY_GENERAL_SERVER_FAILURE: CURLproxycode = 20; -pub const CURLPX_REPLY_CONNECTION_REFUSED: CURLproxycode = 19; -pub const CURLPX_REPLY_COMMAND_NOT_SUPPORTED: CURLproxycode = 18; -pub const CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED: CURLproxycode = 17; -pub const CURLPX_RECV_REQACK: CURLproxycode = 16; -pub const CURLPX_RECV_CONNECT: CURLproxycode = 15; -pub const CURLPX_RECV_AUTH: CURLproxycode = 14; -pub const CURLPX_RECV_ADDRESS: CURLproxycode = 13; -pub const CURLPX_NO_AUTH: CURLproxycode = 12; -pub const CURLPX_LONG_USER: CURLproxycode = 11; -pub const CURLPX_LONG_PASSWD: CURLproxycode = 10; -pub const CURLPX_LONG_HOSTNAME: CURLproxycode = 9; -pub const CURLPX_IDENTD_DIFFER: CURLproxycode = 8; -pub const CURLPX_IDENTD: CURLproxycode = 7; -pub const CURLPX_GSSAPI_PROTECTION: CURLproxycode = 6; -pub const CURLPX_GSSAPI_PERMSG: CURLproxycode = 5; -pub const CURLPX_GSSAPI: CURLproxycode = 4; -pub const CURLPX_CLOSED: CURLproxycode = 3; -pub const CURLPX_BAD_VERSION: CURLproxycode = 2; -pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; -pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; -pub const CURLWC_DONE: wildcard_states = 7; -pub const CURLWC_ERROR: wildcard_states = 6; -pub const CURLWC_SKIP: wildcard_states = 5; -pub const CURLWC_CLEAN: wildcard_states = 4; -pub const CURLWC_DOWNLOADING: wildcard_states = 3; -pub const CURLWC_MATCHING: wildcard_states = 2; -pub const CURLWC_INIT: wildcard_states = 1; -pub const CURLWC_CLEAR: wildcard_states = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UrlState { - pub conn_cache: *mut conncache, - pub keeps_speed: curltime, - pub lastconnect_id: libc::c_long, - pub headerb: dynbuf, - pub buffer: *mut libc::c_char, - pub ulbuf: *mut libc::c_char, - pub current_speed: curl_off_t, - pub first_host: *mut libc::c_char, - pub retrycount: libc::c_int, - pub first_remote_port: libc::c_int, - pub session: *mut Curl_ssl_session, - pub sessionage: libc::c_long, - pub tempwrite: [tempbuf; 3], - pub tempcount: libc::c_uint, - pub os_errno: libc::c_int, - pub scratch: *mut libc::c_char, - pub followlocation: libc::c_long, - pub prev_signal: Option ()>, - pub digest: digestdata, - pub proxydigest: digestdata, - pub authhost: auth, - pub authproxy: auth, - pub async_0: Curl_async, - pub engine: *mut libc::c_void, - pub expiretime: curltime, - pub timenode: Curl_tree, - pub timeoutlist: Curl_llist, - pub expires: [time_node; 13], - pub most_recent_ftp_entrypath: *mut libc::c_char, - pub httpwant: libc::c_uchar, - pub httpversion: libc::c_uchar, - #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] - pub prev_block_had_trailing_cr: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 5], - pub crlf_conversions: curl_off_t, - pub range: *mut libc::c_char, - pub resume_from: curl_off_t, - pub rtsp_next_client_CSeq: libc::c_long, - pub rtsp_next_server_CSeq: libc::c_long, - pub rtsp_CSeq_recv: libc::c_long, - pub infilesize: curl_off_t, - pub drain: size_t, - pub fread_func: curl_read_callback, - pub in_0: *mut libc::c_void, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub uh: *mut CURLU, - pub up: urlpieces, - pub httpreq: Curl_HttpReq, - pub url: *mut libc::c_char, - pub referer: *mut libc::c_char, - pub cookielist: *mut curl_slist, - pub resolve: *mut curl_slist, - pub trailers_bytes_sent: size_t, - pub trailers_buf: dynbuf, - pub trailers_state: trailers_state, - pub aptr: dynamically_allocated_data, - #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] - #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] - #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] - #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] - #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] - #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] - #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] - #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] - #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] - #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] - #[bitfield(name = "done", ty = "bit", bits = "12..=12")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] - #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] - #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] - #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] - #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] - #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] - #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: - [u8; 3], - #[bitfield(padding)] - pub c2rust_padding_0: [u8; 5], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; -pub const TRAILERS_DONE: trailers_state = 3; -pub const TRAILERS_SENDING: trailers_state = 2; -pub const TRAILERS_INITIALIZED: trailers_state = 1; -pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; -pub const HTTPREQ_HEAD: Curl_HttpReq = 5; -pub const HTTPREQ_PUT: Curl_HttpReq = 4; -pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; -pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; -pub const HTTPREQ_POST: Curl_HttpReq = 1; -pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} -pub type CURLU = Curl_URL; -pub type curl_read_callback = - Option size_t>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; -pub const EXPIRE_LAST: expire_id = 13; -pub const EXPIRE_QUIC: expire_id = 12; -pub const EXPIRE_TOOFAST: expire_id = 11; -pub const EXPIRE_TIMEOUT: expire_id = 10; -pub const EXPIRE_SPEEDCHECK: expire_id = 9; -pub const EXPIRE_RUN_NOW: expire_id = 8; -pub const EXPIRE_MULTI_PENDING: expire_id = 7; -pub const EXPIRE_HAPPY_EYEBALLS: expire_id = 6; -pub const EXPIRE_HAPPY_EYEBALLS_DNS: expire_id = 5; -pub const EXPIRE_DNS_PER_NAME2: expire_id = 4; -pub const EXPIRE_DNS_PER_NAME: expire_id = 3; -pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; -pub const EXPIRE_ASYNC_NAME: expire_id = 1; -pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Curl_async { - pub hostname: *mut libc::c_char, - pub dns: *mut Curl_dns_entry, - pub tdata: *mut thread_data, - pub resolver: *mut libc::c_void, - pub port: libc::c_int, - pub status: libc::c_int, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - pub done: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl_session { - pub name: *mut libc::c_char, - pub conn_to_host: *mut libc::c_char, - pub scheme: *const libc::c_char, - pub sessionid: *mut libc::c_void, - pub idsize: size_t, - pub age: libc::c_long, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub ssl_config: ssl_primary_config, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_primary_config { - pub version: libc::c_long, - pub version_max: libc::c_long, - pub CApath: *mut libc::c_char, - pub CAfile: *mut libc::c_char, - pub issuercert: *mut libc::c_char, - pub clientcert: *mut libc::c_char, - pub random_file: *mut libc::c_char, - pub egdsocket: *mut libc::c_char, - pub cipher_list: *mut libc::c_char, - pub cipher_list13: *mut libc::c_char, - pub pinned_key: *mut libc::c_char, - pub cert_blob: *mut curl_blob, - pub ca_info_blob: *mut curl_blob, - pub issuercert_blob: *mut curl_blob, - pub curves: *mut libc::c_char, - #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] - #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] - #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] - #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] - pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct conncache { - pub hash: Curl_hash, - pub num_conn: size_t, - pub next_connection_id: libc::c_long, - pub last_cleanup: curltime, - pub closure_handle: *mut Curl_easy, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option ()>; -pub type comp_function = - Option size_t>; -pub type hash_function = Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UserDefined { - pub err: *mut FILE, - pub debugdata: *mut libc::c_void, - pub errorbuffer: *mut libc::c_char, - pub proxyport: libc::c_long, - pub out: *mut libc::c_void, - pub in_set: *mut libc::c_void, - pub writeheader: *mut libc::c_void, - pub rtp_out: *mut libc::c_void, - pub use_port: libc::c_long, - pub httpauth: libc::c_ulong, - pub proxyauth: libc::c_ulong, - pub socks5auth: libc::c_ulong, - pub maxredirs: libc::c_long, - pub keep_post: libc::c_int, - pub postfields: *mut libc::c_void, - pub seek_func: curl_seek_callback, - pub postfieldsize: curl_off_t, - pub localport: libc::c_ushort, - pub localportrange: libc::c_int, - pub fwrite_func: curl_write_callback, - pub fwrite_header: curl_write_callback, - pub fwrite_rtp: curl_write_callback, - pub fread_func_set: curl_read_callback, - pub fprogress: curl_progress_callback, - pub fxferinfo: curl_xferinfo_callback, - pub fdebug: curl_debug_callback, - pub ioctl_func: curl_ioctl_callback, - pub fsockopt: curl_sockopt_callback, - pub sockopt_client: *mut libc::c_void, - pub fopensocket: curl_opensocket_callback, - pub opensocket_client: *mut libc::c_void, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub seek_client: *mut libc::c_void, - pub convfromnetwork: curl_conv_callback, - pub convtonetwork: curl_conv_callback, - pub convfromutf8: curl_conv_callback, - pub hsts_read: curl_hstsread_callback, - pub hsts_read_userp: *mut libc::c_void, - pub hsts_write: curl_hstswrite_callback, - pub hsts_write_userp: *mut libc::c_void, - pub progress_client: *mut libc::c_void, - pub ioctl_client: *mut libc::c_void, - pub timeout: libc::c_long, - pub connecttimeout: libc::c_long, - pub accepttimeout: libc::c_long, - pub happy_eyeballs_timeout: libc::c_long, - pub server_response_timeout: libc::c_long, - pub maxage_conn: libc::c_long, - pub tftp_blksize: libc::c_long, - pub filesize: curl_off_t, - pub low_speed_limit: libc::c_long, - pub low_speed_time: libc::c_long, - pub max_send_speed: curl_off_t, - pub max_recv_speed: curl_off_t, - pub set_resume_from: curl_off_t, - pub headers: *mut curl_slist, - pub proxyheaders: *mut curl_slist, - pub httppost: *mut curl_httppost, - pub mimepost: curl_mimepart, - pub quote: *mut curl_slist, - pub postquote: *mut curl_slist, - pub prequote: *mut curl_slist, - pub source_quote: *mut curl_slist, - pub source_prequote: *mut curl_slist, - pub source_postquote: *mut curl_slist, - pub telnet_options: *mut curl_slist, - pub resolve: *mut curl_slist, - pub connect_to: *mut curl_slist, - pub timecondition: curl_TimeCond, - pub proxytype: curl_proxytype, - pub timevalue: time_t, - pub method: Curl_HttpReq, - pub httpwant: libc::c_uchar, - pub ssl: ssl_config_data, - pub proxy_ssl: ssl_config_data, - pub general_ssl: ssl_general_config, - pub dns_cache_timeout: libc::c_long, - pub buffer_size: libc::c_long, - pub upload_buffer_size: libc::c_uint, - pub private_data: *mut libc::c_void, - pub http200aliases: *mut curl_slist, - pub ipver: libc::c_uchar, - pub max_filesize: curl_off_t, - pub ftp_filemethod: curl_ftpfile, - pub ftpsslauth: curl_ftpauth, - pub ftp_ccc: curl_ftpccc, - pub ftp_create_missing_dirs: libc::c_int, - pub ssh_keyfunc: curl_sshkeycallback, - pub ssh_keyfunc_userp: *mut libc::c_void, - pub use_netrc: CURL_NETRC_OPTION, - pub use_ssl: curl_usessl, - pub new_file_perms: libc::c_long, - pub new_directory_perms: libc::c_long, - pub ssh_auth_types: libc::c_long, - pub str_0: [*mut libc::c_char; 80], - pub blobs: [*mut curl_blob; 8], - pub scope_id: libc::c_uint, - pub allowed_protocols: libc::c_long, - pub redir_protocols: libc::c_long, - pub mail_rcpt: *mut curl_slist, - pub rtspreq: Curl_RtspReq, - pub rtspversion: libc::c_long, - pub chunk_bgn: curl_chunk_bgn_callback, - pub chunk_end: curl_chunk_end_callback, - pub fnmatch: curl_fnmatch_callback, - pub fnmatch_data: *mut libc::c_void, - pub gssapi_delegation: libc::c_long, - pub tcp_keepidle: libc::c_long, - pub tcp_keepintvl: libc::c_long, - pub maxconnects: size_t, - pub expect_100_timeout: libc::c_long, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub stream_dependents: *mut Curl_http2_dep, - pub resolver_start: curl_resolver_start_callback, - pub resolver_start_client: *mut libc::c_void, - pub upkeep_interval_ms: libc::c_long, - pub fmultidone: multidone_func, - pub dohfor: *mut Curl_easy, - pub uh: *mut CURLU, - pub trailer_data: *mut libc::c_void, - pub trailer_callback: curl_trailer_callback, - #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] - #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] - #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] - #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] - #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] - #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] - #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] - #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] - #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] - #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] - #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] - #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] - #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] - #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] - #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] - #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] - #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] - #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] - #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] - #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] - #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] - #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] - #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] - #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] - #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] - #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] - #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] - #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] - #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] - #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] - #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] - #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] - #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] - #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] - #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] - #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] - #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] - #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] - #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] - #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] - #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] - #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] - #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] - #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] - #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] - #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] - #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] - #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] - #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] - #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] - #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] - #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] - #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] - #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: - [u8; 8], -} -pub type curl_trailer_callback = - Option libc::c_int>; -pub type multidone_func = Option libc::c_int>; -pub type CURLcode = libc::c_uint; -pub const CURL_LAST: CURLcode = 99; -pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; -pub const CURLE_PROXY: CURLcode = 97; -pub const CURLE_QUIC_CONNECT_ERROR: CURLcode = 96; -pub const CURLE_HTTP3: CURLcode = 95; -pub const CURLE_AUTH_ERROR: CURLcode = 94; -pub const CURLE_RECURSIVE_API_CALL: CURLcode = 93; -pub const CURLE_HTTP2_STREAM: CURLcode = 92; -pub const CURLE_SSL_INVALIDCERTSTATUS: CURLcode = 91; -pub const CURLE_SSL_PINNEDPUBKEYNOTMATCH: CURLcode = 90; -pub const CURLE_NO_CONNECTION_AVAILABLE: CURLcode = 89; -pub const CURLE_CHUNK_FAILED: CURLcode = 88; -pub const CURLE_FTP_BAD_FILE_LIST: CURLcode = 87; -pub const CURLE_RTSP_SESSION_ERROR: CURLcode = 86; -pub const CURLE_RTSP_CSEQ_ERROR: CURLcode = 85; -pub const CURLE_FTP_PRET_FAILED: CURLcode = 84; -pub const CURLE_SSL_ISSUER_ERROR: CURLcode = 83; -pub const CURLE_SSL_CRL_BADFILE: CURLcode = 82; -pub const CURLE_AGAIN: CURLcode = 81; -pub const CURLE_SSL_SHUTDOWN_FAILED: CURLcode = 80; -pub const CURLE_SSH: CURLcode = 79; -pub const CURLE_REMOTE_FILE_NOT_FOUND: CURLcode = 78; -pub const CURLE_SSL_CACERT_BADFILE: CURLcode = 77; -pub const CURLE_CONV_REQD: CURLcode = 76; -pub const CURLE_CONV_FAILED: CURLcode = 75; -pub const CURLE_TFTP_NOSUCHUSER: CURLcode = 74; -pub const CURLE_REMOTE_FILE_EXISTS: CURLcode = 73; -pub const CURLE_TFTP_UNKNOWNID: CURLcode = 72; -pub const CURLE_TFTP_ILLEGAL: CURLcode = 71; -pub const CURLE_REMOTE_DISK_FULL: CURLcode = 70; -pub const CURLE_TFTP_PERM: CURLcode = 69; -pub const CURLE_TFTP_NOTFOUND: CURLcode = 68; -pub const CURLE_LOGIN_DENIED: CURLcode = 67; -pub const CURLE_SSL_ENGINE_INITFAILED: CURLcode = 66; -pub const CURLE_SEND_FAIL_REWIND: CURLcode = 65; -pub const CURLE_USE_SSL_FAILED: CURLcode = 64; -pub const CURLE_FILESIZE_EXCEEDED: CURLcode = 63; -pub const CURLE_LDAP_INVALID_URL: CURLcode = 62; -pub const CURLE_BAD_CONTENT_ENCODING: CURLcode = 61; -pub const CURLE_PEER_FAILED_VERIFICATION: CURLcode = 60; -pub const CURLE_SSL_CIPHER: CURLcode = 59; -pub const CURLE_SSL_CERTPROBLEM: CURLcode = 58; -pub const CURLE_OBSOLETE57: CURLcode = 57; -pub const CURLE_RECV_ERROR: CURLcode = 56; -pub const CURLE_SEND_ERROR: CURLcode = 55; -pub const CURLE_SSL_ENGINE_SETFAILED: CURLcode = 54; -pub const CURLE_SSL_ENGINE_NOTFOUND: CURLcode = 53; -pub const CURLE_GOT_NOTHING: CURLcode = 52; -pub const CURLE_OBSOLETE51: CURLcode = 51; -pub const CURLE_OBSOLETE50: CURLcode = 50; -pub const CURLE_SETOPT_OPTION_SYNTAX: CURLcode = 49; -pub const CURLE_UNKNOWN_OPTION: CURLcode = 48; -pub const CURLE_TOO_MANY_REDIRECTS: CURLcode = 47; -pub const CURLE_OBSOLETE46: CURLcode = 46; -pub const CURLE_INTERFACE_FAILED: CURLcode = 45; -pub const CURLE_OBSOLETE44: CURLcode = 44; -pub const CURLE_BAD_FUNCTION_ARGUMENT: CURLcode = 43; -pub const CURLE_ABORTED_BY_CALLBACK: CURLcode = 42; -pub const CURLE_FUNCTION_NOT_FOUND: CURLcode = 41; -pub const CURLE_OBSOLETE40: CURLcode = 40; -pub const CURLE_LDAP_SEARCH_FAILED: CURLcode = 39; -pub const CURLE_LDAP_CANNOT_BIND: CURLcode = 38; -pub const CURLE_FILE_COULDNT_READ_FILE: CURLcode = 37; -pub const CURLE_BAD_DOWNLOAD_RESUME: CURLcode = 36; -pub const CURLE_SSL_CONNECT_ERROR: CURLcode = 35; -pub const CURLE_HTTP_POST_ERROR: CURLcode = 34; -pub const CURLE_RANGE_ERROR: CURLcode = 33; -pub const CURLE_OBSOLETE32: CURLcode = 32; -pub const CURLE_FTP_COULDNT_USE_REST: CURLcode = 31; -pub const CURLE_FTP_PORT_FAILED: CURLcode = 30; -pub const CURLE_OBSOLETE29: CURLcode = 29; -pub const CURLE_OPERATION_TIMEDOUT: CURLcode = 28; -pub const CURLE_OUT_OF_MEMORY: CURLcode = 27; -pub const CURLE_READ_ERROR: CURLcode = 26; -pub const CURLE_UPLOAD_FAILED: CURLcode = 25; -pub const CURLE_OBSOLETE24: CURLcode = 24; -pub const CURLE_WRITE_ERROR: CURLcode = 23; -pub const CURLE_HTTP_RETURNED_ERROR: CURLcode = 22; -pub const CURLE_QUOTE_ERROR: CURLcode = 21; -pub const CURLE_OBSOLETE20: CURLcode = 20; -pub const CURLE_FTP_COULDNT_RETR_FILE: CURLcode = 19; -pub const CURLE_PARTIAL_FILE: CURLcode = 18; -pub const CURLE_FTP_COULDNT_SET_TYPE: CURLcode = 17; -pub const CURLE_HTTP2: CURLcode = 16; -pub const CURLE_FTP_CANT_GET_HOST: CURLcode = 15; -pub const CURLE_FTP_WEIRD_227_FORMAT: CURLcode = 14; -pub const CURLE_FTP_WEIRD_PASV_REPLY: CURLcode = 13; -pub const CURLE_FTP_ACCEPT_TIMEOUT: CURLcode = 12; -pub const CURLE_FTP_WEIRD_PASS_REPLY: CURLcode = 11; -pub const CURLE_FTP_ACCEPT_FAILED: CURLcode = 10; -pub const CURLE_REMOTE_ACCESS_DENIED: CURLcode = 9; -pub const CURLE_WEIRD_SERVER_REPLY: CURLcode = 8; -pub const CURLE_COULDNT_CONNECT: CURLcode = 7; -pub const CURLE_COULDNT_RESOLVE_HOST: CURLcode = 6; -pub const CURLE_COULDNT_RESOLVE_PROXY: CURLcode = 5; -pub const CURLE_NOT_BUILT_IN: CURLcode = 4; -pub const CURLE_URL_MALFORMAT: CURLcode = 3; -pub const CURLE_FAILED_INIT: CURLcode = 2; -pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; -pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void, *mut libc::c_void) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_http2_dep { - pub next: *mut Curl_http2_dep, - pub data: *mut Curl_easy, -} -pub type curl_fnmatch_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option libc::c_long>; -pub type curl_chunk_bgn_callback = Option< - unsafe extern "C" fn(*const libc::c_void, *mut libc::c_void, libc::c_int) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; -pub const RTSPREQ_LAST: Curl_RtspReq = 12; -pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; -pub const RTSPREQ_RECORD: Curl_RtspReq = 10; -pub const RTSPREQ_SET_PARAMETER: Curl_RtspReq = 9; -pub const RTSPREQ_GET_PARAMETER: Curl_RtspReq = 8; -pub const RTSPREQ_TEARDOWN: Curl_RtspReq = 7; -pub const RTSPREQ_PAUSE: Curl_RtspReq = 6; -pub const RTSPREQ_PLAY: Curl_RtspReq = 5; -pub const RTSPREQ_SETUP: Curl_RtspReq = 4; -pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; -pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; -pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; -pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; -pub const CURLUSESSL_LAST: curl_usessl = 4; -pub const CURLUSESSL_ALL: curl_usessl = 3; -pub const CURLUSESSL_CONTROL: curl_usessl = 2; -pub const CURLUSESSL_TRY: curl_usessl = 1; -pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; -pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; -pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; -pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; -pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option< - unsafe extern "C" fn( - *mut CURL, - *const curl_khkey, - *const curl_khkey, - curl_khmatch, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_khmatch = libc::c_uint; -pub const CURLKHMATCH_LAST: curl_khmatch = 3; -pub const CURLKHMATCH_MISSING: curl_khmatch = 2; -pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; -pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; -pub const CURLKHTYPE_ED25519: curl_khtype = 5; -pub const CURLKHTYPE_ECDSA: curl_khtype = 4; -pub const CURLKHTYPE_DSS: curl_khtype = 3; -pub const CURLKHTYPE_RSA: curl_khtype = 2; -pub const CURLKHTYPE_RSA1: curl_khtype = 1; -pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; -pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; -pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; -pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; -pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; -pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; -pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; -pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; -pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; -pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; -pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; -pub const FTPFILE_NOCWD: curl_ftpfile = 2; -pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_config_data { - pub primary: ssl_primary_config, - pub certverifyresult: libc::c_long, - pub CRLfile: *mut libc::c_char, - pub fsslctx: curl_ssl_ctx_callback, - pub fsslctxp: *mut libc::c_void, - pub cert_type: *mut libc::c_char, - pub key: *mut libc::c_char, - pub key_blob: *mut curl_blob, - pub key_type: *mut libc::c_char, - pub key_passwd: *mut libc::c_char, - pub username: *mut libc::c_char, - pub password: *mut libc::c_char, - pub authtype: CURL_TLSAUTH, - #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] - #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] - #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] - #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] - #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] - #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] - #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] - #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: - [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type CURL_TLSAUTH = libc::c_uint; -pub const CURL_TLSAUTH_LAST: CURL_TLSAUTH = 2; -pub const CURL_TLSAUTH_SRP: CURL_TLSAUTH = 1; -pub const CURL_TLSAUTH_NONE: CURL_TLSAUTH = 0; -pub type curl_ssl_ctx_callback = - Option CURLcode>; -pub type curl_proxytype = libc::c_uint; -pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; -pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; -pub const CURLPROXY_SOCKS5: curl_proxytype = 5; -pub const CURLPROXY_SOCKS4: curl_proxytype = 4; -pub const CURLPROXY_HTTPS: curl_proxytype = 2; -pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; -pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; -pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; -pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; -pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; -pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; -pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mimepart { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mime, - pub nextpart: *mut curl_mimepart, - pub kind: mimekind, - pub flags: libc::c_uint, - pub data: *mut libc::c_char, - pub readfunc: curl_read_callback, - pub seekfunc: curl_seek_callback, - pub freefunc: curl_free_callback, - pub arg: *mut libc::c_void, - pub fp: *mut FILE, - pub curlheaders: *mut curl_slist, - pub userheaders: *mut curl_slist, - pub mimetype: *mut libc::c_char, - pub filename: *mut libc::c_char, - pub name: *mut libc::c_char, - pub datasize: curl_off_t, - pub state: mime_state, - pub encoder: *const mime_encoder, - pub encstate: mime_encoder_state, - pub lastreadstatus: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder { - pub name: *const libc::c_char, - pub encodefunc: - Option size_t>, - pub sizefunc: Option curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, -} -pub type mimestate = libc::c_uint; -pub const MIMESTATE_LAST: mimestate = 9; -pub const MIMESTATE_END: mimestate = 8; -pub const MIMESTATE_CONTENT: mimestate = 7; -pub const MIMESTATE_BOUNDARY2: mimestate = 6; -pub const MIMESTATE_BOUNDARY1: mimestate = 5; -pub const MIMESTATE_BODY: mimestate = 4; -pub const MIMESTATE_EOH: mimestate = 3; -pub const MIMESTATE_USERHEADERS: mimestate = 2; -pub const MIMESTATE_CURLHEADERS: mimestate = 1; -pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option ()>; -pub type curl_seek_callback = - Option libc::c_int>; -pub type mimekind = libc::c_uint; -pub const MIMEKIND_LAST: mimekind = 5; -pub const MIMEKIND_MULTIPART: mimekind = 4; -pub const MIMEKIND_CALLBACK: mimekind = 3; -pub const MIMEKIND_FILE: mimekind = 2; -pub const MIMEKIND_DATA: mimekind = 1; -pub const MIMEKIND_NONE: mimekind = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mime { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mimepart, - pub firstpart: *mut curl_mimepart, - pub lastpart: *mut curl_mimepart, - pub boundary: [libc::c_char; 41], - pub state: mime_state, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut curl_index, - *mut libc::c_void, - ) -> CURLSTScode, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; -pub const CURLSTS_FAIL: CURLSTScode = 2; -pub const CURLSTS_DONE: CURLSTScode = 1; -pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = - Option CURLSTScode>; -pub type curl_conv_callback = Option CURLcode>; -pub type curl_closesocket_callback = - Option libc::c_int>; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, curlsocktype, *mut curl_sockaddr) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; -pub const CURLSOCKTYPE_LAST: curlsocktype = 2; -pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; -pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = - Option libc::c_int>; -pub type curl_ioctl_callback = - Option curlioerr>; -pub type curlioerr = libc::c_uint; -pub const CURLIOE_LAST: curlioerr = 3; -pub const CURLIOE_FAILRESTART: curlioerr = 2; -pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; -pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_infotype = libc::c_uint; -pub const CURLINFO_END: curl_infotype = 7; -pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; -pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; -pub const CURLINFO_DATA_OUT: curl_infotype = 4; -pub const CURLINFO_DATA_IN: curl_infotype = 3; -pub const CURLINFO_HEADER_OUT: curl_infotype = 2; -pub const CURLINFO_HEADER_IN: curl_infotype = 1; -pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, ->; -pub type curl_progress_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, - ) -> libc::c_int, ->; -pub type curl_write_callback = - Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct SingleRequest { - pub size: curl_off_t, - pub maxdownload: curl_off_t, - pub bytecount: curl_off_t, - pub writebytecount: curl_off_t, - pub headerbytecount: curl_off_t, - pub deductheadercount: curl_off_t, - pub pendingheader: curl_off_t, - pub start: curltime, - pub now: curltime, - pub badheader: C2RustUnnamed_1, - pub headerline: libc::c_int, - pub str_0: *mut libc::c_char, - pub offset: curl_off_t, - pub httpcode: libc::c_int, - pub keepon: libc::c_int, - pub start100: curltime, - pub exp100: expect100, - pub upgr101: upgrade101, - pub writer_stack: *mut contenc_writer, - pub timeofdoc: time_t, - pub bodywrites: libc::c_long, - pub location: *mut libc::c_char, - pub newurl: *mut libc::c_char, - pub upload_present: ssize_t, - pub upload_fromhere: *mut libc::c_char, - pub p: C2RustUnnamed, - pub doh: *mut dohdata, - #[bitfield(name = "header", ty = "bit", bits = "0..=0")] - #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] - #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] - #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] - #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] - #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] - #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] - #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] - #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: - [u8; 2], - #[bitfield(padding)] - pub c2rust_padding: [u8; 6], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dohdata { - pub headers: *mut curl_slist, - pub probe: [dnsprobe; 2], - pub pending: libc::c_uint, - pub port: libc::c_int, - pub host: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dnsprobe { - pub easy: *mut CURL, - pub dnstype: libc::c_int, - pub dohbuffer: [libc::c_uchar; 512], - pub dohlen: size_t, - pub serverdoh: dynbuf, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed { - pub file: *mut FILEPROTO, - pub ftp: *mut FTP, - pub http: *mut HTTP, - pub imap: *mut IMAP, - pub ldap: *mut ldapreqinfo, - pub mqtt: *mut MQTT, - pub pop3: *mut POP3, - pub rtsp: *mut RTSP, - pub smb: *mut smb_request, - pub smtp: *mut SMTP, - pub ssh: *mut SSHPROTO, - pub telnet: *mut TELNET, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; -pub const PPTRANSFER_NONE: curl_pp_transfer = 2; -pub const PPTRANSFER_INFO: curl_pp_transfer = 1; -pub const PPTRANSFER_BODY: curl_pp_transfer = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct RTSP { - pub http_wrapper: HTTP, - pub CSeq_sent: libc::c_long, - pub CSeq_recv: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HTTP { - pub sendit: *mut curl_mimepart, - pub postsize: curl_off_t, - pub postdata: *const libc::c_char, - pub p_pragma: *const libc::c_char, - pub form: curl_mimepart, - pub backup: back, - pub sending: C2RustUnnamed_0, - pub send_buffer: dynbuf, - pub stream_id: int32_t, - pub bodystarted: bool, - pub header_recvbuf: dynbuf, - pub nread_header_recvbuf: size_t, - pub trailer_recvbuf: dynbuf, - pub status_code: libc::c_int, - pub pausedata: *const uint8_t, - pub pauselen: size_t, - pub close_handled: bool, - pub push_headers: *mut *mut libc::c_char, - pub push_headers_used: size_t, - pub push_headers_alloc: size_t, - pub error: uint32_t, - pub closed: bool, - pub mem: *mut libc::c_char, - pub len: size_t, - pub memlen: size_t, - pub upload_mem: *const uint8_t, - pub upload_len: size_t, - pub upload_left: curl_off_t, -} -pub type uint8_t = __uint8_t; -pub type uint32_t = __uint32_t; -pub type C2RustUnnamed_0 = libc::c_uint; -pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; -pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; -pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct contenc_writer { - pub handler: *const content_encoding, - pub downstream: *mut contenc_writer, - pub params: *mut libc::c_void, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct content_encoding { - pub name: *const libc::c_char, - pub alias: *const libc::c_char, - pub init_writer: Option CURLcode>, - pub unencode_write: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut contenc_writer, - *const libc::c_char, - size_t, - ) -> CURLcode, - >, - pub close_writer: Option ()>, - pub paramsize: size_t, -} -pub type upgrade101 = libc::c_uint; -pub const UPGR101_WORKING: upgrade101 = 3; -pub const UPGR101_RECEIVED: upgrade101 = 2; -pub const UPGR101_REQUESTED: upgrade101 = 1; -pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; -pub const EXP100_FAILED: expect100 = 3; -pub const EXP100_SENDING_REQUEST: expect100 = 2; -pub const EXP100_AWAITING_CONTINUE: expect100 = 1; -pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; -pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; -pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; -pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct PslCache { - pub psl: *const psl_ctx_t, - pub expires: time_t, - pub dynamic: bool, -} -pub type psl_ctx_t = psl_ctx_st; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_multi { - pub magic: libc::c_uint, - pub easyp: *mut Curl_easy, - pub easylp: *mut Curl_easy, - pub num_easy: libc::c_int, - pub num_alive: libc::c_int, - pub msglist: Curl_llist, - pub pending: Curl_llist, - pub socket_cb: curl_socket_callback, - pub socket_userp: *mut libc::c_void, - pub push_cb: curl_push_callback, - pub push_userp: *mut libc::c_void, - pub hostcache: Curl_hash, - pub psl: PslCache, - pub timetree: *mut Curl_tree, - pub sockhash: Curl_hash, - pub conn_cache: conncache, - pub maxconnects: libc::c_long, - pub max_host_connections: libc::c_long, - pub max_total_connections: libc::c_long, - pub timer_cb: curl_multi_timer_callback, - pub timer_userp: *mut libc::c_void, - pub timer_lastcall: curltime, - pub max_concurrent_streams: libc::c_uint, - pub wakeup_pair: [curl_socket_t; 2], - pub multiplexing: bool, - pub recheckstate: bool, - pub in_callback: bool, - pub ipv6_works: bool, - pub ssl_seeded: bool, -} -pub type curl_multi_timer_callback = - Option libc::c_int>; -pub type CURLM = Curl_multi; -pub type curl_push_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut CURL, - size_t, - *mut curl_pushheaders, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_socket_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_socket_t, - libc::c_int, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; -pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; -pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; -pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_message { - pub list: Curl_llist_element, - pub extmsg: CURLMsg, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CURLMsg { - pub msg: CURLMSG, - pub easy_handle: *mut CURL, - pub data: C2RustUnnamed_3, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_3 { - pub whatever: *mut libc::c_void, - pub result: CURLcode, -} -pub type CURLMSG = libc::c_uint; -pub const CURLMSG_LAST: CURLMSG = 2; -pub const CURLMSG_DONE: CURLMSG = 1; -pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; -pub const MSTATE_LAST: CURLMstate = 17; -pub const MSTATE_MSGSENT: CURLMstate = 16; -pub const MSTATE_COMPLETED: CURLMstate = 15; -pub const MSTATE_DONE: CURLMstate = 14; -pub const MSTATE_RATELIMITING: CURLMstate = 13; -pub const MSTATE_PERFORMING: CURLMstate = 12; -pub const MSTATE_DID: CURLMstate = 11; -pub const MSTATE_DOING_MORE: CURLMstate = 10; -pub const MSTATE_DOING: CURLMstate = 9; -pub const MSTATE_DO: CURLMstate = 8; -pub const MSTATE_PROTOCONNECTING: CURLMstate = 7; -pub const MSTATE_PROTOCONNECT: CURLMstate = 6; -pub const MSTATE_TUNNELING: CURLMstate = 5; -pub const MSTATE_CONNECTING: CURLMstate = 4; -pub const MSTATE_RESOLVING: CURLMstate = 3; -pub const MSTATE_CONNECT: CURLMstate = 2; -pub const MSTATE_PENDING: CURLMstate = 1; -pub const MSTATE_INIT: CURLMstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectdata { - pub cnnct: connstate, - pub bundle_node: Curl_llist_element, - pub chunk: Curl_chunker, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub connection_id: libc::c_long, - pub dns_entry: *mut Curl_dns_entry, - pub ip_addr: *mut Curl_addrinfo, - pub tempaddr: [*mut Curl_addrinfo; 2], - pub scope_id: libc::c_uint, - pub transport: C2RustUnnamed_5, - pub host: hostname, - pub hostname_resolve: *mut libc::c_char, - pub secondaryhostname: *mut libc::c_char, - pub conn_to_host: hostname, - pub socks_proxy: proxy_info, - pub http_proxy: proxy_info, - pub port: libc::c_int, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub secondary_port: libc::c_ushort, - pub primary_ip: [libc::c_char; 46], - pub ip_version: libc::c_uchar, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub options: *mut libc::c_char, - pub sasl_authzid: *mut libc::c_char, - pub httpversion: libc::c_uchar, - pub now: curltime, - pub created: curltime, - pub lastused: curltime, - pub sock: [curl_socket_t; 2], - pub tempsock: [curl_socket_t; 2], - pub tempfamily: [libc::c_int; 2], - pub recv: [Option; 2], - pub send: [Option; 2], - pub ssl: [ssl_connect_data; 2], - pub proxy_ssl: [ssl_connect_data; 2], - pub ssl_extra: *mut libc::c_void, - pub ssl_config: ssl_primary_config, - pub proxy_ssl_config: ssl_primary_config, - pub bits: ConnectBits, - pub num_addr: libc::c_int, - pub connecttime: curltime, - pub timeoutms_per_addr: [timediff_t; 2], - pub handler: *const Curl_handler, - pub given: *const Curl_handler, - pub keepalive: curltime, - pub sockfd: curl_socket_t, - pub writesockfd: curl_socket_t, - pub easyq: Curl_llist, - pub seek_func: curl_seek_callback, - pub seek_client: *mut libc::c_void, - pub http_ntlm_state: curlntlm, - pub proxy_ntlm_state: curlntlm, - pub ntlm: ntlmdata, - pub proxyntlm: ntlmdata, - pub trailer: dynbuf, - pub proto: C2RustUnnamed_4, - pub connect_state: *mut http_connect_state, - pub bundle: *mut connectbundle, - pub unix_domain_socket: *mut libc::c_char, - pub localdev: *mut libc::c_char, - pub localportrange: libc::c_int, - pub cselect_bits: libc::c_int, - pub waitfor: libc::c_int, - pub negnpn: libc::c_int, - pub localport: libc::c_ushort, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_4 { - pub ftpc: ftp_conn, - pub httpc: http_conn, - pub sshc: ssh_conn, - pub tftpc: *mut tftp_state_data, - pub imapc: imap_conn, - pub pop3c: pop3_conn, - pub smtpc: smtp_conn, - pub rtspc: rtsp_conn, - pub smbc: smb_conn, - pub rtmp: *mut libc::c_void, - pub ldapc: *mut ldapconninfo, - pub mqtt: mqtt_conn, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; -pub const MQTT_NOSTATE: mqttstate = 7; -pub const MQTT_PUB_REMAIN: mqttstate = 6; -pub const MQTT_PUBWAIT: mqttstate = 5; -pub const MQTT_SUBACK_COMING: mqttstate = 4; -pub const MQTT_SUBACK: mqttstate = 3; -pub const MQTT_CONNACK: mqttstate = 2; -pub const MQTT_REMAINING_LENGTH: mqttstate = 1; -pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; -pub const SMB_CONNECTED: smb_conn_state = 4; -pub const SMB_SETUP: smb_conn_state = 3; -pub const SMB_NEGOTIATE: smb_conn_state = 2; -pub const SMB_CONNECTING: smb_conn_state = 1; -pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smtp_conn { - pub pp: pingpong, - pub state: smtpstate, - pub ssldone: bool, - pub domain: *mut libc::c_char, - pub sasl: SASL, - pub tls_supported: bool, - pub size_supported: bool, - pub utf8_supported: bool, - pub auth_supported: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASL { - pub params: *const SASLproto, - pub state: saslstate, - pub authmechs: libc::c_ushort, - pub prefmech: libc::c_ushort, - pub authused: libc::c_ushort, - pub resetprefs: bool, - pub mutual_auth: bool, - pub force_ir: bool, -} -pub type saslstate = libc::c_uint; -pub const SASL_FINAL: saslstate = 17; -pub const SASL_CANCEL: saslstate = 16; -pub const SASL_GSASL: saslstate = 15; -pub const SASL_OAUTH2_RESP: saslstate = 14; -pub const SASL_OAUTH2: saslstate = 13; -pub const SASL_GSSAPI_NO_DATA: saslstate = 12; -pub const SASL_GSSAPI_TOKEN: saslstate = 11; -pub const SASL_GSSAPI: saslstate = 10; -pub const SASL_NTLM_TYPE2MSG: saslstate = 9; -pub const SASL_NTLM: saslstate = 8; -pub const SASL_DIGESTMD5_RESP: saslstate = 7; -pub const SASL_DIGESTMD5: saslstate = 6; -pub const SASL_CRAMMD5: saslstate = 5; -pub const SASL_EXTERNAL: saslstate = 4; -pub const SASL_LOGIN_PASSWD: saslstate = 3; -pub const SASL_LOGIN: saslstate = 2; -pub const SASL_PLAIN: saslstate = 1; -pub const SASL_STOP: saslstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASLproto { - pub service: *const libc::c_char, - pub contcode: libc::c_int, - pub finalcode: libc::c_int, - pub maxirlen: size_t, - pub sendauth: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - *const libc::c_char, - ) -> CURLcode, - >, - pub sendcont: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *const libc::c_char) -> CURLcode, - >, - pub getmessage: Option ()>, -} -pub type smtpstate = libc::c_uint; -pub const SMTP_LAST: smtpstate = 13; -pub const SMTP_QUIT: smtpstate = 12; -pub const SMTP_POSTDATA: smtpstate = 11; -pub const SMTP_DATA: smtpstate = 10; -pub const SMTP_RCPT: smtpstate = 9; -pub const SMTP_MAIL: smtpstate = 8; -pub const SMTP_COMMAND: smtpstate = 7; -pub const SMTP_AUTH: smtpstate = 6; -pub const SMTP_UPGRADETLS: smtpstate = 5; -pub const SMTP_STARTTLS: smtpstate = 4; -pub const SMTP_HELO: smtpstate = 3; -pub const SMTP_EHLO: smtpstate = 2; -pub const SMTP_SERVERGREET: smtpstate = 1; -pub const SMTP_STOP: smtpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pingpong { - pub cache: *mut libc::c_char, - pub cache_size: size_t, - pub nread_resp: size_t, - pub linestart_resp: *mut libc::c_char, - pub pending_resp: bool, - pub sendthis: *mut libc::c_char, - pub sendleft: size_t, - pub sendsize: size_t, - pub response: curltime, - pub response_time: timediff_t, - pub sendbuf: dynbuf, - pub statemachine: Option CURLcode>, - pub endofresp: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - >, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pop3_conn { - pub pp: pingpong, - pub state: pop3state, - pub ssldone: bool, - pub tls_supported: bool, - pub eob: size_t, - pub strip: size_t, - pub sasl: SASL, - pub authtypes: libc::c_uint, - pub preftype: libc::c_uint, - pub apoptimestamp: *mut libc::c_char, -} -pub type pop3state = libc::c_uint; -pub const POP3_LAST: pop3state = 11; -pub const POP3_QUIT: pop3state = 10; -pub const POP3_COMMAND: pop3state = 9; -pub const POP3_PASS: pop3state = 8; -pub const POP3_USER: pop3state = 7; -pub const POP3_APOP: pop3state = 6; -pub const POP3_AUTH: pop3state = 5; -pub const POP3_UPGRADETLS: pop3state = 4; -pub const POP3_STARTTLS: pop3state = 3; -pub const POP3_CAPA: pop3state = 2; -pub const POP3_SERVERGREET: pop3state = 1; -pub const POP3_STOP: pop3state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct imap_conn { - pub pp: pingpong, - pub state: imapstate, - pub ssldone: bool, - pub preauth: bool, - pub sasl: SASL, - pub preftype: libc::c_uint, - pub cmdid: libc::c_uint, - pub resptag: [libc::c_char; 5], - pub tls_supported: bool, - pub login_disabled: bool, - pub ir_supported: bool, - pub mailbox: *mut libc::c_char, - pub mailbox_uidvalidity: *mut libc::c_char, - pub dyn_0: dynbuf, -} -pub type imapstate = libc::c_uint; -pub const IMAP_LAST: imapstate = 15; -pub const IMAP_LOGOUT: imapstate = 14; -pub const IMAP_SEARCH: imapstate = 13; -pub const IMAP_APPEND_FINAL: imapstate = 12; -pub const IMAP_APPEND: imapstate = 11; -pub const IMAP_FETCH_FINAL: imapstate = 10; -pub const IMAP_FETCH: imapstate = 9; -pub const IMAP_SELECT: imapstate = 8; -pub const IMAP_LIST: imapstate = 7; -pub const IMAP_LOGIN: imapstate = 6; -pub const IMAP_AUTHENTICATE: imapstate = 5; -pub const IMAP_UPGRADETLS: imapstate = 4; -pub const IMAP_STARTTLS: imapstate = 3; -pub const IMAP_CAPABILITY: imapstate = 2; -pub const IMAP_SERVERGREET: imapstate = 1; -pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; -pub const SSH_LAST: sshstate = 60; -pub const SSH_QUIT: sshstate = 59; -pub const SSH_SESSION_FREE: sshstate = 58; -pub const SSH_SESSION_DISCONNECT: sshstate = 57; -pub const SSH_SCP_CHANNEL_FREE: sshstate = 56; -pub const SSH_SCP_WAIT_CLOSE: sshstate = 55; -pub const SSH_SCP_WAIT_EOF: sshstate = 54; -pub const SSH_SCP_SEND_EOF: sshstate = 53; -pub const SSH_SCP_DONE: sshstate = 52; -pub const SSH_SCP_DOWNLOAD: sshstate = 51; -pub const SSH_SCP_DOWNLOAD_INIT: sshstate = 50; -pub const SSH_SCP_UPLOAD_INIT: sshstate = 49; -pub const SSH_SCP_TRANS_INIT: sshstate = 48; -pub const SSH_SFTP_SHUTDOWN: sshstate = 47; -pub const SSH_SFTP_CLOSE: sshstate = 46; -pub const SSH_SFTP_DOWNLOAD_STAT: sshstate = 45; -pub const SSH_SFTP_DOWNLOAD_INIT: sshstate = 44; -pub const SSH_SFTP_READDIR_DONE: sshstate = 43; -pub const SSH_SFTP_READDIR_BOTTOM: sshstate = 42; -pub const SSH_SFTP_READDIR_LINK: sshstate = 41; -pub const SSH_SFTP_READDIR: sshstate = 40; -pub const SSH_SFTP_READDIR_INIT: sshstate = 39; -pub const SSH_SFTP_CREATE_DIRS_MKDIR: sshstate = 38; -pub const SSH_SFTP_CREATE_DIRS: sshstate = 37; -pub const SSH_SFTP_CREATE_DIRS_INIT: sshstate = 36; -pub const SSH_SFTP_UPLOAD_INIT: sshstate = 35; -pub const SSH_SFTP_TRANS_INIT: sshstate = 34; -pub const SSH_SFTP_FILETIME: sshstate = 33; -pub const SSH_SFTP_GETINFO: sshstate = 32; -pub const SSH_SFTP_QUOTE_STATVFS: sshstate = 31; -pub const SSH_SFTP_QUOTE_UNLINK: sshstate = 30; -pub const SSH_SFTP_QUOTE_RMDIR: sshstate = 29; -pub const SSH_SFTP_QUOTE_RENAME: sshstate = 28; -pub const SSH_SFTP_QUOTE_MKDIR: sshstate = 27; -pub const SSH_SFTP_QUOTE_SYMLINK: sshstate = 26; -pub const SSH_SFTP_QUOTE_SETSTAT: sshstate = 25; -pub const SSH_SFTP_QUOTE_STAT: sshstate = 24; -pub const SSH_SFTP_NEXT_QUOTE: sshstate = 23; -pub const SSH_SFTP_QUOTE: sshstate = 22; -pub const SSH_SFTP_POSTQUOTE_INIT: sshstate = 21; -pub const SSH_SFTP_QUOTE_INIT: sshstate = 20; -pub const SSH_SFTP_REALPATH: sshstate = 19; -pub const SSH_SFTP_INIT: sshstate = 18; -pub const SSH_AUTH_DONE: sshstate = 17; -pub const SSH_AUTH_GSSAPI: sshstate = 16; -pub const SSH_AUTH_KEY: sshstate = 15; -pub const SSH_AUTH_KEY_INIT: sshstate = 14; -pub const SSH_AUTH_HOST: sshstate = 13; -pub const SSH_AUTH_HOST_INIT: sshstate = 12; -pub const SSH_AUTH_AGENT: sshstate = 11; -pub const SSH_AUTH_AGENT_LIST: sshstate = 10; -pub const SSH_AUTH_AGENT_INIT: sshstate = 9; -pub const SSH_AUTH_PASS: sshstate = 8; -pub const SSH_AUTH_PASS_INIT: sshstate = 7; -pub const SSH_AUTH_PKEY: sshstate = 6; -pub const SSH_AUTH_PKEY_INIT: sshstate = 5; -pub const SSH_AUTHLIST: sshstate = 4; -pub const SSH_HOSTKEY: sshstate = 3; -pub const SSH_S_STARTUP: sshstate = 2; -pub const SSH_INIT: sshstate = 1; -pub const SSH_STOP: sshstate = 0; -pub const SSH_NO_STATE: sshstate = -1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct http_conn { - pub binsettings: [uint8_t; 80], - pub binlen: size_t, - pub trnsfr: *mut Curl_easy, - pub h2: *mut nghttp2_session, - pub send_underlying: Option, - pub recv_underlying: Option, - pub inbuf: *mut libc::c_char, - pub inbuflen: size_t, - pub nread_inbuf: size_t, - pub pause_stream_id: int32_t, - pub drain_total: size_t, - pub settings: h2settings, - pub local_settings: [nghttp2_settings_entry; 3], - pub local_settings_num: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct nghttp2_settings_entry { - pub settings_id: int32_t, - pub value: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct h2settings { - pub max_concurrent_streams: uint32_t, - pub enable_push: bool, -} -pub type Curl_recv = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *mut libc::c_char, - size_t, - *mut CURLcode, -) -> ssize_t; -pub type Curl_send = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *const libc::c_void, - size_t, - *mut CURLcode, -) -> ssize_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_conn { - pub pp: pingpong, - pub entrypath: *mut libc::c_char, - pub file: *mut libc::c_char, - pub dirs: *mut *mut libc::c_char, - pub dirdepth: libc::c_int, - pub dont_check: bool, - pub ctl_valid: bool, - pub cwddone: bool, - pub cwdcount: libc::c_int, - pub cwdfail: bool, - pub wait_data_conn: bool, - pub newport: libc::c_ushort, - pub newhost: *mut libc::c_char, - pub prevpath: *mut libc::c_char, - pub transfertype: libc::c_char, - pub count1: libc::c_int, - pub count2: libc::c_int, - pub count3: libc::c_int, - pub state: ftpstate, - pub state_saved: ftpstate, - pub retr_size_saved: curl_off_t, - pub server_os: *mut libc::c_char, - pub known_filesize: curl_off_t, -} -pub type ftpstate = libc::c_uint; -pub const FTP_LAST: ftpstate = 35; -pub const FTP_QUIT: ftpstate = 34; -pub const FTP_STOR: ftpstate = 33; -pub const FTP_RETR: ftpstate = 32; -pub const FTP_LIST: ftpstate = 31; -pub const FTP_PASV: ftpstate = 30; -pub const FTP_PRET: ftpstate = 29; -pub const FTP_PORT: ftpstate = 28; -pub const FTP_RETR_REST: ftpstate = 27; -pub const FTP_REST: ftpstate = 26; -pub const FTP_STOR_SIZE: ftpstate = 25; -pub const FTP_RETR_SIZE: ftpstate = 24; -pub const FTP_SIZE: ftpstate = 23; -pub const FTP_STOR_TYPE: ftpstate = 22; -pub const FTP_RETR_TYPE: ftpstate = 21; -pub const FTP_LIST_TYPE: ftpstate = 20; -pub const FTP_TYPE: ftpstate = 19; -pub const FTP_MDTM: ftpstate = 18; -pub const FTP_MKD: ftpstate = 17; -pub const FTP_CWD: ftpstate = 16; -pub const FTP_POSTQUOTE: ftpstate = 15; -pub const FTP_STOR_PREQUOTE: ftpstate = 14; -pub const FTP_RETR_PREQUOTE: ftpstate = 13; -pub const FTP_QUOTE: ftpstate = 12; -pub const FTP_NAMEFMT: ftpstate = 11; -pub const FTP_SYST: ftpstate = 10; -pub const FTP_PWD: ftpstate = 9; -pub const FTP_CCC: ftpstate = 8; -pub const FTP_PROT: ftpstate = 7; -pub const FTP_PBSZ: ftpstate = 6; -pub const FTP_ACCT: ftpstate = 5; -pub const FTP_PASS: ftpstate = 4; -pub const FTP_USER: ftpstate = 3; -pub const FTP_AUTH: ftpstate = 2; -pub const FTP_WAIT220: ftpstate = 1; -pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ntlmdata { - pub flags: libc::c_uint, - pub nonce: [libc::c_uchar; 8], - pub target_info_len: libc::c_uint, - pub target_info: *mut libc::c_void, - pub ntlm_auth_hlpr_socket: curl_socket_t, - pub ntlm_auth_hlpr_pid: pid_t, - pub challenge: *mut libc::c_char, - pub response: *mut libc::c_char, -} -pub type curlntlm = libc::c_uint; -pub const NTLMSTATE_LAST: curlntlm = 4; -pub const NTLMSTATE_TYPE3: curlntlm = 3; -pub const NTLMSTATE_TYPE2: curlntlm = 2; -pub const NTLMSTATE_TYPE1: curlntlm = 1; -pub const NTLMSTATE_NONE: curlntlm = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_handler { - pub scheme: *const libc::c_char, - pub setup_connection: - Option CURLcode>, - pub do_it: Option CURLcode>, - pub done: Option CURLcode>, - pub do_more: Option CURLcode>, - pub connect_it: Option CURLcode>, - pub connecting: Option CURLcode>, - pub doing: Option CURLcode>, - pub proto_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub doing_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub domore_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub perform_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub disconnect: - Option CURLcode>, - pub readwrite: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut ssize_t, *mut bool) -> CURLcode, - >, - pub connection_check: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_uint) -> libc::c_uint, - >, - pub attach: Option ()>, - pub defport: libc::c_int, - pub protocol: libc::c_uint, - pub family: libc::c_uint, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: - [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_connect_data { - pub state: ssl_connection_state, - pub connecting_state: ssl_connect_state, - pub backend: *mut ssl_backend_data, - #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] - pub use_0: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type ssl_connect_state = libc::c_uint; -pub const ssl_connect_done: ssl_connect_state = 5; -pub const ssl_connect_3: ssl_connect_state = 4; -pub const ssl_connect_2_writing: ssl_connect_state = 3; -pub const ssl_connect_2_reading: ssl_connect_state = 2; -pub const ssl_connect_2: ssl_connect_state = 1; -pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; -pub const ssl_connection_complete: ssl_connection_state = 2; -pub const ssl_connection_negotiating: ssl_connection_state = 1; -pub const ssl_connection_none: ssl_connection_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_5 = libc::c_uint; -pub const TRNSPRT_QUIC: C2RustUnnamed_5 = 5; -pub const TRNSPRT_UDP: C2RustUnnamed_5 = 4; -pub const TRNSPRT_TCP: C2RustUnnamed_5 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; -pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; -pub const CHUNK_TRAILER_CR: ChunkyState = 6; -pub const CHUNK_TRAILER: ChunkyState = 5; -pub const CHUNK_STOP: ChunkyState = 4; -pub const CHUNK_POSTLF: ChunkyState = 3; -pub const CHUNK_DATA: ChunkyState = 2; -pub const CHUNK_LF: ChunkyState = 1; -pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; -pub const CONNECT_DONE: connect_t = 17; -pub const CONNECT_REQ_READ_MORE: connect_t = 16; -pub const CONNECT_REQ_READ: connect_t = 15; -pub const CONNECT_REQ_SENDING: connect_t = 14; -pub const CONNECT_REQ_SEND: connect_t = 13; -pub const CONNECT_RESOLVE_REMOTE: connect_t = 12; -pub const CONNECT_RESOLVED: connect_t = 11; -pub const CONNECT_RESOLVING: connect_t = 10; -pub const CONNECT_REQ_INIT: connect_t = 9; -pub const CONNECT_AUTH_READ: connect_t = 8; -pub const CONNECT_AUTH_SEND: connect_t = 7; -pub const CONNECT_AUTH_INIT: connect_t = 6; -pub const CONNECT_GSSAPI_INIT: connect_t = 5; -pub const CONNECT_SOCKS_READ: connect_t = 4; -pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; -pub const CONNECT_SOCKS_SEND: connect_t = 2; -pub const CONNECT_SOCKS_INIT: connect_t = 1; -pub const CONNECT_INIT: connect_t = 0; -pub type CHUNKcode = libc::c_int; -pub const CHUNKE_LAST: CHUNKcode = 7; -pub const CHUNKE_PASSTHRU_ERROR: CHUNKcode = 6; -pub const CHUNKE_OUT_OF_MEMORY: CHUNKcode = 5; -pub const CHUNKE_BAD_ENCODING: CHUNKcode = 4; -pub const CHUNKE_BAD_CHUNK: CHUNKcode = 3; -pub const CHUNKE_ILLEGAL_HEX: CHUNKcode = 2; -pub const CHUNKE_TOO_LONG_HEX: CHUNKcode = 1; -pub const CHUNKE_OK: CHUNKcode = 0; -pub const CHUNKE_STOP: CHUNKcode = -1; -pub type CURLofft = libc::c_uint; -pub const CURL_OFFT_INVAL: CURLofft = 2; -pub const CURL_OFFT_FLOW: CURLofft = 1; -pub const CURL_OFFT_OK: CURLofft = 0; -#[no_mangle] -pub unsafe extern "C" fn Curl_httpchunk_init(mut data: *mut Curl_easy) { - let mut conn: *mut connectdata = (*data).conn; - let mut chunk: *mut Curl_chunker = &mut (*conn).chunk; - (*chunk).hexindex = 0 as libc::c_int as libc::c_uchar; - (*chunk).state = CHUNK_HEX; - Curl_dyn_init(&mut (*conn).trailer, 4096 as libc::c_int as size_t); -} -#[no_mangle] -pub unsafe extern "C" fn Curl_httpchunk_read( - mut data: *mut Curl_easy, - mut datap: *mut libc::c_char, - mut datalen: ssize_t, - mut wrotep: *mut ssize_t, - mut extrap: *mut CURLcode, -) -> CHUNKcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut ch: *mut Curl_chunker = &mut (*conn).chunk; - let mut k: *mut SingleRequest = &mut (*data).req; - let mut piece: size_t = 0; - let mut length: curl_off_t = datalen; - let mut wrote: *mut size_t = wrotep as *mut size_t; - *wrote = 0 as libc::c_int as size_t; - if ((*data).set).http_te_skip() as libc::c_int != 0 && (*k).ignorebody() == 0 { - result = Curl_client_write( - data, - (1 as libc::c_int) << 0 as libc::c_int, - datap, - datalen as size_t, - ); - if result as u64 != 0 { - *extrap = result; - return CHUNKE_PASSTHRU_ERROR; - } - } - while length != 0 { - let mut current_block_101: u64; - match (*ch).state as libc::c_uint { - 0 => { - if Curl_isxdigit(*datap as libc::c_int) != 0 { - if ((*ch).hexindex as libc::c_int) < 8 as libc::c_int * 2 as libc::c_int { - (*ch).hexbuffer[(*ch).hexindex as usize] = *datap; - datap = datap.offset(1); - length -= 1; - let ref mut fresh0 = (*ch).hexindex; - *fresh0 = (*fresh0).wrapping_add(1); - } else { - return CHUNKE_TOO_LONG_HEX; - } - } else { - let mut endptr: *mut libc::c_char = 0 as *mut libc::c_char; - if 0 as libc::c_int == (*ch).hexindex as libc::c_int { - return CHUNKE_ILLEGAL_HEX; - } - (*ch).hexbuffer[(*ch).hexindex as usize] = 0 as libc::c_int as libc::c_char; - result = CURLE_OK as libc::c_int as CURLcode; - if result as u64 != 0 { - return CHUNKE_ILLEGAL_HEX; - } - if curlx_strtoofft( - ((*ch).hexbuffer).as_mut_ptr(), - &mut endptr, - 16 as libc::c_int, - &mut (*ch).datasize, - ) as u64 - != 0 - { - return CHUNKE_ILLEGAL_HEX; - } - (*ch).state = CHUNK_LF; - } - } - 1 => { - if *datap as libc::c_int == 0xa as libc::c_int { - if 0 as libc::c_int as libc::c_long == (*ch).datasize { - (*ch).state = CHUNK_TRAILER; - } else { - (*ch).state = CHUNK_DATA; - } - } - datap = datap.offset(1); - length -= 1; - } - 2 => { - piece = curlx_sotouz(if (*ch).datasize >= length { - length - } else { - (*ch).datasize - }); - if ((*data).set).http_te_skip() == 0 && (*k).ignorebody() == 0 { - if ((*data).set).http_ce_skip() == 0 && !((*k).writer_stack).is_null() { - result = Curl_unencode_write(data, (*k).writer_stack, datap, piece); - } else { - result = Curl_client_write( - data, - (1 as libc::c_int) << 0 as libc::c_int, - datap, - piece, - ); - } - if result as u64 != 0 { - *extrap = result; - return CHUNKE_PASSTHRU_ERROR; - } - } - *wrote = (*wrote as libc::c_ulong).wrapping_add(piece) as size_t as size_t; - let ref mut fresh1 = (*ch).datasize; - *fresh1 = - (*fresh1 as libc::c_ulong).wrapping_sub(piece) as curl_off_t as curl_off_t; - datap = datap.offset(piece as isize); - length = (length as libc::c_ulong).wrapping_sub(piece) as curl_off_t as curl_off_t; - if 0 as libc::c_int as libc::c_long == (*ch).datasize { - (*ch).state = CHUNK_POSTLF; - } - } - 3 => { - if *datap as libc::c_int == 0xa as libc::c_int { - Curl_httpchunk_init(data); - } else if *datap as libc::c_int != 0xd as libc::c_int { - return CHUNKE_BAD_CHUNK; - } - datap = datap.offset(1); - length -= 1; - } - 5 => { - if *datap as libc::c_int == 0xd as libc::c_int - || *datap as libc::c_int == 0xa as libc::c_int - { - let mut tr: *mut libc::c_char = Curl_dyn_ptr(&mut (*conn).trailer); - if !tr.is_null() { - let mut trlen: size_t = 0; - result = Curl_dyn_add( - &mut (*conn).trailer, - b"\r\n\0" as *const u8 as *const libc::c_char as *mut libc::c_char, - ); - if result as u64 != 0 { - return CHUNKE_OUT_OF_MEMORY; - } - tr = Curl_dyn_ptr(&mut (*conn).trailer); - trlen = Curl_dyn_len(&mut (*conn).trailer); - result = CURLE_OK as libc::c_int as CURLcode; - if result as u64 != 0 { - return CHUNKE_BAD_CHUNK; - } - if ((*data).set).http_te_skip() == 0 { - result = Curl_client_write( - data, - (1 as libc::c_int) << 1 as libc::c_int, - tr, - trlen, - ); - if result as u64 != 0 { - *extrap = result; - return CHUNKE_PASSTHRU_ERROR; - } - } - Curl_dyn_reset(&mut (*conn).trailer); - (*ch).state = CHUNK_TRAILER_CR; - if *datap as libc::c_int == 0xa as libc::c_int { - current_block_101 = 15586796709793571329; - } else { - current_block_101 = 14329534724295951598; - } - } else { - (*ch).state = CHUNK_TRAILER_POSTCR; - current_block_101 = 15586796709793571329; - } - } else { - result = Curl_dyn_addn( - &mut (*conn).trailer, - datap as *const libc::c_void, - 1 as libc::c_int as size_t, - ); - if result as u64 != 0 { - return CHUNKE_OUT_OF_MEMORY; - } - current_block_101 = 14329534724295951598; - } - match current_block_101 { - 15586796709793571329 => {} - _ => { - datap = datap.offset(1); - length -= 1; - } - } - } - 6 => { - if *datap as libc::c_int == 0xa as libc::c_int { - (*ch).state = CHUNK_TRAILER_POSTCR; - datap = datap.offset(1); - length -= 1; - } else { - return CHUNKE_BAD_CHUNK; - } - } - 7 => { - if *datap as libc::c_int != 0xd as libc::c_int - && *datap as libc::c_int != 0xa as libc::c_int - { - (*ch).state = CHUNK_TRAILER; - } else { - if *datap as libc::c_int == 0xd as libc::c_int { - datap = datap.offset(1); - length -= 1; - } - (*ch).state = CHUNK_STOP; - } - } - 4 => { - if *datap as libc::c_int == 0xa as libc::c_int { - length -= 1; - (*ch).datasize = curlx_sotouz(length) as curl_off_t; - return CHUNKE_STOP; - } else { - return CHUNKE_BAD_CHUNK; - } - } - _ => {} - } - } - return CHUNKE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_chunked_strerror(mut code: CHUNKcode) -> *const libc::c_char { - match code as libc::c_int { - 1 => return b"Too long hexadecimal number\0" as *const u8 as *const libc::c_char, - 2 => { - return b"Illegal or missing hexadecimal sequence\0" as *const u8 - as *const libc::c_char; - } - 3 => return b"Malformed encoding found\0" as *const u8 as *const libc::c_char, - 6 => return b"\0" as *const u8 as *const libc::c_char, - 4 => return b"Bad content-encoding found\0" as *const u8 as *const libc::c_char, - 5 => return b"Out of memory\0" as *const u8 as *const libc::c_char, - _ => return b"OK\0" as *const u8 as *const libc::c_char, - }; -} diff --git a/lib/http_digest.c b/lib/http_digest.c new file mode 100644 index 0000000..34bb5a8 --- /dev/null +++ b/lib/http_digest.c @@ -0,0 +1,183 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_CRYPTO_AUTH) + +#include "urldata.h" +#include "strcase.h" +#include "vauth/vauth.h" +#include "http_digest.h" + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" + +/* Test example headers: + +WWW-Authenticate: Digest realm="testrealm", nonce="1053604598" +Proxy-Authenticate: Digest realm="testrealm", nonce="1053604598" + +*/ + +CURLcode Curl_input_digest(struct Curl_easy *data, + bool proxy, + const char *header) /* rest of the *-authenticate: + header */ +{ + /* Point to the correct struct with this */ + struct digestdata *digest; + + if(proxy) { + digest = &data->state.proxydigest; + } + else { + digest = &data->state.digest; + } + + if(!checkprefix("Digest", header) || !ISSPACE(header[6])) + return CURLE_BAD_CONTENT_ENCODING; + + header += strlen("Digest"); + while(*header && ISSPACE(*header)) + header++; + + return Curl_auth_decode_digest_http_message(header, digest); +} + +CURLcode Curl_output_digest(struct Curl_easy *data, + bool proxy, + const unsigned char *request, + const unsigned char *uripath) +{ + CURLcode result; + unsigned char *path = NULL; + char *tmp = NULL; + char *response; + size_t len; + bool have_chlg; + + /* Point to the address of the pointer that holds the string to send to the + server, which is for a plain host or for a HTTP proxy */ + char **allocuserpwd; + + /* Point to the name and password for this */ + const char *userp; + const char *passwdp; + + /* Point to the correct struct with this */ + struct digestdata *digest; + struct auth *authp; + + if(proxy) { +#ifdef CURL_DISABLE_PROXY + return CURLE_NOT_BUILT_IN; +#else + digest = &data->state.proxydigest; + allocuserpwd = &data->state.aptr.proxyuserpwd; + userp = data->state.aptr.proxyuser; + passwdp = data->state.aptr.proxypasswd; + authp = &data->state.authproxy; +#endif + } + else { + digest = &data->state.digest; + allocuserpwd = &data->state.aptr.userpwd; + userp = data->state.aptr.user; + passwdp = data->state.aptr.passwd; + authp = &data->state.authhost; + } + + Curl_safefree(*allocuserpwd); + + /* not set means empty */ + if(!userp) + userp = ""; + + if(!passwdp) + passwdp = ""; + +#if defined(USE_WINDOWS_SSPI) + have_chlg = digest->input_token ? TRUE : FALSE; +#else + have_chlg = digest->nonce ? TRUE : FALSE; +#endif + + if(!have_chlg) { + authp->done = FALSE; + return CURLE_OK; + } + + /* So IE browsers < v7 cut off the URI part at the query part when they + evaluate the MD5 and some (IIS?) servers work with them so we may need to + do the Digest IE-style. Note that the different ways cause different MD5 + sums to get sent. + + Apache servers can be set to do the Digest IE-style automatically using + the BrowserMatch feature: + https://httpd.apache.org/docs/2.2/mod/mod_auth_digest.html#msie + + Further details on Digest implementation differences: + http://www.fngtps.com/2006/09/http-authentication + */ + + if(authp->iestyle) { + tmp = strchr((char *)uripath, '?'); + if(tmp) { + size_t urilen = tmp - (char *)uripath; + /* typecast is fine here since the value is always less than 32 bits */ + path = (unsigned char *) aprintf("%.*s", (int)urilen, uripath); + } + } + if(!tmp) + path = (unsigned char *) strdup((char *) uripath); + + if(!path) + return CURLE_OUT_OF_MEMORY; + + result = Curl_auth_create_digest_http_message(data, userp, passwdp, request, + path, digest, &response, &len); + free(path); + if(result) + return result; + + *allocuserpwd = aprintf("%sAuthorization: Digest %s\r\n", + proxy ? "Proxy-" : "", + response); + free(response); + if(!*allocuserpwd) + return CURLE_OUT_OF_MEMORY; + + authp->done = TRUE; + + return CURLE_OK; +} + +void Curl_http_auth_cleanup_digest(struct Curl_easy *data) +{ + Curl_auth_digest_cleanup(&data->state.digest); + Curl_auth_digest_cleanup(&data->state.proxydigest); +} + +#endif diff --git a/lib/http_proxy.c b/lib/http_proxy.c new file mode 100644 index 0000000..58489ab --- /dev/null +++ b/lib/http_proxy.c @@ -0,0 +1,1005 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at https://curl.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ + +#include "curl_setup.h" + +#include "http_proxy.h" + +#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) + +#include +#ifdef USE_HYPER +#include +#endif +#include "sendf.h" +#include "http.h" +#include "url.h" +#include "select.h" +#include "progress.h" +#include "non-ascii.h" +#include "connect.h" +#include "curlx.h" +#include "vtls/vtls.h" +#include "transfer.h" +#include "multiif.h" + +/* The last 3 #include files should be in this order */ +#include "curl_printf.h" +#include "curl_memory.h" +#include "memdebug.h" + +/* + * Perform SSL initialization for HTTPS proxy. Sets + * proxy_ssl_connected connection bit when complete. Can be + * called multiple times. + */ +static CURLcode https_proxy_connect(struct Curl_easy *data, int sockindex) +{ +#ifdef USE_SSL + struct connectdata *conn = data->conn; + CURLcode result = CURLE_OK; + DEBUGASSERT(conn->http_proxy.proxytype == CURLPROXY_HTTPS); + if(!conn->bits.proxy_ssl_connected[sockindex]) { + /* perform SSL initialization for this socket */ + result = + Curl_ssl_connect_nonblocking(data, conn, TRUE, sockindex, + &conn->bits.proxy_ssl_connected[sockindex]); + if(result) + /* a failed connection is marked for closure to prevent (bad) re-use or + similar */ + connclose(conn, "TLS handshake failed"); + } + return result; +#else + (void) data; + (void) sockindex; + return CURLE_NOT_BUILT_IN; +#endif +} + +CURLcode Curl_proxy_connect(struct Curl_easy *data, int sockindex) +{ + struct connectdata *conn = data->conn; + if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) { + const CURLcode result = https_proxy_connect(data, sockindex); + if(result) + return result; + if(!conn->bits.proxy_ssl_connected[sockindex]) + return result; /* wait for HTTPS proxy SSL initialization to complete */ + } + + if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { +#ifndef CURL_DISABLE_PROXY + /* for [protocol] tunneled through HTTP proxy */ + const char *hostname; + int remote_port; + CURLcode result; + + /* We want "seamless" operations through HTTP proxy tunnel */ + + /* for the secondary socket (FTP), use the "connect to host" + * but ignore the "connect to port" (use the secondary port) + */ + + if(conn->bits.conn_to_host) + hostname = conn->conn_to_host.name; + else if(sockindex == SECONDARYSOCKET) + hostname = conn->secondaryhostname; + else + hostname = conn->host.name; + + if(sockindex == SECONDARYSOCKET) + remote_port = conn->secondary_port; + else if(conn->bits.conn_to_port) + remote_port = conn->conn_to_port; + else + remote_port = conn->remote_port; + + result = Curl_proxyCONNECT(data, sockindex, hostname, remote_port); + if(CURLE_OK != result) + return result; + Curl_safefree(data->state.aptr.proxyuserpwd); +#else + return CURLE_NOT_BUILT_IN; +#endif + } + /* no HTTP tunnel proxy, just return */ + return CURLE_OK; +} + +bool Curl_connect_complete(struct connectdata *conn) +{ + return !conn->connect_state || + (conn->connect_state->tunnel_state >= TUNNEL_COMPLETE); +} + +bool Curl_connect_ongoing(struct connectdata *conn) +{ + return conn->connect_state && + (conn->connect_state->tunnel_state <= TUNNEL_COMPLETE); +} + +/* when we've sent a CONNECT to a proxy, we should rather either wait for the + socket to become readable to be able to get the response headers or if + we're still sending the request, wait for write. */ +int Curl_connect_getsock(struct connectdata *conn) +{ + struct HTTP *http; + DEBUGASSERT(conn); + DEBUGASSERT(conn->connect_state); + http = &conn->connect_state->http_proxy; + + if(http->sending == HTTPSEND_REQUEST) + return GETSOCK_WRITESOCK(0); + + return GETSOCK_READSOCK(0); +} + +static CURLcode connect_init(struct Curl_easy *data, bool reinit) +{ + struct http_connect_state *s; + struct connectdata *conn = data->conn; + if(!reinit) { + CURLcode result; + DEBUGASSERT(!conn->connect_state); + /* we might need the upload buffer for streaming a partial request */ + result = Curl_get_upload_buffer(data); + if(result) + return result; + + s = calloc(1, sizeof(struct http_connect_state)); + if(!s) + return CURLE_OUT_OF_MEMORY; + infof(data, "allocate connect buffer!"); + conn->connect_state = s; + Curl_dyn_init(&s->rcvbuf, DYN_PROXY_CONNECT_HEADERS); + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the + * member conn->proto.http; we want [protocol] through HTTP and we have + * to change the member temporarily for connecting to the HTTP + * proxy. After Curl_proxyCONNECT we have to set back the member to the + * original pointer + * + * This function might be called several times in the multi interface case + * if the proxy's CONNECT response is not instant. + */ + s->prot_save = data->req.p.http; + data->req.p.http = &s->http_proxy; + connkeep(conn, "HTTP proxy CONNECT"); + } + else { + DEBUGASSERT(conn->connect_state); + s = conn->connect_state; + Curl_dyn_reset(&s->rcvbuf); + } + s->tunnel_state = TUNNEL_INIT; + s->keepon = KEEPON_CONNECT; + s->cl = 0; + s->close_connection = FALSE; + return CURLE_OK; +} + +static void connect_done(struct Curl_easy *data) +{ + struct connectdata *conn = data->conn; + struct http_connect_state *s = conn->connect_state; + if(s->tunnel_state != TUNNEL_EXIT) { + s->tunnel_state = TUNNEL_EXIT; + Curl_dyn_free(&s->rcvbuf); + Curl_dyn_free(&s->req); + + /* retore the protocol pointer */ + data->req.p.http = s->prot_save; + s->prot_save = NULL; + infof(data, "CONNECT phase completed!"); + } +} + +static CURLcode CONNECT_host(struct Curl_easy *data, + struct connectdata *conn, + const char *hostname, + int remote_port, + char **connecthostp, + char **hostp) +{ + char *hostheader; /* for CONNECT */ + char *host = NULL; /* Host: */ + bool ipv6_ip = conn->bits.ipv6_ip; + + /* the hostname may be different */ + if(hostname != conn->host.name) + ipv6_ip = (strchr(hostname, ':') != NULL); + hostheader = /* host:port with IPv6 support */ + aprintf("%s%s%s:%d", ipv6_ip?"[":"", hostname, ipv6_ip?"]":"", + remote_port); + if(!hostheader) + return CURLE_OUT_OF_MEMORY; + + if(!Curl_checkProxyheaders(data, conn, "Host")) { + host = aprintf("Host: %s\r\n", hostheader); + if(!host) { + free(hostheader); + return CURLE_OUT_OF_MEMORY; + } + } + *connecthostp = hostheader; + *hostp = host; + return CURLE_OK; +} + +#ifndef USE_HYPER +static CURLcode CONNECT(struct Curl_easy *data, + int sockindex, + const char *hostname, + int remote_port) +{ + int subversion = 0; + struct SingleRequest *k = &data->req; + CURLcode result; + struct connectdata *conn = data->conn; + curl_socket_t tunnelsocket = conn->sock[sockindex]; + struct http_connect_state *s = conn->connect_state; + struct HTTP *http = data->req.p.http; + char *linep; + size_t perline; + +#define SELECT_OK 0 +#define SELECT_ERROR 1 + + if(Curl_connect_complete(conn)) + return CURLE_OK; /* CONNECT is already completed */ + + conn->bits.proxy_connect_closed = FALSE; + + do { + timediff_t check; + if(TUNNEL_INIT == s->tunnel_state) { + /* BEGIN CONNECT PHASE */ + struct dynbuf *req = &s->req; + char *hostheader = NULL; + char *host = NULL; + + infof(data, "Establish HTTP proxy tunnel to %s:%d", + hostname, remote_port); + + /* This only happens if we've looped here due to authentication + reasons, and we don't really use the newly cloned URL here + then. Just free() it. */ + free(data->req.newurl); + data->req.newurl = NULL; + + /* initialize send-buffer */ + Curl_dyn_init(req, DYN_HTTP_REQUEST); + + result = CONNECT_host(data, conn, + hostname, remote_port, &hostheader, &host); + if(result) + return result; + + /* Setup the proxy-authorization header, if any */ + result = Curl_http_output_auth(data, conn, "CONNECT", HTTPREQ_GET, + hostheader, TRUE); + + if(!result) { + const char *httpv = + (conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? "1.0" : "1.1"; + + result = + Curl_dyn_addf(req, + "CONNECT %s HTTP/%s\r\n" + "%s" /* Host: */ + "%s", /* Proxy-Authorization */ + hostheader, + httpv, + host?host:"", + data->state.aptr.proxyuserpwd? + data->state.aptr.proxyuserpwd:""); + + if(!result && !Curl_checkProxyheaders(data, conn, "User-Agent") && + data->set.str[STRING_USERAGENT]) + result = Curl_dyn_addf(req, "User-Agent: %s\r\n", + data->set.str[STRING_USERAGENT]); + + if(!result && !Curl_checkProxyheaders(data, conn, "Proxy-Connection")) + result = Curl_dyn_add(req, "Proxy-Connection: Keep-Alive\r\n"); + + if(!result) + result = Curl_add_custom_headers(data, TRUE, req); + + if(!result) + /* CRLF terminate the request */ + result = Curl_dyn_add(req, "\r\n"); + + if(!result) { + /* Send the connect request to the proxy */ + result = Curl_buffer_send(req, data, &data->info.request_size, 0, + sockindex); + } + if(result) + failf(data, "Failed sending CONNECT to proxy"); + } + free(host); + free(hostheader); + if(result) + return result; + + s->tunnel_state = TUNNEL_CONNECT; + } /* END CONNECT PHASE */ + + check = Curl_timeleft(data, NULL, TRUE); + if(check <= 0) { + failf(data, "Proxy CONNECT aborted due to timeout"); + return CURLE_OPERATION_TIMEDOUT; + } + + if(!Curl_conn_data_pending(conn, sockindex) && !http->sending) + /* return so we'll be called again polling-style */ + return CURLE_OK; + + /* at this point, the tunnel_connecting phase is over. */ + + if(http->sending == HTTPSEND_REQUEST) { + if(!s->nsend) { + size_t fillcount; + k->upload_fromhere = data->state.ulbuf; + result = Curl_fillreadbuffer(data, data->set.upload_buffer_size, + &fillcount); + if(result) + return result; + s->nsend = fillcount; + } + if(s->nsend) { + ssize_t bytes_written; + /* write to socket (send away data) */ + result = Curl_write(data, + conn->writesockfd, /* socket to send to */ + k->upload_fromhere, /* buffer pointer */ + s->nsend, /* buffer size */ + &bytes_written); /* actually sent */ + + if(!result) + /* send to debug callback! */ + result = Curl_debug(data, CURLINFO_HEADER_OUT, + k->upload_fromhere, bytes_written); + + s->nsend -= bytes_written; + k->upload_fromhere += bytes_written; + return result; + } + http->sending = HTTPSEND_NADA; + /* if nothing left to send, continue */ + } + { /* READING RESPONSE PHASE */ + int error = SELECT_OK; + + while(s->keepon) { + ssize_t gotbytes; + char byte; + + /* Read one byte at a time to avoid a race condition. Wait at most one + second before looping to ensure continuous pgrsUpdates. */ + result = Curl_read(data, tunnelsocket, &byte, 1, &gotbytes); + if(result == CURLE_AGAIN) + /* socket buffer drained, return */ + return CURLE_OK; + + if(Curl_pgrsUpdate(data)) + return CURLE_ABORTED_BY_CALLBACK; + + if(result) { + s->keepon = KEEPON_DONE; + break; + } + else if(gotbytes <= 0) { + if(data->set.proxyauth && data->state.authproxy.avail && + data->state.aptr.proxyuserpwd) { + /* proxy auth was requested and there was proxy auth available, + then deem this as "mere" proxy disconnect */ + conn->bits.proxy_connect_closed = TRUE; + infof(data, "Proxy CONNECT connection closed"); + } + else { + error = SELECT_ERROR; + failf(data, "Proxy CONNECT aborted"); + } + s->keepon = KEEPON_DONE; + break; + } + + if(s->keepon == KEEPON_IGNORE) { + /* This means we are currently ignoring a response-body */ + + if(s->cl) { + /* A Content-Length based body: simply count down the counter + and make sure to break out of the loop when we're done! */ + s->cl--; + if(s->cl <= 0) { + s->keepon = KEEPON_DONE; + s->tunnel_state = TUNNEL_COMPLETE; + break; + } + } + else { + /* chunked-encoded body, so we need to do the chunked dance + properly to know when the end of the body is reached */ + CHUNKcode r; + CURLcode extra; + ssize_t tookcareof = 0; + + /* now parse the chunked piece of data so that we can + properly tell when the stream ends */ + r = Curl_httpchunk_read(data, &byte, 1, &tookcareof, &extra); + if(r == CHUNKE_STOP) { + /* we're done reading chunks! */ + infof(data, "chunk reading DONE"); + s->keepon = KEEPON_DONE; + /* we did the full CONNECT treatment, go COMPLETE */ + s->tunnel_state = TUNNEL_COMPLETE; + } + } + continue; + } + + if(Curl_dyn_addn(&s->rcvbuf, &byte, 1)) { + failf(data, "CONNECT response too large!"); + return CURLE_RECV_ERROR; + } + + /* if this is not the end of a header line then continue */ + if(byte != 0x0a) + continue; + + linep = Curl_dyn_ptr(&s->rcvbuf); + perline = Curl_dyn_len(&s->rcvbuf); /* amount of bytes in this line */ + + /* convert from the network encoding */ + result = Curl_convert_from_network(data, linep, perline); + /* Curl_convert_from_network calls failf if unsuccessful */ + if(result) + return result; + + /* output debug if that is requested */ + Curl_debug(data, CURLINFO_HEADER_IN, linep, perline); + + if(!data->set.suppress_connect_headers) { + /* send the header to the callback */ + int writetype = CLIENTWRITE_HEADER; + if(data->set.include_header) + writetype |= CLIENTWRITE_BODY; + + result = Curl_client_write(data, writetype, linep, perline); + if(result) + return result; + } + + data->info.header_size += (long)perline; + + /* Newlines are CRLF, so the CR is ignored as the line isn't + really terminated until the LF comes. Treat a following CR + as end-of-headers as well.*/ + + if(('\r' == linep[0]) || + ('\n' == linep[0])) { + /* end of response-headers from the proxy */ + + if((407 == k->httpcode) && !data->state.authproblem) { + /* If we get a 407 response code with content length + when we have no auth problem, we must ignore the + whole response-body */ + s->keepon = KEEPON_IGNORE; + + if(s->cl) { + infof(data, "Ignore %" CURL_FORMAT_CURL_OFF_T + " bytes of response-body", s->cl); + } + else if(s->chunked_encoding) { + CHUNKcode r; + CURLcode extra; + + infof(data, "Ignore chunked response-body"); + + /* We set ignorebody true here since the chunked decoder + function will acknowledge that. Pay attention so that this is + cleared again when this function returns! */ + k->ignorebody = TRUE; + + if(linep[1] == '\n') + /* this can only be a LF if the letter at index 0 was a CR */ + linep++; + + /* now parse the chunked piece of data so that we can properly + tell when the stream ends */ + r = Curl_httpchunk_read(data, linep + 1, 1, &gotbytes, + &extra); + if(r == CHUNKE_STOP) { + /* we're done reading chunks! */ + infof(data, "chunk reading DONE"); + s->keepon = KEEPON_DONE; + /* we did the full CONNECT treatment, go to COMPLETE */ + s->tunnel_state = TUNNEL_COMPLETE; + } + } + else { + /* without content-length or chunked encoding, we + can't keep the connection alive since the close is + the end signal so we bail out at once instead */ + s->keepon = KEEPON_DONE; + } + } + else + s->keepon = KEEPON_DONE; + + if(s->keepon == KEEPON_DONE && !s->cl) + /* we did the full CONNECT treatment, go to COMPLETE */ + s->tunnel_state = TUNNEL_COMPLETE; + + DEBUGASSERT(s->keepon == KEEPON_IGNORE || s->keepon == KEEPON_DONE); + continue; + } + + if((checkprefix("WWW-Authenticate:", linep) && + (401 == k->httpcode)) || + (checkprefix("Proxy-authenticate:", linep) && + (407 == k->httpcode))) { + + bool proxy = (k->httpcode == 407) ? TRUE : FALSE; + char *auth = Curl_copy_header_value(linep); + if(!auth) + return CURLE_OUT_OF_MEMORY; + + result = Curl_http_input_auth(data, proxy, auth); + + free(auth); + + if(result) + return result; + } + else if(checkprefix("Content-Length:", linep)) { + if(k->httpcode/100 == 2) { + /* A client MUST ignore any Content-Length or Transfer-Encoding + header fields received in a successful response to CONNECT. + "Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */ + infof(data, "Ignoring Content-Length in CONNECT %03d response", + k->httpcode); + } + else { + (void)curlx_strtoofft(linep + + strlen("Content-Length:"), NULL, 10, &s->cl); + } + } + else if(Curl_compareheader(linep, "Connection:", "close")) + s->close_connection = TRUE; + else if(checkprefix("Transfer-Encoding:", linep)) { + if(k->httpcode/100 == 2) { + /* A client MUST ignore any Content-Length or Transfer-Encoding + header fields received in a successful response to CONNECT. + "Successful" described as: 2xx (Successful). RFC 7231 4.3.6 */ + infof(data, "Ignoring Transfer-Encoding in " + "CONNECT %03d response", k->httpcode); + } + else if(Curl_compareheader(linep, + "Transfer-Encoding:", "chunked")) { + infof(data, "CONNECT responded chunked"); + s->chunked_encoding = TRUE; + /* init our chunky engine */ + Curl_httpchunk_init(data); + } + } + else if(Curl_compareheader(linep, "Proxy-Connection:", "close")) + s->close_connection = TRUE; + else if(2 == sscanf(linep, "HTTP/1.%d %d", + &subversion, + &k->httpcode)) { + /* store the HTTP code from the proxy */ + data->info.httpproxycode = k->httpcode; + } + + Curl_dyn_reset(&s->rcvbuf); + } /* while there's buffer left and loop is requested */ + + if(Curl_pgrsUpdate(data)) + return CURLE_ABORTED_BY_CALLBACK; + + if(error) + return CURLE_RECV_ERROR; + + if(data->info.httpproxycode/100 != 2) { + /* Deal with the possibly already received authenticate + headers. 'newurl' is set to a new URL if we must loop. */ + result = Curl_http_auth_act(data); + if(result) + return result; + + if(conn->bits.close) + /* the connection has been marked for closure, most likely in the + Curl_http_auth_act() function and thus we can kill it at once + below */ + s->close_connection = TRUE; + } + + if(s->close_connection && data->req.newurl) { + /* Connection closed by server. Don't use it anymore */ + Curl_closesocket(data, conn, conn->sock[sockindex]); + conn->sock[sockindex] = CURL_SOCKET_BAD; + break; + } + } /* END READING RESPONSE PHASE */ + + /* If we are supposed to continue and request a new URL, which basically + * means the HTTP authentication is still going on so if the tunnel + * is complete we start over in INIT state */ + if(data->req.newurl && (TUNNEL_COMPLETE == s->tunnel_state)) { + connect_init(data, TRUE); /* reinit */ + } + + } while(data->req.newurl); + + if(data->info.httpproxycode/100 != 2) { + if(s->close_connection && data->req.newurl) { + conn->bits.proxy_connect_closed = TRUE; + infof(data, "Connect me again please"); + connect_done(data); + } + else { + free(data->req.newurl); + data->req.newurl = NULL; + /* failure, close this connection to avoid re-use */ + streamclose(conn, "proxy CONNECT failure"); + Curl_closesocket(data, conn, conn->sock[sockindex]); + conn->sock[sockindex] = CURL_SOCKET_BAD; + } + + /* to back to init state */ + s->tunnel_state = TUNNEL_INIT; + + if(conn->bits.proxy_connect_closed) + /* this is not an error, just part of the connection negotiation */ + return CURLE_OK; + Curl_dyn_free(&s->rcvbuf); + failf(data, "Received HTTP code %d from proxy after CONNECT", + data->req.httpcode); + return CURLE_RECV_ERROR; + } + + s->tunnel_state = TUNNEL_COMPLETE; + + /* If a proxy-authorization header was used for the proxy, then we should + make sure that it isn't accidentally used for the document request + after we've connected. So let's free and clear it here. */ + Curl_safefree(data->state.aptr.proxyuserpwd); + data->state.aptr.proxyuserpwd = NULL; + + data->state.authproxy.done = TRUE; + data->state.authproxy.multipass = FALSE; + + infof(data, "Proxy replied %d to CONNECT request", + data->info.httpproxycode); + data->req.ignorebody = FALSE; /* put it (back) to non-ignore state */ + conn->bits.rewindaftersend = FALSE; /* make sure this isn't set for the + document request */ + Curl_dyn_free(&s->rcvbuf); + return CURLE_OK; +} +#else +/* The Hyper version of CONNECT */ +static CURLcode CONNECT(struct Curl_easy *data, + int sockindex, + const char *hostname, + int remote_port) +{ + struct connectdata *conn = data->conn; + struct hyptransfer *h = &data->hyp; + curl_socket_t tunnelsocket = conn->sock[sockindex]; + struct http_connect_state *s = conn->connect_state; + CURLcode result = CURLE_OUT_OF_MEMORY; + hyper_io *io = NULL; + hyper_request *req = NULL; + hyper_headers *headers = NULL; + hyper_clientconn_options *options = NULL; + hyper_task *handshake = NULL; + hyper_task *task = NULL; /* for the handshake */ + hyper_task *sendtask = NULL; /* for the send */ + hyper_clientconn *client = NULL; + hyper_error *hypererr = NULL; + char *hostheader = NULL; /* for CONNECT */ + char *host = NULL; /* Host: */ + + if(Curl_connect_complete(conn)) + return CURLE_OK; /* CONNECT is already completed */ + + conn->bits.proxy_connect_closed = FALSE; + + do { + switch(s->tunnel_state) { + case TUNNEL_INIT: + /* BEGIN CONNECT PHASE */ + io = hyper_io_new(); + if(!io) { + failf(data, "Couldn't create hyper IO"); + goto error; + } + /* tell Hyper how to read/write network data */ + hyper_io_set_userdata(io, data); + hyper_io_set_read(io, Curl_hyper_recv); + hyper_io_set_write(io, Curl_hyper_send); + conn->sockfd = tunnelsocket; + + data->state.hconnect = TRUE; + + /* create an executor to poll futures */ + if(!h->exec) { + h->exec = hyper_executor_new(); + if(!h->exec) { + failf(data, "Couldn't create hyper executor"); + goto error; + } + } + + options = hyper_clientconn_options_new(); + if(!options) { + failf(data, "Couldn't create hyper client options"); + goto error; + } + + hyper_clientconn_options_exec(options, h->exec); + + /* "Both the `io` and the `options` are consumed in this function + call" */ + handshake = hyper_clientconn_handshake(io, options); + if(!handshake) { + failf(data, "Couldn't create hyper client handshake"); + goto error; + } + io = NULL; + options = NULL; + + if(HYPERE_OK != hyper_executor_push(h->exec, handshake)) { + failf(data, "Couldn't hyper_executor_push the handshake"); + goto error; + } + handshake = NULL; /* ownership passed on */ + + task = hyper_executor_poll(h->exec); + if(!task) { + failf(data, "Couldn't hyper_executor_poll the handshake"); + goto error; + } + + client = hyper_task_value(task); + hyper_task_free(task); + req = hyper_request_new(); + if(!req) { + failf(data, "Couldn't hyper_request_new"); + goto error; + } + if(hyper_request_set_method(req, (uint8_t *)"CONNECT", + strlen("CONNECT"))) { + failf(data, "error setting method"); + goto error; + } + + result = CONNECT_host(data, conn, hostname, remote_port, + &hostheader, &host); + if(result) + goto error; + + if(hyper_request_set_uri(req, (uint8_t *)hostheader, + strlen(hostheader))) { + failf(data, "error setting path"); + result = CURLE_OUT_OF_MEMORY; + } + /* Setup the proxy-authorization header, if any */ + result = Curl_http_output_auth(data, conn, "CONNECT", HTTPREQ_GET, + hostheader, TRUE); + if(result) + goto error; + Curl_safefree(hostheader); + + /* default is 1.1 */ + if((conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) && + (HYPERE_OK != hyper_request_set_version(req, + HYPER_HTTP_VERSION_1_0))) { + failf(data, "error setting HTTP version"); + goto error; + } + + headers = hyper_request_headers(req); + if(!headers) { + failf(data, "hyper_request_headers"); + goto error; + } + if(host && Curl_hyper_header(data, headers, host)) + goto error; + Curl_safefree(host); + + if(data->state.aptr.proxyuserpwd && + Curl_hyper_header(data, headers, data->state.aptr.proxyuserpwd)) + goto error; + + if(!Curl_checkProxyheaders(data, conn, "User-Agent") && + data->set.str[STRING_USERAGENT]) { + struct dynbuf ua; + Curl_dyn_init(&ua, DYN_HTTP_REQUEST); + result = Curl_dyn_addf(&ua, "User-Agent: %s\r\n", + data->set.str[STRING_USERAGENT]); + if(result) + goto error; + if(Curl_hyper_header(data, headers, Curl_dyn_ptr(&ua))) + goto error; + Curl_dyn_free(&ua); + } + + if(!Curl_checkProxyheaders(data, conn, "Proxy-Connection") && + Curl_hyper_header(data, headers, "Proxy-Connection: Keep-Alive")) + goto error; + + if(Curl_add_custom_headers(data, TRUE, headers)) + goto error; + + sendtask = hyper_clientconn_send(client, req); + if(!sendtask) { + failf(data, "hyper_clientconn_send"); + goto error; + } + + if(HYPERE_OK != hyper_executor_push(h->exec, sendtask)) { + failf(data, "Couldn't hyper_executor_push the send"); + goto error; + } + + hyper_clientconn_free(client); + + do { + task = hyper_executor_poll(h->exec); + if(task) { + bool error = hyper_task_type(task) == HYPER_TASK_ERROR; + if(error) + hypererr = hyper_task_value(task); + hyper_task_free(task); + if(error) + goto error; + } + } while(task); + s->tunnel_state = TUNNEL_CONNECT; + /* FALLTHROUGH */ + case TUNNEL_CONNECT: { + int didwhat; + bool done = FALSE; + result = Curl_hyper_stream(data, conn, &didwhat, &done, + CURL_CSELECT_IN | CURL_CSELECT_OUT); + if(result) + goto error; + if(!done) + break; + s->tunnel_state = TUNNEL_COMPLETE; + if(h->exec) { + hyper_executor_free(h->exec); + h->exec = NULL; + } + if(h->read_waker) { + hyper_waker_free(h->read_waker); + h->read_waker = NULL; + } + if(h->write_waker) { + hyper_waker_free(h->write_waker); + h->write_waker = NULL; + } + } + /* FALLTHROUGH */ + default: + break; + } + } while(data->req.newurl); + + result = CURLE_OK; + if(s->tunnel_state == TUNNEL_COMPLETE) { + data->info.httpproxycode = data->req.httpcode; + if(data->info.httpproxycode/100 != 2) { + if(conn->bits.close && data->req.newurl) { + conn->bits.proxy_connect_closed = TRUE; + infof(data, "Connect me again please"); + connect_done(data); + } + else { + free(data->req.newurl); + data->req.newurl = NULL; + /* failure, close this connection to avoid re-use */ + streamclose(conn, "proxy CONNECT failure"); + Curl_closesocket(data, conn, conn->sock[sockindex]); + conn->sock[sockindex] = CURL_SOCKET_BAD; + } + + /* to back to init state */ + s->tunnel_state = TUNNEL_INIT; + + if(!conn->bits.proxy_connect_closed) { + failf(data, "Received HTTP code %d from proxy after CONNECT", + data->req.httpcode); + result = CURLE_RECV_ERROR; + } + } + } + error: + free(host); + free(hostheader); + if(io) + hyper_io_free(io); + + if(options) + hyper_clientconn_options_free(options); + + if(handshake) + hyper_task_free(handshake); + + if(hypererr) { + uint8_t errbuf[256]; + size_t errlen = hyper_error_print(hypererr, errbuf, sizeof(errbuf)); + failf(data, "Hyper: %.*s", (int)errlen, errbuf); + hyper_error_free(hypererr); + } + return result; +} +#endif + +void Curl_connect_free(struct Curl_easy *data) +{ + struct connectdata *conn = data->conn; + struct http_connect_state *s = conn->connect_state; + if(s) { + free(s); + conn->connect_state = NULL; + } +} + +/* + * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This + * function will issue the necessary commands to get a seamless tunnel through + * this proxy. After that, the socket can be used just as a normal socket. + */ + +CURLcode Curl_proxyCONNECT(struct Curl_easy *data, + int sockindex, + const char *hostname, + int remote_port) +{ + CURLcode result; + struct connectdata *conn = data->conn; + if(!conn->connect_state) { + result = connect_init(data, FALSE); + if(result) + return result; + } + result = CONNECT(data, sockindex, hostname, remote_port); + + if(result || Curl_connect_complete(conn)) + connect_done(data); + + return result; +} + +#else +void Curl_connect_free(struct Curl_easy *data) +{ + (void)data; +} + +#endif /* CURL_DISABLE_PROXY */ diff --git a/lib/http_proxy.rs b/lib/http_proxy.rs deleted file mode 100644 index cea738e..0000000 --- a/lib/http_proxy.rs +++ /dev/null @@ -1,3275 +0,0 @@ -#![allow( - dead_code, - mutable_transmutes, - non_camel_case_types, - non_snake_case, - non_upper_case_globals, - unused_assignments, - unused_mut -)] -#![register_tool(c2rust)] -#![feature(extern_types, register_tool)] -extern "C" { - pub type _IO_wide_data; - pub type _IO_codecvt; - pub type _IO_marker; - pub type Curl_URL; - pub type thread_data; - pub type altsvcinfo; - pub type hsts; - pub type TELNET; - pub type smb_request; - pub type ldapreqinfo; - pub type contenc_writer; - pub type psl_ctx_st; - pub type Curl_share; - pub type curl_pushheaders; - pub type ldapconninfo; - pub type tftp_state_data; - pub type nghttp2_session; - pub type ssl_backend_data; - fn sscanf(_: *const libc::c_char, _: *const libc::c_char, _: ...) -> libc::c_int; - fn curl_strnequal(s1: *const libc::c_char, s2: *const libc::c_char, n: size_t) -> libc::c_int; - fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; - fn strlen(_: *const libc::c_char) -> libc::c_ulong; - fn Curl_httpchunk_init(data: *mut Curl_easy); - fn Curl_httpchunk_read( - data: *mut Curl_easy, - datap: *mut libc::c_char, - length: ssize_t, - wrote: *mut ssize_t, - passthru: *mut CURLcode, - ) -> CHUNKcode; - fn Curl_dyn_init(s: *mut dynbuf, toobig: size_t); - fn Curl_dyn_free(s: *mut dynbuf); - fn Curl_dyn_addn(s: *mut dynbuf, mem: *const libc::c_void, len: size_t) -> CURLcode; - fn Curl_dyn_add(s: *mut dynbuf, str: *const libc::c_char) -> CURLcode; - fn Curl_dyn_addf(s: *mut dynbuf, fmt: *const libc::c_char, _: ...) -> CURLcode; - fn Curl_dyn_reset(s: *mut dynbuf); - fn Curl_dyn_ptr(s: *const dynbuf) -> *mut libc::c_char; - fn Curl_dyn_len(s: *const dynbuf) -> size_t; - fn Curl_compareheader( - headerline: *const libc::c_char, - header: *const libc::c_char, - content: *const libc::c_char, - ) -> bool; - fn Curl_copy_header_value(header: *const libc::c_char) -> *mut libc::c_char; - fn Curl_checkProxyheaders( - data: *mut Curl_easy, - conn: *const connectdata, - thisheader: *const libc::c_char, - ) -> *mut libc::c_char; - fn Curl_buffer_send( - in_0: *mut dynbuf, - data: *mut Curl_easy, - bytes_written: *mut curl_off_t, - included_body_bytes: curl_off_t, - socketindex: libc::c_int, - ) -> CURLcode; - fn Curl_add_custom_headers( - data: *mut Curl_easy, - is_connect: bool, - req: *mut dynbuf, - ) -> CURLcode; - fn Curl_http_input_auth( - data: *mut Curl_easy, - proxy: bool, - auth: *const libc::c_char, - ) -> CURLcode; - fn Curl_http_auth_act(data: *mut Curl_easy) -> CURLcode; - fn Curl_http_output_auth( - data: *mut Curl_easy, - conn: *mut connectdata, - request: *const libc::c_char, - httpreq: Curl_HttpReq, - path: *const libc::c_char, - proxytunnel: bool, - ) -> CURLcode; - fn Curl_infof(_: *mut Curl_easy, fmt: *const libc::c_char, _: ...); - fn Curl_failf(_: *mut Curl_easy, fmt: *const libc::c_char, _: ...); - fn Curl_client_write( - data: *mut Curl_easy, - type_0: libc::c_int, - ptr: *mut libc::c_char, - len: size_t, - ) -> CURLcode; - fn Curl_read( - data: *mut Curl_easy, - sockfd: curl_socket_t, - buf: *mut libc::c_char, - buffersize: size_t, - n: *mut ssize_t, - ) -> CURLcode; - fn Curl_write( - data: *mut Curl_easy, - sockfd: curl_socket_t, - mem: *const libc::c_void, - len: size_t, - written: *mut ssize_t, - ) -> CURLcode; - fn Curl_debug( - data: *mut Curl_easy, - type_0: curl_infotype, - ptr: *mut libc::c_char, - size: size_t, - ) -> libc::c_int; - fn Curl_pgrsUpdate(data: *mut Curl_easy) -> libc::c_int; - fn Curl_timeleft(data: *mut Curl_easy, nowp: *mut curltime, duringconnect: bool) -> timediff_t; - fn Curl_closesocket( - data: *mut Curl_easy, - conn: *mut connectdata, - sock: curl_socket_t, - ) -> libc::c_int; - fn Curl_conncontrol(conn: *mut connectdata, closeit: libc::c_int); - fn Curl_conn_data_pending(conn: *mut connectdata, sockindex: libc::c_int) -> bool; - fn curlx_strtoofft( - str: *const libc::c_char, - endp: *mut *mut libc::c_char, - base: libc::c_int, - num: *mut curl_off_t, - ) -> CURLofft; - fn curl_maprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char; - fn Curl_ssl_connect_nonblocking( - data: *mut Curl_easy, - conn: *mut connectdata, - isproxy: bool, - sockindex: libc::c_int, - done: *mut bool, - ) -> CURLcode; - fn Curl_fillreadbuffer(data: *mut Curl_easy, bytes: size_t, nreadp: *mut size_t) -> CURLcode; - fn Curl_get_upload_buffer(data: *mut Curl_easy) -> CURLcode; - static mut Curl_cfree: curl_free_callback; - static mut Curl_ccalloc: curl_calloc_callback; -} -pub type __uint8_t = libc::c_uchar; -pub type __int32_t = libc::c_int; -pub type __uint32_t = libc::c_uint; -pub type __off_t = libc::c_long; -pub type __off64_t = libc::c_long; -pub type __pid_t = libc::c_int; -pub type __time_t = libc::c_long; -pub type __ssize_t = libc::c_long; -pub type __socklen_t = libc::c_uint; -pub type pid_t = __pid_t; -pub type ssize_t = __ssize_t; -pub type time_t = __time_t; -pub type size_t = libc::c_ulong; -pub type int32_t = __int32_t; -pub type socklen_t = __socklen_t; -pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} -pub type curl_socklen_t = socklen_t; -pub type curl_off_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _IO_FILE { - pub _flags: libc::c_int, - pub _IO_read_ptr: *mut libc::c_char, - pub _IO_read_end: *mut libc::c_char, - pub _IO_read_base: *mut libc::c_char, - pub _IO_write_base: *mut libc::c_char, - pub _IO_write_ptr: *mut libc::c_char, - pub _IO_write_end: *mut libc::c_char, - pub _IO_buf_base: *mut libc::c_char, - pub _IO_buf_end: *mut libc::c_char, - pub _IO_save_base: *mut libc::c_char, - pub _IO_backup_base: *mut libc::c_char, - pub _IO_save_end: *mut libc::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: libc::c_int, - pub _flags2: libc::c_int, - pub _old_offset: __off_t, - pub _cur_column: libc::c_ushort, - pub _vtable_offset: libc::c_schar, - pub _shortbuf: [libc::c_char; 1], - pub _lock: *mut libc::c_void, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut libc::c_void, - pub __pad5: size_t, - pub _mode: libc::c_int, - pub _unused2: [libc::c_char; 20], -} -pub type _IO_lock_t = (); -pub type FILE = _IO_FILE; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_easy { - pub magic: libc::c_uint, - pub next: *mut Curl_easy, - pub prev: *mut Curl_easy, - pub conn: *mut connectdata, - pub connect_queue: Curl_llist_element, - pub conn_queue: Curl_llist_element, - pub mstate: CURLMstate, - pub result: CURLcode, - pub msg: Curl_message, - pub sockets: [curl_socket_t; 5], - pub actions: [libc::c_uchar; 5], - pub numsocks: libc::c_int, - pub dns: Names, - pub multi: *mut Curl_multi, - pub multi_easy: *mut Curl_multi, - pub share: *mut Curl_share, - pub psl: *mut PslCache, - pub req: SingleRequest, - pub set: UserDefined, - pub cookies: *mut CookieInfo, - pub hsts: *mut hsts, - pub asi: *mut altsvcinfo, - pub progress: Progress, - pub state: UrlState, - pub wildcard: WildcardData, - pub info: PureInfo, - pub tsi: curl_tlssessioninfo, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} -pub type curl_sslbackend = libc::c_uint; -pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; -pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; -pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; -pub const CURLSSLBACKEND_MBEDTLS: curl_sslbackend = 11; -pub const CURLSSLBACKEND_AXTLS: curl_sslbackend = 10; -pub const CURLSSLBACKEND_SECURETRANSPORT: curl_sslbackend = 9; -pub const CURLSSLBACKEND_SCHANNEL: curl_sslbackend = 8; -pub const CURLSSLBACKEND_WOLFSSL: curl_sslbackend = 7; -pub const CURLSSLBACKEND_POLARSSL: curl_sslbackend = 6; -pub const CURLSSLBACKEND_GSKIT: curl_sslbackend = 5; -pub const CURLSSLBACKEND_OBSOLETE4: curl_sslbackend = 4; -pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; -pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; -pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; -pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; -pub const CURLPX_LAST: CURLproxycode = 34; -pub const CURLPX_USER_REJECTED: CURLproxycode = 33; -pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; -pub const CURLPX_UNKNOWN_FAIL: CURLproxycode = 31; -pub const CURLPX_SEND_REQUEST: CURLproxycode = 30; -pub const CURLPX_SEND_CONNECT: CURLproxycode = 29; -pub const CURLPX_SEND_AUTH: CURLproxycode = 28; -pub const CURLPX_RESOLVE_HOST: CURLproxycode = 27; -pub const CURLPX_REQUEST_FAILED: CURLproxycode = 26; -pub const CURLPX_REPLY_UNASSIGNED: CURLproxycode = 25; -pub const CURLPX_REPLY_TTL_EXPIRED: CURLproxycode = 24; -pub const CURLPX_REPLY_NOT_ALLOWED: CURLproxycode = 23; -pub const CURLPX_REPLY_NETWORK_UNREACHABLE: CURLproxycode = 22; -pub const CURLPX_REPLY_HOST_UNREACHABLE: CURLproxycode = 21; -pub const CURLPX_REPLY_GENERAL_SERVER_FAILURE: CURLproxycode = 20; -pub const CURLPX_REPLY_CONNECTION_REFUSED: CURLproxycode = 19; -pub const CURLPX_REPLY_COMMAND_NOT_SUPPORTED: CURLproxycode = 18; -pub const CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED: CURLproxycode = 17; -pub const CURLPX_RECV_REQACK: CURLproxycode = 16; -pub const CURLPX_RECV_CONNECT: CURLproxycode = 15; -pub const CURLPX_RECV_AUTH: CURLproxycode = 14; -pub const CURLPX_RECV_ADDRESS: CURLproxycode = 13; -pub const CURLPX_NO_AUTH: CURLproxycode = 12; -pub const CURLPX_LONG_USER: CURLproxycode = 11; -pub const CURLPX_LONG_PASSWD: CURLproxycode = 10; -pub const CURLPX_LONG_HOSTNAME: CURLproxycode = 9; -pub const CURLPX_IDENTD_DIFFER: CURLproxycode = 8; -pub const CURLPX_IDENTD: CURLproxycode = 7; -pub const CURLPX_GSSAPI_PROTECTION: CURLproxycode = 6; -pub const CURLPX_GSSAPI_PERMSG: CURLproxycode = 5; -pub const CURLPX_GSSAPI: CURLproxycode = 4; -pub const CURLPX_CLOSED: CURLproxycode = 3; -pub const CURLPX_BAD_VERSION: CURLproxycode = 2; -pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; -pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; -pub const CURLWC_DONE: wildcard_states = 7; -pub const CURLWC_ERROR: wildcard_states = 6; -pub const CURLWC_SKIP: wildcard_states = 5; -pub const CURLWC_CLEAN: wildcard_states = 4; -pub const CURLWC_DOWNLOADING: wildcard_states = 3; -pub const CURLWC_MATCHING: wildcard_states = 2; -pub const CURLWC_INIT: wildcard_states = 1; -pub const CURLWC_CLEAR: wildcard_states = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UrlState { - pub conn_cache: *mut conncache, - pub keeps_speed: curltime, - pub lastconnect_id: libc::c_long, - pub headerb: dynbuf, - pub buffer: *mut libc::c_char, - pub ulbuf: *mut libc::c_char, - pub current_speed: curl_off_t, - pub first_host: *mut libc::c_char, - pub retrycount: libc::c_int, - pub first_remote_port: libc::c_int, - pub session: *mut Curl_ssl_session, - pub sessionage: libc::c_long, - pub tempwrite: [tempbuf; 3], - pub tempcount: libc::c_uint, - pub os_errno: libc::c_int, - pub scratch: *mut libc::c_char, - pub followlocation: libc::c_long, - pub prev_signal: Option ()>, - pub digest: digestdata, - pub proxydigest: digestdata, - pub authhost: auth, - pub authproxy: auth, - pub async_0: Curl_async, - pub engine: *mut libc::c_void, - pub expiretime: curltime, - pub timenode: Curl_tree, - pub timeoutlist: Curl_llist, - pub expires: [time_node; 13], - pub most_recent_ftp_entrypath: *mut libc::c_char, - pub httpwant: libc::c_uchar, - pub httpversion: libc::c_uchar, - #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] - pub prev_block_had_trailing_cr: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 5], - pub crlf_conversions: curl_off_t, - pub range: *mut libc::c_char, - pub resume_from: curl_off_t, - pub rtsp_next_client_CSeq: libc::c_long, - pub rtsp_next_server_CSeq: libc::c_long, - pub rtsp_CSeq_recv: libc::c_long, - pub infilesize: curl_off_t, - pub drain: size_t, - pub fread_func: curl_read_callback, - pub in_0: *mut libc::c_void, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub uh: *mut CURLU, - pub up: urlpieces, - pub httpreq: Curl_HttpReq, - pub url: *mut libc::c_char, - pub referer: *mut libc::c_char, - pub cookielist: *mut curl_slist, - pub resolve: *mut curl_slist, - pub trailers_bytes_sent: size_t, - pub trailers_buf: dynbuf, - pub trailers_state: trailers_state, - pub aptr: dynamically_allocated_data, - #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] - #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] - #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] - #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] - #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] - #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] - #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] - #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] - #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] - #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] - #[bitfield(name = "done", ty = "bit", bits = "12..=12")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] - #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] - #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] - #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] - #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] - #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] - #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: - [u8; 3], - #[bitfield(padding)] - pub c2rust_padding_0: [u8; 5], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; -pub const TRAILERS_DONE: trailers_state = 3; -pub const TRAILERS_SENDING: trailers_state = 2; -pub const TRAILERS_INITIALIZED: trailers_state = 1; -pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; -pub const HTTPREQ_HEAD: Curl_HttpReq = 5; -pub const HTTPREQ_PUT: Curl_HttpReq = 4; -pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; -pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; -pub const HTTPREQ_POST: Curl_HttpReq = 1; -pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} -pub type CURLU = Curl_URL; -pub type curl_read_callback = - Option size_t>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; -pub const EXPIRE_LAST: expire_id = 13; -pub const EXPIRE_QUIC: expire_id = 12; -pub const EXPIRE_TOOFAST: expire_id = 11; -pub const EXPIRE_TIMEOUT: expire_id = 10; -pub const EXPIRE_SPEEDCHECK: expire_id = 9; -pub const EXPIRE_RUN_NOW: expire_id = 8; -pub const EXPIRE_MULTI_PENDING: expire_id = 7; -pub const EXPIRE_HAPPY_EYEBALLS: expire_id = 6; -pub const EXPIRE_HAPPY_EYEBALLS_DNS: expire_id = 5; -pub const EXPIRE_DNS_PER_NAME2: expire_id = 4; -pub const EXPIRE_DNS_PER_NAME: expire_id = 3; -pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; -pub const EXPIRE_ASYNC_NAME: expire_id = 1; -pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Curl_async { - pub hostname: *mut libc::c_char, - pub dns: *mut Curl_dns_entry, - pub tdata: *mut thread_data, - pub resolver: *mut libc::c_void, - pub port: libc::c_int, - pub status: libc::c_int, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - pub done: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl_session { - pub name: *mut libc::c_char, - pub conn_to_host: *mut libc::c_char, - pub scheme: *const libc::c_char, - pub sessionid: *mut libc::c_void, - pub idsize: size_t, - pub age: libc::c_long, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub ssl_config: ssl_primary_config, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_primary_config { - pub version: libc::c_long, - pub version_max: libc::c_long, - pub CApath: *mut libc::c_char, - pub CAfile: *mut libc::c_char, - pub issuercert: *mut libc::c_char, - pub clientcert: *mut libc::c_char, - pub random_file: *mut libc::c_char, - pub egdsocket: *mut libc::c_char, - pub cipher_list: *mut libc::c_char, - pub cipher_list13: *mut libc::c_char, - pub pinned_key: *mut libc::c_char, - pub cert_blob: *mut curl_blob, - pub ca_info_blob: *mut curl_blob, - pub issuercert_blob: *mut curl_blob, - pub curves: *mut libc::c_char, - #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] - #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] - #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] - #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] - pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct conncache { - pub hash: Curl_hash, - pub num_conn: size_t, - pub next_connection_id: libc::c_long, - pub last_cleanup: curltime, - pub closure_handle: *mut Curl_easy, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option ()>; -pub type comp_function = - Option size_t>; -pub type hash_function = Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UserDefined { - pub err: *mut FILE, - pub debugdata: *mut libc::c_void, - pub errorbuffer: *mut libc::c_char, - pub proxyport: libc::c_long, - pub out: *mut libc::c_void, - pub in_set: *mut libc::c_void, - pub writeheader: *mut libc::c_void, - pub rtp_out: *mut libc::c_void, - pub use_port: libc::c_long, - pub httpauth: libc::c_ulong, - pub proxyauth: libc::c_ulong, - pub socks5auth: libc::c_ulong, - pub maxredirs: libc::c_long, - pub keep_post: libc::c_int, - pub postfields: *mut libc::c_void, - pub seek_func: curl_seek_callback, - pub postfieldsize: curl_off_t, - pub localport: libc::c_ushort, - pub localportrange: libc::c_int, - pub fwrite_func: curl_write_callback, - pub fwrite_header: curl_write_callback, - pub fwrite_rtp: curl_write_callback, - pub fread_func_set: curl_read_callback, - pub fprogress: curl_progress_callback, - pub fxferinfo: curl_xferinfo_callback, - pub fdebug: curl_debug_callback, - pub ioctl_func: curl_ioctl_callback, - pub fsockopt: curl_sockopt_callback, - pub sockopt_client: *mut libc::c_void, - pub fopensocket: curl_opensocket_callback, - pub opensocket_client: *mut libc::c_void, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub seek_client: *mut libc::c_void, - pub convfromnetwork: curl_conv_callback, - pub convtonetwork: curl_conv_callback, - pub convfromutf8: curl_conv_callback, - pub hsts_read: curl_hstsread_callback, - pub hsts_read_userp: *mut libc::c_void, - pub hsts_write: curl_hstswrite_callback, - pub hsts_write_userp: *mut libc::c_void, - pub progress_client: *mut libc::c_void, - pub ioctl_client: *mut libc::c_void, - pub timeout: libc::c_long, - pub connecttimeout: libc::c_long, - pub accepttimeout: libc::c_long, - pub happy_eyeballs_timeout: libc::c_long, - pub server_response_timeout: libc::c_long, - pub maxage_conn: libc::c_long, - pub tftp_blksize: libc::c_long, - pub filesize: curl_off_t, - pub low_speed_limit: libc::c_long, - pub low_speed_time: libc::c_long, - pub max_send_speed: curl_off_t, - pub max_recv_speed: curl_off_t, - pub set_resume_from: curl_off_t, - pub headers: *mut curl_slist, - pub proxyheaders: *mut curl_slist, - pub httppost: *mut curl_httppost, - pub mimepost: curl_mimepart, - pub quote: *mut curl_slist, - pub postquote: *mut curl_slist, - pub prequote: *mut curl_slist, - pub source_quote: *mut curl_slist, - pub source_prequote: *mut curl_slist, - pub source_postquote: *mut curl_slist, - pub telnet_options: *mut curl_slist, - pub resolve: *mut curl_slist, - pub connect_to: *mut curl_slist, - pub timecondition: curl_TimeCond, - pub proxytype: curl_proxytype, - pub timevalue: time_t, - pub method: Curl_HttpReq, - pub httpwant: libc::c_uchar, - pub ssl: ssl_config_data, - pub proxy_ssl: ssl_config_data, - pub general_ssl: ssl_general_config, - pub dns_cache_timeout: libc::c_long, - pub buffer_size: libc::c_long, - pub upload_buffer_size: libc::c_uint, - pub private_data: *mut libc::c_void, - pub http200aliases: *mut curl_slist, - pub ipver: libc::c_uchar, - pub max_filesize: curl_off_t, - pub ftp_filemethod: curl_ftpfile, - pub ftpsslauth: curl_ftpauth, - pub ftp_ccc: curl_ftpccc, - pub ftp_create_missing_dirs: libc::c_int, - pub ssh_keyfunc: curl_sshkeycallback, - pub ssh_keyfunc_userp: *mut libc::c_void, - pub use_netrc: CURL_NETRC_OPTION, - pub use_ssl: curl_usessl, - pub new_file_perms: libc::c_long, - pub new_directory_perms: libc::c_long, - pub ssh_auth_types: libc::c_long, - pub str_0: [*mut libc::c_char; 80], - pub blobs: [*mut curl_blob; 8], - pub scope_id: libc::c_uint, - pub allowed_protocols: libc::c_long, - pub redir_protocols: libc::c_long, - pub mail_rcpt: *mut curl_slist, - pub rtspreq: Curl_RtspReq, - pub rtspversion: libc::c_long, - pub chunk_bgn: curl_chunk_bgn_callback, - pub chunk_end: curl_chunk_end_callback, - pub fnmatch: curl_fnmatch_callback, - pub fnmatch_data: *mut libc::c_void, - pub gssapi_delegation: libc::c_long, - pub tcp_keepidle: libc::c_long, - pub tcp_keepintvl: libc::c_long, - pub maxconnects: size_t, - pub expect_100_timeout: libc::c_long, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub stream_dependents: *mut Curl_http2_dep, - pub resolver_start: curl_resolver_start_callback, - pub resolver_start_client: *mut libc::c_void, - pub upkeep_interval_ms: libc::c_long, - pub fmultidone: multidone_func, - pub dohfor: *mut Curl_easy, - pub uh: *mut CURLU, - pub trailer_data: *mut libc::c_void, - pub trailer_callback: curl_trailer_callback, - #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] - #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] - #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] - #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] - #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] - #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] - #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] - #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] - #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] - #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] - #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] - #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] - #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] - #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] - #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] - #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] - #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] - #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] - #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] - #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] - #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] - #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] - #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] - #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] - #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] - #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] - #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] - #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] - #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] - #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] - #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] - #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] - #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] - #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] - #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] - #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] - #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] - #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] - #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] - #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] - #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] - #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] - #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] - #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] - #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] - #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] - #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] - #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] - #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] - #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] - #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] - #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] - #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] - #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: - [u8; 8], -} -pub type curl_trailer_callback = - Option libc::c_int>; -pub type multidone_func = Option libc::c_int>; -pub type CURLcode = libc::c_uint; -pub const CURL_LAST: CURLcode = 99; -pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; -pub const CURLE_PROXY: CURLcode = 97; -pub const CURLE_QUIC_CONNECT_ERROR: CURLcode = 96; -pub const CURLE_HTTP3: CURLcode = 95; -pub const CURLE_AUTH_ERROR: CURLcode = 94; -pub const CURLE_RECURSIVE_API_CALL: CURLcode = 93; -pub const CURLE_HTTP2_STREAM: CURLcode = 92; -pub const CURLE_SSL_INVALIDCERTSTATUS: CURLcode = 91; -pub const CURLE_SSL_PINNEDPUBKEYNOTMATCH: CURLcode = 90; -pub const CURLE_NO_CONNECTION_AVAILABLE: CURLcode = 89; -pub const CURLE_CHUNK_FAILED: CURLcode = 88; -pub const CURLE_FTP_BAD_FILE_LIST: CURLcode = 87; -pub const CURLE_RTSP_SESSION_ERROR: CURLcode = 86; -pub const CURLE_RTSP_CSEQ_ERROR: CURLcode = 85; -pub const CURLE_FTP_PRET_FAILED: CURLcode = 84; -pub const CURLE_SSL_ISSUER_ERROR: CURLcode = 83; -pub const CURLE_SSL_CRL_BADFILE: CURLcode = 82; -pub const CURLE_AGAIN: CURLcode = 81; -pub const CURLE_SSL_SHUTDOWN_FAILED: CURLcode = 80; -pub const CURLE_SSH: CURLcode = 79; -pub const CURLE_REMOTE_FILE_NOT_FOUND: CURLcode = 78; -pub const CURLE_SSL_CACERT_BADFILE: CURLcode = 77; -pub const CURLE_CONV_REQD: CURLcode = 76; -pub const CURLE_CONV_FAILED: CURLcode = 75; -pub const CURLE_TFTP_NOSUCHUSER: CURLcode = 74; -pub const CURLE_REMOTE_FILE_EXISTS: CURLcode = 73; -pub const CURLE_TFTP_UNKNOWNID: CURLcode = 72; -pub const CURLE_TFTP_ILLEGAL: CURLcode = 71; -pub const CURLE_REMOTE_DISK_FULL: CURLcode = 70; -pub const CURLE_TFTP_PERM: CURLcode = 69; -pub const CURLE_TFTP_NOTFOUND: CURLcode = 68; -pub const CURLE_LOGIN_DENIED: CURLcode = 67; -pub const CURLE_SSL_ENGINE_INITFAILED: CURLcode = 66; -pub const CURLE_SEND_FAIL_REWIND: CURLcode = 65; -pub const CURLE_USE_SSL_FAILED: CURLcode = 64; -pub const CURLE_FILESIZE_EXCEEDED: CURLcode = 63; -pub const CURLE_LDAP_INVALID_URL: CURLcode = 62; -pub const CURLE_BAD_CONTENT_ENCODING: CURLcode = 61; -pub const CURLE_PEER_FAILED_VERIFICATION: CURLcode = 60; -pub const CURLE_SSL_CIPHER: CURLcode = 59; -pub const CURLE_SSL_CERTPROBLEM: CURLcode = 58; -pub const CURLE_OBSOLETE57: CURLcode = 57; -pub const CURLE_RECV_ERROR: CURLcode = 56; -pub const CURLE_SEND_ERROR: CURLcode = 55; -pub const CURLE_SSL_ENGINE_SETFAILED: CURLcode = 54; -pub const CURLE_SSL_ENGINE_NOTFOUND: CURLcode = 53; -pub const CURLE_GOT_NOTHING: CURLcode = 52; -pub const CURLE_OBSOLETE51: CURLcode = 51; -pub const CURLE_OBSOLETE50: CURLcode = 50; -pub const CURLE_SETOPT_OPTION_SYNTAX: CURLcode = 49; -pub const CURLE_UNKNOWN_OPTION: CURLcode = 48; -pub const CURLE_TOO_MANY_REDIRECTS: CURLcode = 47; -pub const CURLE_OBSOLETE46: CURLcode = 46; -pub const CURLE_INTERFACE_FAILED: CURLcode = 45; -pub const CURLE_OBSOLETE44: CURLcode = 44; -pub const CURLE_BAD_FUNCTION_ARGUMENT: CURLcode = 43; -pub const CURLE_ABORTED_BY_CALLBACK: CURLcode = 42; -pub const CURLE_FUNCTION_NOT_FOUND: CURLcode = 41; -pub const CURLE_OBSOLETE40: CURLcode = 40; -pub const CURLE_LDAP_SEARCH_FAILED: CURLcode = 39; -pub const CURLE_LDAP_CANNOT_BIND: CURLcode = 38; -pub const CURLE_FILE_COULDNT_READ_FILE: CURLcode = 37; -pub const CURLE_BAD_DOWNLOAD_RESUME: CURLcode = 36; -pub const CURLE_SSL_CONNECT_ERROR: CURLcode = 35; -pub const CURLE_HTTP_POST_ERROR: CURLcode = 34; -pub const CURLE_RANGE_ERROR: CURLcode = 33; -pub const CURLE_OBSOLETE32: CURLcode = 32; -pub const CURLE_FTP_COULDNT_USE_REST: CURLcode = 31; -pub const CURLE_FTP_PORT_FAILED: CURLcode = 30; -pub const CURLE_OBSOLETE29: CURLcode = 29; -pub const CURLE_OPERATION_TIMEDOUT: CURLcode = 28; -pub const CURLE_OUT_OF_MEMORY: CURLcode = 27; -pub const CURLE_READ_ERROR: CURLcode = 26; -pub const CURLE_UPLOAD_FAILED: CURLcode = 25; -pub const CURLE_OBSOLETE24: CURLcode = 24; -pub const CURLE_WRITE_ERROR: CURLcode = 23; -pub const CURLE_HTTP_RETURNED_ERROR: CURLcode = 22; -pub const CURLE_QUOTE_ERROR: CURLcode = 21; -pub const CURLE_OBSOLETE20: CURLcode = 20; -pub const CURLE_FTP_COULDNT_RETR_FILE: CURLcode = 19; -pub const CURLE_PARTIAL_FILE: CURLcode = 18; -pub const CURLE_FTP_COULDNT_SET_TYPE: CURLcode = 17; -pub const CURLE_HTTP2: CURLcode = 16; -pub const CURLE_FTP_CANT_GET_HOST: CURLcode = 15; -pub const CURLE_FTP_WEIRD_227_FORMAT: CURLcode = 14; -pub const CURLE_FTP_WEIRD_PASV_REPLY: CURLcode = 13; -pub const CURLE_FTP_ACCEPT_TIMEOUT: CURLcode = 12; -pub const CURLE_FTP_WEIRD_PASS_REPLY: CURLcode = 11; -pub const CURLE_FTP_ACCEPT_FAILED: CURLcode = 10; -pub const CURLE_REMOTE_ACCESS_DENIED: CURLcode = 9; -pub const CURLE_WEIRD_SERVER_REPLY: CURLcode = 8; -pub const CURLE_COULDNT_CONNECT: CURLcode = 7; -pub const CURLE_COULDNT_RESOLVE_HOST: CURLcode = 6; -pub const CURLE_COULDNT_RESOLVE_PROXY: CURLcode = 5; -pub const CURLE_NOT_BUILT_IN: CURLcode = 4; -pub const CURLE_URL_MALFORMAT: CURLcode = 3; -pub const CURLE_FAILED_INIT: CURLcode = 2; -pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; -pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void, *mut libc::c_void) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_http2_dep { - pub next: *mut Curl_http2_dep, - pub data: *mut Curl_easy, -} -pub type curl_fnmatch_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option libc::c_long>; -pub type curl_chunk_bgn_callback = Option< - unsafe extern "C" fn(*const libc::c_void, *mut libc::c_void, libc::c_int) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; -pub const RTSPREQ_LAST: Curl_RtspReq = 12; -pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; -pub const RTSPREQ_RECORD: Curl_RtspReq = 10; -pub const RTSPREQ_SET_PARAMETER: Curl_RtspReq = 9; -pub const RTSPREQ_GET_PARAMETER: Curl_RtspReq = 8; -pub const RTSPREQ_TEARDOWN: Curl_RtspReq = 7; -pub const RTSPREQ_PAUSE: Curl_RtspReq = 6; -pub const RTSPREQ_PLAY: Curl_RtspReq = 5; -pub const RTSPREQ_SETUP: Curl_RtspReq = 4; -pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; -pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; -pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; -pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; -pub const CURLUSESSL_LAST: curl_usessl = 4; -pub const CURLUSESSL_ALL: curl_usessl = 3; -pub const CURLUSESSL_CONTROL: curl_usessl = 2; -pub const CURLUSESSL_TRY: curl_usessl = 1; -pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; -pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; -pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; -pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; -pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option< - unsafe extern "C" fn( - *mut CURL, - *const curl_khkey, - *const curl_khkey, - curl_khmatch, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_khmatch = libc::c_uint; -pub const CURLKHMATCH_LAST: curl_khmatch = 3; -pub const CURLKHMATCH_MISSING: curl_khmatch = 2; -pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; -pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; -pub const CURLKHTYPE_ED25519: curl_khtype = 5; -pub const CURLKHTYPE_ECDSA: curl_khtype = 4; -pub const CURLKHTYPE_DSS: curl_khtype = 3; -pub const CURLKHTYPE_RSA: curl_khtype = 2; -pub const CURLKHTYPE_RSA1: curl_khtype = 1; -pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; -pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; -pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; -pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; -pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; -pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; -pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; -pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; -pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; -pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; -pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; -pub const FTPFILE_NOCWD: curl_ftpfile = 2; -pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_config_data { - pub primary: ssl_primary_config, - pub certverifyresult: libc::c_long, - pub CRLfile: *mut libc::c_char, - pub fsslctx: curl_ssl_ctx_callback, - pub fsslctxp: *mut libc::c_void, - pub cert_type: *mut libc::c_char, - pub key: *mut libc::c_char, - pub key_blob: *mut curl_blob, - pub key_type: *mut libc::c_char, - pub key_passwd: *mut libc::c_char, - pub username: *mut libc::c_char, - pub password: *mut libc::c_char, - pub authtype: CURL_TLSAUTH, - #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] - #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] - #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] - #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] - #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] - #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] - #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] - #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: - [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type CURL_TLSAUTH = libc::c_uint; -pub const CURL_TLSAUTH_LAST: CURL_TLSAUTH = 2; -pub const CURL_TLSAUTH_SRP: CURL_TLSAUTH = 1; -pub const CURL_TLSAUTH_NONE: CURL_TLSAUTH = 0; -pub type curl_ssl_ctx_callback = - Option CURLcode>; -pub type curl_proxytype = libc::c_uint; -pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; -pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; -pub const CURLPROXY_SOCKS5: curl_proxytype = 5; -pub const CURLPROXY_SOCKS4: curl_proxytype = 4; -pub const CURLPROXY_HTTPS: curl_proxytype = 2; -pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; -pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; -pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; -pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; -pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; -pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; -pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mimepart { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mime, - pub nextpart: *mut curl_mimepart, - pub kind: mimekind, - pub flags: libc::c_uint, - pub data: *mut libc::c_char, - pub readfunc: curl_read_callback, - pub seekfunc: curl_seek_callback, - pub freefunc: curl_free_callback, - pub arg: *mut libc::c_void, - pub fp: *mut FILE, - pub curlheaders: *mut curl_slist, - pub userheaders: *mut curl_slist, - pub mimetype: *mut libc::c_char, - pub filename: *mut libc::c_char, - pub name: *mut libc::c_char, - pub datasize: curl_off_t, - pub state: mime_state, - pub encoder: *const mime_encoder, - pub encstate: mime_encoder_state, - pub lastreadstatus: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder { - pub name: *const libc::c_char, - pub encodefunc: - Option size_t>, - pub sizefunc: Option curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, -} -pub type mimestate = libc::c_uint; -pub const MIMESTATE_LAST: mimestate = 9; -pub const MIMESTATE_END: mimestate = 8; -pub const MIMESTATE_CONTENT: mimestate = 7; -pub const MIMESTATE_BOUNDARY2: mimestate = 6; -pub const MIMESTATE_BOUNDARY1: mimestate = 5; -pub const MIMESTATE_BODY: mimestate = 4; -pub const MIMESTATE_EOH: mimestate = 3; -pub const MIMESTATE_USERHEADERS: mimestate = 2; -pub const MIMESTATE_CURLHEADERS: mimestate = 1; -pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option ()>; -pub type curl_seek_callback = - Option libc::c_int>; -pub type mimekind = libc::c_uint; -pub const MIMEKIND_LAST: mimekind = 5; -pub const MIMEKIND_MULTIPART: mimekind = 4; -pub const MIMEKIND_CALLBACK: mimekind = 3; -pub const MIMEKIND_FILE: mimekind = 2; -pub const MIMEKIND_DATA: mimekind = 1; -pub const MIMEKIND_NONE: mimekind = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mime { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mimepart, - pub firstpart: *mut curl_mimepart, - pub lastpart: *mut curl_mimepart, - pub boundary: [libc::c_char; 41], - pub state: mime_state, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut curl_index, - *mut libc::c_void, - ) -> CURLSTScode, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; -pub const CURLSTS_FAIL: CURLSTScode = 2; -pub const CURLSTS_DONE: CURLSTScode = 1; -pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = - Option CURLSTScode>; -pub type curl_conv_callback = Option CURLcode>; -pub type curl_closesocket_callback = - Option libc::c_int>; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, curlsocktype, *mut curl_sockaddr) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; -pub const CURLSOCKTYPE_LAST: curlsocktype = 2; -pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; -pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = - Option libc::c_int>; -pub type curl_ioctl_callback = - Option curlioerr>; -pub type curlioerr = libc::c_uint; -pub const CURLIOE_LAST: curlioerr = 3; -pub const CURLIOE_FAILRESTART: curlioerr = 2; -pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; -pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_infotype = libc::c_uint; -pub const CURLINFO_END: curl_infotype = 7; -pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; -pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; -pub const CURLINFO_DATA_OUT: curl_infotype = 4; -pub const CURLINFO_DATA_IN: curl_infotype = 3; -pub const CURLINFO_HEADER_OUT: curl_infotype = 2; -pub const CURLINFO_HEADER_IN: curl_infotype = 1; -pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, ->; -pub type curl_progress_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, - ) -> libc::c_int, ->; -pub type curl_write_callback = - Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct SingleRequest { - pub size: curl_off_t, - pub maxdownload: curl_off_t, - pub bytecount: curl_off_t, - pub writebytecount: curl_off_t, - pub headerbytecount: curl_off_t, - pub deductheadercount: curl_off_t, - pub pendingheader: curl_off_t, - pub start: curltime, - pub now: curltime, - pub badheader: C2RustUnnamed_1, - pub headerline: libc::c_int, - pub str_0: *mut libc::c_char, - pub offset: curl_off_t, - pub httpcode: libc::c_int, - pub keepon: libc::c_int, - pub start100: curltime, - pub exp100: expect100, - pub upgr101: upgrade101, - pub writer_stack: *mut contenc_writer, - pub timeofdoc: time_t, - pub bodywrites: libc::c_long, - pub location: *mut libc::c_char, - pub newurl: *mut libc::c_char, - pub upload_present: ssize_t, - pub upload_fromhere: *mut libc::c_char, - pub p: C2RustUnnamed, - pub doh: *mut dohdata, - #[bitfield(name = "header", ty = "bit", bits = "0..=0")] - #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] - #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] - #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] - #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] - #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] - #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] - #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] - #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: - [u8; 2], - #[bitfield(padding)] - pub c2rust_padding: [u8; 6], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dohdata { - pub headers: *mut curl_slist, - pub probe: [dnsprobe; 2], - pub pending: libc::c_uint, - pub port: libc::c_int, - pub host: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dnsprobe { - pub easy: *mut CURL, - pub dnstype: libc::c_int, - pub dohbuffer: [libc::c_uchar; 512], - pub dohlen: size_t, - pub serverdoh: dynbuf, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed { - pub file: *mut FILEPROTO, - pub ftp: *mut FTP, - pub http: *mut HTTP, - pub imap: *mut IMAP, - pub ldap: *mut ldapreqinfo, - pub mqtt: *mut MQTT, - pub pop3: *mut POP3, - pub rtsp: *mut RTSP, - pub smb: *mut smb_request, - pub smtp: *mut SMTP, - pub ssh: *mut SSHPROTO, - pub telnet: *mut TELNET, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; -pub const PPTRANSFER_NONE: curl_pp_transfer = 2; -pub const PPTRANSFER_INFO: curl_pp_transfer = 1; -pub const PPTRANSFER_BODY: curl_pp_transfer = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct RTSP { - pub http_wrapper: HTTP, - pub CSeq_sent: libc::c_long, - pub CSeq_recv: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HTTP { - pub sendit: *mut curl_mimepart, - pub postsize: curl_off_t, - pub postdata: *const libc::c_char, - pub p_pragma: *const libc::c_char, - pub form: curl_mimepart, - pub backup: back, - pub sending: C2RustUnnamed_0, - pub send_buffer: dynbuf, - pub stream_id: int32_t, - pub bodystarted: bool, - pub header_recvbuf: dynbuf, - pub nread_header_recvbuf: size_t, - pub trailer_recvbuf: dynbuf, - pub status_code: libc::c_int, - pub pausedata: *const uint8_t, - pub pauselen: size_t, - pub close_handled: bool, - pub push_headers: *mut *mut libc::c_char, - pub push_headers_used: size_t, - pub push_headers_alloc: size_t, - pub error: uint32_t, - pub closed: bool, - pub mem: *mut libc::c_char, - pub len: size_t, - pub memlen: size_t, - pub upload_mem: *const uint8_t, - pub upload_len: size_t, - pub upload_left: curl_off_t, -} -pub type uint8_t = __uint8_t; -pub type uint32_t = __uint32_t; -pub type C2RustUnnamed_0 = libc::c_uint; -pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; -pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; -pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -pub type upgrade101 = libc::c_uint; -pub const UPGR101_WORKING: upgrade101 = 3; -pub const UPGR101_RECEIVED: upgrade101 = 2; -pub const UPGR101_REQUESTED: upgrade101 = 1; -pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; -pub const EXP100_FAILED: expect100 = 3; -pub const EXP100_SENDING_REQUEST: expect100 = 2; -pub const EXP100_AWAITING_CONTINUE: expect100 = 1; -pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; -pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; -pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; -pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct PslCache { - pub psl: *const psl_ctx_t, - pub expires: time_t, - pub dynamic: bool, -} -pub type psl_ctx_t = psl_ctx_st; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_multi { - pub magic: libc::c_uint, - pub easyp: *mut Curl_easy, - pub easylp: *mut Curl_easy, - pub num_easy: libc::c_int, - pub num_alive: libc::c_int, - pub msglist: Curl_llist, - pub pending: Curl_llist, - pub socket_cb: curl_socket_callback, - pub socket_userp: *mut libc::c_void, - pub push_cb: curl_push_callback, - pub push_userp: *mut libc::c_void, - pub hostcache: Curl_hash, - pub psl: PslCache, - pub timetree: *mut Curl_tree, - pub sockhash: Curl_hash, - pub conn_cache: conncache, - pub maxconnects: libc::c_long, - pub max_host_connections: libc::c_long, - pub max_total_connections: libc::c_long, - pub timer_cb: curl_multi_timer_callback, - pub timer_userp: *mut libc::c_void, - pub timer_lastcall: curltime, - pub max_concurrent_streams: libc::c_uint, - pub wakeup_pair: [curl_socket_t; 2], - pub multiplexing: bool, - pub recheckstate: bool, - pub in_callback: bool, - pub ipv6_works: bool, - pub ssl_seeded: bool, -} -pub type curl_multi_timer_callback = - Option libc::c_int>; -pub type CURLM = Curl_multi; -pub type curl_push_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut CURL, - size_t, - *mut curl_pushheaders, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_socket_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_socket_t, - libc::c_int, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; -pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; -pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; -pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_message { - pub list: Curl_llist_element, - pub extmsg: CURLMsg, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CURLMsg { - pub msg: CURLMSG, - pub easy_handle: *mut CURL, - pub data: C2RustUnnamed_3, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_3 { - pub whatever: *mut libc::c_void, - pub result: CURLcode, -} -pub type CURLMSG = libc::c_uint; -pub const CURLMSG_LAST: CURLMSG = 2; -pub const CURLMSG_DONE: CURLMSG = 1; -pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; -pub const MSTATE_LAST: CURLMstate = 17; -pub const MSTATE_MSGSENT: CURLMstate = 16; -pub const MSTATE_COMPLETED: CURLMstate = 15; -pub const MSTATE_DONE: CURLMstate = 14; -pub const MSTATE_RATELIMITING: CURLMstate = 13; -pub const MSTATE_PERFORMING: CURLMstate = 12; -pub const MSTATE_DID: CURLMstate = 11; -pub const MSTATE_DOING_MORE: CURLMstate = 10; -pub const MSTATE_DOING: CURLMstate = 9; -pub const MSTATE_DO: CURLMstate = 8; -pub const MSTATE_PROTOCONNECTING: CURLMstate = 7; -pub const MSTATE_PROTOCONNECT: CURLMstate = 6; -pub const MSTATE_TUNNELING: CURLMstate = 5; -pub const MSTATE_CONNECTING: CURLMstate = 4; -pub const MSTATE_RESOLVING: CURLMstate = 3; -pub const MSTATE_CONNECT: CURLMstate = 2; -pub const MSTATE_PENDING: CURLMstate = 1; -pub const MSTATE_INIT: CURLMstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectdata { - pub cnnct: connstate, - pub bundle_node: Curl_llist_element, - pub chunk: Curl_chunker, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub connection_id: libc::c_long, - pub dns_entry: *mut Curl_dns_entry, - pub ip_addr: *mut Curl_addrinfo, - pub tempaddr: [*mut Curl_addrinfo; 2], - pub scope_id: libc::c_uint, - pub transport: C2RustUnnamed_6, - pub host: hostname, - pub hostname_resolve: *mut libc::c_char, - pub secondaryhostname: *mut libc::c_char, - pub conn_to_host: hostname, - pub socks_proxy: proxy_info, - pub http_proxy: proxy_info, - pub port: libc::c_int, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub secondary_port: libc::c_ushort, - pub primary_ip: [libc::c_char; 46], - pub ip_version: libc::c_uchar, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub options: *mut libc::c_char, - pub sasl_authzid: *mut libc::c_char, - pub httpversion: libc::c_uchar, - pub now: curltime, - pub created: curltime, - pub lastused: curltime, - pub sock: [curl_socket_t; 2], - pub tempsock: [curl_socket_t; 2], - pub tempfamily: [libc::c_int; 2], - pub recv: [Option; 2], - pub send: [Option; 2], - pub ssl: [ssl_connect_data; 2], - pub proxy_ssl: [ssl_connect_data; 2], - pub ssl_extra: *mut libc::c_void, - pub ssl_config: ssl_primary_config, - pub proxy_ssl_config: ssl_primary_config, - pub bits: ConnectBits, - pub num_addr: libc::c_int, - pub connecttime: curltime, - pub timeoutms_per_addr: [timediff_t; 2], - pub handler: *const Curl_handler, - pub given: *const Curl_handler, - pub keepalive: curltime, - pub sockfd: curl_socket_t, - pub writesockfd: curl_socket_t, - pub easyq: Curl_llist, - pub seek_func: curl_seek_callback, - pub seek_client: *mut libc::c_void, - pub http_ntlm_state: curlntlm, - pub proxy_ntlm_state: curlntlm, - pub ntlm: ntlmdata, - pub proxyntlm: ntlmdata, - pub trailer: dynbuf, - pub proto: C2RustUnnamed_5, - pub connect_state: *mut http_connect_state, - pub bundle: *mut connectbundle, - pub unix_domain_socket: *mut libc::c_char, - pub localdev: *mut libc::c_char, - pub localportrange: libc::c_int, - pub cselect_bits: libc::c_int, - pub waitfor: libc::c_int, - pub negnpn: libc::c_int, - pub localport: libc::c_ushort, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct http_connect_state { - pub http_proxy: HTTP, - pub prot_save: *mut HTTP, - pub rcvbuf: dynbuf, - pub req: dynbuf, - pub nsend: size_t, - pub keepon: keeponval, - pub cl: curl_off_t, - pub tunnel_state: C2RustUnnamed_4, - #[bitfield(name = "chunked_encoding", ty = "bit", bits = "0..=0")] - #[bitfield(name = "close_connection", ty = "bit", bits = "1..=1")] - pub chunked_encoding_close_connection: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type C2RustUnnamed_4 = libc::c_uint; -pub const TUNNEL_EXIT: C2RustUnnamed_4 = 3; -pub const TUNNEL_COMPLETE: C2RustUnnamed_4 = 2; -pub const TUNNEL_CONNECT: C2RustUnnamed_4 = 1; -pub const TUNNEL_INIT: C2RustUnnamed_4 = 0; -pub type keeponval = libc::c_uint; -pub const KEEPON_IGNORE: keeponval = 2; -pub const KEEPON_CONNECT: keeponval = 1; -pub const KEEPON_DONE: keeponval = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_5 { - pub ftpc: ftp_conn, - pub httpc: http_conn, - pub sshc: ssh_conn, - pub tftpc: *mut tftp_state_data, - pub imapc: imap_conn, - pub pop3c: pop3_conn, - pub smtpc: smtp_conn, - pub rtspc: rtsp_conn, - pub smbc: smb_conn, - pub rtmp: *mut libc::c_void, - pub ldapc: *mut ldapconninfo, - pub mqtt: mqtt_conn, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; -pub const MQTT_NOSTATE: mqttstate = 7; -pub const MQTT_PUB_REMAIN: mqttstate = 6; -pub const MQTT_PUBWAIT: mqttstate = 5; -pub const MQTT_SUBACK_COMING: mqttstate = 4; -pub const MQTT_SUBACK: mqttstate = 3; -pub const MQTT_CONNACK: mqttstate = 2; -pub const MQTT_REMAINING_LENGTH: mqttstate = 1; -pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; -pub const SMB_CONNECTED: smb_conn_state = 4; -pub const SMB_SETUP: smb_conn_state = 3; -pub const SMB_NEGOTIATE: smb_conn_state = 2; -pub const SMB_CONNECTING: smb_conn_state = 1; -pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smtp_conn { - pub pp: pingpong, - pub state: smtpstate, - pub ssldone: bool, - pub domain: *mut libc::c_char, - pub sasl: SASL, - pub tls_supported: bool, - pub size_supported: bool, - pub utf8_supported: bool, - pub auth_supported: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASL { - pub params: *const SASLproto, - pub state: saslstate, - pub authmechs: libc::c_ushort, - pub prefmech: libc::c_ushort, - pub authused: libc::c_ushort, - pub resetprefs: bool, - pub mutual_auth: bool, - pub force_ir: bool, -} -pub type saslstate = libc::c_uint; -pub const SASL_FINAL: saslstate = 17; -pub const SASL_CANCEL: saslstate = 16; -pub const SASL_GSASL: saslstate = 15; -pub const SASL_OAUTH2_RESP: saslstate = 14; -pub const SASL_OAUTH2: saslstate = 13; -pub const SASL_GSSAPI_NO_DATA: saslstate = 12; -pub const SASL_GSSAPI_TOKEN: saslstate = 11; -pub const SASL_GSSAPI: saslstate = 10; -pub const SASL_NTLM_TYPE2MSG: saslstate = 9; -pub const SASL_NTLM: saslstate = 8; -pub const SASL_DIGESTMD5_RESP: saslstate = 7; -pub const SASL_DIGESTMD5: saslstate = 6; -pub const SASL_CRAMMD5: saslstate = 5; -pub const SASL_EXTERNAL: saslstate = 4; -pub const SASL_LOGIN_PASSWD: saslstate = 3; -pub const SASL_LOGIN: saslstate = 2; -pub const SASL_PLAIN: saslstate = 1; -pub const SASL_STOP: saslstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASLproto { - pub service: *const libc::c_char, - pub contcode: libc::c_int, - pub finalcode: libc::c_int, - pub maxirlen: size_t, - pub sendauth: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - *const libc::c_char, - ) -> CURLcode, - >, - pub sendcont: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *const libc::c_char) -> CURLcode, - >, - pub getmessage: Option ()>, -} -pub type smtpstate = libc::c_uint; -pub const SMTP_LAST: smtpstate = 13; -pub const SMTP_QUIT: smtpstate = 12; -pub const SMTP_POSTDATA: smtpstate = 11; -pub const SMTP_DATA: smtpstate = 10; -pub const SMTP_RCPT: smtpstate = 9; -pub const SMTP_MAIL: smtpstate = 8; -pub const SMTP_COMMAND: smtpstate = 7; -pub const SMTP_AUTH: smtpstate = 6; -pub const SMTP_UPGRADETLS: smtpstate = 5; -pub const SMTP_STARTTLS: smtpstate = 4; -pub const SMTP_HELO: smtpstate = 3; -pub const SMTP_EHLO: smtpstate = 2; -pub const SMTP_SERVERGREET: smtpstate = 1; -pub const SMTP_STOP: smtpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pingpong { - pub cache: *mut libc::c_char, - pub cache_size: size_t, - pub nread_resp: size_t, - pub linestart_resp: *mut libc::c_char, - pub pending_resp: bool, - pub sendthis: *mut libc::c_char, - pub sendleft: size_t, - pub sendsize: size_t, - pub response: curltime, - pub response_time: timediff_t, - pub sendbuf: dynbuf, - pub statemachine: Option CURLcode>, - pub endofresp: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - >, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pop3_conn { - pub pp: pingpong, - pub state: pop3state, - pub ssldone: bool, - pub tls_supported: bool, - pub eob: size_t, - pub strip: size_t, - pub sasl: SASL, - pub authtypes: libc::c_uint, - pub preftype: libc::c_uint, - pub apoptimestamp: *mut libc::c_char, -} -pub type pop3state = libc::c_uint; -pub const POP3_LAST: pop3state = 11; -pub const POP3_QUIT: pop3state = 10; -pub const POP3_COMMAND: pop3state = 9; -pub const POP3_PASS: pop3state = 8; -pub const POP3_USER: pop3state = 7; -pub const POP3_APOP: pop3state = 6; -pub const POP3_AUTH: pop3state = 5; -pub const POP3_UPGRADETLS: pop3state = 4; -pub const POP3_STARTTLS: pop3state = 3; -pub const POP3_CAPA: pop3state = 2; -pub const POP3_SERVERGREET: pop3state = 1; -pub const POP3_STOP: pop3state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct imap_conn { - pub pp: pingpong, - pub state: imapstate, - pub ssldone: bool, - pub preauth: bool, - pub sasl: SASL, - pub preftype: libc::c_uint, - pub cmdid: libc::c_uint, - pub resptag: [libc::c_char; 5], - pub tls_supported: bool, - pub login_disabled: bool, - pub ir_supported: bool, - pub mailbox: *mut libc::c_char, - pub mailbox_uidvalidity: *mut libc::c_char, - pub dyn_0: dynbuf, -} -pub type imapstate = libc::c_uint; -pub const IMAP_LAST: imapstate = 15; -pub const IMAP_LOGOUT: imapstate = 14; -pub const IMAP_SEARCH: imapstate = 13; -pub const IMAP_APPEND_FINAL: imapstate = 12; -pub const IMAP_APPEND: imapstate = 11; -pub const IMAP_FETCH_FINAL: imapstate = 10; -pub const IMAP_FETCH: imapstate = 9; -pub const IMAP_SELECT: imapstate = 8; -pub const IMAP_LIST: imapstate = 7; -pub const IMAP_LOGIN: imapstate = 6; -pub const IMAP_AUTHENTICATE: imapstate = 5; -pub const IMAP_UPGRADETLS: imapstate = 4; -pub const IMAP_STARTTLS: imapstate = 3; -pub const IMAP_CAPABILITY: imapstate = 2; -pub const IMAP_SERVERGREET: imapstate = 1; -pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; -pub const SSH_LAST: sshstate = 60; -pub const SSH_QUIT: sshstate = 59; -pub const SSH_SESSION_FREE: sshstate = 58; -pub const SSH_SESSION_DISCONNECT: sshstate = 57; -pub const SSH_SCP_CHANNEL_FREE: sshstate = 56; -pub const SSH_SCP_WAIT_CLOSE: sshstate = 55; -pub const SSH_SCP_WAIT_EOF: sshstate = 54; -pub const SSH_SCP_SEND_EOF: sshstate = 53; -pub const SSH_SCP_DONE: sshstate = 52; -pub const SSH_SCP_DOWNLOAD: sshstate = 51; -pub const SSH_SCP_DOWNLOAD_INIT: sshstate = 50; -pub const SSH_SCP_UPLOAD_INIT: sshstate = 49; -pub const SSH_SCP_TRANS_INIT: sshstate = 48; -pub const SSH_SFTP_SHUTDOWN: sshstate = 47; -pub const SSH_SFTP_CLOSE: sshstate = 46; -pub const SSH_SFTP_DOWNLOAD_STAT: sshstate = 45; -pub const SSH_SFTP_DOWNLOAD_INIT: sshstate = 44; -pub const SSH_SFTP_READDIR_DONE: sshstate = 43; -pub const SSH_SFTP_READDIR_BOTTOM: sshstate = 42; -pub const SSH_SFTP_READDIR_LINK: sshstate = 41; -pub const SSH_SFTP_READDIR: sshstate = 40; -pub const SSH_SFTP_READDIR_INIT: sshstate = 39; -pub const SSH_SFTP_CREATE_DIRS_MKDIR: sshstate = 38; -pub const SSH_SFTP_CREATE_DIRS: sshstate = 37; -pub const SSH_SFTP_CREATE_DIRS_INIT: sshstate = 36; -pub const SSH_SFTP_UPLOAD_INIT: sshstate = 35; -pub const SSH_SFTP_TRANS_INIT: sshstate = 34; -pub const SSH_SFTP_FILETIME: sshstate = 33; -pub const SSH_SFTP_GETINFO: sshstate = 32; -pub const SSH_SFTP_QUOTE_STATVFS: sshstate = 31; -pub const SSH_SFTP_QUOTE_UNLINK: sshstate = 30; -pub const SSH_SFTP_QUOTE_RMDIR: sshstate = 29; -pub const SSH_SFTP_QUOTE_RENAME: sshstate = 28; -pub const SSH_SFTP_QUOTE_MKDIR: sshstate = 27; -pub const SSH_SFTP_QUOTE_SYMLINK: sshstate = 26; -pub const SSH_SFTP_QUOTE_SETSTAT: sshstate = 25; -pub const SSH_SFTP_QUOTE_STAT: sshstate = 24; -pub const SSH_SFTP_NEXT_QUOTE: sshstate = 23; -pub const SSH_SFTP_QUOTE: sshstate = 22; -pub const SSH_SFTP_POSTQUOTE_INIT: sshstate = 21; -pub const SSH_SFTP_QUOTE_INIT: sshstate = 20; -pub const SSH_SFTP_REALPATH: sshstate = 19; -pub const SSH_SFTP_INIT: sshstate = 18; -pub const SSH_AUTH_DONE: sshstate = 17; -pub const SSH_AUTH_GSSAPI: sshstate = 16; -pub const SSH_AUTH_KEY: sshstate = 15; -pub const SSH_AUTH_KEY_INIT: sshstate = 14; -pub const SSH_AUTH_HOST: sshstate = 13; -pub const SSH_AUTH_HOST_INIT: sshstate = 12; -pub const SSH_AUTH_AGENT: sshstate = 11; -pub const SSH_AUTH_AGENT_LIST: sshstate = 10; -pub const SSH_AUTH_AGENT_INIT: sshstate = 9; -pub const SSH_AUTH_PASS: sshstate = 8; -pub const SSH_AUTH_PASS_INIT: sshstate = 7; -pub const SSH_AUTH_PKEY: sshstate = 6; -pub const SSH_AUTH_PKEY_INIT: sshstate = 5; -pub const SSH_AUTHLIST: sshstate = 4; -pub const SSH_HOSTKEY: sshstate = 3; -pub const SSH_S_STARTUP: sshstate = 2; -pub const SSH_INIT: sshstate = 1; -pub const SSH_STOP: sshstate = 0; -pub const SSH_NO_STATE: sshstate = -1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct http_conn { - pub binsettings: [uint8_t; 80], - pub binlen: size_t, - pub trnsfr: *mut Curl_easy, - pub h2: *mut nghttp2_session, - pub send_underlying: Option, - pub recv_underlying: Option, - pub inbuf: *mut libc::c_char, - pub inbuflen: size_t, - pub nread_inbuf: size_t, - pub pause_stream_id: int32_t, - pub drain_total: size_t, - pub settings: h2settings, - pub local_settings: [nghttp2_settings_entry; 3], - pub local_settings_num: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct nghttp2_settings_entry { - pub settings_id: int32_t, - pub value: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct h2settings { - pub max_concurrent_streams: uint32_t, - pub enable_push: bool, -} -pub type Curl_recv = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *mut libc::c_char, - size_t, - *mut CURLcode, -) -> ssize_t; -pub type Curl_send = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *const libc::c_void, - size_t, - *mut CURLcode, -) -> ssize_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_conn { - pub pp: pingpong, - pub entrypath: *mut libc::c_char, - pub file: *mut libc::c_char, - pub dirs: *mut *mut libc::c_char, - pub dirdepth: libc::c_int, - pub dont_check: bool, - pub ctl_valid: bool, - pub cwddone: bool, - pub cwdcount: libc::c_int, - pub cwdfail: bool, - pub wait_data_conn: bool, - pub newport: libc::c_ushort, - pub newhost: *mut libc::c_char, - pub prevpath: *mut libc::c_char, - pub transfertype: libc::c_char, - pub count1: libc::c_int, - pub count2: libc::c_int, - pub count3: libc::c_int, - pub state: ftpstate, - pub state_saved: ftpstate, - pub retr_size_saved: curl_off_t, - pub server_os: *mut libc::c_char, - pub known_filesize: curl_off_t, -} -pub type ftpstate = libc::c_uint; -pub const FTP_LAST: ftpstate = 35; -pub const FTP_QUIT: ftpstate = 34; -pub const FTP_STOR: ftpstate = 33; -pub const FTP_RETR: ftpstate = 32; -pub const FTP_LIST: ftpstate = 31; -pub const FTP_PASV: ftpstate = 30; -pub const FTP_PRET: ftpstate = 29; -pub const FTP_PORT: ftpstate = 28; -pub const FTP_RETR_REST: ftpstate = 27; -pub const FTP_REST: ftpstate = 26; -pub const FTP_STOR_SIZE: ftpstate = 25; -pub const FTP_RETR_SIZE: ftpstate = 24; -pub const FTP_SIZE: ftpstate = 23; -pub const FTP_STOR_TYPE: ftpstate = 22; -pub const FTP_RETR_TYPE: ftpstate = 21; -pub const FTP_LIST_TYPE: ftpstate = 20; -pub const FTP_TYPE: ftpstate = 19; -pub const FTP_MDTM: ftpstate = 18; -pub const FTP_MKD: ftpstate = 17; -pub const FTP_CWD: ftpstate = 16; -pub const FTP_POSTQUOTE: ftpstate = 15; -pub const FTP_STOR_PREQUOTE: ftpstate = 14; -pub const FTP_RETR_PREQUOTE: ftpstate = 13; -pub const FTP_QUOTE: ftpstate = 12; -pub const FTP_NAMEFMT: ftpstate = 11; -pub const FTP_SYST: ftpstate = 10; -pub const FTP_PWD: ftpstate = 9; -pub const FTP_CCC: ftpstate = 8; -pub const FTP_PROT: ftpstate = 7; -pub const FTP_PBSZ: ftpstate = 6; -pub const FTP_ACCT: ftpstate = 5; -pub const FTP_PASS: ftpstate = 4; -pub const FTP_USER: ftpstate = 3; -pub const FTP_AUTH: ftpstate = 2; -pub const FTP_WAIT220: ftpstate = 1; -pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ntlmdata { - pub flags: libc::c_uint, - pub nonce: [libc::c_uchar; 8], - pub target_info_len: libc::c_uint, - pub target_info: *mut libc::c_void, - pub ntlm_auth_hlpr_socket: curl_socket_t, - pub ntlm_auth_hlpr_pid: pid_t, - pub challenge: *mut libc::c_char, - pub response: *mut libc::c_char, -} -pub type curlntlm = libc::c_uint; -pub const NTLMSTATE_LAST: curlntlm = 4; -pub const NTLMSTATE_TYPE3: curlntlm = 3; -pub const NTLMSTATE_TYPE2: curlntlm = 2; -pub const NTLMSTATE_TYPE1: curlntlm = 1; -pub const NTLMSTATE_NONE: curlntlm = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_handler { - pub scheme: *const libc::c_char, - pub setup_connection: - Option CURLcode>, - pub do_it: Option CURLcode>, - pub done: Option CURLcode>, - pub do_more: Option CURLcode>, - pub connect_it: Option CURLcode>, - pub connecting: Option CURLcode>, - pub doing: Option CURLcode>, - pub proto_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub doing_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub domore_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub perform_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub disconnect: - Option CURLcode>, - pub readwrite: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut ssize_t, *mut bool) -> CURLcode, - >, - pub connection_check: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_uint) -> libc::c_uint, - >, - pub attach: Option ()>, - pub defport: libc::c_int, - pub protocol: libc::c_uint, - pub family: libc::c_uint, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: - [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_connect_data { - pub state: ssl_connection_state, - pub connecting_state: ssl_connect_state, - pub backend: *mut ssl_backend_data, - #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] - pub use_0: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type ssl_connect_state = libc::c_uint; -pub const ssl_connect_done: ssl_connect_state = 5; -pub const ssl_connect_3: ssl_connect_state = 4; -pub const ssl_connect_2_writing: ssl_connect_state = 3; -pub const ssl_connect_2_reading: ssl_connect_state = 2; -pub const ssl_connect_2: ssl_connect_state = 1; -pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; -pub const ssl_connection_complete: ssl_connection_state = 2; -pub const ssl_connection_negotiating: ssl_connection_state = 1; -pub const ssl_connection_none: ssl_connection_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_6 = libc::c_uint; -pub const TRNSPRT_QUIC: C2RustUnnamed_6 = 5; -pub const TRNSPRT_UDP: C2RustUnnamed_6 = 4; -pub const TRNSPRT_TCP: C2RustUnnamed_6 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; -pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; -pub const CHUNK_TRAILER_CR: ChunkyState = 6; -pub const CHUNK_TRAILER: ChunkyState = 5; -pub const CHUNK_STOP: ChunkyState = 4; -pub const CHUNK_POSTLF: ChunkyState = 3; -pub const CHUNK_DATA: ChunkyState = 2; -pub const CHUNK_LF: ChunkyState = 1; -pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; -pub const CONNECT_DONE: connect_t = 17; -pub const CONNECT_REQ_READ_MORE: connect_t = 16; -pub const CONNECT_REQ_READ: connect_t = 15; -pub const CONNECT_REQ_SENDING: connect_t = 14; -pub const CONNECT_REQ_SEND: connect_t = 13; -pub const CONNECT_RESOLVE_REMOTE: connect_t = 12; -pub const CONNECT_RESOLVED: connect_t = 11; -pub const CONNECT_RESOLVING: connect_t = 10; -pub const CONNECT_REQ_INIT: connect_t = 9; -pub const CONNECT_AUTH_READ: connect_t = 8; -pub const CONNECT_AUTH_SEND: connect_t = 7; -pub const CONNECT_AUTH_INIT: connect_t = 6; -pub const CONNECT_GSSAPI_INIT: connect_t = 5; -pub const CONNECT_SOCKS_READ: connect_t = 4; -pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; -pub const CONNECT_SOCKS_SEND: connect_t = 2; -pub const CONNECT_SOCKS_INIT: connect_t = 1; -pub const CONNECT_INIT: connect_t = 0; -pub type curl_calloc_callback = Option *mut libc::c_void>; -pub type CHUNKcode = libc::c_int; -pub const CHUNKE_LAST: CHUNKcode = 7; -pub const CHUNKE_PASSTHRU_ERROR: CHUNKcode = 6; -pub const CHUNKE_OUT_OF_MEMORY: CHUNKcode = 5; -pub const CHUNKE_BAD_ENCODING: CHUNKcode = 4; -pub const CHUNKE_BAD_CHUNK: CHUNKcode = 3; -pub const CHUNKE_ILLEGAL_HEX: CHUNKcode = 2; -pub const CHUNKE_TOO_LONG_HEX: CHUNKcode = 1; -pub const CHUNKE_OK: CHUNKcode = 0; -pub const CHUNKE_STOP: CHUNKcode = -1; -pub type dupstring = libc::c_uint; -pub const STRING_LAST: dupstring = 80; -pub const STRING_AWS_SIGV4: dupstring = 79; -pub const STRING_COPYPOSTFIELDS: dupstring = 78; -pub const STRING_LASTZEROTERMINATED: dupstring = 77; -pub const STRING_SSL_EC_CURVES: dupstring = 76; -pub const STRING_DNS_LOCAL_IP6: dupstring = 75; -pub const STRING_DNS_LOCAL_IP4: dupstring = 74; -pub const STRING_DNS_INTERFACE: dupstring = 73; -pub const STRING_DNS_SERVERS: dupstring = 72; -pub const STRING_SASL_AUTHZID: dupstring = 71; -pub const STRING_HSTS: dupstring = 70; -pub const STRING_ALTSVC: dupstring = 69; -pub const STRING_DOH: dupstring = 68; -pub const STRING_TARGET: dupstring = 67; -pub const STRING_UNIX_SOCKET_PATH: dupstring = 66; -pub const STRING_BEARER: dupstring = 65; -pub const STRING_TLSAUTH_PASSWORD_PROXY: dupstring = 64; -pub const STRING_TLSAUTH_PASSWORD: dupstring = 63; -pub const STRING_TLSAUTH_USERNAME_PROXY: dupstring = 62; -pub const STRING_TLSAUTH_USERNAME: dupstring = 61; -pub const STRING_MAIL_AUTH: dupstring = 60; -pub const STRING_MAIL_FROM: dupstring = 59; -pub const STRING_SERVICE_NAME: dupstring = 58; -pub const STRING_PROXY_SERVICE_NAME: dupstring = 57; -pub const STRING_SSH_KNOWNHOSTS: dupstring = 56; -pub const STRING_SSH_HOST_PUBLIC_KEY_MD5: dupstring = 55; -pub const STRING_SSH_PUBLIC_KEY: dupstring = 54; -pub const STRING_SSH_PRIVATE_KEY: dupstring = 53; -pub const STRING_RTSP_TRANSPORT: dupstring = 52; -pub const STRING_RTSP_STREAM_URI: dupstring = 51; -pub const STRING_RTSP_SESSION_ID: dupstring = 50; -pub const STRING_NOPROXY: dupstring = 49; -pub const STRING_PROXYPASSWORD: dupstring = 48; -pub const STRING_PROXYUSERNAME: dupstring = 47; -pub const STRING_OPTIONS: dupstring = 46; -pub const STRING_PASSWORD: dupstring = 45; -pub const STRING_USERNAME: dupstring = 44; -pub const STRING_SSL_ENGINE: dupstring = 43; -pub const STRING_SSL_ISSUERCERT_PROXY: dupstring = 42; -pub const STRING_SSL_ISSUERCERT: dupstring = 41; -pub const STRING_SSL_CRLFILE_PROXY: dupstring = 40; -pub const STRING_SSL_CRLFILE: dupstring = 39; -pub const STRING_USERAGENT: dupstring = 38; -pub const STRING_SSL_RANDOM_FILE: dupstring = 37; -pub const STRING_SSL_EGDSOCKET: dupstring = 36; -pub const STRING_SSL_CIPHER13_LIST_PROXY: dupstring = 35; -pub const STRING_SSL_CIPHER13_LIST: dupstring = 34; -pub const STRING_SSL_CIPHER_LIST_PROXY: dupstring = 33; -pub const STRING_SSL_CIPHER_LIST: dupstring = 32; -pub const STRING_SSL_PINNEDPUBLICKEY_PROXY: dupstring = 31; -pub const STRING_SSL_PINNEDPUBLICKEY: dupstring = 30; -pub const STRING_SSL_CAFILE_PROXY: dupstring = 29; -pub const STRING_SSL_CAFILE: dupstring = 28; -pub const STRING_SSL_CAPATH_PROXY: dupstring = 27; -pub const STRING_SSL_CAPATH: dupstring = 26; -pub const STRING_SET_URL: dupstring = 25; -pub const STRING_SET_REFERER: dupstring = 24; -pub const STRING_SET_RANGE: dupstring = 23; -pub const STRING_PRE_PROXY: dupstring = 22; -pub const STRING_PROXY: dupstring = 21; -pub const STRING_NETRC_FILE: dupstring = 20; -pub const STRING_KRB_LEVEL: dupstring = 19; -pub const STRING_KEY_TYPE_PROXY: dupstring = 18; -pub const STRING_KEY_TYPE: dupstring = 17; -pub const STRING_KEY_PASSWD_PROXY: dupstring = 16; -pub const STRING_KEY_PASSWD: dupstring = 15; -pub const STRING_KEY_PROXY: dupstring = 14; -pub const STRING_KEY: dupstring = 13; -pub const STRING_FTPPORT: dupstring = 12; -pub const STRING_FTP_ALTERNATIVE_TO_USER: dupstring = 11; -pub const STRING_FTP_ACCOUNT: dupstring = 10; -pub const STRING_ENCODING: dupstring = 9; -pub const STRING_DEVICE: dupstring = 8; -pub const STRING_DEFAULT_PROTOCOL: dupstring = 7; -pub const STRING_CUSTOMREQUEST: dupstring = 6; -pub const STRING_COOKIEJAR: dupstring = 5; -pub const STRING_COOKIE: dupstring = 4; -pub const STRING_CERT_TYPE_PROXY: dupstring = 3; -pub const STRING_CERT_TYPE: dupstring = 2; -pub const STRING_CERT_PROXY: dupstring = 1; -pub const STRING_CERT: dupstring = 0; -pub type CURLofft = libc::c_uint; -pub const CURL_OFFT_INVAL: CURLofft = 2; -pub const CURL_OFFT_FLOW: CURLofft = 1; -pub const CURL_OFFT_OK: CURLofft = 0; -unsafe extern "C" fn https_proxy_connect( - mut data: *mut Curl_easy, - mut sockindex: libc::c_int, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - let mut result: CURLcode = CURLE_OK; - if !(*conn).bits.proxy_ssl_connected[sockindex as usize] { - result = Curl_ssl_connect_nonblocking( - data, - conn, - 1 as libc::c_int != 0, - sockindex, - &mut *((*conn).bits.proxy_ssl_connected) - .as_mut_ptr() - .offset(sockindex as isize), - ); - if result as u64 != 0 { - Curl_conncontrol(conn, 1 as libc::c_int); - } - } - return result; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_proxy_connect( - mut data: *mut Curl_easy, - mut sockindex: libc::c_int, -) -> CURLcode { - let mut conn: *mut connectdata = (*data).conn; - if (*conn).http_proxy.proxytype as libc::c_uint - == CURLPROXY_HTTPS as libc::c_int as libc::c_uint - { - let result: CURLcode = https_proxy_connect(data, sockindex); - if result as u64 != 0 { - return result; - } - if !(*conn).bits.proxy_ssl_connected[sockindex as usize] { - return result; - } - } - if ((*conn).bits).tunnel_proxy() as libc::c_int != 0 - && ((*conn).bits).httpproxy() as libc::c_int != 0 - { - let mut hostname: *const libc::c_char = 0 as *const libc::c_char; - let mut remote_port: libc::c_int = 0; - let mut result_0: CURLcode = CURLE_OK; - if ((*conn).bits).conn_to_host() != 0 { - hostname = (*conn).conn_to_host.name; - } else if sockindex == 1 as libc::c_int { - hostname = (*conn).secondaryhostname; - } else { - hostname = (*conn).host.name; - } - if sockindex == 1 as libc::c_int { - remote_port = (*conn).secondary_port as libc::c_int; - } else if ((*conn).bits).conn_to_port() != 0 { - remote_port = (*conn).conn_to_port; - } else { - remote_port = (*conn).remote_port; - } - result_0 = Curl_proxyCONNECT(data, sockindex, hostname, remote_port); - if CURLE_OK as libc::c_int as libc::c_uint != result_0 as libc::c_uint { - return result_0; - } - Curl_cfree.expect("non-null function pointer")( - (*data).state.aptr.proxyuserpwd as *mut libc::c_void, - ); - let ref mut fresh0 = (*data).state.aptr.proxyuserpwd; - *fresh0 = 0 as *mut libc::c_char; - } - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_connect_complete(mut conn: *mut connectdata) -> bool { - return ((*conn).connect_state).is_null() - || (*(*conn).connect_state).tunnel_state as libc::c_uint - >= TUNNEL_COMPLETE as libc::c_int as libc::c_uint; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_connect_ongoing(mut conn: *mut connectdata) -> bool { - return !((*conn).connect_state).is_null() - && (*(*conn).connect_state).tunnel_state as libc::c_uint - <= TUNNEL_COMPLETE as libc::c_int as libc::c_uint; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_connect_getsock(mut conn: *mut connectdata) -> libc::c_int { - let mut http: *mut HTTP = 0 as *mut HTTP; - http = &mut (*(*conn).connect_state).http_proxy; - if (*http).sending as libc::c_uint == HTTPSEND_REQUEST as libc::c_int as libc::c_uint { - return (1 as libc::c_int) << 16 as libc::c_int + 0 as libc::c_int; - } - return (1 as libc::c_int) << 0 as libc::c_int; -} -unsafe extern "C" fn connect_init(mut data: *mut Curl_easy, mut reinit: bool) -> CURLcode { - let mut s: *mut http_connect_state = 0 as *mut http_connect_state; - let mut conn: *mut connectdata = (*data).conn; - if !reinit { - let mut result: CURLcode = CURLE_OK; - result = Curl_get_upload_buffer(data); - if result as u64 != 0 { - return result; - } - s = Curl_ccalloc.expect("non-null function pointer")( - 1 as libc::c_int as size_t, - ::std::mem::size_of::() as libc::c_ulong, - ) as *mut http_connect_state; - if s.is_null() { - return CURLE_OUT_OF_MEMORY; - } - Curl_infof( - data, - b"allocate connect buffer!\0" as *const u8 as *const libc::c_char, - ); - let ref mut fresh1 = (*conn).connect_state; - *fresh1 = s; - Curl_dyn_init(&mut (*s).rcvbuf, 16384 as libc::c_int as size_t); - let ref mut fresh2 = (*s).prot_save; - *fresh2 = (*data).req.p.http; - let ref mut fresh3 = (*data).req.p.http; - *fresh3 = &mut (*s).http_proxy; - Curl_conncontrol(conn, 0 as libc::c_int); - } else { - s = (*conn).connect_state; - Curl_dyn_reset(&mut (*s).rcvbuf); - } - (*s).tunnel_state = TUNNEL_INIT; - (*s).keepon = KEEPON_CONNECT; - (*s).cl = 0 as libc::c_int as curl_off_t; - (*s).set_close_connection(0 as libc::c_int as bit); - return CURLE_OK; -} -unsafe extern "C" fn connect_done(mut data: *mut Curl_easy) { - let mut conn: *mut connectdata = (*data).conn; - let mut s: *mut http_connect_state = (*conn).connect_state; - if (*s).tunnel_state as libc::c_uint != TUNNEL_EXIT as libc::c_int as libc::c_uint { - (*s).tunnel_state = TUNNEL_EXIT; - Curl_dyn_free(&mut (*s).rcvbuf); - Curl_dyn_free(&mut (*s).req); - let ref mut fresh4 = (*data).req.p.http; - *fresh4 = (*s).prot_save; - let ref mut fresh5 = (*s).prot_save; - *fresh5 = 0 as *mut HTTP; - Curl_infof( - data, - b"CONNECT phase completed!\0" as *const u8 as *const libc::c_char, - ); - } -} -unsafe extern "C" fn CONNECT_host( - mut data: *mut Curl_easy, - mut conn: *mut connectdata, - mut hostname: *const libc::c_char, - mut remote_port: libc::c_int, - mut connecthostp: *mut *mut libc::c_char, - mut hostp: *mut *mut libc::c_char, -) -> CURLcode { - let mut hostheader: *mut libc::c_char = 0 as *mut libc::c_char; - let mut host: *mut libc::c_char = 0 as *mut libc::c_char; - let mut ipv6_ip: bool = ((*conn).bits).ipv6_ip() != 0; - if hostname != (*conn).host.name as *const libc::c_char { - ipv6_ip = !(strchr(hostname, ':' as i32)).is_null(); - } - hostheader = curl_maprintf( - b"%s%s%s:%d\0" as *const u8 as *const libc::c_char, - if ipv6_ip as libc::c_int != 0 { - b"[\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - hostname, - if ipv6_ip as libc::c_int != 0 { - b"]\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - remote_port, - ); - if hostheader.is_null() { - return CURLE_OUT_OF_MEMORY; - } - if (Curl_checkProxyheaders(data, conn, b"Host\0" as *const u8 as *const libc::c_char)).is_null() - { - host = curl_maprintf( - b"Host: %s\r\n\0" as *const u8 as *const libc::c_char, - hostheader, - ); - if host.is_null() { - Curl_cfree.expect("non-null function pointer")(hostheader as *mut libc::c_void); - return CURLE_OUT_OF_MEMORY; - } - } - *connecthostp = hostheader; - *hostp = host; - return CURLE_OK; -} -unsafe extern "C" fn CONNECT( - mut data: *mut Curl_easy, - mut sockindex: libc::c_int, - mut hostname: *const libc::c_char, - mut remote_port: libc::c_int, -) -> CURLcode { - let mut subversion: libc::c_int = 0 as libc::c_int; - let mut k: *mut SingleRequest = &mut (*data).req; - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - let mut tunnelsocket: curl_socket_t = (*conn).sock[sockindex as usize]; - let mut s: *mut http_connect_state = (*conn).connect_state; - let mut http: *mut HTTP = (*data).req.p.http; - let mut linep: *mut libc::c_char = 0 as *mut libc::c_char; - let mut perline: size_t = 0; - if Curl_connect_complete(conn) { - return CURLE_OK; - } - let ref mut fresh6 = (*conn).bits; - (*fresh6).set_proxy_connect_closed(0 as libc::c_int as bit); - loop { - let mut check: timediff_t = 0; - if TUNNEL_INIT as libc::c_int as libc::c_uint == (*s).tunnel_state as libc::c_uint { - let mut req: *mut dynbuf = &mut (*s).req; - let mut hostheader: *mut libc::c_char = 0 as *mut libc::c_char; - let mut host: *mut libc::c_char = 0 as *mut libc::c_char; - Curl_infof( - data, - b"Establish HTTP proxy tunnel to %s:%d\0" as *const u8 as *const libc::c_char, - hostname, - remote_port, - ); - Curl_cfree.expect("non-null function pointer")((*data).req.newurl as *mut libc::c_void); - let ref mut fresh7 = (*data).req.newurl; - *fresh7 = 0 as *mut libc::c_char; - Curl_dyn_init(req, (1024 as libc::c_int * 1024 as libc::c_int) as size_t); - result = CONNECT_host( - data, - conn, - hostname, - remote_port, - &mut hostheader, - &mut host, - ); - if result as u64 != 0 { - return result; - } - result = Curl_http_output_auth( - data, - conn, - b"CONNECT\0" as *const u8 as *const libc::c_char, - HTTPREQ_GET, - hostheader, - 1 as libc::c_int != 0, - ); - if result as u64 == 0 { - let mut httpv: *const libc::c_char = if (*conn).http_proxy.proxytype as libc::c_uint - == CURLPROXY_HTTP_1_0 as libc::c_int as libc::c_uint - { - b"1.0\0" as *const u8 as *const libc::c_char - } else { - b"1.1\0" as *const u8 as *const libc::c_char - }; - result = Curl_dyn_addf( - req, - b"CONNECT %s HTTP/%s\r\n%s%s\0" as *const u8 as *const libc::c_char, - hostheader, - httpv, - if !host.is_null() { - host as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - if !((*data).state.aptr.proxyuserpwd).is_null() { - (*data).state.aptr.proxyuserpwd as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - ); - if result as u64 == 0 - && (Curl_checkProxyheaders( - data, - conn, - b"User-Agent\0" as *const u8 as *const libc::c_char, - )) - .is_null() - && !((*data).set.str_0[STRING_USERAGENT as libc::c_int as usize]).is_null() - { - result = Curl_dyn_addf( - req, - b"User-Agent: %s\r\n\0" as *const u8 as *const libc::c_char, - (*data).set.str_0[STRING_USERAGENT as libc::c_int as usize], - ); - } - if result as u64 == 0 - && (Curl_checkProxyheaders( - data, - conn, - b"Proxy-Connection\0" as *const u8 as *const libc::c_char, - )) - .is_null() - { - result = Curl_dyn_add( - req, - b"Proxy-Connection: Keep-Alive\r\n\0" as *const u8 as *const libc::c_char, - ); - } - if result as u64 == 0 { - result = Curl_add_custom_headers(data, 1 as libc::c_int != 0, req); - } - if result as u64 == 0 { - result = Curl_dyn_add(req, b"\r\n\0" as *const u8 as *const libc::c_char); - } - if result as u64 == 0 { - result = Curl_buffer_send( - req, - data, - &mut (*data).info.request_size, - 0 as libc::c_int as curl_off_t, - sockindex, - ); - } - if result as u64 != 0 { - Curl_failf( - data, - b"Failed sending CONNECT to proxy\0" as *const u8 as *const libc::c_char, - ); - } - } - Curl_cfree.expect("non-null function pointer")(host as *mut libc::c_void); - Curl_cfree.expect("non-null function pointer")(hostheader as *mut libc::c_void); - if result as u64 != 0 { - return result; - } - (*s).tunnel_state = TUNNEL_CONNECT; - } - check = Curl_timeleft(data, 0 as *mut curltime, 1 as libc::c_int != 0); - if check <= 0 as libc::c_int as libc::c_long { - Curl_failf( - data, - b"Proxy CONNECT aborted due to timeout\0" as *const u8 as *const libc::c_char, - ); - return CURLE_OPERATION_TIMEDOUT; - } - if !Curl_conn_data_pending(conn, sockindex) && (*http).sending as u64 == 0 { - return CURLE_OK; - } - if (*http).sending as libc::c_uint == HTTPSEND_REQUEST as libc::c_int as libc::c_uint { - if (*s).nsend == 0 { - let mut fillcount: size_t = 0; - let ref mut fresh8 = (*k).upload_fromhere; - *fresh8 = (*data).state.ulbuf; - result = Curl_fillreadbuffer( - data, - (*data).set.upload_buffer_size as size_t, - &mut fillcount, - ); - if result as u64 != 0 { - return result; - } - (*s).nsend = fillcount; - } - if (*s).nsend != 0 { - let mut bytes_written: ssize_t = 0; - result = Curl_write( - data, - (*conn).writesockfd, - (*k).upload_fromhere as *const libc::c_void, - (*s).nsend, - &mut bytes_written, - ); - if result as u64 == 0 { - result = Curl_debug( - data, - CURLINFO_HEADER_OUT, - (*k).upload_fromhere, - bytes_written as size_t, - ) as CURLcode; - } - let ref mut fresh9 = (*s).nsend; - *fresh9 = (*fresh9 as libc::c_ulong).wrapping_sub(bytes_written as libc::c_ulong) - as size_t as size_t; - let ref mut fresh10 = (*k).upload_fromhere; - *fresh10 = (*fresh10).offset(bytes_written as isize); - return result; - } - (*http).sending = HTTPSEND_NADA; - } - let mut error: libc::c_int = 0 as libc::c_int; - while (*s).keepon as u64 != 0 { - let mut gotbytes: ssize_t = 0; - let mut byte: libc::c_char = 0; - result = Curl_read( - data, - tunnelsocket, - &mut byte, - 1 as libc::c_int as size_t, - &mut gotbytes, - ); - if result as libc::c_uint == CURLE_AGAIN as libc::c_int as libc::c_uint { - return CURLE_OK; - } - if Curl_pgrsUpdate(data) != 0 { - return CURLE_ABORTED_BY_CALLBACK; - } - if result as u64 != 0 { - (*s).keepon = KEEPON_DONE; - break; - } else if gotbytes <= 0 as libc::c_int as libc::c_long { - if (*data).set.proxyauth != 0 - && (*data).state.authproxy.avail != 0 - && !((*data).state.aptr.proxyuserpwd).is_null() - { - let ref mut fresh11 = (*conn).bits; - (*fresh11).set_proxy_connect_closed(1 as libc::c_int as bit); - Curl_infof( - data, - b"Proxy CONNECT connection closed\0" as *const u8 as *const libc::c_char, - ); - } else { - error = 1 as libc::c_int; - Curl_failf( - data, - b"Proxy CONNECT aborted\0" as *const u8 as *const libc::c_char, - ); - } - (*s).keepon = KEEPON_DONE; - break; - } else if (*s).keepon as libc::c_uint == KEEPON_IGNORE as libc::c_int as libc::c_uint { - if (*s).cl != 0 { - let ref mut fresh12 = (*s).cl; - *fresh12 -= 1; - if !((*s).cl <= 0 as libc::c_int as libc::c_long) { - continue; - } - (*s).keepon = KEEPON_DONE; - (*s).tunnel_state = TUNNEL_COMPLETE; - break; - } else { - let mut r: CHUNKcode = CHUNKE_OK; - let mut extra: CURLcode = CURLE_OK; - let mut tookcareof: ssize_t = 0 as libc::c_int as ssize_t; - r = Curl_httpchunk_read( - data, - &mut byte, - 1 as libc::c_int as ssize_t, - &mut tookcareof, - &mut extra, - ); - if r as libc::c_int == CHUNKE_STOP as libc::c_int { - Curl_infof( - data, - b"chunk reading DONE\0" as *const u8 as *const libc::c_char, - ); - (*s).keepon = KEEPON_DONE; - (*s).tunnel_state = TUNNEL_COMPLETE; - } - } - } else { - if Curl_dyn_addn( - &mut (*s).rcvbuf, - &mut byte as *mut libc::c_char as *const libc::c_void, - 1 as libc::c_int as size_t, - ) as u64 - != 0 - { - Curl_failf( - data, - b"CONNECT response too large!\0" as *const u8 as *const libc::c_char, - ); - return CURLE_RECV_ERROR; - } - if byte as libc::c_int != 0xa as libc::c_int { - continue; - } - linep = Curl_dyn_ptr(&mut (*s).rcvbuf); - perline = Curl_dyn_len(&mut (*s).rcvbuf); - result = CURLE_OK as libc::c_int as CURLcode; - if result as u64 != 0 { - return result; - } - Curl_debug(data, CURLINFO_HEADER_IN, linep, perline); - if ((*data).set).suppress_connect_headers() == 0 { - let mut writetype: libc::c_int = (1 as libc::c_int) << 1 as libc::c_int; - if ((*data).set).include_header() != 0 { - writetype |= (1 as libc::c_int) << 0 as libc::c_int; - } - result = Curl_client_write(data, writetype, linep, perline); - if result as u64 != 0 { - return result; - } - } - let ref mut fresh13 = (*data).info.header_size; - *fresh13 += perline as libc::c_long; - if '\r' as i32 == *linep.offset(0 as libc::c_int as isize) as libc::c_int - || '\n' as i32 == *linep.offset(0 as libc::c_int as isize) as libc::c_int - { - if 407 as libc::c_int == (*k).httpcode && ((*data).state).authproblem() == 0 { - (*s).keepon = KEEPON_IGNORE; - if (*s).cl != 0 { - Curl_infof( - data, - b"Ignore %ld bytes of response-body\0" as *const u8 - as *const libc::c_char, - (*s).cl, - ); - } else if (*s).chunked_encoding() != 0 { - let mut r_0: CHUNKcode = CHUNKE_OK; - let mut extra_0: CURLcode = CURLE_OK; - Curl_infof( - data, - b"Ignore chunked response-body\0" as *const u8 - as *const libc::c_char, - ); - (*k).set_ignorebody(1 as libc::c_int as bit); - if *linep.offset(1 as libc::c_int as isize) as libc::c_int - == '\n' as i32 - { - linep = linep.offset(1); - } - r_0 = Curl_httpchunk_read( - data, - linep.offset(1 as libc::c_int as isize), - 1 as libc::c_int as ssize_t, - &mut gotbytes, - &mut extra_0, - ); - if r_0 as libc::c_int == CHUNKE_STOP as libc::c_int { - Curl_infof( - data, - b"chunk reading DONE\0" as *const u8 as *const libc::c_char, - ); - (*s).keepon = KEEPON_DONE; - (*s).tunnel_state = TUNNEL_COMPLETE; - } - } else { - (*s).keepon = KEEPON_DONE; - } - } else { - (*s).keepon = KEEPON_DONE; - } - if (*s).keepon as libc::c_uint == KEEPON_DONE as libc::c_int as libc::c_uint - && (*s).cl == 0 - { - (*s).tunnel_state = TUNNEL_COMPLETE; - } - } else { - if curl_strnequal( - b"WWW-Authenticate:\0" as *const u8 as *const libc::c_char, - linep, - strlen(b"WWW-Authenticate:\0" as *const u8 as *const libc::c_char), - ) != 0 - && 401 as libc::c_int == (*k).httpcode - || curl_strnequal( - b"Proxy-authenticate:\0" as *const u8 as *const libc::c_char, - linep, - strlen(b"Proxy-authenticate:\0" as *const u8 as *const libc::c_char), - ) != 0 - && 407 as libc::c_int == (*k).httpcode - { - let mut proxy: bool = if (*k).httpcode == 407 as libc::c_int { - 1 as libc::c_int - } else { - 0 as libc::c_int - } != 0; - let mut auth: *mut libc::c_char = Curl_copy_header_value(linep); - if auth.is_null() { - return CURLE_OUT_OF_MEMORY; - } - result = Curl_http_input_auth(data, proxy, auth); - Curl_cfree.expect("non-null function pointer")(auth as *mut libc::c_void); - if result as u64 != 0 { - return result; - } - } else if curl_strnequal( - b"Content-Length:\0" as *const u8 as *const libc::c_char, - linep, - strlen(b"Content-Length:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - if (*k).httpcode / 100 as libc::c_int == 2 as libc::c_int { - Curl_infof( - data, - b"Ignoring Content-Length in CONNECT %03d response\0" as *const u8 - as *const libc::c_char, - (*k).httpcode, - ); - } else { - curlx_strtoofft( - linep.offset(strlen( - b"Content-Length:\0" as *const u8 as *const libc::c_char, - ) as isize), - 0 as *mut *mut libc::c_char, - 10 as libc::c_int, - &mut (*s).cl, - ); - } - } else if Curl_compareheader( - linep, - b"Connection:\0" as *const u8 as *const libc::c_char, - b"close\0" as *const u8 as *const libc::c_char, - ) { - (*s).set_close_connection(1 as libc::c_int as bit); - } else if curl_strnequal( - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - linep, - strlen(b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char), - ) != 0 - { - if (*k).httpcode / 100 as libc::c_int == 2 as libc::c_int { - Curl_infof( - data, - b"Ignoring Transfer-Encoding in CONNECT %03d response\0" - as *const u8 - as *const libc::c_char, - (*k).httpcode, - ); - } else if Curl_compareheader( - linep, - b"Transfer-Encoding:\0" as *const u8 as *const libc::c_char, - b"chunked\0" as *const u8 as *const libc::c_char, - ) { - Curl_infof( - data, - b"CONNECT responded chunked\0" as *const u8 as *const libc::c_char, - ); - (*s).set_chunked_encoding(1 as libc::c_int as bit); - Curl_httpchunk_init(data); - } - } else if Curl_compareheader( - linep, - b"Proxy-Connection:\0" as *const u8 as *const libc::c_char, - b"close\0" as *const u8 as *const libc::c_char, - ) { - (*s).set_close_connection(1 as libc::c_int as bit); - } else if 2 as libc::c_int - == sscanf( - linep, - b"HTTP/1.%d %d\0" as *const u8 as *const libc::c_char, - &mut subversion as *mut libc::c_int, - &mut (*k).httpcode as *mut libc::c_int, - ) - { - (*data).info.httpproxycode = (*k).httpcode; - } - Curl_dyn_reset(&mut (*s).rcvbuf); - } - } - } - if Curl_pgrsUpdate(data) != 0 { - return CURLE_ABORTED_BY_CALLBACK; - } - if error != 0 { - return CURLE_RECV_ERROR; - } - if (*data).info.httpproxycode / 100 as libc::c_int != 2 as libc::c_int { - result = Curl_http_auth_act(data); - if result as u64 != 0 { - return result; - } - if ((*conn).bits).close() != 0 { - (*s).set_close_connection(1 as libc::c_int as bit); - } - } - if (*s).close_connection() as libc::c_int != 0 && !((*data).req.newurl).is_null() { - Curl_closesocket(data, conn, (*conn).sock[sockindex as usize]); - (*conn).sock[sockindex as usize] = -(1 as libc::c_int); - break; - } else { - if !((*data).req.newurl).is_null() - && TUNNEL_COMPLETE as libc::c_int as libc::c_uint - == (*s).tunnel_state as libc::c_uint - { - connect_init(data, 1 as libc::c_int != 0); - } - if ((*data).req.newurl).is_null() { - break; - } - } - } - if (*data).info.httpproxycode / 100 as libc::c_int != 2 as libc::c_int { - if (*s).close_connection() as libc::c_int != 0 && !((*data).req.newurl).is_null() { - let ref mut fresh14 = (*conn).bits; - (*fresh14).set_proxy_connect_closed(1 as libc::c_int as bit); - Curl_infof( - data, - b"Connect me again please\0" as *const u8 as *const libc::c_char, - ); - connect_done(data); - } else { - Curl_cfree.expect("non-null function pointer")((*data).req.newurl as *mut libc::c_void); - let ref mut fresh15 = (*data).req.newurl; - *fresh15 = 0 as *mut libc::c_char; - Curl_conncontrol(conn, 2 as libc::c_int); - Curl_closesocket(data, conn, (*conn).sock[sockindex as usize]); - (*conn).sock[sockindex as usize] = -(1 as libc::c_int); - } - (*s).tunnel_state = TUNNEL_INIT; - if ((*conn).bits).proxy_connect_closed() != 0 { - return CURLE_OK; - } - Curl_dyn_free(&mut (*s).rcvbuf); - Curl_failf( - data, - b"Received HTTP code %d from proxy after CONNECT\0" as *const u8 as *const libc::c_char, - (*data).req.httpcode, - ); - return CURLE_RECV_ERROR; - } - (*s).tunnel_state = TUNNEL_COMPLETE; - Curl_cfree.expect("non-null function pointer")( - (*data).state.aptr.proxyuserpwd as *mut libc::c_void, - ); - let ref mut fresh16 = (*data).state.aptr.proxyuserpwd; - *fresh16 = 0 as *mut libc::c_char; - let ref mut fresh17 = (*data).state.aptr.proxyuserpwd; - *fresh17 = 0 as *mut libc::c_char; - let ref mut fresh18 = (*data).state.authproxy; - (*fresh18).set_done(1 as libc::c_int as bit); - let ref mut fresh19 = (*data).state.authproxy; - (*fresh19).set_multipass(0 as libc::c_int as bit); - Curl_infof( - data, - b"Proxy replied %d to CONNECT request\0" as *const u8 as *const libc::c_char, - (*data).info.httpproxycode, - ); - let ref mut fresh20 = (*data).req; - (*fresh20).set_ignorebody(0 as libc::c_int as bit); - let ref mut fresh21 = (*conn).bits; - (*fresh21).set_rewindaftersend(0 as libc::c_int as bit); - Curl_dyn_free(&mut (*s).rcvbuf); - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_connect_free(mut data: *mut Curl_easy) { - let mut conn: *mut connectdata = (*data).conn; - let mut s: *mut http_connect_state = (*conn).connect_state; - if !s.is_null() { - Curl_cfree.expect("non-null function pointer")(s as *mut libc::c_void); - let ref mut fresh22 = (*conn).connect_state; - *fresh22 = 0 as *mut http_connect_state; - } -} -#[no_mangle] -pub unsafe extern "C" fn Curl_proxyCONNECT( - mut data: *mut Curl_easy, - mut sockindex: libc::c_int, - mut hostname: *const libc::c_char, - mut remote_port: libc::c_int, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut conn: *mut connectdata = (*data).conn; - if ((*conn).connect_state).is_null() { - result = connect_init(data, 0 as libc::c_int != 0); - if result as u64 != 0 { - return result; - } - } - result = CONNECT(data, sockindex, hostname, remote_port); - if result as libc::c_uint != 0 || Curl_connect_complete(conn) as libc::c_int != 0 { - connect_done(data); - } - return result; -} diff --git a/lib/vtls/keylog.c b/lib/vtls/keylog.c deleted file mode 100644 index a45945f..0000000 --- a/lib/vtls/keylog.c +++ /dev/null @@ -1,156 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at https://curl.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ -#include "curl_setup.h" - -#include "keylog.h" - -/* The last #include files should be: */ -#include "curl_memory.h" -#include "memdebug.h" - -#define KEYLOG_LABEL_MAXLEN (sizeof("CLIENT_HANDSHAKE_TRAFFIC_SECRET") - 1) - -#define CLIENT_RANDOM_SIZE 32 - -/* - * The master secret in TLS 1.2 and before is always 48 bytes. In TLS 1.3, the - * secret size depends on the cipher suite's hash function which is 32 bytes - * for SHA-256 and 48 bytes for SHA-384. - */ -#define SECRET_MAXLEN 48 - - -/* The fp for the open SSLKEYLOGFILE, or NULL if not open */ -static FILE *keylog_file_fp; - -void -Curl_tls_keylog_open(void) -{ - char *keylog_file_name; - - if(!keylog_file_fp) { - keylog_file_name = curl_getenv("SSLKEYLOGFILE"); - if(keylog_file_name) { - keylog_file_fp = fopen(keylog_file_name, FOPEN_APPENDTEXT); - if(keylog_file_fp) { -#ifdef WIN32 - if(setvbuf(keylog_file_fp, NULL, _IONBF, 0)) -#else - if(setvbuf(keylog_file_fp, NULL, _IOLBF, 4096)) -#endif - { - fclose(keylog_file_fp); - keylog_file_fp = NULL; - } - } - Curl_safefree(keylog_file_name); - } - } -} - -void -Curl_tls_keylog_close(void) -{ - if(keylog_file_fp) { - fclose(keylog_file_fp); - keylog_file_fp = NULL; - } -} - -bool -Curl_tls_keylog_enabled(void) -{ - return keylog_file_fp != NULL; -} - -bool -Curl_tls_keylog_write_line(const char *line) -{ - /* The current maximum valid keylog line length LF and NUL is 195. */ - size_t linelen; - char buf[256]; - - if(!keylog_file_fp || !line) { - return false; - } - - linelen = strlen(line); - if(linelen == 0 || linelen > sizeof(buf) - 2) { - /* Empty line or too big to fit in a LF and NUL. */ - return false; - } - - memcpy(buf, line, linelen); - if(line[linelen - 1] != '\n') { - buf[linelen++] = '\n'; - } - buf[linelen] = '\0'; - - /* Using fputs here instead of fprintf since libcurl's fprintf replacement - may not be thread-safe. */ - fputs(buf, keylog_file_fp); - return true; -} - -bool -Curl_tls_keylog_write(const char *label, - const unsigned char client_random[CLIENT_RANDOM_SIZE], - const unsigned char *secret, size_t secretlen) -{ - const char *hex = "0123456789ABCDEF"; - size_t pos, i; - char line[KEYLOG_LABEL_MAXLEN + 1 + 2 * CLIENT_RANDOM_SIZE + 1 + - 2 * SECRET_MAXLEN + 1 + 1]; - - if(!keylog_file_fp) { - return false; - } - - pos = strlen(label); - if(pos > KEYLOG_LABEL_MAXLEN || !secretlen || secretlen > SECRET_MAXLEN) { - /* Should never happen - sanity check anyway. */ - return false; - } - - memcpy(line, label, pos); - line[pos++] = ' '; - - /* Client Random */ - for(i = 0; i < CLIENT_RANDOM_SIZE; i++) { - line[pos++] = hex[client_random[i] >> 4]; - line[pos++] = hex[client_random[i] & 0xF]; - } - line[pos++] = ' '; - - /* Secret */ - for(i = 0; i < secretlen; i++) { - line[pos++] = hex[secret[i] >> 4]; - line[pos++] = hex[secret[i] & 0xF]; - } - line[pos++] = '\n'; - line[pos] = '\0'; - - /* Using fputs here instead of fprintf since libcurl's fprintf replacement - may not be thread-safe. */ - fputs(line, keylog_file_fp); - return true; -} diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..f258ec2 --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "rust_project", + "rust_ffi" +] \ No newline at end of file diff --git a/rust/rust_ffi/Cargo.toml b/rust/rust_ffi/Cargo.toml new file mode 100644 index 0000000..4ea350d --- /dev/null +++ b/rust/rust_ffi/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "rust_ffi" +authors = ["CSS Group"] +version = "0.1.0" +edition = "2021" +# build = "build.rs" + +[dependencies] +libc = "0.2.9" +c2rust-bitfields = "0.3.0" + +[lib] +crate-type = ["rlib"] +name = "rust_ffi" +path = "lib.rs" \ No newline at end of file diff --git a/rust/rust_ffi/build.rs b/rust/rust_ffi/build.rs new file mode 100644 index 0000000..7d59d25 --- /dev/null +++ b/rust/rust_ffi/build.rs @@ -0,0 +1,11 @@ +#[cfg(all(unix, not(target_os = "macos")))] +fn main() { + // add unix dependencies below + // println!("cargo:rustc-flags=-l readline"); +} + +#[cfg(target_os = "macos")] +fn main() { + // add macos dependencies below + // println!("cargo:rustc-flags=-l edit"); +} \ No newline at end of file diff --git a/rust/rust_ffi/lib.rs b/rust/rust_ffi/lib.rs new file mode 100644 index 0000000..55a0c6c --- /dev/null +++ b/rust/rust_ffi/lib.rs @@ -0,0 +1,26 @@ +#![allow( + dead_code, + mutable_transmutes, + non_camel_case_types, + non_snake_case, + non_upper_case_globals, + unused_assignments, + unused_mut +)] +#![feature( + c_variadic, + extern_types, + label_break_value, + register_tool +)] +#![register_tool(c2rust)] + +#[macro_use] +extern crate libc; +extern crate c2rust_bitfields; + +pub mod src { + pub mod ffi_alias; + pub mod ffi_fun; + pub mod ffi_struct; +} \ No newline at end of file diff --git a/rust/rust_ffi/src/ffi_alias/mod.rs b/rust/rust_ffi/src/ffi_alias/mod.rs new file mode 100644 index 0000000..b0be722 --- /dev/null +++ b/rust/rust_ffi/src/ffi_alias/mod.rs @@ -0,0 +1 @@ +pub mod type_alias; \ No newline at end of file diff --git a/lib/http_digest.rs b/rust/rust_ffi/src/ffi_alias/type_alias.rs similarity index 30% rename from lib/http_digest.rs rename to rust/rust_ffi/src/ffi_alias/type_alias.rs index 40e5220..fb4089c 100644 --- a/lib/http_digest.rs +++ b/rust/rust_ffi/src/ffi_alias/type_alias.rs @@ -1,57 +1,6 @@ -#![allow( - dead_code, - mutable_transmutes, - non_camel_case_types, - non_snake_case, - non_upper_case_globals, - unused_assignments, - unused_mut -)] -#![register_tool(c2rust)] -#![feature(extern_types, register_tool)] -extern "C" { - pub type _IO_wide_data; - pub type _IO_codecvt; - pub type _IO_marker; - pub type Curl_URL; - pub type thread_data; - pub type altsvcinfo; - pub type hsts; - pub type TELNET; - pub type smb_request; - pub type ldapreqinfo; - pub type contenc_writer; - pub type psl_ctx_st; - pub type Curl_share; - pub type curl_pushheaders; - pub type http_connect_state; - pub type ldapconninfo; - pub type tftp_state_data; - pub type nghttp2_session; - pub type ssl_backend_data; - fn Curl_isspace(c: libc::c_int) -> libc::c_int; - fn curl_strnequal(s1: *const libc::c_char, s2: *const libc::c_char, n: size_t) -> libc::c_int; - fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char; - fn strlen(_: *const libc::c_char) -> libc::c_ulong; - fn Curl_auth_digest_cleanup(digest: *mut digestdata); - fn Curl_auth_decode_digest_http_message( - chlg: *const libc::c_char, - digest: *mut digestdata, - ) -> CURLcode; - fn Curl_auth_create_digest_http_message( - data: *mut Curl_easy, - userp: *const libc::c_char, - passwdp: *const libc::c_char, - request: *const libc::c_uchar, - uri: *const libc::c_uchar, - digest: *mut digestdata, - outptr: *mut *mut libc::c_char, - outlen: *mut size_t, - ) -> CURLcode; - fn curl_maprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char; - static mut Curl_cfree: curl_free_callback; - static mut Curl_cstrdup: curl_strdup_callback; -} +// use crate::src::ffi_struct::struct_define::*; + +// ---------------------Type Alias-------------------- pub type __uint8_t = libc::c_uchar; pub type __int32_t = libc::c_int; pub type __uint32_t = libc::c_uint; @@ -68,87 +17,208 @@ pub type size_t = libc::c_ulong; pub type int32_t = __int32_t; pub type socklen_t = __socklen_t; pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} pub type curl_socklen_t = socklen_t; pub type curl_off_t = libc::c_long; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct _IO_FILE { - pub _flags: libc::c_int, - pub _IO_read_ptr: *mut libc::c_char, - pub _IO_read_end: *mut libc::c_char, - pub _IO_read_base: *mut libc::c_char, - pub _IO_write_base: *mut libc::c_char, - pub _IO_write_ptr: *mut libc::c_char, - pub _IO_write_end: *mut libc::c_char, - pub _IO_buf_base: *mut libc::c_char, - pub _IO_buf_end: *mut libc::c_char, - pub _IO_save_base: *mut libc::c_char, - pub _IO_backup_base: *mut libc::c_char, - pub _IO_save_end: *mut libc::c_char, - pub _markers: *mut _IO_marker, - pub _chain: *mut _IO_FILE, - pub _fileno: libc::c_int, - pub _flags2: libc::c_int, - pub _old_offset: __off_t, - pub _cur_column: libc::c_ushort, - pub _vtable_offset: libc::c_schar, - pub _shortbuf: [libc::c_char; 1], - pub _lock: *mut libc::c_void, - pub _offset: __off64_t, - pub _codecvt: *mut _IO_codecvt, - pub _wide_data: *mut _IO_wide_data, - pub _freeres_list: *mut _IO_FILE, - pub _freeres_buf: *mut libc::c_void, - pub __pad5: size_t, - pub _mode: libc::c_int, - pub _unused2: [libc::c_char; 20], -} pub type _IO_lock_t = (); -pub type FILE = _IO_FILE; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_easy { - pub magic: libc::c_uint, - pub next: *mut Curl_easy, - pub prev: *mut Curl_easy, - pub conn: *mut connectdata, - pub connect_queue: Curl_llist_element, - pub conn_queue: Curl_llist_element, - pub mstate: CURLMstate, - pub result: CURLcode, - pub msg: Curl_message, - pub sockets: [curl_socket_t; 5], - pub actions: [libc::c_uchar; 5], - pub numsocks: libc::c_int, - pub dns: Names, - pub multi: *mut Curl_multi, - pub multi_easy: *mut Curl_multi, - pub share: *mut Curl_share, - pub psl: *mut PslCache, - pub req: SingleRequest, - pub set: UserDefined, - pub cookies: *mut CookieInfo, - pub hsts: *mut hsts, - pub asi: *mut altsvcinfo, - pub progress: Progress, - pub state: UrlState, - pub wildcard: WildcardData, - pub info: PureInfo, - pub tsi: curl_tlssessioninfo, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} +// pub type FILE = _IO_FILE; pub type curl_sslbackend = libc::c_uint; +pub type bit = libc::c_uint; +pub type CURLproxycode = libc::c_uint; +pub type wildcard_dtor = Option:: ()>; +pub type Curl_llist_dtor = Option:: (),>; +pub type wildcard_states = libc::c_uint; +pub type trailers_state = libc::c_uint; +pub type Curl_HttpReq = libc::c_uint; +// pub type CURLU = Curl_URL; +pub type curl_read_callback = Option:: size_t,>; +pub type expire_id = libc::c_uint; +pub type Curl_hash_dtor = Option:: ()>; +pub type comp_function = Option:: size_t,>; +pub type hash_function = Option:: size_t,>; +pub type timediff_t = curl_off_t; +// pub type curl_trailer_callback = Option:: libc::c_int,>; +// pub type multidone_func = Option:: libc::c_int,>; +pub type CURLcode = libc::c_uint; +pub type curl_resolver_start_callback = Option::< + unsafe extern "C" fn( + *mut libc::c_void, + *mut libc::c_void, + *mut libc::c_void, + ) -> libc::c_int, +>; +pub type curl_fnmatch_callback = Option::< + unsafe extern "C" fn( + *mut libc::c_void, + *const libc::c_char, + *const libc::c_char, + ) -> libc::c_int, +>; +pub type curl_chunk_end_callback = Option::< + unsafe extern "C" fn(*mut libc::c_void) -> libc::c_long, +>; +pub type curl_chunk_bgn_callback = Option::< +unsafe extern "C" fn( + *const libc::c_void, + *mut libc::c_void, + libc::c_int, + ) -> libc::c_long, +>; +pub type Curl_RtspReq = libc::c_uint; +pub type curl_usessl = libc::c_uint; +pub type CURL_NETRC_OPTION = libc::c_uint; +// pub type curl_sshkeycallback = Option::< +// unsafe extern "C" fn( + // *mut CURL, + // *const curl_khkey, + // *const curl_khkey, + // curl_khmatch, + // *mut libc::c_void, + // ) -> libc::c_int, + // >; +pub type curl_khmatch = libc::c_uint; +pub type curl_khtype = libc::c_uint; +// pub type CURL = Curl_easy; +pub type curl_ftpccc = libc::c_uint; +pub type curl_ftpauth = libc::c_uint; +pub type curl_ftpfile = libc::c_uint; +pub type CURL_TLSAUTH = libc::c_uint; +// pub type curl_ssl_ctx_callback = Option::< +// unsafe extern "C" fn(*mut CURL, *mut libc::c_void, *mut libc::c_void) -> CURLcode, +// >; +pub type curl_proxytype = libc::c_uint; +pub type curl_TimeCond = libc::c_uint; +pub type mimestate = libc::c_uint; +pub type curl_free_callback = Option:: ()>; +pub type curl_seek_callback = Option:: libc::c_int,>; +pub type mimekind = libc::c_uint; +// pub type curl_hstswrite_callback = Option::< +// unsafe extern "C" fn( +// *mut CURL, +// *mut curl_hstsentry, +// *mut curl_index, +// *mut libc::c_void, +// ) -> CURLSTScode, +// >; +pub type CURLSTScode = libc::c_uint; +// pub type curl_hstsread_callback = Option::< +// unsafe extern "C" fn( +// *mut CURL, +// *mut curl_hstsentry, +// *mut libc::c_void, +// ) -> CURLSTScode, +// >; +pub type curl_conv_callback = Option:: CURLcode,>; +pub type curl_closesocket_callback = Option:: libc::c_int,>; +pub type curl_socket_t = libc::c_int; +// pub type curl_opensocket_callback = Option::< +// unsafe extern "C" fn( +// *mut libc::c_void, +// curlsocktype, +// *mut curl_sockaddr, +// ) -> curl_socket_t, +// >; +pub type curlsocktype = libc::c_uint; +pub type curl_sockopt_callback = Option:: libc::c_int,>; +// pub type curl_ioctl_callback = Option::< +// unsafe extern "C" fn(*mut CURL, libc::c_int, *mut libc::c_void) -> curlioerr, +// >; +pub type curlioerr = libc::c_uint; +// pub type curl_debug_callback = Option::< +// unsafe extern "C" fn( +// *mut CURL, +// curl_infotype, +// *mut libc::c_char, +// size_t, +// *mut libc::c_void, +// ) -> libc::c_int, +// >; +pub type curl_infotype = libc::c_uint; +pub type curl_xferinfo_callback = Option::< + unsafe extern "C" fn( + *mut libc::c_void, + curl_off_t, + curl_off_t, + curl_off_t, + curl_off_t, + ) -> libc::c_int, +>; +pub type curl_progress_callback = Option::< + unsafe extern "C" fn( + *mut libc::c_void, + libc::c_double, + libc::c_double, + libc::c_double, + libc::c_double, + ) -> libc::c_int, +>; +pub type curl_write_callback = Option::< + unsafe extern "C" fn(*mut libc::c_char, size_t, size_t, *mut libc::c_void) -> size_t, +>; +pub type curl_pp_transfer = libc::c_uint; +pub type uint8_t = __uint8_t; +pub type uint32_t = __uint32_t; +pub type C2RustUnnamed_0 = libc::c_uint; +pub type upgrade101 = libc::c_uint; +pub type expect100 = libc::c_uint; +pub type C2RustUnnamed_1 = libc::c_uint; +// pub type curl_multi_timer_callback = Option::< +// unsafe extern "C" fn(*mut CURLM, libc::c_long, *mut libc::c_void) -> libc::c_int, +// >; +// pub type CURLM = Curl_multi; +// pub type curl_push_callback = Option::< +// unsafe extern "C" fn( +// *mut CURL, +// *mut CURL, +// size_t, +// *mut curl_pushheaders, +// *mut libc::c_void, +// ) -> libc::c_int, +// >; +// pub type curl_socket_callback = Option::< +// unsafe extern "C" fn( +// *mut CURL, +// curl_socket_t, +// libc::c_int, +// *mut libc::c_void, +// *mut libc::c_void, +// ) -> libc::c_int, +// >; +pub type C2RustUnnamed_2 = libc::c_uint; +pub type CURLMSG = libc::c_uint; +pub type CURLMstate = libc::c_uint; +pub type mqttstate = libc::c_uint; +pub type smb_conn_state = libc::c_uint; +pub type saslstate = libc::c_uint; +pub type smtpstate = libc::c_uint; +pub type pop3state = libc::c_uint; +pub type imapstate = libc::c_uint; +pub type sshstate = libc::c_int; +// pub type Curl_recv = unsafe extern "C" fn( +// *mut Curl_easy, +// libc::c_int, +// *mut libc::c_char, +// size_t, +// *mut CURLcode, +// ) -> ssize_t; +// pub type Curl_send = unsafe extern "C" fn( +// *mut Curl_easy, +// libc::c_int, +// *const libc::c_void, +// size_t, +// *mut CURLcode, +// ) -> ssize_t; +pub type ftpstate = libc::c_uint; +pub type curlntlm = libc::c_uint; +pub type ssl_connect_state = libc::c_uint; +pub type ssl_connection_state = libc::c_uint; +pub type C2RustUnnamed_5 = libc::c_uint; +pub type ChunkyState = libc::c_uint; +pub type connect_t = libc::c_uint; +pub type dupstring = libc::c_uint; + + +// ----------------------Constants---------------------- +// curl_sslbackend pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; @@ -164,36 +234,8 @@ pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; + +// CURLproxycode pub const CURLPX_LAST: CURLproxycode = 34; pub const CURLPX_USER_REJECTED: CURLproxycode = 33; pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; @@ -229,47 +271,8 @@ pub const CURLPX_CLOSED: CURLproxycode = 3; pub const CURLPX_BAD_VERSION: CURLproxycode = 2; pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; + +// wildcard_states pub const CURLWC_DONE: wildcard_states = 7; pub const CURLWC_ERROR: wildcard_states = 6; pub const CURLWC_SKIP: wildcard_states = 5; @@ -278,154 +281,22 @@ pub const CURLWC_DOWNLOADING: wildcard_states = 3; pub const CURLWC_MATCHING: wildcard_states = 2; pub const CURLWC_INIT: wildcard_states = 1; pub const CURLWC_CLEAR: wildcard_states = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UrlState { - pub conn_cache: *mut conncache, - pub keeps_speed: curltime, - pub lastconnect_id: libc::c_long, - pub headerb: dynbuf, - pub buffer: *mut libc::c_char, - pub ulbuf: *mut libc::c_char, - pub current_speed: curl_off_t, - pub first_host: *mut libc::c_char, - pub retrycount: libc::c_int, - pub first_remote_port: libc::c_int, - pub session: *mut Curl_ssl_session, - pub sessionage: libc::c_long, - pub tempwrite: [tempbuf; 3], - pub tempcount: libc::c_uint, - pub os_errno: libc::c_int, - pub scratch: *mut libc::c_char, - pub followlocation: libc::c_long, - pub prev_signal: Option ()>, - pub digest: digestdata, - pub proxydigest: digestdata, - pub authhost: auth, - pub authproxy: auth, - pub async_0: Curl_async, - pub engine: *mut libc::c_void, - pub expiretime: curltime, - pub timenode: Curl_tree, - pub timeoutlist: Curl_llist, - pub expires: [time_node; 13], - pub most_recent_ftp_entrypath: *mut libc::c_char, - pub httpwant: libc::c_uchar, - pub httpversion: libc::c_uchar, - #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] - pub prev_block_had_trailing_cr: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 5], - pub crlf_conversions: curl_off_t, - pub range: *mut libc::c_char, - pub resume_from: curl_off_t, - pub rtsp_next_client_CSeq: libc::c_long, - pub rtsp_next_server_CSeq: libc::c_long, - pub rtsp_CSeq_recv: libc::c_long, - pub infilesize: curl_off_t, - pub drain: size_t, - pub fread_func: curl_read_callback, - pub in_0: *mut libc::c_void, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub uh: *mut CURLU, - pub up: urlpieces, - pub httpreq: Curl_HttpReq, - pub url: *mut libc::c_char, - pub referer: *mut libc::c_char, - pub cookielist: *mut curl_slist, - pub resolve: *mut curl_slist, - pub trailers_bytes_sent: size_t, - pub trailers_buf: dynbuf, - pub trailers_state: trailers_state, - pub aptr: dynamically_allocated_data, - #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] - #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] - #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] - #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] - #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] - #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] - #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] - #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] - #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] - #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] - #[bitfield(name = "done", ty = "bit", bits = "12..=12")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] - #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] - #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] - #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] - #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] - #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] - #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: - [u8; 3], - #[bitfield(padding)] - pub c2rust_padding_0: [u8; 5], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; + +// trailers_state pub const TRAILERS_DONE: trailers_state = 3; pub const TRAILERS_SENDING: trailers_state = 2; pub const TRAILERS_INITIALIZED: trailers_state = 1; pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; + +// Curl_HttpReq pub const HTTPREQ_HEAD: Curl_HttpReq = 5; pub const HTTPREQ_PUT: Curl_HttpReq = 4; pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; pub const HTTPREQ_POST: Curl_HttpReq = 1; pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} -pub type CURLU = Curl_URL; -pub type curl_read_callback = - Option size_t>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; + +// expire_id pub const EXPIRE_LAST: expire_id = 13; pub const EXPIRE_QUIC: expire_id = 12; pub const EXPIRE_TOOFAST: expire_id = 11; @@ -440,424 +311,8 @@ pub const EXPIRE_DNS_PER_NAME: expire_id = 3; pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; pub const EXPIRE_ASYNC_NAME: expire_id = 1; pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Curl_async { - pub hostname: *mut libc::c_char, - pub dns: *mut Curl_dns_entry, - pub tdata: *mut thread_data, - pub resolver: *mut libc::c_void, - pub port: libc::c_int, - pub status: libc::c_int, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - pub done: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_ssl_session { - pub name: *mut libc::c_char, - pub conn_to_host: *mut libc::c_char, - pub scheme: *const libc::c_char, - pub sessionid: *mut libc::c_void, - pub idsize: size_t, - pub age: libc::c_long, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub ssl_config: ssl_primary_config, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_primary_config { - pub version: libc::c_long, - pub version_max: libc::c_long, - pub CApath: *mut libc::c_char, - pub CAfile: *mut libc::c_char, - pub issuercert: *mut libc::c_char, - pub clientcert: *mut libc::c_char, - pub random_file: *mut libc::c_char, - pub egdsocket: *mut libc::c_char, - pub cipher_list: *mut libc::c_char, - pub cipher_list13: *mut libc::c_char, - pub pinned_key: *mut libc::c_char, - pub cert_blob: *mut curl_blob, - pub ca_info_blob: *mut curl_blob, - pub issuercert_blob: *mut curl_blob, - pub curves: *mut libc::c_char, - #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] - #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] - #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] - #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] - pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct conncache { - pub hash: Curl_hash, - pub num_conn: size_t, - pub next_connection_id: libc::c_long, - pub last_cleanup: curltime, - pub closure_handle: *mut Curl_easy, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option ()>; -pub type comp_function = - Option size_t>; -pub type hash_function = Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct UserDefined { - pub err: *mut FILE, - pub debugdata: *mut libc::c_void, - pub errorbuffer: *mut libc::c_char, - pub proxyport: libc::c_long, - pub out: *mut libc::c_void, - pub in_set: *mut libc::c_void, - pub writeheader: *mut libc::c_void, - pub rtp_out: *mut libc::c_void, - pub use_port: libc::c_long, - pub httpauth: libc::c_ulong, - pub proxyauth: libc::c_ulong, - pub socks5auth: libc::c_ulong, - pub maxredirs: libc::c_long, - pub keep_post: libc::c_int, - pub postfields: *mut libc::c_void, - pub seek_func: curl_seek_callback, - pub postfieldsize: curl_off_t, - pub localport: libc::c_ushort, - pub localportrange: libc::c_int, - pub fwrite_func: curl_write_callback, - pub fwrite_header: curl_write_callback, - pub fwrite_rtp: curl_write_callback, - pub fread_func_set: curl_read_callback, - pub fprogress: curl_progress_callback, - pub fxferinfo: curl_xferinfo_callback, - pub fdebug: curl_debug_callback, - pub ioctl_func: curl_ioctl_callback, - pub fsockopt: curl_sockopt_callback, - pub sockopt_client: *mut libc::c_void, - pub fopensocket: curl_opensocket_callback, - pub opensocket_client: *mut libc::c_void, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub seek_client: *mut libc::c_void, - pub convfromnetwork: curl_conv_callback, - pub convtonetwork: curl_conv_callback, - pub convfromutf8: curl_conv_callback, - pub hsts_read: curl_hstsread_callback, - pub hsts_read_userp: *mut libc::c_void, - pub hsts_write: curl_hstswrite_callback, - pub hsts_write_userp: *mut libc::c_void, - pub progress_client: *mut libc::c_void, - pub ioctl_client: *mut libc::c_void, - pub timeout: libc::c_long, - pub connecttimeout: libc::c_long, - pub accepttimeout: libc::c_long, - pub happy_eyeballs_timeout: libc::c_long, - pub server_response_timeout: libc::c_long, - pub maxage_conn: libc::c_long, - pub tftp_blksize: libc::c_long, - pub filesize: curl_off_t, - pub low_speed_limit: libc::c_long, - pub low_speed_time: libc::c_long, - pub max_send_speed: curl_off_t, - pub max_recv_speed: curl_off_t, - pub set_resume_from: curl_off_t, - pub headers: *mut curl_slist, - pub proxyheaders: *mut curl_slist, - pub httppost: *mut curl_httppost, - pub mimepost: curl_mimepart, - pub quote: *mut curl_slist, - pub postquote: *mut curl_slist, - pub prequote: *mut curl_slist, - pub source_quote: *mut curl_slist, - pub source_prequote: *mut curl_slist, - pub source_postquote: *mut curl_slist, - pub telnet_options: *mut curl_slist, - pub resolve: *mut curl_slist, - pub connect_to: *mut curl_slist, - pub timecondition: curl_TimeCond, - pub proxytype: curl_proxytype, - pub timevalue: time_t, - pub method: Curl_HttpReq, - pub httpwant: libc::c_uchar, - pub ssl: ssl_config_data, - pub proxy_ssl: ssl_config_data, - pub general_ssl: ssl_general_config, - pub dns_cache_timeout: libc::c_long, - pub buffer_size: libc::c_long, - pub upload_buffer_size: libc::c_uint, - pub private_data: *mut libc::c_void, - pub http200aliases: *mut curl_slist, - pub ipver: libc::c_uchar, - pub max_filesize: curl_off_t, - pub ftp_filemethod: curl_ftpfile, - pub ftpsslauth: curl_ftpauth, - pub ftp_ccc: curl_ftpccc, - pub ftp_create_missing_dirs: libc::c_int, - pub ssh_keyfunc: curl_sshkeycallback, - pub ssh_keyfunc_userp: *mut libc::c_void, - pub use_netrc: CURL_NETRC_OPTION, - pub use_ssl: curl_usessl, - pub new_file_perms: libc::c_long, - pub new_directory_perms: libc::c_long, - pub ssh_auth_types: libc::c_long, - pub str_0: [*mut libc::c_char; 80], - pub blobs: [*mut curl_blob; 8], - pub scope_id: libc::c_uint, - pub allowed_protocols: libc::c_long, - pub redir_protocols: libc::c_long, - pub mail_rcpt: *mut curl_slist, - pub rtspreq: Curl_RtspReq, - pub rtspversion: libc::c_long, - pub chunk_bgn: curl_chunk_bgn_callback, - pub chunk_end: curl_chunk_end_callback, - pub fnmatch: curl_fnmatch_callback, - pub fnmatch_data: *mut libc::c_void, - pub gssapi_delegation: libc::c_long, - pub tcp_keepidle: libc::c_long, - pub tcp_keepintvl: libc::c_long, - pub maxconnects: size_t, - pub expect_100_timeout: libc::c_long, - pub stream_depends_on: *mut Curl_easy, - pub stream_weight: libc::c_int, - pub stream_dependents: *mut Curl_http2_dep, - pub resolver_start: curl_resolver_start_callback, - pub resolver_start_client: *mut libc::c_void, - pub upkeep_interval_ms: libc::c_long, - pub fmultidone: multidone_func, - pub dohfor: *mut Curl_easy, - pub uh: *mut CURLU, - pub trailer_data: *mut libc::c_void, - pub trailer_callback: curl_trailer_callback, - #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] - #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] - #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] - #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] - #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] - #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] - #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] - #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] - #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] - #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] - #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] - #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] - #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] - #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] - #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] - #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] - #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] - #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] - #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] - #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] - #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] - #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] - #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] - #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] - #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] - #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] - #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] - #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] - #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] - #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] - #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] - #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] - #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] - #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] - #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] - #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] - #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] - #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] - #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] - #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] - #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] - #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] - #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] - #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] - #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] - #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] - #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] - #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] - #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] - #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] - #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] - #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] - #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] - #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] - #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: - [u8; 8], -} -pub type curl_trailer_callback = - Option libc::c_int>; -pub type multidone_func = Option libc::c_int>; -pub type CURLcode = libc::c_uint; + +// CURLcode pub const CURL_LAST: CURLcode = 99; pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; pub const CURLE_PROXY: CURLcode = 97; @@ -958,27 +413,8 @@ pub const CURLE_URL_MALFORMAT: CURLcode = 3; pub const CURLE_FAILED_INIT: CURLcode = 2; pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void, *mut libc::c_void) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_http2_dep { - pub next: *mut Curl_http2_dep, - pub data: *mut Curl_easy, -} -pub type curl_fnmatch_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option libc::c_long>; -pub type curl_chunk_bgn_callback = Option< - unsafe extern "C" fn(*const libc::c_void, *mut libc::c_void, libc::c_int) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; + +// Curl_RtspReq pub const RTSPREQ_LAST: Curl_RtspReq = 12; pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; pub const RTSPREQ_RECORD: Curl_RtspReq = 10; @@ -992,101 +428,57 @@ pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; + +// curl_usessl pub const CURLUSESSL_LAST: curl_usessl = 4; pub const CURLUSESSL_ALL: curl_usessl = 3; pub const CURLUSESSL_CONTROL: curl_usessl = 2; pub const CURLUSESSL_TRY: curl_usessl = 1; pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; + +// CURL_NETRC_OPTION pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option< - unsafe extern "C" fn( - *mut CURL, - *const curl_khkey, - *const curl_khkey, - curl_khmatch, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_khmatch = libc::c_uint; + +// curl_khmatch pub const CURLKHMATCH_LAST: curl_khmatch = 3; pub const CURLKHMATCH_MISSING: curl_khmatch = 2; pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; + +// curl_khtype pub const CURLKHTYPE_ED25519: curl_khtype = 5; pub const CURLKHTYPE_ECDSA: curl_khtype = 4; pub const CURLKHTYPE_DSS: curl_khtype = 3; pub const CURLKHTYPE_RSA: curl_khtype = 2; pub const CURLKHTYPE_RSA1: curl_khtype = 1; pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; -pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; + +// curl_ftpccc pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; + +// curl_ftpauth pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; + +// curl_ftpfile pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; pub const FTPFILE_NOCWD: curl_ftpfile = 2; pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_config_data { - pub primary: ssl_primary_config, - pub certverifyresult: libc::c_long, - pub CRLfile: *mut libc::c_char, - pub fsslctx: curl_ssl_ctx_callback, - pub fsslctxp: *mut libc::c_void, - pub cert_type: *mut libc::c_char, - pub key: *mut libc::c_char, - pub key_blob: *mut curl_blob, - pub key_type: *mut libc::c_char, - pub key_passwd: *mut libc::c_char, - pub username: *mut libc::c_char, - pub password: *mut libc::c_char, - pub authtype: CURL_TLSAUTH, - #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] - #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] - #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] - #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] - #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] - #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] - #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] - #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: - [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type CURL_TLSAUTH = libc::c_uint; + +// CURL_TLSAUTH pub const CURL_TLSAUTH_LAST: CURL_TLSAUTH = 2; pub const CURL_TLSAUTH_SRP: CURL_TLSAUTH = 1; pub const CURL_TLSAUTH_NONE: CURL_TLSAUTH = 0; -pub type curl_ssl_ctx_callback = - Option CURLcode>; -pub type curl_proxytype = libc::c_uint; + +// curl_proxytype pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; pub const CURLPROXY_SOCKS5: curl_proxytype = 5; @@ -1094,61 +486,15 @@ pub const CURLPROXY_SOCKS4: curl_proxytype = 4; pub const CURLPROXY_HTTPS: curl_proxytype = 2; pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; + +// curl_TimeCond pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mimepart { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mime, - pub nextpart: *mut curl_mimepart, - pub kind: mimekind, - pub flags: libc::c_uint, - pub data: *mut libc::c_char, - pub readfunc: curl_read_callback, - pub seekfunc: curl_seek_callback, - pub freefunc: curl_free_callback, - pub arg: *mut libc::c_void, - pub fp: *mut FILE, - pub curlheaders: *mut curl_slist, - pub userheaders: *mut curl_slist, - pub mimetype: *mut libc::c_char, - pub filename: *mut libc::c_char, - pub name: *mut libc::c_char, - pub datasize: curl_off_t, - pub state: mime_state, - pub encoder: *const mime_encoder, - pub encstate: mime_encoder_state, - pub lastreadstatus: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_encoder { - pub name: *const libc::c_char, - pub encodefunc: - Option size_t>, - pub sizefunc: Option curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, -} -pub type mimestate = libc::c_uint; + +// mimestate pub const MIMESTATE_LAST: mimestate = 9; pub const MIMESTATE_END: mimestate = 8; pub const MIMESTATE_CONTENT: mimestate = 7; @@ -1159,112 +505,32 @@ pub const MIMESTATE_EOH: mimestate = 3; pub const MIMESTATE_USERHEADERS: mimestate = 2; pub const MIMESTATE_CURLHEADERS: mimestate = 1; pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option ()>; -pub type curl_seek_callback = - Option libc::c_int>; -pub type mimekind = libc::c_uint; + +// mimekind pub const MIMEKIND_LAST: mimekind = 5; pub const MIMEKIND_MULTIPART: mimekind = 4; pub const MIMEKIND_CALLBACK: mimekind = 3; pub const MIMEKIND_FILE: mimekind = 2; pub const MIMEKIND_DATA: mimekind = 1; pub const MIMEKIND_NONE: mimekind = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_mime { - pub easy: *mut Curl_easy, - pub parent: *mut curl_mimepart, - pub firstpart: *mut curl_mimepart, - pub lastpart: *mut curl_mimepart, - pub boundary: [libc::c_char; 41], - pub state: mime_state, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut curl_hstsentry, - *mut curl_index, - *mut libc::c_void, - ) -> CURLSTScode, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; + +// CURLSTScode pub const CURLSTS_FAIL: CURLSTScode = 2; pub const CURLSTS_DONE: CURLSTScode = 1; pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = - Option CURLSTScode>; -pub type curl_conv_callback = Option CURLcode>; -pub type curl_closesocket_callback = - Option libc::c_int>; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, curlsocktype, *mut curl_sockaddr) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; + +// curlsocktype pub const CURLSOCKTYPE_LAST: curlsocktype = 2; pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = - Option libc::c_int>; -pub type curl_ioctl_callback = - Option curlioerr>; -pub type curlioerr = libc::c_uint; + +// curlioerr pub const CURLIOE_LAST: curlioerr = 3; pub const CURLIOE_FAILRESTART: curlioerr = 2; pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_infotype = libc::c_uint; + +// curl_infotype pub const CURLINFO_END: curl_infotype = 7; pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; @@ -1273,333 +539,45 @@ pub const CURLINFO_DATA_IN: curl_infotype = 3; pub const CURLINFO_HEADER_OUT: curl_infotype = 2; pub const CURLINFO_HEADER_IN: curl_infotype = 1; pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, ->; -pub type curl_progress_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, - ) -> libc::c_int, ->; -pub type curl_write_callback = - Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct SingleRequest { - pub size: curl_off_t, - pub maxdownload: curl_off_t, - pub bytecount: curl_off_t, - pub writebytecount: curl_off_t, - pub headerbytecount: curl_off_t, - pub deductheadercount: curl_off_t, - pub pendingheader: curl_off_t, - pub start: curltime, - pub now: curltime, - pub badheader: C2RustUnnamed_1, - pub headerline: libc::c_int, - pub str_0: *mut libc::c_char, - pub offset: curl_off_t, - pub httpcode: libc::c_int, - pub keepon: libc::c_int, - pub start100: curltime, - pub exp100: expect100, - pub upgr101: upgrade101, - pub writer_stack: *mut contenc_writer, - pub timeofdoc: time_t, - pub bodywrites: libc::c_long, - pub location: *mut libc::c_char, - pub newurl: *mut libc::c_char, - pub upload_present: ssize_t, - pub upload_fromhere: *mut libc::c_char, - pub p: C2RustUnnamed, - pub doh: *mut dohdata, - #[bitfield(name = "header", ty = "bit", bits = "0..=0")] - #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] - #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] - #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] - #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] - #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] - #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] - #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] - #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] - #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: - [u8; 2], - #[bitfield(padding)] - pub c2rust_padding: [u8; 6], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dohdata { - pub headers: *mut curl_slist, - pub probe: [dnsprobe; 2], - pub pending: libc::c_uint, - pub port: libc::c_int, - pub host: *const libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dnsprobe { - pub easy: *mut CURL, - pub dnstype: libc::c_int, - pub dohbuffer: [libc::c_uchar; 512], - pub dohlen: size_t, - pub serverdoh: dynbuf, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed { - pub file: *mut FILEPROTO, - pub ftp: *mut FTP, - pub http: *mut HTTP, - pub imap: *mut IMAP, - pub ldap: *mut ldapreqinfo, - pub mqtt: *mut MQTT, - pub pop3: *mut POP3, - pub rtsp: *mut RTSP, - pub smb: *mut smb_request, - pub smtp: *mut SMTP, - pub ssh: *mut SSHPROTO, - pub telnet: *mut TELNET, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; + +// curl_pp_transfer pub const PPTRANSFER_NONE: curl_pp_transfer = 2; pub const PPTRANSFER_INFO: curl_pp_transfer = 1; pub const PPTRANSFER_BODY: curl_pp_transfer = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct RTSP { - pub http_wrapper: HTTP, - pub CSeq_sent: libc::c_long, - pub CSeq_recv: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct HTTP { - pub sendit: *mut curl_mimepart, - pub postsize: curl_off_t, - pub postdata: *const libc::c_char, - pub p_pragma: *const libc::c_char, - pub form: curl_mimepart, - pub backup: back, - pub sending: C2RustUnnamed_0, - pub send_buffer: dynbuf, - pub stream_id: int32_t, - pub bodystarted: bool, - pub header_recvbuf: dynbuf, - pub nread_header_recvbuf: size_t, - pub trailer_recvbuf: dynbuf, - pub status_code: libc::c_int, - pub pausedata: *const uint8_t, - pub pauselen: size_t, - pub close_handled: bool, - pub push_headers: *mut *mut libc::c_char, - pub push_headers_used: size_t, - pub push_headers_alloc: size_t, - pub error: uint32_t, - pub closed: bool, - pub mem: *mut libc::c_char, - pub len: size_t, - pub memlen: size_t, - pub upload_mem: *const uint8_t, - pub upload_len: size_t, - pub upload_left: curl_off_t, -} -pub type uint8_t = __uint8_t; -pub type uint32_t = __uint32_t; -pub type C2RustUnnamed_0 = libc::c_uint; + +// C2RustUnnamed_0 pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -pub type upgrade101 = libc::c_uint; + +// upgrade101 pub const UPGR101_WORKING: upgrade101 = 3; pub const UPGR101_RECEIVED: upgrade101 = 2; pub const UPGR101_REQUESTED: upgrade101 = 1; pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; + +// expect100 pub const EXP100_FAILED: expect100 = 3; pub const EXP100_SENDING_REQUEST: expect100 = 2; pub const EXP100_AWAITING_CONTINUE: expect100 = 1; pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; + +// C2RustUnnamed_1 pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct PslCache { - pub psl: *const psl_ctx_t, - pub expires: time_t, - pub dynamic: bool, -} -pub type psl_ctx_t = psl_ctx_st; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_multi { - pub magic: libc::c_uint, - pub easyp: *mut Curl_easy, - pub easylp: *mut Curl_easy, - pub num_easy: libc::c_int, - pub num_alive: libc::c_int, - pub msglist: Curl_llist, - pub pending: Curl_llist, - pub socket_cb: curl_socket_callback, - pub socket_userp: *mut libc::c_void, - pub push_cb: curl_push_callback, - pub push_userp: *mut libc::c_void, - pub hostcache: Curl_hash, - pub psl: PslCache, - pub timetree: *mut Curl_tree, - pub sockhash: Curl_hash, - pub conn_cache: conncache, - pub maxconnects: libc::c_long, - pub max_host_connections: libc::c_long, - pub max_total_connections: libc::c_long, - pub timer_cb: curl_multi_timer_callback, - pub timer_userp: *mut libc::c_void, - pub timer_lastcall: curltime, - pub max_concurrent_streams: libc::c_uint, - pub wakeup_pair: [curl_socket_t; 2], - pub multiplexing: bool, - pub recheckstate: bool, - pub in_callback: bool, - pub ipv6_works: bool, - pub ssl_seeded: bool, -} -pub type curl_multi_timer_callback = - Option libc::c_int>; -pub type CURLM = Curl_multi; -pub type curl_push_callback = Option< - unsafe extern "C" fn( - *mut CURL, - *mut CURL, - size_t, - *mut curl_pushheaders, - *mut libc::c_void, - ) -> libc::c_int, ->; -pub type curl_socket_callback = Option< - unsafe extern "C" fn( - *mut CURL, - curl_socket_t, - libc::c_int, - *mut libc::c_void, - *mut libc::c_void, - ) -> libc::c_int, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; + +// C2RUSTUnnamed_2 pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_message { - pub list: Curl_llist_element, - pub extmsg: CURLMsg, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CURLMsg { - pub msg: CURLMSG, - pub easy_handle: *mut CURL, - pub data: C2RustUnnamed_3, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_3 { - pub whatever: *mut libc::c_void, - pub result: CURLcode, -} -pub type CURLMSG = libc::c_uint; + +// CURLMSG pub const CURLMSG_LAST: CURLMSG = 2; pub const CURLMSG_DONE: CURLMSG = 1; pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; + +// CURLMstate pub const MSTATE_LAST: CURLMstate = 17; pub const MSTATE_MSGSENT: CURLMstate = 16; pub const MSTATE_COMPLETED: CURLMstate = 15; @@ -1618,109 +596,8 @@ pub const MSTATE_RESOLVING: CURLMstate = 3; pub const MSTATE_CONNECT: CURLMstate = 2; pub const MSTATE_PENDING: CURLMstate = 1; pub const MSTATE_INIT: CURLMstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectdata { - pub cnnct: connstate, - pub bundle_node: Curl_llist_element, - pub chunk: Curl_chunker, - pub fclosesocket: curl_closesocket_callback, - pub closesocket_client: *mut libc::c_void, - pub connection_id: libc::c_long, - pub dns_entry: *mut Curl_dns_entry, - pub ip_addr: *mut Curl_addrinfo, - pub tempaddr: [*mut Curl_addrinfo; 2], - pub scope_id: libc::c_uint, - pub transport: C2RustUnnamed_5, - pub host: hostname, - pub hostname_resolve: *mut libc::c_char, - pub secondaryhostname: *mut libc::c_char, - pub conn_to_host: hostname, - pub socks_proxy: proxy_info, - pub http_proxy: proxy_info, - pub port: libc::c_int, - pub remote_port: libc::c_int, - pub conn_to_port: libc::c_int, - pub secondary_port: libc::c_ushort, - pub primary_ip: [libc::c_char; 46], - pub ip_version: libc::c_uchar, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub options: *mut libc::c_char, - pub sasl_authzid: *mut libc::c_char, - pub httpversion: libc::c_uchar, - pub now: curltime, - pub created: curltime, - pub lastused: curltime, - pub sock: [curl_socket_t; 2], - pub tempsock: [curl_socket_t; 2], - pub tempfamily: [libc::c_int; 2], - pub recv: [Option; 2], - pub send: [Option; 2], - pub ssl: [ssl_connect_data; 2], - pub proxy_ssl: [ssl_connect_data; 2], - pub ssl_extra: *mut libc::c_void, - pub ssl_config: ssl_primary_config, - pub proxy_ssl_config: ssl_primary_config, - pub bits: ConnectBits, - pub num_addr: libc::c_int, - pub connecttime: curltime, - pub timeoutms_per_addr: [timediff_t; 2], - pub handler: *const Curl_handler, - pub given: *const Curl_handler, - pub keepalive: curltime, - pub sockfd: curl_socket_t, - pub writesockfd: curl_socket_t, - pub easyq: Curl_llist, - pub seek_func: curl_seek_callback, - pub seek_client: *mut libc::c_void, - pub http_ntlm_state: curlntlm, - pub proxy_ntlm_state: curlntlm, - pub ntlm: ntlmdata, - pub proxyntlm: ntlmdata, - pub trailer: dynbuf, - pub proto: C2RustUnnamed_4, - pub connect_state: *mut http_connect_state, - pub bundle: *mut connectbundle, - pub unix_domain_socket: *mut libc::c_char, - pub localdev: *mut libc::c_char, - pub localportrange: libc::c_int, - pub cselect_bits: libc::c_int, - pub waitfor: libc::c_int, - pub negnpn: libc::c_int, - pub localport: libc::c_ushort, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub union C2RustUnnamed_4 { - pub ftpc: ftp_conn, - pub httpc: http_conn, - pub sshc: ssh_conn, - pub tftpc: *mut tftp_state_data, - pub imapc: imap_conn, - pub pop3c: pop3_conn, - pub smtpc: smtp_conn, - pub rtspc: rtsp_conn, - pub smbc: smb_conn, - pub rtmp: *mut libc::c_void, - pub ldapc: *mut ldapconninfo, - pub mqtt: mqtt_conn, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; + +// mqttstate pub const MQTT_NOSTATE: mqttstate = 7; pub const MQTT_PUB_REMAIN: mqttstate = 6; pub const MQTT_PUBWAIT: mqttstate = 5; @@ -1729,61 +606,15 @@ pub const MQTT_SUBACK: mqttstate = 3; pub const MQTT_CONNACK: mqttstate = 2; pub const MQTT_REMAINING_LENGTH: mqttstate = 1; pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; + +// smb_conn_state pub const SMB_CONNECTED: smb_conn_state = 4; pub const SMB_SETUP: smb_conn_state = 3; pub const SMB_NEGOTIATE: smb_conn_state = 2; pub const SMB_CONNECTING: smb_conn_state = 1; pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smtp_conn { - pub pp: pingpong, - pub state: smtpstate, - pub ssldone: bool, - pub domain: *mut libc::c_char, - pub sasl: SASL, - pub tls_supported: bool, - pub size_supported: bool, - pub utf8_supported: bool, - pub auth_supported: bool, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASL { - pub params: *const SASLproto, - pub state: saslstate, - pub authmechs: libc::c_ushort, - pub prefmech: libc::c_ushort, - pub authused: libc::c_ushort, - pub resetprefs: bool, - pub mutual_auth: bool, - pub force_ir: bool, -} -pub type saslstate = libc::c_uint; + +// saslstate pub const SASL_FINAL: saslstate = 17; pub const SASL_CANCEL: saslstate = 16; pub const SASL_GSASL: saslstate = 15; @@ -1802,27 +633,8 @@ pub const SASL_LOGIN_PASSWD: saslstate = 3; pub const SASL_LOGIN: saslstate = 2; pub const SASL_PLAIN: saslstate = 1; pub const SASL_STOP: saslstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SASLproto { - pub service: *const libc::c_char, - pub contcode: libc::c_int, - pub finalcode: libc::c_int, - pub maxirlen: size_t, - pub sendauth: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *const libc::c_char, - *const libc::c_char, - ) -> CURLcode, - >, - pub sendcont: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *const libc::c_char) -> CURLcode, - >, - pub getmessage: Option ()>, -} -pub type smtpstate = libc::c_uint; + +// smtpstate pub const SMTP_LAST: smtpstate = 13; pub const SMTP_QUIT: smtpstate = 12; pub const SMTP_POSTDATA: smtpstate = 11; @@ -1837,46 +649,8 @@ pub const SMTP_HELO: smtpstate = 3; pub const SMTP_EHLO: smtpstate = 2; pub const SMTP_SERVERGREET: smtpstate = 1; pub const SMTP_STOP: smtpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pingpong { - pub cache: *mut libc::c_char, - pub cache_size: size_t, - pub nread_resp: size_t, - pub linestart_resp: *mut libc::c_char, - pub pending_resp: bool, - pub sendthis: *mut libc::c_char, - pub sendleft: size_t, - pub sendsize: size_t, - pub response: curltime, - pub response_time: timediff_t, - pub sendbuf: dynbuf, - pub statemachine: Option CURLcode>, - pub endofresp: Option< - unsafe extern "C" fn( - *mut Curl_easy, - *mut connectdata, - *mut libc::c_char, - size_t, - *mut libc::c_int, - ) -> bool, - >, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct pop3_conn { - pub pp: pingpong, - pub state: pop3state, - pub ssldone: bool, - pub tls_supported: bool, - pub eob: size_t, - pub strip: size_t, - pub sasl: SASL, - pub authtypes: libc::c_uint, - pub preftype: libc::c_uint, - pub apoptimestamp: *mut libc::c_char, -} -pub type pop3state = libc::c_uint; + +// pop3state pub const POP3_LAST: pop3state = 11; pub const POP3_QUIT: pop3state = 10; pub const POP3_COMMAND: pop3state = 9; @@ -1889,25 +663,8 @@ pub const POP3_STARTTLS: pop3state = 3; pub const POP3_CAPA: pop3state = 2; pub const POP3_SERVERGREET: pop3state = 1; pub const POP3_STOP: pop3state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct imap_conn { - pub pp: pingpong, - pub state: imapstate, - pub ssldone: bool, - pub preauth: bool, - pub sasl: SASL, - pub preftype: libc::c_uint, - pub cmdid: libc::c_uint, - pub resptag: [libc::c_char; 5], - pub tls_supported: bool, - pub login_disabled: bool, - pub ir_supported: bool, - pub mailbox: *mut libc::c_char, - pub mailbox_uidvalidity: *mut libc::c_char, - pub dyn_0: dynbuf, -} -pub type imapstate = libc::c_uint; + +// imapstate pub const IMAP_LAST: imapstate = 15; pub const IMAP_LOGOUT: imapstate = 14; pub const IMAP_SEARCH: imapstate = 13; @@ -1924,28 +681,8 @@ pub const IMAP_STARTTLS: imapstate = 3; pub const IMAP_CAPABILITY: imapstate = 2; pub const IMAP_SERVERGREET: imapstate = 1; pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; + +// sshstate pub const SSH_LAST: sshstate = 60; pub const SSH_QUIT: sshstate = 59; pub const SSH_SESSION_FREE: sshstate = 58; @@ -2008,78 +745,8 @@ pub const SSH_S_STARTUP: sshstate = 2; pub const SSH_INIT: sshstate = 1; pub const SSH_STOP: sshstate = 0; pub const SSH_NO_STATE: sshstate = -1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct http_conn { - pub binsettings: [uint8_t; 80], - pub binlen: size_t, - pub trnsfr: *mut Curl_easy, - pub h2: *mut nghttp2_session, - pub send_underlying: Option, - pub recv_underlying: Option, - pub inbuf: *mut libc::c_char, - pub inbuflen: size_t, - pub nread_inbuf: size_t, - pub pause_stream_id: int32_t, - pub drain_total: size_t, - pub settings: h2settings, - pub local_settings: [nghttp2_settings_entry; 3], - pub local_settings_num: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct nghttp2_settings_entry { - pub settings_id: int32_t, - pub value: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct h2settings { - pub max_concurrent_streams: uint32_t, - pub enable_push: bool, -} -pub type Curl_recv = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *mut libc::c_char, - size_t, - *mut CURLcode, -) -> ssize_t; -pub type Curl_send = unsafe extern "C" fn( - *mut Curl_easy, - libc::c_int, - *const libc::c_void, - size_t, - *mut CURLcode, -) -> ssize_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ftp_conn { - pub pp: pingpong, - pub entrypath: *mut libc::c_char, - pub file: *mut libc::c_char, - pub dirs: *mut *mut libc::c_char, - pub dirdepth: libc::c_int, - pub dont_check: bool, - pub ctl_valid: bool, - pub cwddone: bool, - pub cwdcount: libc::c_int, - pub cwdfail: bool, - pub wait_data_conn: bool, - pub newport: libc::c_ushort, - pub newhost: *mut libc::c_char, - pub prevpath: *mut libc::c_char, - pub transfertype: libc::c_char, - pub count1: libc::c_int, - pub count2: libc::c_int, - pub count3: libc::c_int, - pub state: ftpstate, - pub state_saved: ftpstate, - pub retr_size_saved: curl_off_t, - pub server_os: *mut libc::c_char, - pub known_filesize: curl_off_t, -} -pub type ftpstate = libc::c_uint; + +// ftpstate pub const FTP_LAST: ftpstate = 35; pub const FTP_QUIT: ftpstate = 34; pub const FTP_STOR: ftpstate = 33; @@ -2116,159 +783,33 @@ pub const FTP_USER: ftpstate = 3; pub const FTP_AUTH: ftpstate = 2; pub const FTP_WAIT220: ftpstate = 1; pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ntlmdata { - pub flags: libc::c_uint, - pub nonce: [libc::c_uchar; 8], - pub target_info_len: libc::c_uint, - pub target_info: *mut libc::c_void, - pub ntlm_auth_hlpr_socket: curl_socket_t, - pub ntlm_auth_hlpr_pid: pid_t, - pub challenge: *mut libc::c_char, - pub response: *mut libc::c_char, -} -pub type curlntlm = libc::c_uint; + +// curlntlm pub const NTLMSTATE_LAST: curlntlm = 4; pub const NTLMSTATE_TYPE3: curlntlm = 3; pub const NTLMSTATE_TYPE2: curlntlm = 2; pub const NTLMSTATE_TYPE1: curlntlm = 1; pub const NTLMSTATE_NONE: curlntlm = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_handler { - pub scheme: *const libc::c_char, - pub setup_connection: - Option CURLcode>, - pub do_it: Option CURLcode>, - pub done: Option CURLcode>, - pub do_more: Option CURLcode>, - pub connect_it: Option CURLcode>, - pub connecting: Option CURLcode>, - pub doing: Option CURLcode>, - pub proto_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub doing_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub domore_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub perform_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, - >, - pub disconnect: - Option CURLcode>, - pub readwrite: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut ssize_t, *mut bool) -> CURLcode, - >, - pub connection_check: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_uint) -> libc::c_uint, - >, - pub attach: Option ()>, - pub defport: libc::c_int, - pub protocol: libc::c_uint, - pub family: libc::c_uint, - pub flags: libc::c_uint, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: - [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct ssl_connect_data { - pub state: ssl_connection_state, - pub connecting_state: ssl_connect_state, - pub backend: *mut ssl_backend_data, - #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] - pub use_0: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -pub type ssl_connect_state = libc::c_uint; + +// ssl_connect_state pub const ssl_connect_done: ssl_connect_state = 5; pub const ssl_connect_3: ssl_connect_state = 4; pub const ssl_connect_2_writing: ssl_connect_state = 3; pub const ssl_connect_2_reading: ssl_connect_state = 2; pub const ssl_connect_2: ssl_connect_state = 1; pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; + +// ssl_connection_state pub const ssl_connection_complete: ssl_connection_state = 2; pub const ssl_connection_negotiating: ssl_connection_state = 1; pub const ssl_connection_none: ssl_connection_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_5 = libc::c_uint; + +// C2RustUnnamed_5 pub const TRNSPRT_QUIC: C2RustUnnamed_5 = 5; pub const TRNSPRT_UDP: C2RustUnnamed_5 = 4; pub const TRNSPRT_TCP: C2RustUnnamed_5 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; + +// ChunkyState pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; pub const CHUNK_TRAILER_CR: ChunkyState = 6; pub const CHUNK_TRAILER: ChunkyState = 5; @@ -2277,14 +818,8 @@ pub const CHUNK_POSTLF: ChunkyState = 3; pub const CHUNK_DATA: ChunkyState = 2; pub const CHUNK_LF: ChunkyState = 1; pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; + +// connect_t pub const CONNECT_DONE: connect_t = 17; pub const CONNECT_REQ_READ_MORE: connect_t = 16; pub const CONNECT_REQ_READ: connect_t = 15; @@ -2303,136 +838,86 @@ pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; pub const CONNECT_SOCKS_SEND: connect_t = 2; pub const CONNECT_SOCKS_INIT: connect_t = 1; pub const CONNECT_INIT: connect_t = 0; -pub type curl_strdup_callback = - Option *mut libc::c_char>; -#[no_mangle] -pub unsafe extern "C" fn Curl_input_digest( - mut data: *mut Curl_easy, - mut proxy: bool, - mut header: *const libc::c_char, -) -> CURLcode { - let mut digest: *mut digestdata = 0 as *mut digestdata; - if proxy { - digest = &mut (*data).state.proxydigest; - } else { - digest = &mut (*data).state.digest; - } - if curl_strnequal( - b"Digest\0" as *const u8 as *const libc::c_char, - header, - strlen(b"Digest\0" as *const u8 as *const libc::c_char), - ) == 0 - || Curl_isspace(*header.offset(6 as libc::c_int as isize) as libc::c_uchar as libc::c_int) - == 0 - { - return CURLE_BAD_CONTENT_ENCODING; - } - header = header.offset(strlen(b"Digest\0" as *const u8 as *const libc::c_char) as isize); - while *header as libc::c_int != 0 && Curl_isspace(*header as libc::c_uchar as libc::c_int) != 0 - { - header = header.offset(1); - } - return Curl_auth_decode_digest_http_message(header, digest); -} -#[no_mangle] -pub unsafe extern "C" fn Curl_output_digest( - mut data: *mut Curl_easy, - mut proxy: bool, - mut request: *const libc::c_uchar, - mut uripath: *const libc::c_uchar, -) -> CURLcode { - let mut result: CURLcode = CURLE_OK; - let mut path: *mut libc::c_uchar = 0 as *mut libc::c_uchar; - let mut tmp: *mut libc::c_char = 0 as *mut libc::c_char; - let mut response: *mut libc::c_char = 0 as *mut libc::c_char; - let mut len: size_t = 0; - let mut have_chlg: bool = false; - let mut allocuserpwd: *mut *mut libc::c_char = 0 as *mut *mut libc::c_char; - let mut userp: *const libc::c_char = 0 as *const libc::c_char; - let mut passwdp: *const libc::c_char = 0 as *const libc::c_char; - let mut digest: *mut digestdata = 0 as *mut digestdata; - let mut authp: *mut auth = 0 as *mut auth; - if proxy { - digest = &mut (*data).state.proxydigest; - allocuserpwd = &mut (*data).state.aptr.proxyuserpwd; - userp = (*data).state.aptr.proxyuser; - passwdp = (*data).state.aptr.proxypasswd; - authp = &mut (*data).state.authproxy; - } else { - digest = &mut (*data).state.digest; - allocuserpwd = &mut (*data).state.aptr.userpwd; - userp = (*data).state.aptr.user; - passwdp = (*data).state.aptr.passwd; - authp = &mut (*data).state.authhost; - } - Curl_cfree.expect("non-null function pointer")(*allocuserpwd as *mut libc::c_void); - *allocuserpwd = 0 as *mut libc::c_char; - if userp.is_null() { - userp = b"\0" as *const u8 as *const libc::c_char; - } - if passwdp.is_null() { - passwdp = b"\0" as *const u8 as *const libc::c_char; - } - have_chlg = if !((*digest).nonce).is_null() { - 1 as libc::c_int - } else { - 0 as libc::c_int - } != 0; - if !have_chlg { - (*authp).set_done(0 as libc::c_int as bit); - return CURLE_OK; - } - if (*authp).iestyle() != 0 { - tmp = strchr(uripath as *mut libc::c_char, '?' as i32); - if !tmp.is_null() { - let mut urilen: size_t = - tmp.offset_from(uripath as *mut libc::c_char) as libc::c_long as size_t; - path = curl_maprintf( - b"%.*s\0" as *const u8 as *const libc::c_char, - urilen as libc::c_int, - uripath, - ) as *mut libc::c_uchar; - } - } - if tmp.is_null() { - path = Curl_cstrdup.expect("non-null function pointer")(uripath as *mut libc::c_char) - as *mut libc::c_uchar; - } - if path.is_null() { - return CURLE_OUT_OF_MEMORY; - } - result = Curl_auth_create_digest_http_message( - data, - userp, - passwdp, - request, - path, - digest, - &mut response, - &mut len, - ); - Curl_cfree.expect("non-null function pointer")(path as *mut libc::c_void); - if result as u64 != 0 { - return result; - } - *allocuserpwd = curl_maprintf( - b"%sAuthorization: Digest %s\r\n\0" as *const u8 as *const libc::c_char, - if proxy as libc::c_int != 0 { - b"Proxy-\0" as *const u8 as *const libc::c_char - } else { - b"\0" as *const u8 as *const libc::c_char - }, - response, - ); - Curl_cfree.expect("non-null function pointer")(response as *mut libc::c_void); - if (*allocuserpwd).is_null() { - return CURLE_OUT_OF_MEMORY; - } - (*authp).set_done(1 as libc::c_int as bit); - return CURLE_OK; -} -#[no_mangle] -pub unsafe extern "C" fn Curl_http_auth_cleanup_digest(mut data: *mut Curl_easy) { - Curl_auth_digest_cleanup(&mut (*data).state.digest); - Curl_auth_digest_cleanup(&mut (*data).state.proxydigest); -} + +// dupstring +pub const STRING_LAST: dupstring = 80; +pub const STRING_AWS_SIGV4: dupstring = 79; +pub const STRING_COPYPOSTFIELDS: dupstring = 78; +pub const STRING_LASTZEROTERMINATED: dupstring = 77; +pub const STRING_SSL_EC_CURVES: dupstring = 76; +pub const STRING_DNS_LOCAL_IP6: dupstring = 75; +pub const STRING_DNS_LOCAL_IP4: dupstring = 74; +pub const STRING_DNS_INTERFACE: dupstring = 73; +pub const STRING_DNS_SERVERS: dupstring = 72; +pub const STRING_SASL_AUTHZID: dupstring = 71; +pub const STRING_HSTS: dupstring = 70; +pub const STRING_ALTSVC: dupstring = 69; +pub const STRING_DOH: dupstring = 68; +pub const STRING_TARGET: dupstring = 67; +pub const STRING_UNIX_SOCKET_PATH: dupstring = 66; +pub const STRING_BEARER: dupstring = 65; +pub const STRING_TLSAUTH_PASSWORD_PROXY: dupstring = 64; +pub const STRING_TLSAUTH_PASSWORD: dupstring = 63; +pub const STRING_TLSAUTH_USERNAME_PROXY: dupstring = 62; +pub const STRING_TLSAUTH_USERNAME: dupstring = 61; +pub const STRING_MAIL_AUTH: dupstring = 60; +pub const STRING_MAIL_FROM: dupstring = 59; +pub const STRING_SERVICE_NAME: dupstring = 58; +pub const STRING_PROXY_SERVICE_NAME: dupstring = 57; +pub const STRING_SSH_KNOWNHOSTS: dupstring = 56; +pub const STRING_SSH_HOST_PUBLIC_KEY_MD5: dupstring = 55; +pub const STRING_SSH_PUBLIC_KEY: dupstring = 54; +pub const STRING_SSH_PRIVATE_KEY: dupstring = 53; +pub const STRING_RTSP_TRANSPORT: dupstring = 52; +pub const STRING_RTSP_STREAM_URI: dupstring = 51; +pub const STRING_RTSP_SESSION_ID: dupstring = 50; +pub const STRING_NOPROXY: dupstring = 49; +pub const STRING_PROXYPASSWORD: dupstring = 48; +pub const STRING_PROXYUSERNAME: dupstring = 47; +pub const STRING_OPTIONS: dupstring = 46; +pub const STRING_PASSWORD: dupstring = 45; +pub const STRING_USERNAME: dupstring = 44; +pub const STRING_SSL_ENGINE: dupstring = 43; +pub const STRING_SSL_ISSUERCERT_PROXY: dupstring = 42; +pub const STRING_SSL_ISSUERCERT: dupstring = 41; +pub const STRING_SSL_CRLFILE_PROXY: dupstring = 40; +pub const STRING_SSL_CRLFILE: dupstring = 39; +pub const STRING_USERAGENT: dupstring = 38; +pub const STRING_SSL_RANDOM_FILE: dupstring = 37; +pub const STRING_SSL_EGDSOCKET: dupstring = 36; +pub const STRING_SSL_CIPHER13_LIST_PROXY: dupstring = 35; +pub const STRING_SSL_CIPHER13_LIST: dupstring = 34; +pub const STRING_SSL_CIPHER_LIST_PROXY: dupstring = 33; +pub const STRING_SSL_CIPHER_LIST: dupstring = 32; +pub const STRING_SSL_PINNEDPUBLICKEY_PROXY: dupstring = 31; +pub const STRING_SSL_PINNEDPUBLICKEY: dupstring = 30; +pub const STRING_SSL_CAFILE_PROXY: dupstring = 29; +pub const STRING_SSL_CAFILE: dupstring = 28; +pub const STRING_SSL_CAPATH_PROXY: dupstring = 27; +pub const STRING_SSL_CAPATH: dupstring = 26; +pub const STRING_SET_URL: dupstring = 25; +pub const STRING_SET_REFERER: dupstring = 24; +pub const STRING_SET_RANGE: dupstring = 23; +pub const STRING_PRE_PROXY: dupstring = 22; +pub const STRING_PROXY: dupstring = 21; +pub const STRING_NETRC_FILE: dupstring = 20; +pub const STRING_KRB_LEVEL: dupstring = 19; +pub const STRING_KEY_TYPE_PROXY: dupstring = 18; +pub const STRING_KEY_TYPE: dupstring = 17; +pub const STRING_KEY_PASSWD_PROXY: dupstring = 16; +pub const STRING_KEY_PASSWD: dupstring = 15; +pub const STRING_KEY_PROXY: dupstring = 14; +pub const STRING_KEY: dupstring = 13; +pub const STRING_FTPPORT: dupstring = 12; +pub const STRING_FTP_ALTERNATIVE_TO_USER: dupstring = 11; +pub const STRING_FTP_ACCOUNT: dupstring = 10; +pub const STRING_ENCODING: dupstring = 9; +pub const STRING_DEVICE: dupstring = 8; +pub const STRING_DEFAULT_PROTOCOL: dupstring = 7; +pub const STRING_CUSTOMREQUEST: dupstring = 6; +pub const STRING_COOKIEJAR: dupstring = 5; +pub const STRING_COOKIE: dupstring = 4; +pub const STRING_CERT_TYPE_PROXY: dupstring = 3; +pub const STRING_CERT_TYPE: dupstring = 2; +pub const STRING_CERT_PROXY: dupstring = 1; +pub const STRING_CERT: dupstring = 0; \ No newline at end of file diff --git a/rust/rust_ffi/src/ffi_fun/fun_call.rs b/rust/rust_ffi/src/ffi_fun/fun_call.rs new file mode 100644 index 0000000..1166d2a --- /dev/null +++ b/rust/rust_ffi/src/ffi_fun/fun_call.rs @@ -0,0 +1,70 @@ +// use crate::src::ffi_alias::type_alias::*; +// use crate::src::ffi_struct::struct_define::*; + +extern "C" { + // ftp.rs + + // ftplistparser.rs + + // http_aws_sigv4.rs + + // http_chunks.rs + + // http_digest.rs + + // http_negotiate.rs + + // http_ntlm.rs + + // http_proxy.rs + + // http.rs + + // http2.rs + + // vtls/bearssl.rs + + // vtls/gskit.rs + + // vtls/gtls.rs + + // vtls/keylog.rs + // fn curl_getenv(variable: *const libc::c_char) -> *mut libc::c_char; + // fn fclose(__stream: *mut FILE) -> libc::c_int; + // fn fopen(_: *const libc::c_char, _: *const libc::c_char) -> *mut FILE; + // fn setvbuf( + // __stream: *mut FILE, + // __buf: *mut libc::c_char, + // __modes: libc::c_int, + // __n: size_t, + // ) -> libc::c_int; + // fn fputs(__s: *const libc::c_char, __stream: *mut FILE) -> libc::c_int; + // fn memcpy( + // _: *mut libc::c_void, + // _: *const libc::c_void, + // _: libc::c_ulong, + // ) -> *mut libc::c_void; + // fn strlen(_: *const libc::c_char) -> libc::c_ulong; + // vtls/mbedtls_threadlock.rs + + // vtls/mbedtls.rs + + // vtls/mesalink.rs + + // vtls/nss.rs + + // vtls/openssl.rs + + // vtls/rustls.rs + + // vtls/schannel_verify.rs + + // vtls/schannel.rs + + // vtls/sectransp.rs + + // vtls/vtls.rs + + // vtls/wolfssl.rs + +} \ No newline at end of file diff --git a/rust/rust_ffi/src/ffi_fun/mod.rs b/rust/rust_ffi/src/ffi_fun/mod.rs new file mode 100644 index 0000000..03184eb --- /dev/null +++ b/rust/rust_ffi/src/ffi_fun/mod.rs @@ -0,0 +1 @@ +pub mod fun_call; \ No newline at end of file diff --git a/rust/rust_ffi/src/ffi_struct/mod.rs b/rust/rust_ffi/src/ffi_struct/mod.rs new file mode 100644 index 0000000..e4061a1 --- /dev/null +++ b/rust/rust_ffi/src/ffi_struct/mod.rs @@ -0,0 +1 @@ +pub mod struct_define; \ No newline at end of file diff --git a/rust/rust_ffi/src/ffi_struct/struct_define.rs b/rust/rust_ffi/src/ffi_struct/struct_define.rs new file mode 100644 index 0000000..9af0d6a --- /dev/null +++ b/rust/rust_ffi/src/ffi_struct/struct_define.rs @@ -0,0 +1,1531 @@ +use c2rust_bitfields::BitfieldStruct; +use crate::src::ffi_alias::type_alias::*; + +// http_ntlm.rs + vtls/keylog.rs +#[derive(Copy, Clone)] +#[repr(C)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [libc::c_char; 14], +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct _IO_FILE { +// pub _flags: libc::c_int, +// pub _IO_read_ptr: *mut libc::c_char, +// pub _IO_read_end: *mut libc::c_char, +// pub _IO_read_base: *mut libc::c_char, +// pub _IO_write_base: *mut libc::c_char, +// pub _IO_write_ptr: *mut libc::c_char, +// pub _IO_write_end: *mut libc::c_char, +// pub _IO_buf_base: *mut libc::c_char, +// pub _IO_buf_end: *mut libc::c_char, +// pub _IO_save_base: *mut libc::c_char, +// pub _IO_backup_base: *mut libc::c_char, +// pub _IO_save_end: *mut libc::c_char, +// pub _markers: *mut _IO_marker, +// pub _chain: *mut _IO_FILE, +// pub _fileno: libc::c_int, +// pub _flags2: libc::c_int, +// pub _old_offset: __off_t, +// pub _cur_column: libc::c_ushort, +// pub _vtable_offset: libc::c_schar, +// pub _shortbuf: [libc::c_char; 1], +// pub _lock: *mut libc::c_void, +// pub _offset: __off64_t, +// pub _codecvt: *mut _IO_codecvt, +// pub _wide_data: *mut _IO_wide_data, +// pub _freeres_list: *mut _IO_FILE, +// pub _freeres_buf: *mut libc::c_void, +// pub __pad5: size_t, +// pub _mode: libc::c_int, +// pub _unused2: [libc::c_char; 20], +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct Curl_easy { +// pub magic: libc::c_uint, +// pub next: *mut Curl_easy, +// pub prev: *mut Curl_easy, +// pub conn: *mut connectdata, +// pub connect_queue: Curl_llist_element, +// pub conn_queue: Curl_llist_element, +// pub mstate: CURLMstate, +// pub result: CURLcode, +// pub msg: Curl_message, +// pub sockets: [curl_socket_t; 5], +// pub actions: [libc::c_uchar; 5], +// pub numsocks: libc::c_int, +// pub dns: Names, +// pub multi: *mut Curl_multi, +// pub multi_easy: *mut Curl_multi, +// pub share: *mut Curl_share, +// pub req: SingleRequest, +// pub set: UserDefined, +// pub cookies: *mut CookieInfo, +// pub hsts: *mut hsts, +// pub asi: *mut altsvcinfo, +// pub progress: Progress, +// pub state: UrlState, +// pub wildcard: WildcardData, +// pub info: PureInfo, +// pub tsi: curl_tlssessioninfo, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_tlssessioninfo { + pub backend: curl_sslbackend, + pub internals: *mut libc::c_void, +} +#[derive(Copy, Clone, BitfieldStruct)] +#[repr(C)] +pub struct PureInfo { + pub httpcode: libc::c_int, + pub httpproxycode: libc::c_int, + pub httpversion: libc::c_int, + pub filetime: time_t, + pub header_size: curl_off_t, + pub request_size: curl_off_t, + pub proxyauthavail: libc::c_ulong, + pub httpauthavail: libc::c_ulong, + pub numconnects: libc::c_long, + pub contenttype: *mut libc::c_char, + pub wouldredirect: *mut libc::c_char, + pub retry_after: curl_off_t, + pub conn_primary_ip: [libc::c_char; 46], + pub conn_primary_port: libc::c_int, + pub conn_local_ip: [libc::c_char; 46], + pub conn_local_port: libc::c_int, + pub conn_scheme: *const libc::c_char, + pub conn_protocol: libc::c_uint, + pub certs: curl_certinfo, + pub pxcode: CURLproxycode, + #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] + pub timecond: [u8; 1], + #[bitfield(padding)] + pub c2rust_padding: [u8; 3], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_certinfo { + pub num_of_certs: libc::c_int, + pub certinfo: *mut *mut curl_slist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_slist { + pub data: *mut libc::c_char, + pub next: *mut curl_slist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct WildcardData { + pub state: wildcard_states, + pub path: *mut libc::c_char, + pub pattern: *mut libc::c_char, + pub filelist: Curl_llist, + pub protdata: *mut libc::c_void, + pub dtor: wildcard_dtor, + pub customptr: *mut libc::c_void, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Curl_llist { + pub head: *mut Curl_llist_element, + pub tail: *mut Curl_llist_element, + pub dtor: Curl_llist_dtor, + pub size: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Curl_llist_element { + pub ptr: *mut libc::c_void, + pub prev: *mut Curl_llist_element, + pub next: *mut Curl_llist_element, +} +// #[derive(Copy, Clone, BitfieldStruct)] +// #[repr(C)] +// pub struct UrlState { +// pub conn_cache: *mut conncache, +// pub keeps_speed: curltime, +// pub lastconnect_id: libc::c_long, +// pub headerb: dynbuf, +// pub buffer: *mut libc::c_char, +// pub ulbuf: *mut libc::c_char, +// pub current_speed: curl_off_t, +// pub first_host: *mut libc::c_char, +// pub retrycount: libc::c_int, +// pub first_remote_port: libc::c_int, +// pub session: *mut Curl_ssl_session, +// pub sessionage: libc::c_long, +// pub tempwrite: [tempbuf; 3], +// pub tempcount: libc::c_uint, +// pub os_errno: libc::c_int, +// pub scratch: *mut libc::c_char, +// pub followlocation: libc::c_long, +// pub prev_signal: Option:: ()>, +// pub digest: digestdata, +// pub proxydigest: digestdata, +// pub authhost: auth, +// pub authproxy: auth, +// pub async_0: Curl_async, +// pub engine: *mut libc::c_void, +// pub expiretime: curltime, +// pub timenode: Curl_tree, +// pub timeoutlist: Curl_llist, +// pub expires: [time_node; 13], +// pub most_recent_ftp_entrypath: *mut libc::c_char, +// pub httpwant: libc::c_uchar, +// pub httpversion: libc::c_uchar, +// #[bitfield(name = "prev_block_had_trailing_cr", ty = "bit", bits = "0..=0")] +// pub prev_block_had_trailing_cr: [u8; 1], +// #[bitfield(padding)] +// pub c2rust_padding: [u8; 5], +// pub crlf_conversions: curl_off_t, +// pub range: *mut libc::c_char, +// pub resume_from: curl_off_t, +// pub rtsp_next_client_CSeq: libc::c_long, +// pub rtsp_next_server_CSeq: libc::c_long, +// pub rtsp_CSeq_recv: libc::c_long, +// pub infilesize: curl_off_t, +// pub drain: size_t, +// pub fread_func: curl_read_callback, +// pub in_0: *mut libc::c_void, +// pub stream_depends_on: *mut Curl_easy, +// pub stream_weight: libc::c_int, +// pub uh: *mut CURLU, +// pub up: urlpieces, +// pub httpreq: Curl_HttpReq, +// pub url: *mut libc::c_char, +// pub referer: *mut libc::c_char, +// pub cookielist: *mut curl_slist, +// pub resolve: *mut curl_slist, +// pub trailers_bytes_sent: size_t, +// pub trailers_buf: dynbuf, +// pub trailers_state: trailers_state, +// pub aptr: dynamically_allocated_data, +// #[bitfield(name = "multi_owned_by_easy", ty = "bit", bits = "0..=0")] +// #[bitfield(name = "this_is_a_follow", ty = "bit", bits = "1..=1")] +// #[bitfield(name = "refused_stream", ty = "bit", bits = "2..=2")] +// #[bitfield(name = "errorbuf", ty = "bit", bits = "3..=3")] +// #[bitfield(name = "allow_port", ty = "bit", bits = "4..=4")] +// #[bitfield(name = "authproblem", ty = "bit", bits = "5..=5")] +// #[bitfield(name = "ftp_trying_alternative", ty = "bit", bits = "6..=6")] +// #[bitfield(name = "wildcardmatch", ty = "bit", bits = "7..=7")] +// #[bitfield(name = "expect100header", ty = "bit", bits = "8..=8")] +// #[bitfield(name = "disableexpect", ty = "bit", bits = "9..=9")] +// #[bitfield(name = "use_range", ty = "bit", bits = "10..=10")] +// #[bitfield(name = "rangestringalloc", ty = "bit", bits = "11..=11")] +// #[bitfield(name = "done", ty = "bit", bits = "12..=12")] +// #[bitfield(name = "stream_depends_e", ty = "bit", bits = "13..=13")] +// #[bitfield(name = "previouslypending", ty = "bit", bits = "14..=14")] +// #[bitfield(name = "cookie_engine", ty = "bit", bits = "15..=15")] +// #[bitfield(name = "prefer_ascii", ty = "bit", bits = "16..=16")] +// #[bitfield(name = "list_only", ty = "bit", bits = "17..=17")] +// #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] +// #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] +// #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] +// pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: [u8; 3], +// #[bitfield(padding)] +// pub c2rust_padding_0: [u8; 5], +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct dynamically_allocated_data { + pub proxyuserpwd: *mut libc::c_char, + pub uagent: *mut libc::c_char, + pub accept_encoding: *mut libc::c_char, + pub userpwd: *mut libc::c_char, + pub rangeline: *mut libc::c_char, + pub ref_0: *mut libc::c_char, + pub host: *mut libc::c_char, + pub cookiehost: *mut libc::c_char, + pub rtsp_transport: *mut libc::c_char, + pub te: *mut libc::c_char, + pub user: *mut libc::c_char, + pub passwd: *mut libc::c_char, + pub proxyuser: *mut libc::c_char, + pub proxypasswd: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct dynbuf { + pub bufr: *mut libc::c_char, + pub leng: size_t, + pub allc: size_t, + pub toobig: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct urlpieces { + pub scheme: *mut libc::c_char, + pub hostname: *mut libc::c_char, + pub port: *mut libc::c_char, + pub user: *mut libc::c_char, + pub password: *mut libc::c_char, + pub options: *mut libc::c_char, + pub path: *mut libc::c_char, + pub query: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct time_node { + pub list: Curl_llist_element, + pub time: curltime, + pub eid: expire_id, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curltime { + pub tv_sec: time_t, + pub tv_usec: libc::c_int, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Curl_tree { + pub smaller: *mut Curl_tree, + pub larger: *mut Curl_tree, + pub samen: *mut Curl_tree, + pub samep: *mut Curl_tree, + pub key: curltime, + pub payload: *mut libc::c_void, +} +// #[derive(Copy, Clone, BitfieldStruct)] +// #[repr(C)] +// pub struct Curl_async { +// pub hostname: *mut libc::c_char, +// pub dns: *mut Curl_dns_entry, +// pub tdata: *mut thread_data, +// pub resolver: *mut libc::c_void, +// pub port: libc::c_int, +// pub status: libc::c_int, +// #[bitfield(name = "done", ty = "bit", bits = "0..=0")] +// pub done: [u8; 1], +// #[bitfield(padding)] +// pub c2rust_padding: [u8; 7], +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Curl_dns_entry { + pub addr: *mut Curl_addrinfo, + pub timestamp: time_t, + pub inuse: libc::c_long, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Curl_addrinfo { + pub ai_flags: libc::c_int, + pub ai_family: libc::c_int, + pub ai_socktype: libc::c_int, + pub ai_protocol: libc::c_int, + pub ai_addrlen: curl_socklen_t, + pub ai_canonname: *mut libc::c_char, + pub ai_addr: *mut sockaddr, + pub ai_next: *mut Curl_addrinfo, +} +#[derive(Copy, Clone, BitfieldStruct)] +#[repr(C)] +pub struct auth { + pub want: libc::c_ulong, + pub picked: libc::c_ulong, + pub avail: libc::c_ulong, + #[bitfield(name = "done", ty = "bit", bits = "0..=0")] + #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] + #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] + pub done_multipass_iestyle: [u8; 1], + #[bitfield(padding)] + pub c2rust_padding: [u8; 7], +} +#[derive(Copy, Clone, BitfieldStruct)] +#[repr(C)] +pub struct digestdata { + pub nonce: *mut libc::c_char, + pub cnonce: *mut libc::c_char, + pub realm: *mut libc::c_char, + pub algo: libc::c_int, + pub opaque: *mut libc::c_char, + pub qop: *mut libc::c_char, + pub algorithm: *mut libc::c_char, + pub nc: libc::c_int, + #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] + #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] + pub stale_userhash: [u8; 1], + #[bitfield(padding)] + pub c2rust_padding: [u8; 3], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct tempbuf { + pub b: dynbuf, + pub type_0: libc::c_int, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct Curl_ssl_session { +// pub name: *mut libc::c_char, +// pub conn_to_host: *mut libc::c_char, +// pub scheme: *const libc::c_char, +// pub sessionid: *mut libc::c_void, +// pub idsize: size_t, +// pub age: libc::c_long, +// pub remote_port: libc::c_int, +// pub conn_to_port: libc::c_int, +// pub ssl_config: ssl_primary_config, +// } +// #[derive(Copy, Clone, BitfieldStruct)] +// #[repr(C)] +// pub struct ssl_primary_config { +// pub version: libc::c_long, +// pub version_max: libc::c_long, +// pub CApath: *mut libc::c_char, +// pub CAfile: *mut libc::c_char, +// pub issuercert: *mut libc::c_char, +// pub clientcert: *mut libc::c_char, +// pub random_file: *mut libc::c_char, +// pub egdsocket: *mut libc::c_char, +// pub cipher_list: *mut libc::c_char, +// pub cipher_list13: *mut libc::c_char, +// pub pinned_key: *mut libc::c_char, +// pub cert_blob: *mut curl_blob, +// pub ca_info_blob: *mut curl_blob, +// pub issuercert_blob: *mut curl_blob, +// pub curves: *mut libc::c_char, +// #[bitfield(name = "verifypeer", ty = "bit", bits = "0..=0")] +// #[bitfield(name = "verifyhost", ty = "bit", bits = "1..=1")] +// #[bitfield(name = "verifystatus", ty = "bit", bits = "2..=2")] +// #[bitfield(name = "sessionid", ty = "bit", bits = "3..=3")] +// pub verifypeer_verifyhost_verifystatus_sessionid: [u8; 1], +// #[bitfield(padding)] +// pub c2rust_padding: [u8; 7], +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_blob { + pub data: *mut libc::c_void, + pub len: size_t, + pub flags: libc::c_uint, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct conncache { +// pub hash: Curl_hash, +// pub num_conn: size_t, +// pub next_connection_id: libc::c_long, +// pub last_cleanup: curltime, +// pub closure_handle: *mut Curl_easy, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Curl_hash { + pub table: *mut Curl_llist, + pub hash_func: hash_function, + pub comp_func: comp_function, + pub dtor: Curl_hash_dtor, + pub slots: libc::c_int, + pub size: size_t, +} +#[derive(Copy, Clone, BitfieldStruct)] +#[repr(C)] +pub struct Progress { + pub lastshow: time_t, + pub size_dl: curl_off_t, + pub size_ul: curl_off_t, + pub downloaded: curl_off_t, + pub uploaded: curl_off_t, + pub current_speed: curl_off_t, + pub width: libc::c_int, + pub flags: libc::c_int, + pub timespent: timediff_t, + pub dlspeed: curl_off_t, + pub ulspeed: curl_off_t, + pub t_nslookup: timediff_t, + pub t_connect: timediff_t, + pub t_appconnect: timediff_t, + pub t_pretransfer: timediff_t, + pub t_starttransfer: timediff_t, + pub t_redirect: timediff_t, + pub start: curltime, + pub t_startsingle: curltime, + pub t_startop: curltime, + pub t_acceptdata: curltime, + pub ul_limit_start: curltime, + pub ul_limit_size: curl_off_t, + pub dl_limit_start: curltime, + pub dl_limit_size: curl_off_t, + pub speeder: [curl_off_t; 6], + pub speeder_time: [curltime; 6], + pub speeder_c: libc::c_int, + #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] + #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] + pub callback_is_t_startransfer_set: [u8; 1], + #[bitfield(padding)] + pub c2rust_padding: [u8; 3], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct CookieInfo { + pub cookies: [*mut Cookie; 256], + pub filename: *mut libc::c_char, + pub numcookies: libc::c_long, + pub running: bool, + pub newsession: bool, + pub lastct: libc::c_int, + pub next_expiration: curl_off_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Cookie { + pub next: *mut Cookie, + pub name: *mut libc::c_char, + pub value: *mut libc::c_char, + pub path: *mut libc::c_char, + pub spath: *mut libc::c_char, + pub domain: *mut libc::c_char, + pub expires: curl_off_t, + pub expirestr: *mut libc::c_char, + pub version: *mut libc::c_char, + pub maxage: *mut libc::c_char, + pub tailmatch: bool, + pub secure: bool, + pub livecookie: bool, + pub httponly: bool, + pub creationtime: libc::c_int, + pub prefix: libc::c_uchar, +} +// #[derive(Copy, Clone, BitfieldStruct)] +// #[repr(C)] +// pub struct UserDefined { +// pub err: *mut FILE, +// pub debugdata: *mut libc::c_void, +// pub errorbuffer: *mut libc::c_char, +// pub proxyport: libc::c_long, +// pub out: *mut libc::c_void, +// pub in_set: *mut libc::c_void, +// pub writeheader: *mut libc::c_void, +// pub rtp_out: *mut libc::c_void, +// pub use_port: libc::c_long, +// pub httpauth: libc::c_ulong, +// pub proxyauth: libc::c_ulong, +// pub socks5auth: libc::c_ulong, +// pub maxredirs: libc::c_long, +// pub keep_post: libc::c_int, +// pub postfields: *mut libc::c_void, +// pub seek_func: curl_seek_callback, +// pub postfieldsize: curl_off_t, +// pub localport: libc::c_ushort, +// pub localportrange: libc::c_int, +// pub fwrite_func: curl_write_callback, +// pub fwrite_header: curl_write_callback, +// pub fwrite_rtp: curl_write_callback, +// pub fread_func_set: curl_read_callback, +// pub fprogress: curl_progress_callback, +// pub fxferinfo: curl_xferinfo_callback, +// pub fdebug: curl_debug_callback, +// pub ioctl_func: curl_ioctl_callback, +// pub fsockopt: curl_sockopt_callback, +// pub sockopt_client: *mut libc::c_void, +// pub fopensocket: curl_opensocket_callback, +// pub opensocket_client: *mut libc::c_void, +// pub fclosesocket: curl_closesocket_callback, +// pub closesocket_client: *mut libc::c_void, +// pub seek_client: *mut libc::c_void, +// pub convfromnetwork: curl_conv_callback, +// pub convtonetwork: curl_conv_callback, +// pub convfromutf8: curl_conv_callback, +// pub hsts_read: curl_hstsread_callback, +// pub hsts_read_userp: *mut libc::c_void, +// pub hsts_write: curl_hstswrite_callback, +// pub hsts_write_userp: *mut libc::c_void, +// pub progress_client: *mut libc::c_void, +// pub ioctl_client: *mut libc::c_void, +// pub timeout: libc::c_long, +// pub connecttimeout: libc::c_long, +// pub accepttimeout: libc::c_long, +// pub happy_eyeballs_timeout: libc::c_long, +// pub server_response_timeout: libc::c_long, +// pub maxage_conn: libc::c_long, +// pub tftp_blksize: libc::c_long, +// pub filesize: curl_off_t, +// pub low_speed_limit: libc::c_long, +// pub low_speed_time: libc::c_long, +// pub max_send_speed: curl_off_t, +// pub max_recv_speed: curl_off_t, +// pub set_resume_from: curl_off_t, +// pub headers: *mut curl_slist, +// pub proxyheaders: *mut curl_slist, +// pub httppost: *mut curl_httppost, +// pub mimepost: curl_mimepart, +// pub quote: *mut curl_slist, +// pub postquote: *mut curl_slist, +// pub prequote: *mut curl_slist, +// pub source_quote: *mut curl_slist, +// pub source_prequote: *mut curl_slist, +// pub source_postquote: *mut curl_slist, +// pub telnet_options: *mut curl_slist, +// pub resolve: *mut curl_slist, +// pub connect_to: *mut curl_slist, +// pub timecondition: curl_TimeCond, +// pub proxytype: curl_proxytype, +// pub timevalue: time_t, +// pub method: Curl_HttpReq, +// pub httpwant: libc::c_uchar, +// pub ssl: ssl_config_data, +// pub proxy_ssl: ssl_config_data, +// pub general_ssl: ssl_general_config, +// pub dns_cache_timeout: libc::c_long, +// pub buffer_size: libc::c_long, +// pub upload_buffer_size: libc::c_uint, +// pub private_data: *mut libc::c_void, +// pub http200aliases: *mut curl_slist, +// pub ipver: libc::c_uchar, +// pub max_filesize: curl_off_t, +// pub ftp_filemethod: curl_ftpfile, +// pub ftpsslauth: curl_ftpauth, +// pub ftp_ccc: curl_ftpccc, +// pub ftp_create_missing_dirs: libc::c_int, +// pub ssh_keyfunc: curl_sshkeycallback, +// pub ssh_keyfunc_userp: *mut libc::c_void, +// pub use_netrc: CURL_NETRC_OPTION, +// pub use_ssl: curl_usessl, +// pub new_file_perms: libc::c_long, +// pub new_directory_perms: libc::c_long, +// pub ssh_auth_types: libc::c_long, +// pub str_0: [*mut libc::c_char; 80], +// pub blobs: [*mut curl_blob; 8], +// pub scope_id: libc::c_uint, +// pub allowed_protocols: libc::c_long, +// pub redir_protocols: libc::c_long, +// pub mail_rcpt: *mut curl_slist, +// pub rtspreq: Curl_RtspReq, +// pub rtspversion: libc::c_long, +// pub chunk_bgn: curl_chunk_bgn_callback, +// pub chunk_end: curl_chunk_end_callback, +// pub fnmatch: curl_fnmatch_callback, +// pub fnmatch_data: *mut libc::c_void, +// pub gssapi_delegation: libc::c_long, +// pub tcp_keepidle: libc::c_long, +// pub tcp_keepintvl: libc::c_long, +// pub maxconnects: size_t, +// pub expect_100_timeout: libc::c_long, +// pub stream_depends_on: *mut Curl_easy, +// pub stream_weight: libc::c_int, +// pub stream_dependents: *mut Curl_http2_dep, +// pub resolver_start: curl_resolver_start_callback, +// pub resolver_start_client: *mut libc::c_void, +// pub upkeep_interval_ms: libc::c_long, +// pub fmultidone: multidone_func, +// pub dohfor: *mut Curl_easy, +// pub uh: *mut CURLU, +// pub trailer_data: *mut libc::c_void, +// pub trailer_callback: curl_trailer_callback, +// #[bitfield(name = "is_fread_set", ty = "bit", bits = "0..=0")] +// #[bitfield(name = "is_fwrite_set", ty = "bit", bits = "1..=1")] +// #[bitfield(name = "free_referer", ty = "bit", bits = "2..=2")] +// #[bitfield(name = "tftp_no_options", ty = "bit", bits = "3..=3")] +// #[bitfield(name = "sep_headers", ty = "bit", bits = "4..=4")] +// #[bitfield(name = "cookiesession", ty = "bit", bits = "5..=5")] +// #[bitfield(name = "crlf", ty = "bit", bits = "6..=6")] +// #[bitfield(name = "strip_path_slash", ty = "bit", bits = "7..=7")] +// #[bitfield(name = "ssh_compression", ty = "bit", bits = "8..=8")] +// #[bitfield(name = "get_filetime", ty = "bit", bits = "9..=9")] +// #[bitfield(name = "tunnel_thru_httpproxy", ty = "bit", bits = "10..=10")] +// #[bitfield(name = "prefer_ascii", ty = "bit", bits = "11..=11")] +// #[bitfield(name = "remote_append", ty = "bit", bits = "12..=12")] +// #[bitfield(name = "list_only", ty = "bit", bits = "13..=13")] +// #[bitfield(name = "ftp_use_port", ty = "bit", bits = "14..=14")] +// #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "15..=15")] +// #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "16..=16")] +// #[bitfield(name = "ftp_use_pret", ty = "bit", bits = "17..=17")] +// #[bitfield(name = "ftp_skip_ip", ty = "bit", bits = "18..=18")] +// #[bitfield(name = "hide_progress", ty = "bit", bits = "19..=19")] +// #[bitfield(name = "http_fail_on_error", ty = "bit", bits = "20..=20")] +// #[bitfield(name = "http_keep_sending_on_error", ty = "bit", bits = "21..=21")] +// #[bitfield(name = "http_follow_location", ty = "bit", bits = "22..=22")] +// #[bitfield(name = "http_transfer_encoding", ty = "bit", bits = "23..=23")] +// #[bitfield(name = "allow_auth_to_other_hosts", ty = "bit", bits = "24..=24")] +// #[bitfield(name = "include_header", ty = "bit", bits = "25..=25")] +// #[bitfield(name = "http_set_referer", ty = "bit", bits = "26..=26")] +// #[bitfield(name = "http_auto_referer", ty = "bit", bits = "27..=27")] +// #[bitfield(name = "opt_no_body", ty = "bit", bits = "28..=28")] +// #[bitfield(name = "upload", ty = "bit", bits = "29..=29")] +// #[bitfield(name = "verbose", ty = "bit", bits = "30..=30")] +// #[bitfield(name = "krb", ty = "bit", bits = "31..=31")] +// #[bitfield(name = "reuse_forbid", ty = "bit", bits = "32..=32")] +// #[bitfield(name = "reuse_fresh", ty = "bit", bits = "33..=33")] +// #[bitfield(name = "no_signal", ty = "bit", bits = "34..=34")] +// #[bitfield(name = "tcp_nodelay", ty = "bit", bits = "35..=35")] +// #[bitfield(name = "ignorecl", ty = "bit", bits = "36..=36")] +// #[bitfield(name = "connect_only", ty = "bit", bits = "37..=37")] +// #[bitfield(name = "http_te_skip", ty = "bit", bits = "38..=38")] +// #[bitfield(name = "http_ce_skip", ty = "bit", bits = "39..=39")] +// #[bitfield(name = "proxy_transfer_mode", ty = "bit", bits = "40..=40")] +// #[bitfield(name = "sasl_ir", ty = "bit", bits = "41..=41")] +// #[bitfield(name = "wildcard_enabled", ty = "bit", bits = "42..=42")] +// #[bitfield(name = "tcp_keepalive", ty = "bit", bits = "43..=43")] +// #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "44..=44")] +// #[bitfield(name = "ssl_enable_npn", ty = "bit", bits = "45..=45")] +// #[bitfield(name = "ssl_enable_alpn", ty = "bit", bits = "46..=46")] +// #[bitfield(name = "path_as_is", ty = "bit", bits = "47..=47")] +// #[bitfield(name = "pipewait", ty = "bit", bits = "48..=48")] +// #[bitfield(name = "suppress_connect_headers", ty = "bit", bits = "49..=49")] +// #[bitfield(name = "dns_shuffle_addresses", ty = "bit", bits = "50..=50")] +// #[bitfield(name = "stream_depends_e", ty = "bit", bits = "51..=51")] +// #[bitfield(name = "haproxyprotocol", ty = "bit", bits = "52..=52")] +// #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "53..=53")] +// #[bitfield(name = "disallow_username_in_url", ty = "bit", bits = "54..=54")] +// #[bitfield(name = "doh", ty = "bit", bits = "55..=55")] +// #[bitfield(name = "doh_get", ty = "bit", bits = "56..=56")] +// #[bitfield(name = "doh_verifypeer", ty = "bit", bits = "57..=57")] +// #[bitfield(name = "doh_verifyhost", ty = "bit", bits = "58..=58")] +// #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] +// #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] +// #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] +// pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: [u8; 8], +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct Curl_http2_dep { +// pub next: *mut Curl_http2_dep, +// pub data: *mut Curl_easy, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_khkey { + pub key: *const libc::c_char, + pub len: size_t, + pub keytype: curl_khtype, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ssl_general_config { + pub max_ssl_sessions: size_t, +} +// #[derive(Copy, Clone, BitfieldStruct)] +// #[repr(C)] +// pub struct ssl_config_data { +// pub primary: ssl_primary_config, +// pub certverifyresult: libc::c_long, +// pub CRLfile: *mut libc::c_char, +// pub fsslctx: curl_ssl_ctx_callback, +// pub fsslctxp: *mut libc::c_void, +// pub cert_type: *mut libc::c_char, +// pub key: *mut libc::c_char, +// pub key_blob: *mut curl_blob, +// pub key_type: *mut libc::c_char, +// pub key_passwd: *mut libc::c_char, +// pub username: *mut libc::c_char, +// pub password: *mut libc::c_char, +// pub authtype: CURL_TLSAUTH, +// #[bitfield(name = "certinfo", ty = "bit", bits = "0..=0")] +// #[bitfield(name = "falsestart", ty = "bit", bits = "1..=1")] +// #[bitfield(name = "enable_beast", ty = "bit", bits = "2..=2")] +// #[bitfield(name = "no_revoke", ty = "bit", bits = "3..=3")] +// #[bitfield(name = "no_partialchain", ty = "bit", bits = "4..=4")] +// #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] +// #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] +// #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] +// pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: [u8; 1], +// #[bitfield(padding)] +// pub c2rust_padding: [u8; 3], +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct curl_mimepart { +// pub easy: *mut Curl_easy, +// pub parent: *mut curl_mime, +// pub nextpart: *mut curl_mimepart, +// pub kind: mimekind, +// pub flags: libc::c_uint, +// pub data: *mut libc::c_char, +// pub readfunc: curl_read_callback, +// pub seekfunc: curl_seek_callback, +// pub freefunc: curl_free_callback, +// pub arg: *mut libc::c_void, +// pub fp: *mut FILE, +// pub curlheaders: *mut curl_slist, +// pub userheaders: *mut curl_slist, +// pub mimetype: *mut libc::c_char, +// pub filename: *mut libc::c_char, +// pub name: *mut libc::c_char, +// pub datasize: curl_off_t, +// pub state: mime_state, +// pub encoder: *const mime_encoder, +// pub encstate: mime_encoder_state, +// pub lastreadstatus: size_t, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mime_encoder_state { + pub pos: size_t, + pub bufbeg: size_t, + pub bufend: size_t, + pub buf: [libc::c_char; 256], +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct mime_encoder { +// pub name: *const libc::c_char, +// pub encodefunc: Option::< +// unsafe extern "C" fn( +// *mut libc::c_char, +// size_t, +// bool, +// *mut curl_mimepart, +// ) -> size_t, +// >, +// pub sizefunc: Option:: curl_off_t>, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mime_state { + pub state: mimestate, + pub ptr: *mut libc::c_void, + pub offset: curl_off_t, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct curl_mime { +// pub easy: *mut Curl_easy, +// pub parent: *mut curl_mimepart, +// pub firstpart: *mut curl_mimepart, +// pub lastpart: *mut curl_mimepart, +// pub boundary: [libc::c_char; 41], +// pub state: mime_state, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_httppost { + pub next: *mut curl_httppost, + pub name: *mut libc::c_char, + pub namelength: libc::c_long, + pub contents: *mut libc::c_char, + pub contentslength: libc::c_long, + pub buffer: *mut libc::c_char, + pub bufferlength: libc::c_long, + pub contenttype: *mut libc::c_char, + pub contentheader: *mut curl_slist, + pub more: *mut curl_httppost, + pub flags: libc::c_long, + pub showfilename: *mut libc::c_char, + pub userp: *mut libc::c_void, + pub contentlen: curl_off_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_index { + pub index: size_t, + pub total: size_t, +} +#[derive(Copy, Clone, BitfieldStruct)] +#[repr(C)] +pub struct curl_hstsentry { + pub name: *mut libc::c_char, + pub namelen: size_t, + #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] + pub includeSubDomains: [u8; 1], + pub expire: [libc::c_char; 18], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct curl_sockaddr { + pub family: libc::c_int, + pub socktype: libc::c_int, + pub protocol: libc::c_int, + pub addrlen: libc::c_uint, + pub addr: sockaddr, +} +// #[derive(Copy, Clone, BitfieldStruct)] +// #[repr(C)] +// pub struct SingleRequest { +// pub size: curl_off_t, +// pub maxdownload: curl_off_t, +// pub bytecount: curl_off_t, +// pub writebytecount: curl_off_t, +// pub headerbytecount: curl_off_t, +// pub deductheadercount: curl_off_t, +// pub pendingheader: curl_off_t, +// pub start: curltime, +// pub now: curltime, +// pub badheader: C2RustUnnamed_1, +// pub headerline: libc::c_int, +// pub str_0: *mut libc::c_char, +// pub offset: curl_off_t, +// pub httpcode: libc::c_int, +// pub keepon: libc::c_int, +// pub start100: curltime, +// pub exp100: expect100, +// pub upgr101: upgrade101, +// pub writer_stack: *mut contenc_writer, +// pub timeofdoc: time_t, +// pub bodywrites: libc::c_long, +// pub location: *mut libc::c_char, +// pub newurl: *mut libc::c_char, +// pub upload_present: ssize_t, +// pub upload_fromhere: *mut libc::c_char, +// pub p: C2RustUnnamed, +// pub doh: *mut dohdata, +// #[bitfield(name = "header", ty = "bit", bits = "0..=0")] +// #[bitfield(name = "content_range", ty = "bit", bits = "1..=1")] +// #[bitfield(name = "upload_done", ty = "bit", bits = "2..=2")] +// #[bitfield(name = "ignorebody", ty = "bit", bits = "3..=3")] +// #[bitfield(name = "http_bodyless", ty = "bit", bits = "4..=4")] +// #[bitfield(name = "chunk", ty = "bit", bits = "5..=5")] +// #[bitfield(name = "ignore_cl", ty = "bit", bits = "6..=6")] +// #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] +// #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] +// #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] +// pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: [u8; 2], +// #[bitfield(padding)] +// pub c2rust_padding: [u8; 6], +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct dohdata { +// pub headers: *mut curl_slist, +// pub probe: [dnsprobe; 2], +// pub pending: libc::c_uint, +// pub port: libc::c_int, +// pub host: *const libc::c_char, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct dnsprobe { +// pub easy: *mut CURL, +// pub dnstype: libc::c_int, +// pub dohbuffer: [libc::c_uchar; 512], +// pub dohlen: size_t, +// pub serverdoh: dynbuf, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct SSHPROTO { + pub path: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct SMTP { + pub transfer: curl_pp_transfer, + pub custom: *mut libc::c_char, + pub rcpt: *mut curl_slist, + pub rcpt_had_ok: bool, + pub trailing_crlf: bool, + pub rcpt_last_error: libc::c_int, + pub eob: size_t, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct RTSP { +// pub http_wrapper: HTTP, +// pub CSeq_sent: libc::c_long, +// pub CSeq_recv: libc::c_long, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct HTTP { +// pub sendit: *mut curl_mimepart, +// pub postsize: curl_off_t, +// pub postdata: *const libc::c_char, +// pub p_pragma: *const libc::c_char, +// pub form: curl_mimepart, +// pub backup: back, +// pub sending: C2RustUnnamed_0, +// pub send_buffer: dynbuf, +// pub stream_id: int32_t, +// pub bodystarted: bool, +// pub header_recvbuf: dynbuf, +// pub nread_header_recvbuf: size_t, +// pub trailer_recvbuf: dynbuf, +// pub status_code: libc::c_int, +// pub pausedata: *const uint8_t, +// pub pauselen: size_t, +// pub close_handled: bool, +// pub push_headers: *mut *mut libc::c_char, +// pub push_headers_used: size_t, +// pub push_headers_alloc: size_t, +// pub error: uint32_t, +// pub closed: bool, +// pub mem: *mut libc::c_char, +// pub len: size_t, +// pub memlen: size_t, +// pub upload_mem: *const uint8_t, +// pub upload_len: size_t, +// pub upload_left: curl_off_t, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct back { + pub fread_func: curl_read_callback, + pub fread_in: *mut libc::c_void, + pub postdata: *const libc::c_char, + pub postsize: curl_off_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct POP3 { + pub transfer: curl_pp_transfer, + pub id: *mut libc::c_char, + pub custom: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct MQTT { + pub sendleftovers: *mut libc::c_char, + pub nsend: size_t, + pub npacket: size_t, + pub firstbyte: libc::c_uchar, + pub remaining_length: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct IMAP { + pub transfer: curl_pp_transfer, + pub mailbox: *mut libc::c_char, + pub uidvalidity: *mut libc::c_char, + pub uid: *mut libc::c_char, + pub mindex: *mut libc::c_char, + pub section: *mut libc::c_char, + pub partial: *mut libc::c_char, + pub query: *mut libc::c_char, + pub custom: *mut libc::c_char, + pub custom_params: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct FTP { + pub path: *mut libc::c_char, + pub pathalloc: *mut libc::c_char, + pub transfer: curl_pp_transfer, + pub downloadsize: curl_off_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct FILEPROTO { + pub path: *mut libc::c_char, + pub freepath: *mut libc::c_char, + pub fd: libc::c_int, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct Curl_multi { +// pub magic: libc::c_uint, +// pub easyp: *mut Curl_easy, +// pub easylp: *mut Curl_easy, +// pub num_easy: libc::c_int, +// pub num_alive: libc::c_int, +// pub msglist: Curl_llist, +// pub pending: Curl_llist, +// pub socket_cb: curl_socket_callback, +// pub socket_userp: *mut libc::c_void, +// pub push_cb: curl_push_callback, +// pub push_userp: *mut libc::c_void, +// pub hostcache: Curl_hash, +// pub timetree: *mut Curl_tree, +// pub sockhash: Curl_hash, +// pub conn_cache: conncache, +// pub maxconnects: libc::c_long, +// pub max_host_connections: libc::c_long, +// pub max_total_connections: libc::c_long, +// pub timer_cb: curl_multi_timer_callback, +// pub timer_userp: *mut libc::c_void, +// pub timer_lastcall: curltime, +// pub max_concurrent_streams: libc::c_uint, +// pub wakeup_pair: [curl_socket_t; 2], +// pub multiplexing: bool, +// pub recheckstate: bool, +// pub in_callback: bool, +// pub ipv6_works: bool, +// pub ssl_seeded: bool, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Names { + pub hostcache: *mut Curl_hash, + pub hostcachetype: C2RustUnnamed_2, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct Curl_message { +// pub list: Curl_llist_element, +// pub extmsg: CURLMsg, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct CURLMsg { +// pub msg: CURLMSG, +// pub easy_handle: *mut CURL, +// pub data: C2RustUnnamed_3, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct connectdata { +// pub cnnct: connstate, +// pub bundle_node: Curl_llist_element, +// pub chunk: Curl_chunker, +// pub fclosesocket: curl_closesocket_callback, +// pub closesocket_client: *mut libc::c_void, +// pub connection_id: libc::c_long, +// pub dns_entry: *mut Curl_dns_entry, +// pub ip_addr: *mut Curl_addrinfo, +// pub tempaddr: [*mut Curl_addrinfo; 2], +// pub scope_id: libc::c_uint, +// pub transport: C2RustUnnamed_5, +// pub host: hostname, +// pub hostname_resolve: *mut libc::c_char, +// pub secondaryhostname: *mut libc::c_char, +// pub conn_to_host: hostname, +// pub socks_proxy: proxy_info, +// pub http_proxy: proxy_info, +// pub port: libc::c_int, +// pub remote_port: libc::c_int, +// pub conn_to_port: libc::c_int, +// pub secondary_port: libc::c_ushort, +// pub primary_ip: [libc::c_char; 46], +// pub ip_version: libc::c_uchar, +// pub user: *mut libc::c_char, +// pub passwd: *mut libc::c_char, +// pub options: *mut libc::c_char, +// pub sasl_authzid: *mut libc::c_char, +// pub httpversion: libc::c_uchar, +// pub now: curltime, +// pub created: curltime, +// pub lastused: curltime, +// pub sock: [curl_socket_t; 2], +// pub tempsock: [curl_socket_t; 2], +// pub tempfamily: [libc::c_int; 2], +// pub recv: [Option::; 2], +// pub send: [Option::; 2], +// pub ssl: [ssl_connect_data; 2], +// pub proxy_ssl: [ssl_connect_data; 2], +// pub ssl_extra: *mut libc::c_void, +// pub ssl_config: ssl_primary_config, +// pub proxy_ssl_config: ssl_primary_config, +// pub bits: ConnectBits, +// pub num_addr: libc::c_int, +// pub connecttime: curltime, +// pub timeoutms_per_addr: [timediff_t; 2], +// pub handler: *const Curl_handler, +// pub given: *const Curl_handler, +// pub keepalive: curltime, +// pub sockfd: curl_socket_t, +// pub writesockfd: curl_socket_t, +// pub easyq: Curl_llist, +// pub seek_func: curl_seek_callback, +// pub seek_client: *mut libc::c_void, +// pub http_ntlm_state: curlntlm, +// pub proxy_ntlm_state: curlntlm, +// pub ntlm: ntlmdata, +// pub proxyntlm: ntlmdata, +// pub trailer: dynbuf, +// pub proto: C2RustUnnamed_4, +// pub connect_state: *mut http_connect_state, +// pub bundle: *mut connectbundle, +// pub unix_domain_socket: *mut libc::c_char, +// pub localdev: *mut libc::c_char, +// pub localportrange: libc::c_int, +// pub cselect_bits: libc::c_int, +// pub waitfor: libc::c_int, +// pub negnpn: libc::c_int, +// pub localport: libc::c_ushort, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct connectbundle { + pub multiuse: libc::c_int, + pub num_connections: size_t, + pub conn_list: Curl_llist, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct mqtt_conn { + pub state: mqttstate, + pub nextstate: mqttstate, + pub packetid: libc::c_uint, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct smb_conn { + pub state: smb_conn_state, + pub user: *mut libc::c_char, + pub domain: *mut libc::c_char, + pub share: *mut libc::c_char, + pub challenge: [libc::c_uchar; 8], + pub session_key: libc::c_uint, + pub uid: libc::c_ushort, + pub recv_buf: *mut libc::c_char, + pub upload_size: size_t, + pub send_size: size_t, + pub sent: size_t, + pub got: size_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct rtsp_conn { + pub rtp_buf: *mut libc::c_char, + pub rtp_bufsize: ssize_t, + pub rtp_channel: libc::c_int, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct smtp_conn { +// pub pp: pingpong, +// pub state: smtpstate, +// pub ssldone: bool, +// pub domain: *mut libc::c_char, +// pub sasl: SASL, +// pub tls_supported: bool, +// pub size_supported: bool, +// pub utf8_supported: bool, +// pub auth_supported: bool, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct SASL { +// pub params: *const SASLproto, +// pub state: saslstate, +// pub authmechs: libc::c_ushort, +// pub prefmech: libc::c_ushort, +// pub authused: libc::c_ushort, +// pub resetprefs: bool, +// pub mutual_auth: bool, +// pub force_ir: bool, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct SASLproto { +// pub service: *const libc::c_char, +// pub contcode: libc::c_int, +// pub finalcode: libc::c_int, +// pub maxirlen: size_t, +// pub sendauth: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *const libc::c_char, +// *const libc::c_char, +// ) -> CURLcode, +// >, +// pub sendcont: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *const libc::c_char, +// ) -> CURLcode, +// >, +// pub getmessage: Option::< +// unsafe extern "C" fn(*mut libc::c_char, *mut *mut libc::c_char) -> (), +// >, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct pingpong { +// pub cache: *mut libc::c_char, +// pub cache_size: size_t, +// pub nread_resp: size_t, +// pub linestart_resp: *mut libc::c_char, +// pub pending_resp: bool, +// pub sendthis: *mut libc::c_char, +// pub sendleft: size_t, +// pub sendsize: size_t, +// pub response: curltime, +// pub response_time: timediff_t, +// pub sendbuf: dynbuf, +// pub statemachine: Option::< +// unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, +// >, +// pub endofresp: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *mut libc::c_char, +// size_t, +// *mut libc::c_int, +// ) -> bool, +// >, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct pop3_conn { +// pub pp: pingpong, +// pub state: pop3state, +// pub ssldone: bool, +// pub tls_supported: bool, +// pub eob: size_t, +// pub strip: size_t, +// pub sasl: SASL, +// pub authtypes: libc::c_uint, +// pub preftype: libc::c_uint, +// pub apoptimestamp: *mut libc::c_char, +// } +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct imap_conn { +// pub pp: pingpong, +// pub state: imapstate, +// pub ssldone: bool, +// pub preauth: bool, +// pub sasl: SASL, +// pub preftype: libc::c_uint, +// pub cmdid: libc::c_uint, +// pub resptag: [libc::c_char; 5], +// pub tls_supported: bool, +// pub login_disabled: bool, +// pub ir_supported: bool, +// pub mailbox: *mut libc::c_char, +// pub mailbox_uidvalidity: *mut libc::c_char, +// pub dyn_0: dynbuf, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ssh_conn { + pub authlist: *const libc::c_char, + pub passphrase: *const libc::c_char, + pub rsa_pub: *mut libc::c_char, + pub rsa: *mut libc::c_char, + pub authed: bool, + pub acceptfail: bool, + pub state: sshstate, + pub nextstate: sshstate, + pub actualcode: CURLcode, + pub quote_item: *mut curl_slist, + pub quote_path1: *mut libc::c_char, + pub quote_path2: *mut libc::c_char, + pub homedir: *mut libc::c_char, + pub readdir_line: *mut libc::c_char, + pub secondCreateDirs: libc::c_int, + pub orig_waitfor: libc::c_int, + pub slash_pos: *mut libc::c_char, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct http_conn { +// pub binsettings: [uint8_t; 80], +// pub binlen: size_t, +// pub trnsfr: *mut Curl_easy, +// pub h2: *mut nghttp2_session, +// pub send_underlying: Option::, +// pub recv_underlying: Option::, +// pub inbuf: *mut libc::c_char, +// pub inbuflen: size_t, +// pub nread_inbuf: size_t, +// pub pause_stream_id: int32_t, +// pub drain_total: size_t, +// pub settings: h2settings, +// pub local_settings: [nghttp2_settings_entry; 3], +// pub local_settings_num: size_t, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct nghttp2_settings_entry { + pub settings_id: int32_t, + pub value: uint32_t, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct h2settings { + pub max_concurrent_streams: uint32_t, + pub enable_push: bool, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct ftp_conn { +// pub pp: pingpong, +// pub entrypath: *mut libc::c_char, +// pub file: *mut libc::c_char, +// pub dirs: *mut *mut libc::c_char, +// pub dirdepth: libc::c_int, +// pub dont_check: bool, +// pub ctl_valid: bool, +// pub cwddone: bool, +// pub cwdcount: libc::c_int, +// pub cwdfail: bool, +// pub wait_data_conn: bool, +// pub newport: libc::c_ushort, +// pub newhost: *mut libc::c_char, +// pub prevpath: *mut libc::c_char, +// pub transfertype: libc::c_char, +// pub count1: libc::c_int, +// pub count2: libc::c_int, +// pub count3: libc::c_int, +// pub state: ftpstate, +// pub state_saved: ftpstate, +// pub retr_size_saved: curl_off_t, +// pub server_os: *mut libc::c_char, +// pub known_filesize: curl_off_t, +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct ntlmdata { + pub flags: libc::c_uint, + pub nonce: [libc::c_uchar; 8], + pub target_info_len: libc::c_uint, + pub target_info: *mut libc::c_void, + pub ntlm_auth_hlpr_socket: curl_socket_t, + pub ntlm_auth_hlpr_pid: pid_t, + pub challenge: *mut libc::c_char, + pub response: *mut libc::c_char, +} +// #[derive(Copy, Clone)] +// #[repr(C)] +// pub struct Curl_handler { +// pub scheme: *const libc::c_char, +// pub setup_connection: Option::< +// unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, +// >, +// pub do_it: Option:: CURLcode>, +// pub done: Option:: CURLcode>, +// pub do_more: Option::< +// unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, +// >, +// pub connect_it: Option::< +// unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, +// >, +// pub connecting: Option::< +// unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, +// >, +// pub doing: Option:: CURLcode>, +// pub proto_getsock: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *mut curl_socket_t, +// ) -> libc::c_int, +// >, +// pub doing_getsock: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *mut curl_socket_t, +// ) -> libc::c_int, +// >, +// pub domore_getsock: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *mut curl_socket_t, +// ) -> libc::c_int, +// >, +// pub perform_getsock: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *mut curl_socket_t, +// ) -> libc::c_int, +// >, +// pub disconnect: Option::< +// unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, bool) -> CURLcode, +// >, +// pub readwrite: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// *mut ssize_t, +// *mut bool, +// ) -> CURLcode, +// >, +// pub connection_check: Option::< +// unsafe extern "C" fn( +// *mut Curl_easy, +// *mut connectdata, +// libc::c_uint, +// ) -> libc::c_uint, +// >, +// pub attach: Option:: ()>, +// pub defport: libc::c_int, +// pub protocol: libc::c_uint, +// pub family: libc::c_uint, +// pub flags: libc::c_uint, +// } +#[derive(Copy, Clone, BitfieldStruct)] +#[repr(C)] +pub struct ConnectBits { + pub tcpconnect: [bool; 2], + pub proxy_ssl_connected: [bool; 2], + #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] + #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] + #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] + #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] + #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] + #[bitfield(name = "close", ty = "bit", bits = "5..=5")] + #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] + #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] + #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] + #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] + #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] + #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] + #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] + #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] + #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] + #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] + #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] + #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] + #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] + #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] + #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] + #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] + #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] + #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] + #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] + #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] + #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] + #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] + #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] + #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] + #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] + #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] + #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] + #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] + #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] + pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: [u8; 5], + #[bitfield(padding)] + pub c2rust_padding: [u8; 3], +} +// #[derive(Copy, Clone, BitfieldStruct)] +// #[repr(C)] +// pub struct ssl_connect_data { +// pub state: ssl_connection_state, +// pub connecting_state: ssl_connect_state, +// pub backend: *mut ssl_backend_data, +// #[bitfield(name = "use_0", ty = "bit", bits = "0..=0")] +// pub use_0: [u8; 1], +// #[bitfield(padding)] +// pub c2rust_padding: [u8; 7], +// } +#[derive(Copy, Clone)] +#[repr(C)] +pub struct proxy_info { + pub host: hostname, + pub port: libc::c_long, + pub proxytype: curl_proxytype, + pub user: *mut libc::c_char, + pub passwd: *mut libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct hostname { + pub rawalloc: *mut libc::c_char, + pub encalloc: *mut libc::c_char, + pub name: *mut libc::c_char, + pub dispname: *const libc::c_char, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct Curl_chunker { + pub datasize: curl_off_t, + pub state: ChunkyState, + pub hexindex: libc::c_uchar, + pub hexbuffer: [libc::c_char; 17], +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct connstate { + pub state: connect_t, + pub outstanding: ssize_t, + pub outp: *mut libc::c_uchar, +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct bufref { + pub dtor: Option:: ()>, + pub ptr: *const libc::c_uchar, + pub len: size_t, +} \ No newline at end of file diff --git a/rust/rust_project/Cargo.toml b/rust/rust_project/Cargo.toml new file mode 100644 index 0000000..4d58546 --- /dev/null +++ b/rust/rust_project/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "rust_project" +authors = ["CSS Group"] +version = "0.1.0" +edition = "2021" +# build = "build.rs" + +[dependencies] +libc = "0.2.9" +c2rust-bitfields = "0.3.0" +rust_ffi = {path = "../rust_ffi"} + +[lib] +crate-type = ["staticlib"] +name = "rust_project" +path = "lib.rs" \ No newline at end of file diff --git a/rust/rust_project/build.rs b/rust/rust_project/build.rs new file mode 100644 index 0000000..7d59d25 --- /dev/null +++ b/rust/rust_project/build.rs @@ -0,0 +1,11 @@ +#[cfg(all(unix, not(target_os = "macos")))] +fn main() { + // add unix dependencies below + // println!("cargo:rustc-flags=-l readline"); +} + +#[cfg(target_os = "macos")] +fn main() { + // add macos dependencies below + // println!("cargo:rustc-flags=-l edit"); +} \ No newline at end of file diff --git a/rust/rust_project/lib.rs b/rust/rust_project/lib.rs new file mode 100644 index 0000000..6b366d7 --- /dev/null +++ b/rust/rust_project/lib.rs @@ -0,0 +1,51 @@ +#![allow( + dead_code, + mutable_transmutes, + non_camel_case_types, + non_snake_case, + non_upper_case_globals, + unused_assignments, + unused_mut +)] +#![feature( + c_variadic, + extern_types, + label_break_value, + register_tool +)] +#![register_tool(c2rust)] + +#[macro_use] +extern crate libc; +extern crate c2rust_bitfields; +extern crate rust_ffi; + +pub mod src { + // pub mod ftp; + // pub mod ftplistparser; + // pub mod http_aws_sigv4; + // pub mod http_chunks; + // pub mod http_digest; + // pub mod http_negotiate; + pub mod http_ntlm; + // pub mod http_proxy; + // pub mod http; + // pub mod http2; + pub mod vtls { + // pub mod bearssl; + // pub mod gskit; + // pub mod gtls; + pub mod keylog; + // pub mod mbedtls_threadlock; + // pub mod mbedtls; + // pub mod mesalink; + // pub mod nss; + // pub mod openssl; + // pub mod rustls; + // pub mod schannel_verify; + // pub mod schannel; + // pub mod sectransp; + // pub mod vtls; + // pub mod wolfssl; + } +} \ No newline at end of file diff --git a/rust/rust_project/src/ftp.rs b/rust/rust_project/src/ftp.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/ftplistparser.rs b/rust/rust_project/src/ftplistparser.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/http.rs b/rust/rust_project/src/http.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/http2.rs b/rust/rust_project/src/http2.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/http_aws_sigv4.rs b/rust/rust_project/src/http_aws_sigv4.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/http_chunks.rs b/rust/rust_project/src/http_chunks.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/http_digest.rs b/rust/rust_project/src/http_digest.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/http_negotiate.rs b/rust/rust_project/src/http_negotiate.rs new file mode 100644 index 0000000..e69de29 diff --git a/lib/http_ntlm.rs b/rust/rust_project/src/http_ntlm.rs similarity index 44% rename from lib/http_ntlm.rs rename to rust/rust_project/src/http_ntlm.rs index bbcea51..dd0b83b 100644 --- a/lib/http_ntlm.rs +++ b/rust/rust_project/src/http_ntlm.rs @@ -1,14 +1,8 @@ -#![allow( - dead_code, - mutable_transmutes, - non_camel_case_types, - non_snake_case, - non_upper_case_globals, - unused_assignments, - unused_mut -)] -#![register_tool(c2rust)] -#![feature(extern_types, register_tool)] +use ::libc; +use c2rust_bitfields::BitfieldStruct; +use rust_ffi::src::ffi_alias::type_alias::*; +// use rust_ffi::src::ffi_fun::fun_call::*; +use rust_ffi::src::ffi_struct::struct_define::*; extern "C" { pub type _IO_wide_data; pub type _IO_codecvt; @@ -21,7 +15,6 @@ extern "C" { pub type smb_request; pub type ldapreqinfo; pub type contenc_writer; - pub type psl_ctx_st; pub type Curl_share; pub type curl_pushheaders; pub type http_connect_state; @@ -29,7 +22,11 @@ extern "C" { pub type tftp_state_data; pub type nghttp2_session; pub type ssl_backend_data; - fn curl_strnequal(s1: *const libc::c_char, s2: *const libc::c_char, n: size_t) -> libc::c_int; + fn curl_strnequal( + s1: *const libc::c_char, + s2: *const libc::c_char, + n: size_t, + ) -> libc::c_int; fn Curl_isspace(c: libc::c_int) -> libc::c_int; fn curl_free(p: *mut libc::c_void); fn strlen(_: *const libc::c_char) -> libc::c_ulong; @@ -47,16 +44,6 @@ extern "C" { outptr: *mut *mut libc::c_uchar, outlen: *mut size_t, ) -> CURLcode; - fn Curl_bufref_init(br: *mut bufref); - fn Curl_bufref_set( - br: *mut bufref, - ptr: *const libc::c_void, - len: size_t, - dtor: Option ()>, - ); - fn Curl_bufref_ptr(br: *const bufref) -> *const libc::c_uchar; - fn Curl_bufref_free(br: *mut bufref); - fn Curl_bufref_len(br: *const bufref) -> size_t; fn Curl_auth_create_ntlm_type1_message( data: *mut Curl_easy, userp: *const libc::c_char, @@ -78,34 +65,21 @@ extern "C" { ntlm: *mut ntlmdata, out: *mut bufref, ) -> CURLcode; + fn Curl_bufref_init(br: *mut bufref); + fn Curl_bufref_set( + br: *mut bufref, + ptr: *const libc::c_void, + len: size_t, + dtor: Option:: ()>, + ); + fn Curl_bufref_ptr(br: *const bufref) -> *const libc::c_uchar; + fn Curl_bufref_len(br: *const bufref) -> size_t; + fn Curl_bufref_free(br: *mut bufref); fn Curl_auth_cleanup_ntlm(ntlm: *mut ntlmdata); fn curl_maprintf(format: *const libc::c_char, _: ...) -> *mut libc::c_char; static mut Curl_cfree: curl_free_callback; } -pub type __uint8_t = libc::c_uchar; -pub type __int32_t = libc::c_int; -pub type __uint32_t = libc::c_uint; -pub type __off_t = libc::c_long; -pub type __off64_t = libc::c_long; -pub type __pid_t = libc::c_int; -pub type __time_t = libc::c_long; -pub type __ssize_t = libc::c_long; -pub type __socklen_t = libc::c_uint; -pub type pid_t = __pid_t; -pub type ssize_t = __ssize_t; -pub type time_t = __time_t; -pub type size_t = libc::c_ulong; -pub type int32_t = __int32_t; -pub type socklen_t = __socklen_t; -pub type sa_family_t = libc::c_ushort; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct sockaddr { - pub sa_family: sa_family_t, - pub sa_data: [libc::c_char; 14], -} -pub type curl_socklen_t = socklen_t; -pub type curl_off_t = libc::c_long; + #[derive(Copy, Clone)] #[repr(C)] pub struct _IO_FILE { @@ -139,7 +113,6 @@ pub struct _IO_FILE { pub _mode: libc::c_int, pub _unused2: [libc::c_char; 20], } -pub type _IO_lock_t = (); pub type FILE = _IO_FILE; #[derive(Copy, Clone)] #[repr(C)] @@ -160,7 +133,6 @@ pub struct Curl_easy { pub multi: *mut Curl_multi, pub multi_easy: *mut Curl_multi, pub share: *mut Curl_share, - pub psl: *mut PslCache, pub req: SingleRequest, pub set: UserDefined, pub cookies: *mut CookieInfo, @@ -172,142 +144,7 @@ pub struct Curl_easy { pub info: PureInfo, pub tsi: curl_tlssessioninfo, } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_tlssessioninfo { - pub backend: curl_sslbackend, - pub internals: *mut libc::c_void, -} -pub type curl_sslbackend = libc::c_uint; -pub const CURLSSLBACKEND_RUSTLS: curl_sslbackend = 14; -pub const CURLSSLBACKEND_BEARSSL: curl_sslbackend = 13; -pub const CURLSSLBACKEND_MESALINK: curl_sslbackend = 12; -pub const CURLSSLBACKEND_MBEDTLS: curl_sslbackend = 11; -pub const CURLSSLBACKEND_AXTLS: curl_sslbackend = 10; -pub const CURLSSLBACKEND_SECURETRANSPORT: curl_sslbackend = 9; -pub const CURLSSLBACKEND_SCHANNEL: curl_sslbackend = 8; -pub const CURLSSLBACKEND_WOLFSSL: curl_sslbackend = 7; -pub const CURLSSLBACKEND_POLARSSL: curl_sslbackend = 6; -pub const CURLSSLBACKEND_GSKIT: curl_sslbackend = 5; -pub const CURLSSLBACKEND_OBSOLETE4: curl_sslbackend = 4; -pub const CURLSSLBACKEND_NSS: curl_sslbackend = 3; -pub const CURLSSLBACKEND_GNUTLS: curl_sslbackend = 2; -pub const CURLSSLBACKEND_OPENSSL: curl_sslbackend = 1; -pub const CURLSSLBACKEND_NONE: curl_sslbackend = 0; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct PureInfo { - pub httpcode: libc::c_int, - pub httpproxycode: libc::c_int, - pub httpversion: libc::c_int, - pub filetime: time_t, - pub header_size: curl_off_t, - pub request_size: curl_off_t, - pub proxyauthavail: libc::c_ulong, - pub httpauthavail: libc::c_ulong, - pub numconnects: libc::c_long, - pub contenttype: *mut libc::c_char, - pub wouldredirect: *mut libc::c_char, - pub retry_after: curl_off_t, - pub conn_primary_ip: [libc::c_char; 46], - pub conn_primary_port: libc::c_int, - pub conn_local_ip: [libc::c_char; 46], - pub conn_local_port: libc::c_int, - pub conn_scheme: *const libc::c_char, - pub conn_protocol: libc::c_uint, - pub certs: curl_certinfo, - pub pxcode: CURLproxycode, - #[bitfield(name = "timecond", ty = "bit", bits = "0..=0")] - pub timecond: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type bit = libc::c_uint; -pub type CURLproxycode = libc::c_uint; -pub const CURLPX_LAST: CURLproxycode = 34; -pub const CURLPX_USER_REJECTED: CURLproxycode = 33; -pub const CURLPX_UNKNOWN_MODE: CURLproxycode = 32; -pub const CURLPX_UNKNOWN_FAIL: CURLproxycode = 31; -pub const CURLPX_SEND_REQUEST: CURLproxycode = 30; -pub const CURLPX_SEND_CONNECT: CURLproxycode = 29; -pub const CURLPX_SEND_AUTH: CURLproxycode = 28; -pub const CURLPX_RESOLVE_HOST: CURLproxycode = 27; -pub const CURLPX_REQUEST_FAILED: CURLproxycode = 26; -pub const CURLPX_REPLY_UNASSIGNED: CURLproxycode = 25; -pub const CURLPX_REPLY_TTL_EXPIRED: CURLproxycode = 24; -pub const CURLPX_REPLY_NOT_ALLOWED: CURLproxycode = 23; -pub const CURLPX_REPLY_NETWORK_UNREACHABLE: CURLproxycode = 22; -pub const CURLPX_REPLY_HOST_UNREACHABLE: CURLproxycode = 21; -pub const CURLPX_REPLY_GENERAL_SERVER_FAILURE: CURLproxycode = 20; -pub const CURLPX_REPLY_CONNECTION_REFUSED: CURLproxycode = 19; -pub const CURLPX_REPLY_COMMAND_NOT_SUPPORTED: CURLproxycode = 18; -pub const CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED: CURLproxycode = 17; -pub const CURLPX_RECV_REQACK: CURLproxycode = 16; -pub const CURLPX_RECV_CONNECT: CURLproxycode = 15; -pub const CURLPX_RECV_AUTH: CURLproxycode = 14; -pub const CURLPX_RECV_ADDRESS: CURLproxycode = 13; -pub const CURLPX_NO_AUTH: CURLproxycode = 12; -pub const CURLPX_LONG_USER: CURLproxycode = 11; -pub const CURLPX_LONG_PASSWD: CURLproxycode = 10; -pub const CURLPX_LONG_HOSTNAME: CURLproxycode = 9; -pub const CURLPX_IDENTD_DIFFER: CURLproxycode = 8; -pub const CURLPX_IDENTD: CURLproxycode = 7; -pub const CURLPX_GSSAPI_PROTECTION: CURLproxycode = 6; -pub const CURLPX_GSSAPI_PERMSG: CURLproxycode = 5; -pub const CURLPX_GSSAPI: CURLproxycode = 4; -pub const CURLPX_CLOSED: CURLproxycode = 3; -pub const CURLPX_BAD_VERSION: CURLproxycode = 2; -pub const CURLPX_BAD_ADDRESS_TYPE: CURLproxycode = 1; -pub const CURLPX_OK: CURLproxycode = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_certinfo { - pub num_of_certs: libc::c_int, - pub certinfo: *mut *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_slist { - pub data: *mut libc::c_char, - pub next: *mut curl_slist, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WildcardData { - pub state: wildcard_states, - pub path: *mut libc::c_char, - pub pattern: *mut libc::c_char, - pub filelist: Curl_llist, - pub protdata: *mut libc::c_void, - pub dtor: wildcard_dtor, - pub customptr: *mut libc::c_void, -} -pub type wildcard_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist { - pub head: *mut Curl_llist_element, - pub tail: *mut Curl_llist_element, - pub dtor: Curl_llist_dtor, - pub size: size_t, -} -pub type Curl_llist_dtor = Option ()>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_llist_element { - pub ptr: *mut libc::c_void, - pub prev: *mut Curl_llist_element, - pub next: *mut Curl_llist_element, -} -pub type wildcard_states = libc::c_uint; -pub const CURLWC_DONE: wildcard_states = 7; -pub const CURLWC_ERROR: wildcard_states = 6; -pub const CURLWC_SKIP: wildcard_states = 5; -pub const CURLWC_CLEAN: wildcard_states = 4; -pub const CURLWC_DOWNLOADING: wildcard_states = 3; -pub const CURLWC_MATCHING: wildcard_states = 2; -pub const CURLWC_INIT: wildcard_states = 1; -pub const CURLWC_CLEAR: wildcard_states = 0; + #[derive(Copy, Clone, BitfieldStruct)] #[repr(C)] pub struct UrlState { @@ -328,7 +165,7 @@ pub struct UrlState { pub os_errno: libc::c_int, pub scratch: *mut libc::c_char, pub followlocation: libc::c_long, - pub prev_signal: Option ()>, + pub prev_signal: Option:: ()>, pub digest: digestdata, pub proxydigest: digestdata, pub authhost: auth, @@ -390,102 +227,12 @@ pub struct UrlState { #[bitfield(name = "url_alloc", ty = "bit", bits = "18..=18")] #[bitfield(name = "referer_alloc", ty = "bit", bits = "19..=19")] #[bitfield(name = "wildcard_resolve", ty = "bit", bits = "20..=20")] - pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: - [u8; 3], + pub multi_owned_by_easy_this_is_a_follow_refused_stream_errorbuf_allow_port_authproblem_ftp_trying_alternative_wildcardmatch_expect100header_disableexpect_use_range_rangestringalloc_done_stream_depends_e_previouslypending_cookie_engine_prefer_ascii_list_only_url_alloc_referer_alloc_wildcard_resolve: [u8; 3], #[bitfield(padding)] pub c2rust_padding_0: [u8; 5], } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynamically_allocated_data { - pub proxyuserpwd: *mut libc::c_char, - pub uagent: *mut libc::c_char, - pub accept_encoding: *mut libc::c_char, - pub userpwd: *mut libc::c_char, - pub rangeline: *mut libc::c_char, - pub ref_0: *mut libc::c_char, - pub host: *mut libc::c_char, - pub cookiehost: *mut libc::c_char, - pub rtsp_transport: *mut libc::c_char, - pub te: *mut libc::c_char, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, - pub proxyuser: *mut libc::c_char, - pub proxypasswd: *mut libc::c_char, -} -pub type trailers_state = libc::c_uint; -pub const TRAILERS_DONE: trailers_state = 3; -pub const TRAILERS_SENDING: trailers_state = 2; -pub const TRAILERS_INITIALIZED: trailers_state = 1; -pub const TRAILERS_NONE: trailers_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct dynbuf { - pub bufr: *mut libc::c_char, - pub leng: size_t, - pub allc: size_t, - pub toobig: size_t, -} -pub type Curl_HttpReq = libc::c_uint; -pub const HTTPREQ_HEAD: Curl_HttpReq = 5; -pub const HTTPREQ_PUT: Curl_HttpReq = 4; -pub const HTTPREQ_POST_MIME: Curl_HttpReq = 3; -pub const HTTPREQ_POST_FORM: Curl_HttpReq = 2; -pub const HTTPREQ_POST: Curl_HttpReq = 1; -pub const HTTPREQ_GET: Curl_HttpReq = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct urlpieces { - pub scheme: *mut libc::c_char, - pub hostname: *mut libc::c_char, - pub port: *mut libc::c_char, - pub user: *mut libc::c_char, - pub password: *mut libc::c_char, - pub options: *mut libc::c_char, - pub path: *mut libc::c_char, - pub query: *mut libc::c_char, -} pub type CURLU = Curl_URL; -pub type curl_read_callback = - Option size_t>; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct time_node { - pub list: Curl_llist_element, - pub time: curltime, - pub eid: expire_id, -} -pub type expire_id = libc::c_uint; -pub const EXPIRE_LAST: expire_id = 13; -pub const EXPIRE_QUIC: expire_id = 12; -pub const EXPIRE_TOOFAST: expire_id = 11; -pub const EXPIRE_TIMEOUT: expire_id = 10; -pub const EXPIRE_SPEEDCHECK: expire_id = 9; -pub const EXPIRE_RUN_NOW: expire_id = 8; -pub const EXPIRE_MULTI_PENDING: expire_id = 7; -pub const EXPIRE_HAPPY_EYEBALLS: expire_id = 6; -pub const EXPIRE_HAPPY_EYEBALLS_DNS: expire_id = 5; -pub const EXPIRE_DNS_PER_NAME2: expire_id = 4; -pub const EXPIRE_DNS_PER_NAME: expire_id = 3; -pub const EXPIRE_CONNECTTIMEOUT: expire_id = 2; -pub const EXPIRE_ASYNC_NAME: expire_id = 1; -pub const EXPIRE_100_TIMEOUT: expire_id = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curltime { - pub tv_sec: time_t, - pub tv_usec: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_tree { - pub smaller: *mut Curl_tree, - pub larger: *mut Curl_tree, - pub samen: *mut Curl_tree, - pub samep: *mut Curl_tree, - pub key: curltime, - pub payload: *mut libc::c_void, -} + #[derive(Copy, Clone, BitfieldStruct)] #[repr(C)] pub struct Curl_async { @@ -500,61 +247,7 @@ pub struct Curl_async { #[bitfield(padding)] pub c2rust_padding: [u8; 7], } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_dns_entry { - pub addr: *mut Curl_addrinfo, - pub timestamp: time_t, - pub inuse: libc::c_long, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_addrinfo { - pub ai_flags: libc::c_int, - pub ai_family: libc::c_int, - pub ai_socktype: libc::c_int, - pub ai_protocol: libc::c_int, - pub ai_addrlen: curl_socklen_t, - pub ai_canonname: *mut libc::c_char, - pub ai_addr: *mut sockaddr, - pub ai_next: *mut Curl_addrinfo, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct auth { - pub want: libc::c_ulong, - pub picked: libc::c_ulong, - pub avail: libc::c_ulong, - #[bitfield(name = "done", ty = "bit", bits = "0..=0")] - #[bitfield(name = "multipass", ty = "bit", bits = "1..=1")] - #[bitfield(name = "iestyle", ty = "bit", bits = "2..=2")] - pub done_multipass_iestyle: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 7], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct digestdata { - pub nonce: *mut libc::c_char, - pub cnonce: *mut libc::c_char, - pub realm: *mut libc::c_char, - pub algo: libc::c_int, - pub opaque: *mut libc::c_char, - pub qop: *mut libc::c_char, - pub algorithm: *mut libc::c_char, - pub nc: libc::c_int, - #[bitfield(name = "stale", ty = "bit", bits = "0..=0")] - #[bitfield(name = "userhash", ty = "bit", bits = "1..=1")] - pub stale_userhash: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct tempbuf { - pub b: dynbuf, - pub type_0: libc::c_int, -} + #[derive(Copy, Clone)] #[repr(C)] pub struct Curl_ssl_session { @@ -594,13 +287,7 @@ pub struct ssl_primary_config { #[bitfield(padding)] pub c2rust_padding: [u8; 7], } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_blob { - pub data: *mut libc::c_void, - pub len: size_t, - pub flags: libc::c_uint, -} + #[derive(Copy, Clone)] #[repr(C)] pub struct conncache { @@ -610,89 +297,7 @@ pub struct conncache { pub last_cleanup: curltime, pub closure_handle: *mut Curl_easy, } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_hash { - pub table: *mut Curl_llist, - pub hash_func: hash_function, - pub comp_func: comp_function, - pub dtor: Curl_hash_dtor, - pub slots: libc::c_int, - pub size: size_t, -} -pub type Curl_hash_dtor = Option ()>; -pub type comp_function = - Option size_t>; -pub type hash_function = Option size_t>; -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct Progress { - pub lastshow: time_t, - pub size_dl: curl_off_t, - pub size_ul: curl_off_t, - pub downloaded: curl_off_t, - pub uploaded: curl_off_t, - pub current_speed: curl_off_t, - pub width: libc::c_int, - pub flags: libc::c_int, - pub timespent: timediff_t, - pub dlspeed: curl_off_t, - pub ulspeed: curl_off_t, - pub t_nslookup: timediff_t, - pub t_connect: timediff_t, - pub t_appconnect: timediff_t, - pub t_pretransfer: timediff_t, - pub t_starttransfer: timediff_t, - pub t_redirect: timediff_t, - pub start: curltime, - pub t_startsingle: curltime, - pub t_startop: curltime, - pub t_acceptdata: curltime, - pub ul_limit_start: curltime, - pub ul_limit_size: curl_off_t, - pub dl_limit_start: curltime, - pub dl_limit_size: curl_off_t, - pub speeder: [curl_off_t; 6], - pub speeder_time: [curltime; 6], - pub speeder_c: libc::c_int, - #[bitfield(name = "callback", ty = "bit", bits = "0..=0")] - #[bitfield(name = "is_t_startransfer_set", ty = "bit", bits = "1..=1")] - pub callback_is_t_startransfer_set: [u8; 1], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -pub type timediff_t = curl_off_t; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct CookieInfo { - pub cookies: [*mut Cookie; 256], - pub filename: *mut libc::c_char, - pub numcookies: libc::c_long, - pub running: bool, - pub newsession: bool, - pub lastct: libc::c_int, - pub next_expiration: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Cookie { - pub next: *mut Cookie, - pub name: *mut libc::c_char, - pub value: *mut libc::c_char, - pub path: *mut libc::c_char, - pub spath: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub expires: curl_off_t, - pub expirestr: *mut libc::c_char, - pub version: *mut libc::c_char, - pub maxage: *mut libc::c_char, - pub tailmatch: bool, - pub secure: bool, - pub livecookie: bool, - pub httponly: bool, - pub creationtime: libc::c_int, - pub prefix: libc::c_uchar, -} + #[derive(Copy, Clone, BitfieldStruct)] #[repr(C)] pub struct UserDefined { @@ -881,159 +486,23 @@ pub struct UserDefined { #[bitfield(name = "doh_verifystatus", ty = "bit", bits = "59..=59")] #[bitfield(name = "http09_allowed", ty = "bit", bits = "60..=60")] #[bitfield(name = "mail_rcpt_allowfails", ty = "bit", bits = "61..=61")] - pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: - [u8; 8], + pub is_fread_set_is_fwrite_set_free_referer_tftp_no_options_sep_headers_cookiesession_crlf_strip_path_slash_ssh_compression_get_filetime_tunnel_thru_httpproxy_prefer_ascii_remote_append_list_only_ftp_use_port_ftp_use_epsv_ftp_use_eprt_ftp_use_pret_ftp_skip_ip_hide_progress_http_fail_on_error_http_keep_sending_on_error_http_follow_location_http_transfer_encoding_allow_auth_to_other_hosts_include_header_http_set_referer_http_auto_referer_opt_no_body_upload_verbose_krb_reuse_forbid_reuse_fresh_no_signal_tcp_nodelay_ignorecl_connect_only_http_te_skip_http_ce_skip_proxy_transfer_mode_sasl_ir_wildcard_enabled_tcp_keepalive_tcp_fastopen_ssl_enable_npn_ssl_enable_alpn_path_as_is_pipewait_suppress_connect_headers_dns_shuffle_addresses_stream_depends_e_haproxyprotocol_abstract_unix_socket_disallow_username_in_url_doh_doh_get_doh_verifypeer_doh_verifyhost_doh_verifystatus_http09_allowed_mail_rcpt_allowfails: [u8; 8], } -pub type curl_trailer_callback = - Option libc::c_int>; -pub type multidone_func = Option libc::c_int>; -pub type CURLcode = libc::c_uint; -pub const CURL_LAST: CURLcode = 99; -pub const CURLE_SSL_CLIENTCERT: CURLcode = 98; -pub const CURLE_PROXY: CURLcode = 97; -pub const CURLE_QUIC_CONNECT_ERROR: CURLcode = 96; -pub const CURLE_HTTP3: CURLcode = 95; -pub const CURLE_AUTH_ERROR: CURLcode = 94; -pub const CURLE_RECURSIVE_API_CALL: CURLcode = 93; -pub const CURLE_HTTP2_STREAM: CURLcode = 92; -pub const CURLE_SSL_INVALIDCERTSTATUS: CURLcode = 91; -pub const CURLE_SSL_PINNEDPUBKEYNOTMATCH: CURLcode = 90; -pub const CURLE_NO_CONNECTION_AVAILABLE: CURLcode = 89; -pub const CURLE_CHUNK_FAILED: CURLcode = 88; -pub const CURLE_FTP_BAD_FILE_LIST: CURLcode = 87; -pub const CURLE_RTSP_SESSION_ERROR: CURLcode = 86; -pub const CURLE_RTSP_CSEQ_ERROR: CURLcode = 85; -pub const CURLE_FTP_PRET_FAILED: CURLcode = 84; -pub const CURLE_SSL_ISSUER_ERROR: CURLcode = 83; -pub const CURLE_SSL_CRL_BADFILE: CURLcode = 82; -pub const CURLE_AGAIN: CURLcode = 81; -pub const CURLE_SSL_SHUTDOWN_FAILED: CURLcode = 80; -pub const CURLE_SSH: CURLcode = 79; -pub const CURLE_REMOTE_FILE_NOT_FOUND: CURLcode = 78; -pub const CURLE_SSL_CACERT_BADFILE: CURLcode = 77; -pub const CURLE_CONV_REQD: CURLcode = 76; -pub const CURLE_CONV_FAILED: CURLcode = 75; -pub const CURLE_TFTP_NOSUCHUSER: CURLcode = 74; -pub const CURLE_REMOTE_FILE_EXISTS: CURLcode = 73; -pub const CURLE_TFTP_UNKNOWNID: CURLcode = 72; -pub const CURLE_TFTP_ILLEGAL: CURLcode = 71; -pub const CURLE_REMOTE_DISK_FULL: CURLcode = 70; -pub const CURLE_TFTP_PERM: CURLcode = 69; -pub const CURLE_TFTP_NOTFOUND: CURLcode = 68; -pub const CURLE_LOGIN_DENIED: CURLcode = 67; -pub const CURLE_SSL_ENGINE_INITFAILED: CURLcode = 66; -pub const CURLE_SEND_FAIL_REWIND: CURLcode = 65; -pub const CURLE_USE_SSL_FAILED: CURLcode = 64; -pub const CURLE_FILESIZE_EXCEEDED: CURLcode = 63; -pub const CURLE_LDAP_INVALID_URL: CURLcode = 62; -pub const CURLE_BAD_CONTENT_ENCODING: CURLcode = 61; -pub const CURLE_PEER_FAILED_VERIFICATION: CURLcode = 60; -pub const CURLE_SSL_CIPHER: CURLcode = 59; -pub const CURLE_SSL_CERTPROBLEM: CURLcode = 58; -pub const CURLE_OBSOLETE57: CURLcode = 57; -pub const CURLE_RECV_ERROR: CURLcode = 56; -pub const CURLE_SEND_ERROR: CURLcode = 55; -pub const CURLE_SSL_ENGINE_SETFAILED: CURLcode = 54; -pub const CURLE_SSL_ENGINE_NOTFOUND: CURLcode = 53; -pub const CURLE_GOT_NOTHING: CURLcode = 52; -pub const CURLE_OBSOLETE51: CURLcode = 51; -pub const CURLE_OBSOLETE50: CURLcode = 50; -pub const CURLE_SETOPT_OPTION_SYNTAX: CURLcode = 49; -pub const CURLE_UNKNOWN_OPTION: CURLcode = 48; -pub const CURLE_TOO_MANY_REDIRECTS: CURLcode = 47; -pub const CURLE_OBSOLETE46: CURLcode = 46; -pub const CURLE_INTERFACE_FAILED: CURLcode = 45; -pub const CURLE_OBSOLETE44: CURLcode = 44; -pub const CURLE_BAD_FUNCTION_ARGUMENT: CURLcode = 43; -pub const CURLE_ABORTED_BY_CALLBACK: CURLcode = 42; -pub const CURLE_FUNCTION_NOT_FOUND: CURLcode = 41; -pub const CURLE_OBSOLETE40: CURLcode = 40; -pub const CURLE_LDAP_SEARCH_FAILED: CURLcode = 39; -pub const CURLE_LDAP_CANNOT_BIND: CURLcode = 38; -pub const CURLE_FILE_COULDNT_READ_FILE: CURLcode = 37; -pub const CURLE_BAD_DOWNLOAD_RESUME: CURLcode = 36; -pub const CURLE_SSL_CONNECT_ERROR: CURLcode = 35; -pub const CURLE_HTTP_POST_ERROR: CURLcode = 34; -pub const CURLE_RANGE_ERROR: CURLcode = 33; -pub const CURLE_OBSOLETE32: CURLcode = 32; -pub const CURLE_FTP_COULDNT_USE_REST: CURLcode = 31; -pub const CURLE_FTP_PORT_FAILED: CURLcode = 30; -pub const CURLE_OBSOLETE29: CURLcode = 29; -pub const CURLE_OPERATION_TIMEDOUT: CURLcode = 28; -pub const CURLE_OUT_OF_MEMORY: CURLcode = 27; -pub const CURLE_READ_ERROR: CURLcode = 26; -pub const CURLE_UPLOAD_FAILED: CURLcode = 25; -pub const CURLE_OBSOLETE24: CURLcode = 24; -pub const CURLE_WRITE_ERROR: CURLcode = 23; -pub const CURLE_HTTP_RETURNED_ERROR: CURLcode = 22; -pub const CURLE_QUOTE_ERROR: CURLcode = 21; -pub const CURLE_OBSOLETE20: CURLcode = 20; -pub const CURLE_FTP_COULDNT_RETR_FILE: CURLcode = 19; -pub const CURLE_PARTIAL_FILE: CURLcode = 18; -pub const CURLE_FTP_COULDNT_SET_TYPE: CURLcode = 17; -pub const CURLE_HTTP2: CURLcode = 16; -pub const CURLE_FTP_CANT_GET_HOST: CURLcode = 15; -pub const CURLE_FTP_WEIRD_227_FORMAT: CURLcode = 14; -pub const CURLE_FTP_WEIRD_PASV_REPLY: CURLcode = 13; -pub const CURLE_FTP_ACCEPT_TIMEOUT: CURLcode = 12; -pub const CURLE_FTP_WEIRD_PASS_REPLY: CURLcode = 11; -pub const CURLE_FTP_ACCEPT_FAILED: CURLcode = 10; -pub const CURLE_REMOTE_ACCESS_DENIED: CURLcode = 9; -pub const CURLE_WEIRD_SERVER_REPLY: CURLcode = 8; -pub const CURLE_COULDNT_CONNECT: CURLcode = 7; -pub const CURLE_COULDNT_RESOLVE_HOST: CURLcode = 6; -pub const CURLE_COULDNT_RESOLVE_PROXY: CURLcode = 5; -pub const CURLE_NOT_BUILT_IN: CURLcode = 4; -pub const CURLE_URL_MALFORMAT: CURLcode = 3; -pub const CURLE_FAILED_INIT: CURLcode = 2; -pub const CURLE_UNSUPPORTED_PROTOCOL: CURLcode = 1; -pub const CURLE_OK: CURLcode = 0; -pub type curl_resolver_start_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, *mut libc::c_void, *mut libc::c_void) -> libc::c_int, +pub type curl_trailer_callback = Option::< + unsafe extern "C" fn(*mut *mut curl_slist, *mut libc::c_void) -> libc::c_int, >; +pub type multidone_func = Option::< + unsafe extern "C" fn(*mut Curl_easy, CURLcode) -> libc::c_int, +>; + #[derive(Copy, Clone)] #[repr(C)] pub struct Curl_http2_dep { pub next: *mut Curl_http2_dep, pub data: *mut Curl_easy, } -pub type curl_fnmatch_callback = Option< - unsafe extern "C" fn( - *mut libc::c_void, - *const libc::c_char, - *const libc::c_char, - ) -> libc::c_int, ->; -pub type curl_chunk_end_callback = Option libc::c_long>; -pub type curl_chunk_bgn_callback = Option< - unsafe extern "C" fn(*const libc::c_void, *mut libc::c_void, libc::c_int) -> libc::c_long, ->; -pub type Curl_RtspReq = libc::c_uint; -pub const RTSPREQ_LAST: Curl_RtspReq = 12; -pub const RTSPREQ_RECEIVE: Curl_RtspReq = 11; -pub const RTSPREQ_RECORD: Curl_RtspReq = 10; -pub const RTSPREQ_SET_PARAMETER: Curl_RtspReq = 9; -pub const RTSPREQ_GET_PARAMETER: Curl_RtspReq = 8; -pub const RTSPREQ_TEARDOWN: Curl_RtspReq = 7; -pub const RTSPREQ_PAUSE: Curl_RtspReq = 6; -pub const RTSPREQ_PLAY: Curl_RtspReq = 5; -pub const RTSPREQ_SETUP: Curl_RtspReq = 4; -pub const RTSPREQ_ANNOUNCE: Curl_RtspReq = 3; -pub const RTSPREQ_DESCRIBE: Curl_RtspReq = 2; -pub const RTSPREQ_OPTIONS: Curl_RtspReq = 1; -pub const RTSPREQ_NONE: Curl_RtspReq = 0; -pub type curl_usessl = libc::c_uint; -pub const CURLUSESSL_LAST: curl_usessl = 4; -pub const CURLUSESSL_ALL: curl_usessl = 3; -pub const CURLUSESSL_CONTROL: curl_usessl = 2; -pub const CURLUSESSL_TRY: curl_usessl = 1; -pub const CURLUSESSL_NONE: curl_usessl = 0; -pub type CURL_NETRC_OPTION = libc::c_uint; -pub const CURL_NETRC_LAST: CURL_NETRC_OPTION = 3; -pub const CURL_NETRC_REQUIRED: CURL_NETRC_OPTION = 2; -pub const CURL_NETRC_OPTIONAL: CURL_NETRC_OPTION = 1; -pub const CURL_NETRC_IGNORED: CURL_NETRC_OPTION = 0; -pub type curl_sshkeycallback = Option< + +pub type curl_sshkeycallback = Option::< unsafe extern "C" fn( *mut CURL, *const curl_khkey, @@ -1042,45 +511,8 @@ pub type curl_sshkeycallback = Option< *mut libc::c_void, ) -> libc::c_int, >; -pub type curl_khmatch = libc::c_uint; -pub const CURLKHMATCH_LAST: curl_khmatch = 3; -pub const CURLKHMATCH_MISSING: curl_khmatch = 2; -pub const CURLKHMATCH_MISMATCH: curl_khmatch = 1; -pub const CURLKHMATCH_OK: curl_khmatch = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_khkey { - pub key: *const libc::c_char, - pub len: size_t, - pub keytype: curl_khtype, -} -pub type curl_khtype = libc::c_uint; -pub const CURLKHTYPE_ED25519: curl_khtype = 5; -pub const CURLKHTYPE_ECDSA: curl_khtype = 4; -pub const CURLKHTYPE_DSS: curl_khtype = 3; -pub const CURLKHTYPE_RSA: curl_khtype = 2; -pub const CURLKHTYPE_RSA1: curl_khtype = 1; -pub const CURLKHTYPE_UNKNOWN: curl_khtype = 0; pub type CURL = Curl_easy; -pub type curl_ftpccc = libc::c_uint; -pub const CURLFTPSSL_CCC_LAST: curl_ftpccc = 3; -pub const CURLFTPSSL_CCC_ACTIVE: curl_ftpccc = 2; -pub const CURLFTPSSL_CCC_PASSIVE: curl_ftpccc = 1; -pub const CURLFTPSSL_CCC_NONE: curl_ftpccc = 0; -pub type curl_ftpauth = libc::c_uint; -pub const CURLFTPAUTH_LAST: curl_ftpauth = 3; -pub const CURLFTPAUTH_TLS: curl_ftpauth = 2; -pub const CURLFTPAUTH_SSL: curl_ftpauth = 1; -pub const CURLFTPAUTH_DEFAULT: curl_ftpauth = 0; -pub type curl_ftpfile = libc::c_uint; -pub const FTPFILE_SINGLECWD: curl_ftpfile = 3; -pub const FTPFILE_NOCWD: curl_ftpfile = 2; -pub const FTPFILE_MULTICWD: curl_ftpfile = 1; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssl_general_config { - pub max_ssl_sessions: size_t, -} + #[derive(Copy, Clone, BitfieldStruct)] #[repr(C)] pub struct ssl_config_data { @@ -1105,31 +537,13 @@ pub struct ssl_config_data { #[bitfield(name = "revoke_best_effort", ty = "bit", bits = "5..=5")] #[bitfield(name = "native_ca_store", ty = "bit", bits = "6..=6")] #[bitfield(name = "auto_client_cert", ty = "bit", bits = "7..=7")] - pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: - [u8; 1], + pub certinfo_falsestart_enable_beast_no_revoke_no_partialchain_revoke_best_effort_native_ca_store_auto_client_cert: [u8; 1], #[bitfield(padding)] pub c2rust_padding: [u8; 3], } -pub type CURL_TLSAUTH = libc::c_uint; -pub const CURL_TLSAUTH_LAST: CURL_TLSAUTH = 2; -pub const CURL_TLSAUTH_SRP: CURL_TLSAUTH = 1; -pub const CURL_TLSAUTH_NONE: CURL_TLSAUTH = 0; -pub type curl_ssl_ctx_callback = - Option CURLcode>; -pub type curl_proxytype = libc::c_uint; -pub const CURLPROXY_SOCKS5_HOSTNAME: curl_proxytype = 7; -pub const CURLPROXY_SOCKS4A: curl_proxytype = 6; -pub const CURLPROXY_SOCKS5: curl_proxytype = 5; -pub const CURLPROXY_SOCKS4: curl_proxytype = 4; -pub const CURLPROXY_HTTPS: curl_proxytype = 2; -pub const CURLPROXY_HTTP_1_0: curl_proxytype = 1; -pub const CURLPROXY_HTTP: curl_proxytype = 0; -pub type curl_TimeCond = libc::c_uint; -pub const CURL_TIMECOND_LAST: curl_TimeCond = 4; -pub const CURL_TIMECOND_LASTMOD: curl_TimeCond = 3; -pub const CURL_TIMECOND_IFUNMODSINCE: curl_TimeCond = 2; -pub const CURL_TIMECOND_IFMODSINCE: curl_TimeCond = 1; -pub const CURL_TIMECOND_NONE: curl_TimeCond = 0; +pub type curl_ssl_ctx_callback = Option::< + unsafe extern "C" fn(*mut CURL, *mut libc::c_void, *mut libc::c_void) -> CURLcode, +>; #[derive(Copy, Clone)] #[repr(C)] pub struct curl_mimepart { @@ -1157,48 +571,19 @@ pub struct curl_mimepart { } #[derive(Copy, Clone)] #[repr(C)] -pub struct mime_encoder_state { - pub pos: size_t, - pub bufbeg: size_t, - pub bufend: size_t, - pub buf: [libc::c_char; 256], -} -#[derive(Copy, Clone)] -#[repr(C)] pub struct mime_encoder { pub name: *const libc::c_char, - pub encodefunc: - Option size_t>, - pub sizefunc: Option curl_off_t>, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct mime_state { - pub state: mimestate, - pub ptr: *mut libc::c_void, - pub offset: curl_off_t, + pub encodefunc: Option::< + unsafe extern "C" fn( + *mut libc::c_char, + size_t, + bool, + *mut curl_mimepart, + ) -> size_t, + >, + pub sizefunc: Option:: curl_off_t>, } -pub type mimestate = libc::c_uint; -pub const MIMESTATE_LAST: mimestate = 9; -pub const MIMESTATE_END: mimestate = 8; -pub const MIMESTATE_CONTENT: mimestate = 7; -pub const MIMESTATE_BOUNDARY2: mimestate = 6; -pub const MIMESTATE_BOUNDARY1: mimestate = 5; -pub const MIMESTATE_BODY: mimestate = 4; -pub const MIMESTATE_EOH: mimestate = 3; -pub const MIMESTATE_USERHEADERS: mimestate = 2; -pub const MIMESTATE_CURLHEADERS: mimestate = 1; -pub const MIMESTATE_BEGIN: mimestate = 0; -pub type curl_free_callback = Option ()>; -pub type curl_seek_callback = - Option libc::c_int>; -pub type mimekind = libc::c_uint; -pub const MIMEKIND_LAST: mimekind = 5; -pub const MIMEKIND_MULTIPART: mimekind = 4; -pub const MIMEKIND_CALLBACK: mimekind = 3; -pub const MIMEKIND_FILE: mimekind = 2; -pub const MIMEKIND_DATA: mimekind = 1; -pub const MIMEKIND_NONE: mimekind = 0; +pub type curl_free_callback = Option:: ()>; #[derive(Copy, Clone)] #[repr(C)] pub struct curl_mime { @@ -1209,25 +594,7 @@ pub struct curl_mime { pub boundary: [libc::c_char; 41], pub state: mime_state, } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_httppost { - pub next: *mut curl_httppost, - pub name: *mut libc::c_char, - pub namelength: libc::c_long, - pub contents: *mut libc::c_char, - pub contentslength: libc::c_long, - pub buffer: *mut libc::c_char, - pub bufferlength: libc::c_long, - pub contenttype: *mut libc::c_char, - pub contentheader: *mut curl_slist, - pub more: *mut curl_httppost, - pub flags: libc::c_long, - pub showfilename: *mut libc::c_char, - pub userp: *mut libc::c_void, - pub contentlen: curl_off_t, -} -pub type curl_hstswrite_callback = Option< +pub type curl_hstswrite_callback = Option::< unsafe extern "C" fn( *mut CURL, *mut curl_hstsentry, @@ -1235,94 +602,32 @@ pub type curl_hstswrite_callback = Option< *mut libc::c_void, ) -> CURLSTScode, >; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_index { - pub index: size_t, - pub total: size_t, -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] -pub struct curl_hstsentry { - pub name: *mut libc::c_char, - pub namelen: size_t, - #[bitfield(name = "includeSubDomains", ty = "libc::c_uint", bits = "0..=0")] - pub includeSubDomains: [u8; 1], - pub expire: [libc::c_char; 18], -} -pub type CURLSTScode = libc::c_uint; -pub const CURLSTS_FAIL: CURLSTScode = 2; -pub const CURLSTS_DONE: CURLSTScode = 1; -pub const CURLSTS_OK: CURLSTScode = 0; -pub type curl_hstsread_callback = - Option CURLSTScode>; -pub type curl_conv_callback = Option CURLcode>; -pub type curl_closesocket_callback = - Option libc::c_int>; -pub type curl_socket_t = libc::c_int; -pub type curl_opensocket_callback = Option< - unsafe extern "C" fn(*mut libc::c_void, curlsocktype, *mut curl_sockaddr) -> curl_socket_t, ->; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct curl_sockaddr { - pub family: libc::c_int, - pub socktype: libc::c_int, - pub protocol: libc::c_int, - pub addrlen: libc::c_uint, - pub addr: sockaddr, -} -pub type curlsocktype = libc::c_uint; -pub const CURLSOCKTYPE_LAST: curlsocktype = 2; -pub const CURLSOCKTYPE_ACCEPT: curlsocktype = 1; -pub const CURLSOCKTYPE_IPCXN: curlsocktype = 0; -pub type curl_sockopt_callback = - Option libc::c_int>; -pub type curl_ioctl_callback = - Option curlioerr>; -pub type curlioerr = libc::c_uint; -pub const CURLIOE_LAST: curlioerr = 3; -pub const CURLIOE_FAILRESTART: curlioerr = 2; -pub const CURLIOE_UNKNOWNCMD: curlioerr = 1; -pub const CURLIOE_OK: curlioerr = 0; -pub type curl_debug_callback = Option< +pub type curl_hstsread_callback = Option::< unsafe extern "C" fn( *mut CURL, - curl_infotype, - *mut libc::c_char, - size_t, + *mut curl_hstsentry, *mut libc::c_void, - ) -> libc::c_int, + ) -> CURLSTScode, >; -pub type curl_infotype = libc::c_uint; -pub const CURLINFO_END: curl_infotype = 7; -pub const CURLINFO_SSL_DATA_OUT: curl_infotype = 6; -pub const CURLINFO_SSL_DATA_IN: curl_infotype = 5; -pub const CURLINFO_DATA_OUT: curl_infotype = 4; -pub const CURLINFO_DATA_IN: curl_infotype = 3; -pub const CURLINFO_HEADER_OUT: curl_infotype = 2; -pub const CURLINFO_HEADER_IN: curl_infotype = 1; -pub const CURLINFO_TEXT: curl_infotype = 0; -pub type curl_xferinfo_callback = Option< +pub type curl_opensocket_callback = Option::< unsafe extern "C" fn( *mut libc::c_void, - curl_off_t, - curl_off_t, - curl_off_t, - curl_off_t, - ) -> libc::c_int, + curlsocktype, + *mut curl_sockaddr, + ) -> curl_socket_t, >; -pub type curl_progress_callback = Option< +pub type curl_ioctl_callback = Option::< + unsafe extern "C" fn(*mut CURL, libc::c_int, *mut libc::c_void) -> curlioerr, +>; +pub type curl_debug_callback = Option::< unsafe extern "C" fn( + *mut CURL, + curl_infotype, + *mut libc::c_char, + size_t, *mut libc::c_void, - libc::c_double, - libc::c_double, - libc::c_double, - libc::c_double, ) -> libc::c_int, >; -pub type curl_write_callback = - Option size_t>; #[derive(Copy, Clone, BitfieldStruct)] #[repr(C)] pub struct SingleRequest { @@ -1363,8 +668,7 @@ pub struct SingleRequest { #[bitfield(name = "upload_chunky", ty = "bit", bits = "7..=7")] #[bitfield(name = "getheader", ty = "bit", bits = "8..=8")] #[bitfield(name = "forbidchunk", ty = "bit", bits = "9..=9")] - pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: - [u8; 2], + pub header_content_range_upload_done_ignorebody_http_bodyless_chunk_ignore_cl_upload_chunky_getheader_forbidchunk: [u8; 2], #[bitfield(padding)] pub c2rust_padding: [u8; 6], } @@ -1402,26 +706,7 @@ pub union C2RustUnnamed { pub ssh: *mut SSHPROTO, pub telnet: *mut TELNET, } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SSHPROTO { - pub path: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct SMTP { - pub transfer: curl_pp_transfer, - pub custom: *mut libc::c_char, - pub rcpt: *mut curl_slist, - pub rcpt_had_ok: bool, - pub trailing_crlf: bool, - pub rcpt_last_error: libc::c_int, - pub eob: size_t, -} -pub type curl_pp_transfer = libc::c_uint; -pub const PPTRANSFER_NONE: curl_pp_transfer = 2; -pub const PPTRANSFER_INFO: curl_pp_transfer = 1; -pub const PPTRANSFER_BODY: curl_pp_transfer = 0; + #[derive(Copy, Clone)] #[repr(C)] pub struct RTSP { @@ -1461,87 +746,6 @@ pub struct HTTP { pub upload_len: size_t, pub upload_left: curl_off_t, } -pub type uint8_t = __uint8_t; -pub type uint32_t = __uint32_t; -pub type C2RustUnnamed_0 = libc::c_uint; -pub const HTTPSEND_BODY: C2RustUnnamed_0 = 2; -pub const HTTPSEND_REQUEST: C2RustUnnamed_0 = 1; -pub const HTTPSEND_NADA: C2RustUnnamed_0 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct back { - pub fread_func: curl_read_callback, - pub fread_in: *mut libc::c_void, - pub postdata: *const libc::c_char, - pub postsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct POP3 { - pub transfer: curl_pp_transfer, - pub id: *mut libc::c_char, - pub custom: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct MQTT { - pub sendleftovers: *mut libc::c_char, - pub nsend: size_t, - pub npacket: size_t, - pub firstbyte: libc::c_uchar, - pub remaining_length: size_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct IMAP { - pub transfer: curl_pp_transfer, - pub mailbox: *mut libc::c_char, - pub uidvalidity: *mut libc::c_char, - pub uid: *mut libc::c_char, - pub mindex: *mut libc::c_char, - pub section: *mut libc::c_char, - pub partial: *mut libc::c_char, - pub query: *mut libc::c_char, - pub custom: *mut libc::c_char, - pub custom_params: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FTP { - pub path: *mut libc::c_char, - pub pathalloc: *mut libc::c_char, - pub transfer: curl_pp_transfer, - pub downloadsize: curl_off_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct FILEPROTO { - pub path: *mut libc::c_char, - pub freepath: *mut libc::c_char, - pub fd: libc::c_int, -} -pub type upgrade101 = libc::c_uint; -pub const UPGR101_WORKING: upgrade101 = 3; -pub const UPGR101_RECEIVED: upgrade101 = 2; -pub const UPGR101_REQUESTED: upgrade101 = 1; -pub const UPGR101_INIT: upgrade101 = 0; -pub type expect100 = libc::c_uint; -pub const EXP100_FAILED: expect100 = 3; -pub const EXP100_SENDING_REQUEST: expect100 = 2; -pub const EXP100_AWAITING_CONTINUE: expect100 = 1; -pub const EXP100_SEND_DATA: expect100 = 0; -pub type C2RustUnnamed_1 = libc::c_uint; -pub const HEADER_ALLBAD: C2RustUnnamed_1 = 2; -pub const HEADER_PARTHEADER: C2RustUnnamed_1 = 1; -pub const HEADER_NORMAL: C2RustUnnamed_1 = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct PslCache { - pub psl: *const psl_ctx_t, - pub expires: time_t, - pub dynamic: bool, -} -pub type psl_ctx_t = psl_ctx_st; #[derive(Copy, Clone)] #[repr(C)] pub struct Curl_multi { @@ -1557,7 +761,6 @@ pub struct Curl_multi { pub push_cb: curl_push_callback, pub push_userp: *mut libc::c_void, pub hostcache: Curl_hash, - pub psl: PslCache, pub timetree: *mut Curl_tree, pub sockhash: Curl_hash, pub conn_cache: conncache, @@ -1575,10 +778,11 @@ pub struct Curl_multi { pub ipv6_works: bool, pub ssl_seeded: bool, } -pub type curl_multi_timer_callback = - Option libc::c_int>; +pub type curl_multi_timer_callback = Option::< + unsafe extern "C" fn(*mut CURLM, libc::c_long, *mut libc::c_void) -> libc::c_int, +>; pub type CURLM = Curl_multi; -pub type curl_push_callback = Option< +pub type curl_push_callback = Option::< unsafe extern "C" fn( *mut CURL, *mut CURL, @@ -1587,7 +791,7 @@ pub type curl_push_callback = Option< *mut libc::c_void, ) -> libc::c_int, >; -pub type curl_socket_callback = Option< +pub type curl_socket_callback = Option::< unsafe extern "C" fn( *mut CURL, curl_socket_t, @@ -1598,16 +802,6 @@ pub type curl_socket_callback = Option< >; #[derive(Copy, Clone)] #[repr(C)] -pub struct Names { - pub hostcache: *mut Curl_hash, - pub hostcachetype: C2RustUnnamed_2, -} -pub type C2RustUnnamed_2 = libc::c_uint; -pub const HCACHE_SHARED: C2RustUnnamed_2 = 2; -pub const HCACHE_MULTI: C2RustUnnamed_2 = 1; -pub const HCACHE_NONE: C2RustUnnamed_2 = 0; -#[derive(Copy, Clone)] -#[repr(C)] pub struct Curl_message { pub list: Curl_llist_element, pub extmsg: CURLMsg, @@ -1625,29 +819,6 @@ pub union C2RustUnnamed_3 { pub whatever: *mut libc::c_void, pub result: CURLcode, } -pub type CURLMSG = libc::c_uint; -pub const CURLMSG_LAST: CURLMSG = 2; -pub const CURLMSG_DONE: CURLMSG = 1; -pub const CURLMSG_NONE: CURLMSG = 0; -pub type CURLMstate = libc::c_uint; -pub const MSTATE_LAST: CURLMstate = 17; -pub const MSTATE_MSGSENT: CURLMstate = 16; -pub const MSTATE_COMPLETED: CURLMstate = 15; -pub const MSTATE_DONE: CURLMstate = 14; -pub const MSTATE_RATELIMITING: CURLMstate = 13; -pub const MSTATE_PERFORMING: CURLMstate = 12; -pub const MSTATE_DID: CURLMstate = 11; -pub const MSTATE_DOING_MORE: CURLMstate = 10; -pub const MSTATE_DOING: CURLMstate = 9; -pub const MSTATE_DO: CURLMstate = 8; -pub const MSTATE_PROTOCONNECTING: CURLMstate = 7; -pub const MSTATE_PROTOCONNECT: CURLMstate = 6; -pub const MSTATE_TUNNELING: CURLMstate = 5; -pub const MSTATE_CONNECTING: CURLMstate = 4; -pub const MSTATE_RESOLVING: CURLMstate = 3; -pub const MSTATE_CONNECT: CURLMstate = 2; -pub const MSTATE_PENDING: CURLMstate = 1; -pub const MSTATE_INIT: CURLMstate = 0; #[derive(Copy, Clone)] #[repr(C)] pub struct connectdata { @@ -1685,8 +856,8 @@ pub struct connectdata { pub sock: [curl_socket_t; 2], pub tempsock: [curl_socket_t; 2], pub tempfamily: [libc::c_int; 2], - pub recv: [Option; 2], - pub send: [Option; 2], + pub recv: [Option::; 2], + pub send: [Option::; 2], pub ssl: [ssl_connect_data; 2], pub proxy_ssl: [ssl_connect_data; 2], pub ssl_extra: *mut libc::c_void, @@ -1722,13 +893,6 @@ pub struct connectdata { } #[derive(Copy, Clone)] #[repr(C)] -pub struct connectbundle { - pub multiuse: libc::c_int, - pub num_connections: size_t, - pub conn_list: Curl_llist, -} -#[derive(Copy, Clone)] -#[repr(C)] pub union C2RustUnnamed_4 { pub ftpc: ftp_conn, pub httpc: http_conn, @@ -1745,51 +909,6 @@ pub union C2RustUnnamed_4 { } #[derive(Copy, Clone)] #[repr(C)] -pub struct mqtt_conn { - pub state: mqttstate, - pub nextstate: mqttstate, - pub packetid: libc::c_uint, -} -pub type mqttstate = libc::c_uint; -pub const MQTT_NOSTATE: mqttstate = 7; -pub const MQTT_PUB_REMAIN: mqttstate = 6; -pub const MQTT_PUBWAIT: mqttstate = 5; -pub const MQTT_SUBACK_COMING: mqttstate = 4; -pub const MQTT_SUBACK: mqttstate = 3; -pub const MQTT_CONNACK: mqttstate = 2; -pub const MQTT_REMAINING_LENGTH: mqttstate = 1; -pub const MQTT_FIRST: mqttstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct smb_conn { - pub state: smb_conn_state, - pub user: *mut libc::c_char, - pub domain: *mut libc::c_char, - pub share: *mut libc::c_char, - pub challenge: [libc::c_uchar; 8], - pub session_key: libc::c_uint, - pub uid: libc::c_ushort, - pub recv_buf: *mut libc::c_char, - pub upload_size: size_t, - pub send_size: size_t, - pub sent: size_t, - pub got: size_t, -} -pub type smb_conn_state = libc::c_uint; -pub const SMB_CONNECTED: smb_conn_state = 4; -pub const SMB_SETUP: smb_conn_state = 3; -pub const SMB_NEGOTIATE: smb_conn_state = 2; -pub const SMB_CONNECTING: smb_conn_state = 1; -pub const SMB_NOT_CONNECTED: smb_conn_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct rtsp_conn { - pub rtp_buf: *mut libc::c_char, - pub rtp_bufsize: ssize_t, - pub rtp_channel: libc::c_int, -} -#[derive(Copy, Clone)] -#[repr(C)] pub struct smtp_conn { pub pp: pingpong, pub state: smtpstate, @@ -1813,25 +932,6 @@ pub struct SASL { pub mutual_auth: bool, pub force_ir: bool, } -pub type saslstate = libc::c_uint; -pub const SASL_FINAL: saslstate = 17; -pub const SASL_CANCEL: saslstate = 16; -pub const SASL_GSASL: saslstate = 15; -pub const SASL_OAUTH2_RESP: saslstate = 14; -pub const SASL_OAUTH2: saslstate = 13; -pub const SASL_GSSAPI_NO_DATA: saslstate = 12; -pub const SASL_GSSAPI_TOKEN: saslstate = 11; -pub const SASL_GSSAPI: saslstate = 10; -pub const SASL_NTLM_TYPE2MSG: saslstate = 9; -pub const SASL_NTLM: saslstate = 8; -pub const SASL_DIGESTMD5_RESP: saslstate = 7; -pub const SASL_DIGESTMD5: saslstate = 6; -pub const SASL_CRAMMD5: saslstate = 5; -pub const SASL_EXTERNAL: saslstate = 4; -pub const SASL_LOGIN_PASSWD: saslstate = 3; -pub const SASL_LOGIN: saslstate = 2; -pub const SASL_PLAIN: saslstate = 1; -pub const SASL_STOP: saslstate = 0; #[derive(Copy, Clone)] #[repr(C)] pub struct SASLproto { @@ -1839,7 +939,7 @@ pub struct SASLproto { pub contcode: libc::c_int, pub finalcode: libc::c_int, pub maxirlen: size_t, - pub sendauth: Option< + pub sendauth: Option::< unsafe extern "C" fn( *mut Curl_easy, *mut connectdata, @@ -1847,26 +947,17 @@ pub struct SASLproto { *const libc::c_char, ) -> CURLcode, >, - pub sendcont: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *const libc::c_char) -> CURLcode, + pub sendcont: Option::< + unsafe extern "C" fn( + *mut Curl_easy, + *mut connectdata, + *const libc::c_char, + ) -> CURLcode, + >, + pub getmessage: Option::< + unsafe extern "C" fn(*mut libc::c_char, *mut *mut libc::c_char) -> (), >, - pub getmessage: Option ()>, } -pub type smtpstate = libc::c_uint; -pub const SMTP_LAST: smtpstate = 13; -pub const SMTP_QUIT: smtpstate = 12; -pub const SMTP_POSTDATA: smtpstate = 11; -pub const SMTP_DATA: smtpstate = 10; -pub const SMTP_RCPT: smtpstate = 9; -pub const SMTP_MAIL: smtpstate = 8; -pub const SMTP_COMMAND: smtpstate = 7; -pub const SMTP_AUTH: smtpstate = 6; -pub const SMTP_UPGRADETLS: smtpstate = 5; -pub const SMTP_STARTTLS: smtpstate = 4; -pub const SMTP_HELO: smtpstate = 3; -pub const SMTP_EHLO: smtpstate = 2; -pub const SMTP_SERVERGREET: smtpstate = 1; -pub const SMTP_STOP: smtpstate = 0; #[derive(Copy, Clone)] #[repr(C)] pub struct pingpong { @@ -1881,8 +972,10 @@ pub struct pingpong { pub response: curltime, pub response_time: timediff_t, pub sendbuf: dynbuf, - pub statemachine: Option CURLcode>, - pub endofresp: Option< + pub statemachine: Option::< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, + >, + pub endofresp: Option::< unsafe extern "C" fn( *mut Curl_easy, *mut connectdata, @@ -1906,19 +999,6 @@ pub struct pop3_conn { pub preftype: libc::c_uint, pub apoptimestamp: *mut libc::c_char, } -pub type pop3state = libc::c_uint; -pub const POP3_LAST: pop3state = 11; -pub const POP3_QUIT: pop3state = 10; -pub const POP3_COMMAND: pop3state = 9; -pub const POP3_PASS: pop3state = 8; -pub const POP3_USER: pop3state = 7; -pub const POP3_APOP: pop3state = 6; -pub const POP3_AUTH: pop3state = 5; -pub const POP3_UPGRADETLS: pop3state = 4; -pub const POP3_STARTTLS: pop3state = 3; -pub const POP3_CAPA: pop3state = 2; -pub const POP3_SERVERGREET: pop3state = 1; -pub const POP3_STOP: pop3state = 0; #[derive(Copy, Clone)] #[repr(C)] pub struct imap_conn { @@ -1937,107 +1017,6 @@ pub struct imap_conn { pub mailbox_uidvalidity: *mut libc::c_char, pub dyn_0: dynbuf, } -pub type imapstate = libc::c_uint; -pub const IMAP_LAST: imapstate = 15; -pub const IMAP_LOGOUT: imapstate = 14; -pub const IMAP_SEARCH: imapstate = 13; -pub const IMAP_APPEND_FINAL: imapstate = 12; -pub const IMAP_APPEND: imapstate = 11; -pub const IMAP_FETCH_FINAL: imapstate = 10; -pub const IMAP_FETCH: imapstate = 9; -pub const IMAP_SELECT: imapstate = 8; -pub const IMAP_LIST: imapstate = 7; -pub const IMAP_LOGIN: imapstate = 6; -pub const IMAP_AUTHENTICATE: imapstate = 5; -pub const IMAP_UPGRADETLS: imapstate = 4; -pub const IMAP_STARTTLS: imapstate = 3; -pub const IMAP_CAPABILITY: imapstate = 2; -pub const IMAP_SERVERGREET: imapstate = 1; -pub const IMAP_STOP: imapstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ssh_conn { - pub authlist: *const libc::c_char, - pub passphrase: *const libc::c_char, - pub rsa_pub: *mut libc::c_char, - pub rsa: *mut libc::c_char, - pub authed: bool, - pub acceptfail: bool, - pub state: sshstate, - pub nextstate: sshstate, - pub actualcode: CURLcode, - pub quote_item: *mut curl_slist, - pub quote_path1: *mut libc::c_char, - pub quote_path2: *mut libc::c_char, - pub homedir: *mut libc::c_char, - pub readdir_line: *mut libc::c_char, - pub secondCreateDirs: libc::c_int, - pub orig_waitfor: libc::c_int, - pub slash_pos: *mut libc::c_char, -} -pub type sshstate = libc::c_int; -pub const SSH_LAST: sshstate = 60; -pub const SSH_QUIT: sshstate = 59; -pub const SSH_SESSION_FREE: sshstate = 58; -pub const SSH_SESSION_DISCONNECT: sshstate = 57; -pub const SSH_SCP_CHANNEL_FREE: sshstate = 56; -pub const SSH_SCP_WAIT_CLOSE: sshstate = 55; -pub const SSH_SCP_WAIT_EOF: sshstate = 54; -pub const SSH_SCP_SEND_EOF: sshstate = 53; -pub const SSH_SCP_DONE: sshstate = 52; -pub const SSH_SCP_DOWNLOAD: sshstate = 51; -pub const SSH_SCP_DOWNLOAD_INIT: sshstate = 50; -pub const SSH_SCP_UPLOAD_INIT: sshstate = 49; -pub const SSH_SCP_TRANS_INIT: sshstate = 48; -pub const SSH_SFTP_SHUTDOWN: sshstate = 47; -pub const SSH_SFTP_CLOSE: sshstate = 46; -pub const SSH_SFTP_DOWNLOAD_STAT: sshstate = 45; -pub const SSH_SFTP_DOWNLOAD_INIT: sshstate = 44; -pub const SSH_SFTP_READDIR_DONE: sshstate = 43; -pub const SSH_SFTP_READDIR_BOTTOM: sshstate = 42; -pub const SSH_SFTP_READDIR_LINK: sshstate = 41; -pub const SSH_SFTP_READDIR: sshstate = 40; -pub const SSH_SFTP_READDIR_INIT: sshstate = 39; -pub const SSH_SFTP_CREATE_DIRS_MKDIR: sshstate = 38; -pub const SSH_SFTP_CREATE_DIRS: sshstate = 37; -pub const SSH_SFTP_CREATE_DIRS_INIT: sshstate = 36; -pub const SSH_SFTP_UPLOAD_INIT: sshstate = 35; -pub const SSH_SFTP_TRANS_INIT: sshstate = 34; -pub const SSH_SFTP_FILETIME: sshstate = 33; -pub const SSH_SFTP_GETINFO: sshstate = 32; -pub const SSH_SFTP_QUOTE_STATVFS: sshstate = 31; -pub const SSH_SFTP_QUOTE_UNLINK: sshstate = 30; -pub const SSH_SFTP_QUOTE_RMDIR: sshstate = 29; -pub const SSH_SFTP_QUOTE_RENAME: sshstate = 28; -pub const SSH_SFTP_QUOTE_MKDIR: sshstate = 27; -pub const SSH_SFTP_QUOTE_SYMLINK: sshstate = 26; -pub const SSH_SFTP_QUOTE_SETSTAT: sshstate = 25; -pub const SSH_SFTP_QUOTE_STAT: sshstate = 24; -pub const SSH_SFTP_NEXT_QUOTE: sshstate = 23; -pub const SSH_SFTP_QUOTE: sshstate = 22; -pub const SSH_SFTP_POSTQUOTE_INIT: sshstate = 21; -pub const SSH_SFTP_QUOTE_INIT: sshstate = 20; -pub const SSH_SFTP_REALPATH: sshstate = 19; -pub const SSH_SFTP_INIT: sshstate = 18; -pub const SSH_AUTH_DONE: sshstate = 17; -pub const SSH_AUTH_GSSAPI: sshstate = 16; -pub const SSH_AUTH_KEY: sshstate = 15; -pub const SSH_AUTH_KEY_INIT: sshstate = 14; -pub const SSH_AUTH_HOST: sshstate = 13; -pub const SSH_AUTH_HOST_INIT: sshstate = 12; -pub const SSH_AUTH_AGENT: sshstate = 11; -pub const SSH_AUTH_AGENT_LIST: sshstate = 10; -pub const SSH_AUTH_AGENT_INIT: sshstate = 9; -pub const SSH_AUTH_PASS: sshstate = 8; -pub const SSH_AUTH_PASS_INIT: sshstate = 7; -pub const SSH_AUTH_PKEY: sshstate = 6; -pub const SSH_AUTH_PKEY_INIT: sshstate = 5; -pub const SSH_AUTHLIST: sshstate = 4; -pub const SSH_HOSTKEY: sshstate = 3; -pub const SSH_S_STARTUP: sshstate = 2; -pub const SSH_INIT: sshstate = 1; -pub const SSH_STOP: sshstate = 0; -pub const SSH_NO_STATE: sshstate = -1; #[derive(Copy, Clone)] #[repr(C)] pub struct http_conn { @@ -2045,8 +1024,8 @@ pub struct http_conn { pub binlen: size_t, pub trnsfr: *mut Curl_easy, pub h2: *mut nghttp2_session, - pub send_underlying: Option, - pub recv_underlying: Option, + pub send_underlying: Option::, + pub recv_underlying: Option::, pub inbuf: *mut libc::c_char, pub inbuflen: size_t, pub nread_inbuf: size_t, @@ -2056,18 +1035,6 @@ pub struct http_conn { pub local_settings: [nghttp2_settings_entry; 3], pub local_settings_num: size_t, } -#[derive(Copy, Clone)] -#[repr(C)] -pub struct nghttp2_settings_entry { - pub settings_id: int32_t, - pub value: uint32_t, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct h2settings { - pub max_concurrent_streams: uint32_t, - pub enable_push: bool, -} pub type Curl_recv = unsafe extern "C" fn( *mut Curl_easy, libc::c_int, @@ -2109,94 +1076,72 @@ pub struct ftp_conn { pub server_os: *mut libc::c_char, pub known_filesize: curl_off_t, } -pub type ftpstate = libc::c_uint; -pub const FTP_LAST: ftpstate = 35; -pub const FTP_QUIT: ftpstate = 34; -pub const FTP_STOR: ftpstate = 33; -pub const FTP_RETR: ftpstate = 32; -pub const FTP_LIST: ftpstate = 31; -pub const FTP_PASV: ftpstate = 30; -pub const FTP_PRET: ftpstate = 29; -pub const FTP_PORT: ftpstate = 28; -pub const FTP_RETR_REST: ftpstate = 27; -pub const FTP_REST: ftpstate = 26; -pub const FTP_STOR_SIZE: ftpstate = 25; -pub const FTP_RETR_SIZE: ftpstate = 24; -pub const FTP_SIZE: ftpstate = 23; -pub const FTP_STOR_TYPE: ftpstate = 22; -pub const FTP_RETR_TYPE: ftpstate = 21; -pub const FTP_LIST_TYPE: ftpstate = 20; -pub const FTP_TYPE: ftpstate = 19; -pub const FTP_MDTM: ftpstate = 18; -pub const FTP_MKD: ftpstate = 17; -pub const FTP_CWD: ftpstate = 16; -pub const FTP_POSTQUOTE: ftpstate = 15; -pub const FTP_STOR_PREQUOTE: ftpstate = 14; -pub const FTP_RETR_PREQUOTE: ftpstate = 13; -pub const FTP_QUOTE: ftpstate = 12; -pub const FTP_NAMEFMT: ftpstate = 11; -pub const FTP_SYST: ftpstate = 10; -pub const FTP_PWD: ftpstate = 9; -pub const FTP_CCC: ftpstate = 8; -pub const FTP_PROT: ftpstate = 7; -pub const FTP_PBSZ: ftpstate = 6; -pub const FTP_ACCT: ftpstate = 5; -pub const FTP_PASS: ftpstate = 4; -pub const FTP_USER: ftpstate = 3; -pub const FTP_AUTH: ftpstate = 2; -pub const FTP_WAIT220: ftpstate = 1; -pub const FTP_STOP: ftpstate = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct ntlmdata { - pub flags: libc::c_uint, - pub nonce: [libc::c_uchar; 8], - pub target_info_len: libc::c_uint, - pub target_info: *mut libc::c_void, - pub ntlm_auth_hlpr_socket: curl_socket_t, - pub ntlm_auth_hlpr_pid: pid_t, - pub challenge: *mut libc::c_char, - pub response: *mut libc::c_char, -} -pub type curlntlm = libc::c_uint; -pub const NTLMSTATE_LAST: curlntlm = 4; -pub const NTLMSTATE_TYPE3: curlntlm = 3; -pub const NTLMSTATE_TYPE2: curlntlm = 2; -pub const NTLMSTATE_TYPE1: curlntlm = 1; -pub const NTLMSTATE_NONE: curlntlm = 0; #[derive(Copy, Clone)] #[repr(C)] pub struct Curl_handler { pub scheme: *const libc::c_char, - pub setup_connection: - Option CURLcode>, - pub do_it: Option CURLcode>, - pub done: Option CURLcode>, - pub do_more: Option CURLcode>, - pub connect_it: Option CURLcode>, - pub connecting: Option CURLcode>, - pub doing: Option CURLcode>, - pub proto_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, + pub setup_connection: Option::< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata) -> CURLcode, + >, + pub do_it: Option:: CURLcode>, + pub done: Option:: CURLcode>, + pub do_more: Option::< + unsafe extern "C" fn(*mut Curl_easy, *mut libc::c_int) -> CURLcode, + >, + pub connect_it: Option::< + unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, >, - pub doing_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, + pub connecting: Option::< + unsafe extern "C" fn(*mut Curl_easy, *mut bool) -> CURLcode, >, - pub domore_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, + pub doing: Option:: CURLcode>, + pub proto_getsock: Option::< + unsafe extern "C" fn( + *mut Curl_easy, + *mut connectdata, + *mut curl_socket_t, + ) -> libc::c_int, >, - pub perform_getsock: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut curl_socket_t) -> libc::c_int, + pub doing_getsock: Option::< + unsafe extern "C" fn( + *mut Curl_easy, + *mut connectdata, + *mut curl_socket_t, + ) -> libc::c_int, >, - pub disconnect: - Option CURLcode>, - pub readwrite: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, *mut ssize_t, *mut bool) -> CURLcode, + pub domore_getsock: Option::< + unsafe extern "C" fn( + *mut Curl_easy, + *mut connectdata, + *mut curl_socket_t, + ) -> libc::c_int, >, - pub connection_check: Option< - unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, libc::c_uint) -> libc::c_uint, + pub perform_getsock: Option::< + unsafe extern "C" fn( + *mut Curl_easy, + *mut connectdata, + *mut curl_socket_t, + ) -> libc::c_int, >, - pub attach: Option ()>, + pub disconnect: Option::< + unsafe extern "C" fn(*mut Curl_easy, *mut connectdata, bool) -> CURLcode, + >, + pub readwrite: Option::< + unsafe extern "C" fn( + *mut Curl_easy, + *mut connectdata, + *mut ssize_t, + *mut bool, + ) -> CURLcode, + >, + pub connection_check: Option::< + unsafe extern "C" fn( + *mut Curl_easy, + *mut connectdata, + libc::c_uint, + ) -> libc::c_uint, + >, + pub attach: Option:: ()>, pub defport: libc::c_int, pub protocol: libc::c_uint, pub family: libc::c_uint, @@ -2204,51 +1149,6 @@ pub struct Curl_handler { } #[derive(Copy, Clone, BitfieldStruct)] #[repr(C)] -pub struct ConnectBits { - pub tcpconnect: [bool; 2], - pub proxy_ssl_connected: [bool; 2], - #[bitfield(name = "httpproxy", ty = "bit", bits = "0..=0")] - #[bitfield(name = "socksproxy", ty = "bit", bits = "1..=1")] - #[bitfield(name = "proxy_user_passwd", ty = "bit", bits = "2..=2")] - #[bitfield(name = "tunnel_proxy", ty = "bit", bits = "3..=3")] - #[bitfield(name = "proxy_connect_closed", ty = "bit", bits = "4..=4")] - #[bitfield(name = "close", ty = "bit", bits = "5..=5")] - #[bitfield(name = "reuse", ty = "bit", bits = "6..=6")] - #[bitfield(name = "altused", ty = "bit", bits = "7..=7")] - #[bitfield(name = "conn_to_host", ty = "bit", bits = "8..=8")] - #[bitfield(name = "conn_to_port", ty = "bit", bits = "9..=9")] - #[bitfield(name = "proxy", ty = "bit", bits = "10..=10")] - #[bitfield(name = "user_passwd", ty = "bit", bits = "11..=11")] - #[bitfield(name = "ipv6_ip", ty = "bit", bits = "12..=12")] - #[bitfield(name = "ipv6", ty = "bit", bits = "13..=13")] - #[bitfield(name = "do_more", ty = "bit", bits = "14..=14")] - #[bitfield(name = "protoconnstart", ty = "bit", bits = "15..=15")] - #[bitfield(name = "retry", ty = "bit", bits = "16..=16")] - #[bitfield(name = "authneg", ty = "bit", bits = "17..=17")] - #[bitfield(name = "rewindaftersend", ty = "bit", bits = "18..=18")] - #[bitfield(name = "ftp_use_epsv", ty = "bit", bits = "19..=19")] - #[bitfield(name = "ftp_use_eprt", ty = "bit", bits = "20..=20")] - #[bitfield(name = "ftp_use_data_ssl", ty = "bit", bits = "21..=21")] - #[bitfield(name = "ftp_use_control_ssl", ty = "bit", bits = "22..=22")] - #[bitfield(name = "netrc", ty = "bit", bits = "23..=23")] - #[bitfield(name = "bound", ty = "bit", bits = "24..=24")] - #[bitfield(name = "multiplex", ty = "bit", bits = "25..=25")] - #[bitfield(name = "tcp_fastopen", ty = "bit", bits = "26..=26")] - #[bitfield(name = "tls_enable_npn", ty = "bit", bits = "27..=27")] - #[bitfield(name = "tls_enable_alpn", ty = "bit", bits = "28..=28")] - #[bitfield(name = "connect_only", ty = "bit", bits = "29..=29")] - #[bitfield(name = "doh", ty = "bit", bits = "30..=30")] - #[bitfield(name = "abstract_unix_socket", ty = "bit", bits = "31..=31")] - #[bitfield(name = "tls_upgraded", ty = "bit", bits = "32..=32")] - #[bitfield(name = "sock_accepted", ty = "bit", bits = "33..=33")] - #[bitfield(name = "parallel_connect", ty = "bit", bits = "34..=34")] - pub httpproxy_socksproxy_proxy_user_passwd_tunnel_proxy_proxy_connect_closed_close_reuse_altused_conn_to_host_conn_to_port_proxy_user_passwd_ipv6_ip_ipv6_do_more_protoconnstart_retry_authneg_rewindaftersend_ftp_use_epsv_ftp_use_eprt_ftp_use_data_ssl_ftp_use_control_ssl_netrc_bound_multiplex_tcp_fastopen_tls_enable_npn_tls_enable_alpn_connect_only_doh_abstract_unix_socket_tls_upgraded_sock_accepted_parallel_connect: - [u8; 5], - #[bitfield(padding)] - pub c2rust_padding: [u8; 3], -} -#[derive(Copy, Clone, BitfieldStruct)] -#[repr(C)] pub struct ssl_connect_data { pub state: ssl_connection_state, pub connecting_state: ssl_connect_state, @@ -2258,170 +1158,7 @@ pub struct ssl_connect_data { #[bitfield(padding)] pub c2rust_padding: [u8; 7], } -pub type ssl_connect_state = libc::c_uint; -pub const ssl_connect_done: ssl_connect_state = 5; -pub const ssl_connect_3: ssl_connect_state = 4; -pub const ssl_connect_2_writing: ssl_connect_state = 3; -pub const ssl_connect_2_reading: ssl_connect_state = 2; -pub const ssl_connect_2: ssl_connect_state = 1; -pub const ssl_connect_1: ssl_connect_state = 0; -pub type ssl_connection_state = libc::c_uint; -pub const ssl_connection_complete: ssl_connection_state = 2; -pub const ssl_connection_negotiating: ssl_connection_state = 1; -pub const ssl_connection_none: ssl_connection_state = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct proxy_info { - pub host: hostname, - pub port: libc::c_long, - pub proxytype: curl_proxytype, - pub user: *mut libc::c_char, - pub passwd: *mut libc::c_char, -} -#[derive(Copy, Clone)] -#[repr(C)] -pub struct hostname { - pub rawalloc: *mut libc::c_char, - pub encalloc: *mut libc::c_char, - pub name: *mut libc::c_char, - pub dispname: *const libc::c_char, -} -pub type C2RustUnnamed_5 = libc::c_uint; -pub const TRNSPRT_QUIC: C2RustUnnamed_5 = 5; -pub const TRNSPRT_UDP: C2RustUnnamed_5 = 4; -pub const TRNSPRT_TCP: C2RustUnnamed_5 = 3; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct Curl_chunker { - pub datasize: curl_off_t, - pub state: ChunkyState, - pub hexindex: libc::c_uchar, - pub hexbuffer: [libc::c_char; 17], -} -pub type ChunkyState = libc::c_uint; -pub const CHUNK_TRAILER_POSTCR: ChunkyState = 7; -pub const CHUNK_TRAILER_CR: ChunkyState = 6; -pub const CHUNK_TRAILER: ChunkyState = 5; -pub const CHUNK_STOP: ChunkyState = 4; -pub const CHUNK_POSTLF: ChunkyState = 3; -pub const CHUNK_DATA: ChunkyState = 2; -pub const CHUNK_LF: ChunkyState = 1; -pub const CHUNK_HEX: ChunkyState = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct connstate { - pub state: connect_t, - pub outstanding: ssize_t, - pub outp: *mut libc::c_uchar, -} -pub type connect_t = libc::c_uint; -pub const CONNECT_DONE: connect_t = 17; -pub const CONNECT_REQ_READ_MORE: connect_t = 16; -pub const CONNECT_REQ_READ: connect_t = 15; -pub const CONNECT_REQ_SENDING: connect_t = 14; -pub const CONNECT_REQ_SEND: connect_t = 13; -pub const CONNECT_RESOLVE_REMOTE: connect_t = 12; -pub const CONNECT_RESOLVED: connect_t = 11; -pub const CONNECT_RESOLVING: connect_t = 10; -pub const CONNECT_REQ_INIT: connect_t = 9; -pub const CONNECT_AUTH_READ: connect_t = 8; -pub const CONNECT_AUTH_SEND: connect_t = 7; -pub const CONNECT_AUTH_INIT: connect_t = 6; -pub const CONNECT_GSSAPI_INIT: connect_t = 5; -pub const CONNECT_SOCKS_READ: connect_t = 4; -pub const CONNECT_SOCKS_READ_INIT: connect_t = 3; -pub const CONNECT_SOCKS_SEND: connect_t = 2; -pub const CONNECT_SOCKS_INIT: connect_t = 1; -pub const CONNECT_INIT: connect_t = 0; -pub type dupstring = libc::c_uint; -pub const STRING_LAST: dupstring = 80; -pub const STRING_AWS_SIGV4: dupstring = 79; -pub const STRING_COPYPOSTFIELDS: dupstring = 78; -pub const STRING_LASTZEROTERMINATED: dupstring = 77; -pub const STRING_SSL_EC_CURVES: dupstring = 76; -pub const STRING_DNS_LOCAL_IP6: dupstring = 75; -pub const STRING_DNS_LOCAL_IP4: dupstring = 74; -pub const STRING_DNS_INTERFACE: dupstring = 73; -pub const STRING_DNS_SERVERS: dupstring = 72; -pub const STRING_SASL_AUTHZID: dupstring = 71; -pub const STRING_HSTS: dupstring = 70; -pub const STRING_ALTSVC: dupstring = 69; -pub const STRING_DOH: dupstring = 68; -pub const STRING_TARGET: dupstring = 67; -pub const STRING_UNIX_SOCKET_PATH: dupstring = 66; -pub const STRING_BEARER: dupstring = 65; -pub const STRING_TLSAUTH_PASSWORD_PROXY: dupstring = 64; -pub const STRING_TLSAUTH_PASSWORD: dupstring = 63; -pub const STRING_TLSAUTH_USERNAME_PROXY: dupstring = 62; -pub const STRING_TLSAUTH_USERNAME: dupstring = 61; -pub const STRING_MAIL_AUTH: dupstring = 60; -pub const STRING_MAIL_FROM: dupstring = 59; -pub const STRING_SERVICE_NAME: dupstring = 58; -pub const STRING_PROXY_SERVICE_NAME: dupstring = 57; -pub const STRING_SSH_KNOWNHOSTS: dupstring = 56; -pub const STRING_SSH_HOST_PUBLIC_KEY_MD5: dupstring = 55; -pub const STRING_SSH_PUBLIC_KEY: dupstring = 54; -pub const STRING_SSH_PRIVATE_KEY: dupstring = 53; -pub const STRING_RTSP_TRANSPORT: dupstring = 52; -pub const STRING_RTSP_STREAM_URI: dupstring = 51; -pub const STRING_RTSP_SESSION_ID: dupstring = 50; -pub const STRING_NOPROXY: dupstring = 49; -pub const STRING_PROXYPASSWORD: dupstring = 48; -pub const STRING_PROXYUSERNAME: dupstring = 47; -pub const STRING_OPTIONS: dupstring = 46; -pub const STRING_PASSWORD: dupstring = 45; -pub const STRING_USERNAME: dupstring = 44; -pub const STRING_SSL_ENGINE: dupstring = 43; -pub const STRING_SSL_ISSUERCERT_PROXY: dupstring = 42; -pub const STRING_SSL_ISSUERCERT: dupstring = 41; -pub const STRING_SSL_CRLFILE_PROXY: dupstring = 40; -pub const STRING_SSL_CRLFILE: dupstring = 39; -pub const STRING_USERAGENT: dupstring = 38; -pub const STRING_SSL_RANDOM_FILE: dupstring = 37; -pub const STRING_SSL_EGDSOCKET: dupstring = 36; -pub const STRING_SSL_CIPHER13_LIST_PROXY: dupstring = 35; -pub const STRING_SSL_CIPHER13_LIST: dupstring = 34; -pub const STRING_SSL_CIPHER_LIST_PROXY: dupstring = 33; -pub const STRING_SSL_CIPHER_LIST: dupstring = 32; -pub const STRING_SSL_PINNEDPUBLICKEY_PROXY: dupstring = 31; -pub const STRING_SSL_PINNEDPUBLICKEY: dupstring = 30; -pub const STRING_SSL_CAFILE_PROXY: dupstring = 29; -pub const STRING_SSL_CAFILE: dupstring = 28; -pub const STRING_SSL_CAPATH_PROXY: dupstring = 27; -pub const STRING_SSL_CAPATH: dupstring = 26; -pub const STRING_SET_URL: dupstring = 25; -pub const STRING_SET_REFERER: dupstring = 24; -pub const STRING_SET_RANGE: dupstring = 23; -pub const STRING_PRE_PROXY: dupstring = 22; -pub const STRING_PROXY: dupstring = 21; -pub const STRING_NETRC_FILE: dupstring = 20; -pub const STRING_KRB_LEVEL: dupstring = 19; -pub const STRING_KEY_TYPE_PROXY: dupstring = 18; -pub const STRING_KEY_TYPE: dupstring = 17; -pub const STRING_KEY_PASSWD_PROXY: dupstring = 16; -pub const STRING_KEY_PASSWD: dupstring = 15; -pub const STRING_KEY_PROXY: dupstring = 14; -pub const STRING_KEY: dupstring = 13; -pub const STRING_FTPPORT: dupstring = 12; -pub const STRING_FTP_ALTERNATIVE_TO_USER: dupstring = 11; -pub const STRING_FTP_ACCOUNT: dupstring = 10; -pub const STRING_ENCODING: dupstring = 9; -pub const STRING_DEVICE: dupstring = 8; -pub const STRING_DEFAULT_PROTOCOL: dupstring = 7; -pub const STRING_CUSTOMREQUEST: dupstring = 6; -pub const STRING_COOKIEJAR: dupstring = 5; -pub const STRING_COOKIE: dupstring = 4; -pub const STRING_CERT_TYPE_PROXY: dupstring = 3; -pub const STRING_CERT_TYPE: dupstring = 2; -pub const STRING_CERT_PROXY: dupstring = 1; -pub const STRING_CERT: dupstring = 0; -#[derive(Copy, Clone)] -#[repr(C)] -pub struct bufref { - pub dtor: Option ()>, - pub ptr: *const libc::c_uchar, - pub len: size_t, -} + #[no_mangle] pub unsafe extern "C" fn Curl_input_ntlm( mut data: *mut Curl_easy, @@ -2448,7 +1185,8 @@ pub unsafe extern "C" fn Curl_input_ntlm( strlen(b"NTLM\0" as *const u8 as *const libc::c_char), ) != 0 { - header = header.offset(strlen(b"NTLM\0" as *const u8 as *const libc::c_char) as isize); + header = header + .offset(strlen(b"NTLM\0" as *const u8 as *const libc::c_char) as isize); while *header as libc::c_int != 0 && Curl_isspace(*header as libc::c_uchar as libc::c_int) != 0 { @@ -2485,7 +1223,9 @@ pub unsafe extern "C" fn Curl_input_ntlm( b"NTLM auth restarted\0" as *const u8 as *const libc::c_char, ); Curl_http_auth_cleanup_ntlm(conn); - } else if *state as libc::c_uint == NTLMSTATE_TYPE3 as libc::c_int as libc::c_uint { + } else if *state as libc::c_uint + == NTLMSTATE_TYPE3 as libc::c_int as libc::c_uint + { Curl_infof( data, b"NTLM handshake rejected\0" as *const u8 as *const libc::c_char, @@ -2494,7 +1234,9 @@ pub unsafe extern "C" fn Curl_input_ntlm( *state = NTLMSTATE_NONE; return CURLE_REMOTE_ACCESS_DENIED; } else { - if *state as libc::c_uint >= NTLMSTATE_TYPE1 as libc::c_int as libc::c_uint { + if *state as libc::c_uint + >= NTLMSTATE_TYPE1 as libc::c_int as libc::c_uint + { Curl_infof( data, b"NTLM handshake failure (internal error)\0" as *const u8 @@ -2509,7 +1251,10 @@ pub unsafe extern "C" fn Curl_input_ntlm( return result; } #[no_mangle] -pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: bool) -> CURLcode { +pub unsafe extern "C" fn Curl_output_ntlm( + mut data: *mut Curl_easy, + mut proxy: bool, +) -> CURLcode { let mut base64: *mut libc::c_char = 0 as *mut libc::c_char; let mut len: size_t = 0 as libc::c_int as size_t; let mut result: CURLcode = CURLE_OK; @@ -2531,13 +1276,16 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b allocuserpwd = &mut (*data).state.aptr.proxyuserpwd; userp = (*data).state.aptr.proxyuser; passwdp = (*data).state.aptr.proxypasswd; - service = - if !((*data).set.str_0[STRING_PROXY_SERVICE_NAME as libc::c_int as usize]).is_null() { - (*data).set.str_0[STRING_PROXY_SERVICE_NAME as libc::c_int as usize] - as *const libc::c_char - } else { - b"HTTP\0" as *const u8 as *const libc::c_char - }; + service = if !((*data) + .set + .str_0[STRING_PROXY_SERVICE_NAME as libc::c_int as usize]) + .is_null() + { + (*data).set.str_0[STRING_PROXY_SERVICE_NAME as libc::c_int as usize] + as *const libc::c_char + } else { + b"HTTP\0" as *const u8 as *const libc::c_char + }; hostname = (*conn).http_proxy.host.name; ntlm = &mut (*conn).proxyntlm; state = &mut (*conn).proxy_ntlm_state; @@ -2546,8 +1294,11 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b allocuserpwd = &mut (*data).state.aptr.userpwd; userp = (*data).state.aptr.user; passwdp = (*data).state.aptr.passwd; - service = if !((*data).set.str_0[STRING_SERVICE_NAME as libc::c_int as usize]).is_null() { - (*data).set.str_0[STRING_SERVICE_NAME as libc::c_int as usize] as *const libc::c_char + service = if !((*data).set.str_0[STRING_SERVICE_NAME as libc::c_int as usize]) + .is_null() + { + (*data).set.str_0[STRING_SERVICE_NAME as libc::c_int as usize] + as *const libc::c_char } else { b"HTTP\0" as *const u8 as *const libc::c_char }; @@ -2567,7 +1318,13 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b let mut current_block_61: u64; match *state as libc::c_uint { 2 => { - result = Curl_auth_create_ntlm_type3_message(data, userp, passwdp, ntlm, &mut ntlmmsg); + result = Curl_auth_create_ntlm_type3_message( + data, + userp, + passwdp, + ntlm, + &mut ntlmmsg, + ); if result as u64 == 0 && Curl_bufref_len(&mut ntlmmsg) != 0 { result = Curl_base64_encode( data, @@ -2577,11 +1334,13 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b &mut len, ); if result as u64 == 0 { - Curl_cfree.expect("non-null function pointer")( - *allocuserpwd as *mut libc::c_void, - ); + Curl_cfree + .expect( + "non-null function pointer", + )(*allocuserpwd as *mut libc::c_void); *allocuserpwd = curl_maprintf( - b"%sAuthorization: NTLM %s\r\n\0" as *const u8 as *const libc::c_char, + b"%sAuthorization: NTLM %s\r\n\0" as *const u8 + as *const libc::c_char, if proxy as libc::c_int != 0 { b"Proxy-\0" as *const u8 as *const libc::c_char } else { @@ -2589,7 +1348,10 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b }, base64, ); - Curl_cfree.expect("non-null function pointer")(base64 as *mut libc::c_void); + Curl_cfree + .expect( + "non-null function pointer", + )(base64 as *mut libc::c_void); if (*allocuserpwd).is_null() { result = CURLE_OUT_OF_MEMORY; } else { @@ -2602,10 +1364,10 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b } 3 => { *state = NTLMSTATE_LAST; - current_block_61 = 12473531611435473340; + current_block_61 = 660359442149512078; } 4 => { - current_block_61 = 12473531611435473340; + current_block_61 = 660359442149512078; } 1 | _ => { result = Curl_auth_create_ntlm_type1_message( @@ -2626,11 +1388,13 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b &mut len, ); if result as u64 == 0 { - Curl_cfree.expect("non-null function pointer")( - *allocuserpwd as *mut libc::c_void, - ); + Curl_cfree + .expect( + "non-null function pointer", + )(*allocuserpwd as *mut libc::c_void); *allocuserpwd = curl_maprintf( - b"%sAuthorization: NTLM %s\r\n\0" as *const u8 as *const libc::c_char, + b"%sAuthorization: NTLM %s\r\n\0" as *const u8 + as *const libc::c_char, if proxy as libc::c_int != 0 { b"Proxy-\0" as *const u8 as *const libc::c_char } else { @@ -2638,7 +1402,10 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b }, base64, ); - Curl_cfree.expect("non-null function pointer")(base64 as *mut libc::c_void); + Curl_cfree + .expect( + "non-null function pointer", + )(base64 as *mut libc::c_void); if (*allocuserpwd).is_null() { result = CURLE_OUT_OF_MEMORY; } @@ -2648,8 +1415,9 @@ pub unsafe extern "C" fn Curl_output_ntlm(mut data: *mut Curl_easy, mut proxy: b } } match current_block_61 { - 12473531611435473340 => { - Curl_cfree.expect("non-null function pointer")(*allocuserpwd as *mut libc::c_void); + 660359442149512078 => { + Curl_cfree + .expect("non-null function pointer")(*allocuserpwd as *mut libc::c_void); *allocuserpwd = 0 as *mut libc::c_char; (*authp).set_done(1 as libc::c_int as bit); } @@ -2663,4 +1431,4 @@ pub unsafe extern "C" fn Curl_http_auth_cleanup_ntlm(mut conn: *mut connectdata) Curl_auth_cleanup_ntlm(&mut (*conn).ntlm); Curl_auth_cleanup_ntlm(&mut (*conn).proxyntlm); Curl_http_auth_cleanup_ntlm_wb(conn); -} +} \ No newline at end of file diff --git a/rust/rust_project/src/http_proxy.rs b/rust/rust_project/src/http_proxy.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/bearssl.rs b/rust/rust_project/src/vtls/bearssl.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/gskit.rs b/rust/rust_project/src/vtls/gskit.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/gtls.rs b/rust/rust_project/src/vtls/gtls.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/keylog.rs b/rust/rust_project/src/vtls/keylog.rs new file mode 100644 index 0000000..8789ff7 --- /dev/null +++ b/rust/rust_project/src/vtls/keylog.rs @@ -0,0 +1,209 @@ +use ::libc; +use rust_ffi::src::ffi_alias::type_alias::*; +// use rust_ffi::src::ffi_fun::fun_call::*; +// use rust_ffi::src::ffi_struct::struct_define::*; +extern "C" { + pub type _IO_wide_data; + pub type _IO_codecvt; + pub type _IO_marker; + fn curl_getenv(variable: *const libc::c_char) -> *mut libc::c_char; + fn fclose(__stream: *mut FILE) -> libc::c_int; + fn fopen(_: *const libc::c_char, _: *const libc::c_char) -> *mut FILE; + fn setvbuf( + __stream: *mut FILE, + __buf: *mut libc::c_char, + __modes: libc::c_int, + __n: size_t, + ) -> libc::c_int; + fn fputs(__s: *const libc::c_char, __stream: *mut FILE) -> libc::c_int; + fn memcpy( + _: *mut libc::c_void, + _: *const libc::c_void, + _: libc::c_ulong, + ) -> *mut libc::c_void; + fn strlen(_: *const libc::c_char) -> libc::c_ulong; + static mut Curl_cfree: curl_free_callback; +} +#[derive(Copy, Clone)] +#[repr(C)] +pub struct _IO_FILE { + pub _flags: libc::c_int, + pub _IO_read_ptr: *mut libc::c_char, + pub _IO_read_end: *mut libc::c_char, + pub _IO_read_base: *mut libc::c_char, + pub _IO_write_base: *mut libc::c_char, + pub _IO_write_ptr: *mut libc::c_char, + pub _IO_write_end: *mut libc::c_char, + pub _IO_buf_base: *mut libc::c_char, + pub _IO_buf_end: *mut libc::c_char, + pub _IO_save_base: *mut libc::c_char, + pub _IO_backup_base: *mut libc::c_char, + pub _IO_save_end: *mut libc::c_char, + pub _markers: *mut _IO_marker, + pub _chain: *mut _IO_FILE, + pub _fileno: libc::c_int, + pub _flags2: libc::c_int, + pub _old_offset: __off_t, + pub _cur_column: libc::c_ushort, + pub _vtable_offset: libc::c_schar, + pub _shortbuf: [libc::c_char; 1], + pub _lock: *mut libc::c_void, + pub _offset: __off64_t, + pub _codecvt: *mut _IO_codecvt, + pub _wide_data: *mut _IO_wide_data, + pub _freeres_list: *mut _IO_FILE, + pub _freeres_buf: *mut libc::c_void, + pub __pad5: size_t, + pub _mode: libc::c_int, + pub _unused2: [libc::c_char; 20], +} +pub type FILE = _IO_FILE; + +static mut keylog_file_fp: *mut FILE = 0 as *const FILE as *mut FILE; +#[no_mangle] +pub unsafe extern "C" fn Curl_tls_keylog_open() { + let mut keylog_file_name: *mut libc::c_char = 0 as *mut libc::c_char; + if keylog_file_fp.is_null() { + keylog_file_name = curl_getenv( + b"SSLKEYLOGFILE\0" as *const u8 as *const libc::c_char, + ); + if !keylog_file_name.is_null() { + keylog_file_fp = fopen( + keylog_file_name, + b"a\0" as *const u8 as *const libc::c_char, + ); + if !keylog_file_fp.is_null() { + if setvbuf( + keylog_file_fp, + 0 as *mut libc::c_char, + 1 as libc::c_int, + 4096 as libc::c_int as size_t, + ) != 0 + { + fclose(keylog_file_fp); + keylog_file_fp = 0 as *mut FILE; + } + } + Curl_cfree + .expect( + "non-null function pointer", + )(keylog_file_name as *mut libc::c_void); + keylog_file_name = 0 as *mut libc::c_char; + } + } +} +#[no_mangle] +pub unsafe extern "C" fn Curl_tls_keylog_close() { + if !keylog_file_fp.is_null() { + fclose(keylog_file_fp); + keylog_file_fp = 0 as *mut FILE; + } +} +#[no_mangle] +pub unsafe extern "C" fn Curl_tls_keylog_enabled() -> bool { + return !keylog_file_fp.is_null(); +} +#[no_mangle] +pub unsafe extern "C" fn Curl_tls_keylog_write_line( + mut line: *const libc::c_char, +) -> bool { + let mut linelen: size_t = 0; + let mut buf: [libc::c_char; 256] = [0; 256]; + if keylog_file_fp.is_null() || line.is_null() { + return 0 as libc::c_int != 0; + } + linelen = strlen(line); + if linelen == 0 as libc::c_int as libc::c_ulong + || linelen + > (::std::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong) + .wrapping_sub(2 as libc::c_int as libc::c_ulong) + { + return 0 as libc::c_int != 0; + } + memcpy(buf.as_mut_ptr() as *mut libc::c_void, line as *const libc::c_void, linelen); + if *line.offset(linelen.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize) + as libc::c_int != '\n' as i32 + { + let fresh0 = linelen; + linelen = linelen.wrapping_add(1); + buf[fresh0 as usize] = '\n' as i32 as libc::c_char; + } + buf[linelen as usize] = '\0' as i32 as libc::c_char; + fputs(buf.as_mut_ptr(), keylog_file_fp); + return 1 as libc::c_int != 0; +} +#[no_mangle] +pub unsafe extern "C" fn Curl_tls_keylog_write( + mut label: *const libc::c_char, + mut client_random: *const libc::c_uchar, + mut secret: *const libc::c_uchar, + mut secretlen: size_t, +) -> bool { + let mut hex: *const libc::c_char = b"0123456789ABCDEF\0" as *const u8 + as *const libc::c_char; + let mut pos: size_t = 0; + let mut i: size_t = 0; + let mut line: [libc::c_char; 195] = [0; 195]; + if keylog_file_fp.is_null() { + return 0 as libc::c_int != 0; + } + pos = strlen(label); + if pos + > (::std::mem::size_of::<[libc::c_char; 32]>() as libc::c_ulong) + .wrapping_sub(1 as libc::c_int as libc::c_ulong) || secretlen == 0 + || secretlen > 48 as libc::c_int as libc::c_ulong + { + return 0 as libc::c_int != 0; + } + memcpy(line.as_mut_ptr() as *mut libc::c_void, label as *const libc::c_void, pos); + let fresh1 = pos; + pos = pos.wrapping_add(1); + line[fresh1 as usize] = ' ' as i32 as libc::c_char; + i = 0 as libc::c_int as size_t; + while i < 32 as libc::c_int as libc::c_ulong { + let fresh2 = pos; + pos = pos.wrapping_add(1); + line[fresh2 + as usize] = *hex + .offset( + (*client_random.offset(i as isize) as libc::c_int >> 4 as libc::c_int) + as isize, + ); + let fresh3 = pos; + pos = pos.wrapping_add(1); + line[fresh3 + as usize] = *hex + .offset( + (*client_random.offset(i as isize) as libc::c_int & 0xf as libc::c_int) + as isize, + ); + i = i.wrapping_add(1); + } + let fresh4 = pos; + pos = pos.wrapping_add(1); + line[fresh4 as usize] = ' ' as i32 as libc::c_char; + i = 0 as libc::c_int as size_t; + while i < secretlen { + let fresh5 = pos; + pos = pos.wrapping_add(1); + line[fresh5 + as usize] = *hex + .offset( + (*secret.offset(i as isize) as libc::c_int >> 4 as libc::c_int) as isize, + ); + let fresh6 = pos; + pos = pos.wrapping_add(1); + line[fresh6 + as usize] = *hex + .offset( + (*secret.offset(i as isize) as libc::c_int & 0xf as libc::c_int) as isize, + ); + i = i.wrapping_add(1); + } + let fresh7 = pos; + pos = pos.wrapping_add(1); + line[fresh7 as usize] = '\n' as i32 as libc::c_char; + line[pos as usize] = '\0' as i32 as libc::c_char; + fputs(line.as_mut_ptr(), keylog_file_fp); + return 1 as libc::c_int != 0; +} \ No newline at end of file diff --git a/rust/rust_project/src/vtls/mbedtls.rs b/rust/rust_project/src/vtls/mbedtls.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/mbedtls_threadlock.rs b/rust/rust_project/src/vtls/mbedtls_threadlock.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/mesalink.rs b/rust/rust_project/src/vtls/mesalink.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/nss.rs b/rust/rust_project/src/vtls/nss.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/openssl.rs b/rust/rust_project/src/vtls/openssl.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/rustls.rs b/rust/rust_project/src/vtls/rustls.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/schannel.rs b/rust/rust_project/src/vtls/schannel.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/schannel_verify.rs b/rust/rust_project/src/vtls/schannel_verify.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/sectransp.rs b/rust/rust_project/src/vtls/sectransp.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/vtls.rs b/rust/rust_project/src/vtls/vtls.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust/rust_project/src/vtls/wolfssl.rs b/rust/rust_project/src/vtls/wolfssl.rs new file mode 100644 index 0000000..e69de29 -- Gitee