curl之网络接口

2024-02-03 05:04
文章标签 curl 网络接口

本文主要是介绍curl之网络接口,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Curl_cftype

连接接口定义

struct Curl_cftype {const char *name;                       /* name of the filter type */int flags;                              /* flags of filter type */int log_level;                          /* log level for such filters */Curl_cft_destroy_this *destroy;         /* destroy resources of this cf */Curl_cft_connect *do_connect;           /* establish connection */Curl_cft_close *do_close;               /* close conn */Curl_cft_get_host *get_host;            /* host filter talks to */Curl_cft_adjust_pollset *adjust_pollset; /* adjust transfer poll set */Curl_cft_data_pending *has_data_pending;/* conn has data pending */Curl_cft_send *do_send;                 /* send data */Curl_cft_recv *do_recv;                 /* receive data */Curl_cft_cntrl *cntrl;                  /* events/control */Curl_cft_conn_is_alive *is_alive;       /* FALSE if conn is dead, Jim! */Curl_cft_conn_keep_alive *keep_alive;   /* try to keep it alive */Curl_cft_query *query;                  /* query filter chain */
};

初始化Curl_cftype类型数组

数组定义为struct Curl_cftype *cf_types

static struct Curl_cftype *cf_types[] = {&Curl_cft_tcp,&Curl_cft_udp,&Curl_cft_unix,&Curl_cft_tcp_accept,&Curl_cft_happy_eyeballs,&Curl_cft_setup,
#ifdef USE_NGHTTP2&Curl_cft_nghttp2,
#endif
#ifdef USE_SSL&Curl_cft_ssl,
#ifndef CURL_DISABLE_PROXY&Curl_cft_ssl_proxy,
#endif
#endif
#if !defined(CURL_DISABLE_PROXY)
#if !defined(CURL_DISABLE_HTTP)&Curl_cft_h1_proxy,
#ifdef USE_NGHTTP2&Curl_cft_h2_proxy,
#endif&Curl_cft_http_proxy,
#endif /* !CURL_DISABLE_HTTP */&Curl_cft_haproxy,&Curl_cft_socks_proxy,
#endif /* !CURL_DISABLE_PROXY */
#ifdef ENABLE_QUIC&Curl_cft_http3,
#endif
#if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER)&Curl_cft_http_connect,
#endifNULL,
};

Curl_cfilter

连接处理链

struct Curl_cfilter {const struct Curl_cftype *cft; /* the type providing implementation */struct Curl_cfilter *next;     /* next filter in chain */void *ctx;                     /* filter type specific settings */struct connectdata *conn;      /* the connection this filter belongs to */int sockindex;                 /* the index the filter is installed at */BIT(connected);                /* != 0 iff this filter is connected */
};

transport_provider

定义如下

struct transport_provider {int transport;cf_ip_connect_create *cf_create;
};

初始化代码为

struct transport_provider transport_providers[] = {{ TRNSPRT_TCP, Curl_cf_tcp_create },
#ifdef ENABLE_QUIC{ TRNSPRT_QUIC, Curl_cf_quic_create },
#endif
#ifndef CURL_DISABLE_TFTP{ TRNSPRT_UDP, Curl_cf_udp_create },
#endif
#ifdef USE_UNIX_SOCKETS{ TRNSPRT_UNIX, Curl_cf_unix_create },
#endif
};

这篇关于curl之网络接口的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/673057

相关文章

使用Java实现一个解析CURL脚本小工具

《使用Java实现一个解析CURL脚本小工具》文章介绍了如何使用Java实现一个解析CURL脚本的工具,该工具可以将CURL脚本中的Header解析为KVMap结构,获取URL路径、请求类型,解析UR... 目录使用示例实现原理具体实现CurlParserUtilCurlEntityICurlHandler

Linux中Curl参数详解实践应用

《Linux中Curl参数详解实践应用》在现代网络开发和运维工作中,curl命令是一个不可或缺的工具,它是一个利用URL语法在命令行下工作的文件传输工具,支持多种协议,如HTTP、HTTPS、FTP等... 目录引言一、基础请求参数1. -X 或 --request2. -d 或 --data3. -H 或

redmine安装企业微信和钉钉插件遇到curl类库问题

我开发的这个插件地址如下: 官方注册地址: http://www.redmine.org/plugins/redmine_work_wechat 代码库: https://bitbucket.org/39648421/redmine_work_wechat 最近部署和安装全新的开发环境,安装时有一些备忘: 有些系统的环境没有curl底层支持库,比如linux下需要libcurl.so,则在启动服

error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL_ errno 10054解决方法

error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054解决方法 不敢保证一定能解决,通过搜索多方博客尝试寻找解决方案,最后clone成功。(PS:不保证能成功) http://www.wangxianfeng.cn/wordpress/2018/07/14/git使用过程中常见错误解决/ https:

深入理解 Linux 的 ping、telnet 和 curl 命令

深入理解 Linux 的 ping、telnet 和 curl 命令 在 Linux 系统中,网络调试和测试是日常运维工作的重要部分。ping、telnet 和 curl 是常用的网络命令工具,用于测试网络连接、访问远程服务器和发送 HTTP 请求等操作。本文将详细介绍这些命令的语法、使用场景和区别,尤其是 curl 命令中的 GET 和 POST 请求。 1. ping 命令 1.1

HTB-lgnition(curl工具、yakit、 弱口令)

前言 各位师傅大家好,我是qmx_07,今天来讲解lgnition靶机 渗透流程 信息搜集 服务器开放了80 http端口 curl工具 介绍:curl工具是一个用于发送HTTP请求的命令行工具。它支持多种协议,包括HTTP、HTTPS、FTP、SMTP等,并且支持各种常见的操作,如GET、POST、PUT、DELETE等。 -v显示输出与请求和响应相关的详细信息,包括请求头

curl 出现一些意料外的状态

我想用curl采集nginx的状态信息,然后用awk取值 正常curl情况是这样的: [root@localhost ~]# curl http://www.xxx.com/NginxStatus Active connections: 16392 server accepts handled requests 9711388219 9711388219 2252280420

Linux基础 -- 网络工具之curl使用

curl 使用手册 curl 是一个强大的命令行工具,用于与服务器进行HTTP请求。本文档将介绍常见的请求方法和一些高级用法。 基础用法 1. GET 请求 GET 请求用于从服务器获取数据。 curl -X GET "http://example.com/api/resource" 2. POST 请求 POST 请求用于向服务器发送数据,通常用于创建新资源。 curl -X

curl: (7) couldn't connect to host 解决方法

使用curl命令访问网站时报错: [root@bqh-119 ~]# curl -I www.test.comcurl: (7) couldn't connect to host[root@bqh-119 ~]# curl -V #查询版本以及支持的协议curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zl