/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, 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 http://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 "setup.h"
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef __VMS
#include <in.h>
#include <inet.h>
#endif
#ifndef HAVE_SOCKET
#error "We can't compile without socket() support!"
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef USE_LIBIDN
#include <idna.h>
#include <tld.h>
#include <stringprep.h>
#ifdef HAVE_IDN_FREE_H
#include <idn-free.h>
#else
/* prototype from idn-free.h, not provided by libidn 0.4.5's make install! */
void idn_free (void *ptr);
#endif
#ifndef HAVE_IDN_FREE
/* if idn_free() was not found in this version of libidn use free() instead */
#define idn_free(x) (free)(x)
#endif
#elif defined(USE_WIN32_IDN)
/* prototype for curl_win32_idn_to_ascii() */
int curl_win32_idn_to_ascii(const char *in, char **out);
#endif /* USE_LIBIDN */
#include "urldata.h"
#include "netrc.h"
#include "formdata.h"
#include "sslgen.h"
#include "hostip.h"
#include "transfer.h"
#include "sendf.h"
#include "progress.h"
#include "cookie.h"
#include "strequal.h"
#include "strerror.h"
#include "escape.h"
#include "strtok.h"
#include "share.h"
#include "content_encoding.h"
#include "http_digest.h"
#include "http_negotiate.h"
#include "select.h"
#include "multiif.h"
#include "easyif.h"
#include "speedcheck.h"
#include "rawstr.h"
#include "warnless.h"
#include "non-ascii.h"
#include "inet_pton.h"
/* And now for the protocols */
#include "ftp.h"
#include "dict.h"
#include "telnet.h"
#include "tftp.h"
#include "http.h"
#include "file.h"
#include "curl_ldap.h"
#include "ssh.h"
#include "imap.h"
#include "url.h"
#include "connect.h"
#include "inet_ntop.h"
#include "curl_ntlm.h"
#include "curl_ntlm_wb.h"
#include "socks.h"
#include "curl_rtmp.h"
#include "gopher.h"
#include "http_proxy.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
#include "curl_memory.h"
/* The last #include file should be: */
#include "memdebug.h"
/* Local static prototypes */
static long ConnectionKillOne(struct SessionHandle *data);
static void conn_free(struct connectdata *conn);
static void signalPipeClose(struct curl_llist *pipeline, bool pipe_broke);
static CURLcode do_init(struct connectdata *conn);
static CURLcode parse_url_userpass(struct SessionHandle *data,
struct connectdata *conn,
char *user, char *passwd);
/*
* Protocol table.
*/
static const struct Curl_handler * const protocols[] = {
#ifndef CURL_DISABLE_HTTP
&Curl_handler_http,
#endif
#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)
&Curl_handler_https,
#endif
#ifndef CURL_DISABLE_FTP
&Curl_handler_ftp,
#endif
#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)
&Curl_handler_ftps,
#endif
#ifndef CURL_DISABLE_TELNET
&Curl_handler_telnet,
#endif
#ifndef CURL_DISABLE_DICT
&Curl_handler_dict,
#endif
#ifndef CURL_DISABLE_LDAP
&Curl_handler_ldap,
#if !defined(CURL_DISABLE_LDAPS) && \
((defined(USE_OPENLDAP) && defined(USE_SSL)) || \
(!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))
&Curl_handler_ldaps,
#endif
#endif
#ifndef CURL_DISABLE_FILE
&Curl_handler_file,
#endif
#ifndef CURL_DISABLE_TFTP
&Curl_handler_tftp,
#endif
#ifdef USE_LIBSSH2
&Curl_handler_scp,
&Curl_handler_sftp,
#endif
#ifndef CURL_DISABLE_IMAP
&Curl_handler_imap,
#ifdef USE_SSL
&Curl_handler_imaps,
#endif
#endif
#ifndef CURL_DISABLE_POP3
&Curl_handler_pop3,
#ifdef USE_SSL
&Curl_handler_pop3s,
#endif
#endif
#ifndef CURL_DISABLE_SMTP
&Curl_handler_smtp,
#ifdef USE_SSL
&Curl_handler_smtps,
#endif
#endif
#ifndef CURL_DISABLE_RTSP
&Curl_handler_rtsp,
#endif
#ifndef CURL_DISABLE_GOPHER
&Curl_handler_gopher,
#endif
#ifdef USE_LIBRTMP
&Curl_handler_rtmp,
&Curl_handler_rtmpt,
&Curl_handler_rtmpe,
&Curl_handler_rtmpte,
&Curl_handler_rtmps,
&Curl_handler_rtmpts,
#endif
(struct Curl_handler *) NULL
};
/*
* Dummy handler for undefined protocol schemes.
*/
static const struct Curl_handler Curl_handler_dummy = {
"<no protocol>", /* scheme */
ZERO_NULL, /* setup_connection */
ZERO_NULL, /* do_it */
ZERO_NULL, /* done */
ZERO_NULL, /* do_more */
ZERO_NULL, /* connect_it */
ZERO_NULL, /* connecting */
ZERO_NULL, /* doing */
ZERO_NULL, /* proto_getsock */
ZERO_NULL, /* doing_getsock */
ZERO_NULL, /* domore_getsock */
ZERO_NULL, /* perform_getsock */
ZERO_NULL, /* disconnect */
ZERO_NULL, /* readwrite */
0, /* defport */
0, /* protocol */
PROTOPT_NONE /* flags */
};
static void close_connections(struct SessionHandle *data)
{
/* Loop through all open connections and kill them one by one */
long i;
do {
i = ConnectionKillOne(data);
} while(i != -1L);
}
void Curl_freeset(struct SessionHandle * data)
{
/* Free all dynamic strings stored in the data->set substructure. */
enum dupstring i;
for(i=(enum dupstring)0; i < STRING_LAST; i++)
Curl_safefree(data->set.str[i]);
if(data->change.referer_alloc) {
Curl_safefree(data->change.referer);
data->change.referer_alloc = FALSE;
}
data->change.referer = NULL;
}
static CURLcode setstropt(char **charp, char * s)
{
/* Release the previous storage at `charp' and replace by a dynamic storage
copy of `s'. Return CURLE_OK or CURLE_OUT_OF_MEMORY. */
Curl_safefree(*charp);
if(s) {
s = strdup(s);
if(!s)
return CURLE_OUT_OF_MEMORY;
*charp = s;
}
return CURLE_OK;
}
static CURLcode setstropt_userpwd(char *option, char **user_storage,
char **pwd_storage)
{
char* separator;
CURLcode result = CURLE_OK;
if(!option) {
/* we treat a NULL passed in as a hint to clear existing info */
Curl_safefree(*user_storage);
*user_storage = (char *) NULL;
Curl_safefree(*pwd_storage);
*pwd_storage = (char *) NULL;
return CURLE_OK;
}
separator = strchr(option, ':');
if(separator != NULL) {
/* store username part of option */
char * p;
size_t username_len = (size_t)(separator-option);
p = malloc(username_len+1);
if(!p)
result = CURLE_OUT_OF_MEMORY;
else {
memcpy(p, option, username_len);
p[username_len] = '\0';
没有合适的资源?快使用搜索试试~ 我知道了~
windows下libcurl库
共221个文件
h:114个
c:103个
vcxproj:1个
3星 · 超过75%的资源 需积分: 50 69 下载量 154 浏览量
2018-05-09
15:05:00
上传
评论
收藏 767KB RAR 举报
温馨提示
自己整理的libcurl库,只含有代码和vs-proj,vs为2015版本位7.26
资源推荐
资源详情
资源评论
收起资源包目录
windows下libcurl库 (221个子文件)
url.c 168KB
ftp.c 134KB
http.c 110KB
ssh.c 100KB
multi.c 92KB
ssluse.c 82KB
transfer.c 74KB
smtp.c 56KB
telnet.c 45KB
nss.c 44KB
tftp.c 43KB
formdata.c 43KB
connect.c 36KB
cookie.c 34KB
gtls.c 32KB
ftplistparser.c 31KB
pop3.c 31KB
curl_ntlm_msgs.c 30KB
mprintf.c 30KB
imap.c 29KB
rtsp.c 24KB
socks_sspi.c 24KB
easy.c 24KB
hostip.c 23KB
socks.c 22KB
http_proxy.c 21KB
ldap.c 21KB
sendf.c 20KB
socks_gssapi.c 19KB
strerror.c 19KB
openldap.c 18KB
asyn-ares.c 18KB
asyn-thread.c 17KB
file.c 17KB
progress.c 16KB
cyassl.c 16KB
http_digest.c 16KB
security.c 16KB
parsedate.c 16KB
polarssl.c 16KB
axtls.c 16KB
pingpong.c 15KB
sslgen.c 14KB
md5.c 14KB
select.c 14KB
curl_addrinfo.c 13KB
krb4.c 12KB
content_encoding.c 12KB
http_chunks.c 12KB
curl_ntlm_core.c 12KB
memdebug.c 12KB
qssl.c 12KB
http_negotiate.c 11KB
curl_fnmatch.c 11KB
curl_rtmp.c 11KB
curl_ntlm_wb.c 11KB
hostip4.c 11KB
warnless.c 10KB
non-ascii.c 10KB
krb5.c 9KB
nwlib.c 9KB
getinfo.c 9KB
http_negotiate_sspi.c 8KB
md4.c 8KB
hash.c 8KB
splay.c 8KB
dict.c 8KB
version.c 8KB
base64.c 7KB
hostip6.c 6KB
escape.c 6KB
share.c 6KB
inet_pton.c 6KB
curl_ntlm.c 6KB
gopher.c 6KB
inet_ntop.c 5KB
netrc.c 5KB
hostasyn.c 5KB
if2ip.c 5KB
strtoofft.c 4KB
llist.c 4KB
hmac.c 4KB
timeval.c 4KB
curl_sspi.c 4KB
rawstr.c 4KB
idn_win32.c 3KB
slist.c 3KB
curl_gethostname.c 3KB
strequal.c 3KB
curl_threads.c 3KB
nonblock.c 3KB
nwos.c 3KB
speedcheck.c 3KB
curl_gssapi.c 2KB
hostsyn.c 2KB
strtok.c 2KB
wildcard.c 2KB
amigaos.c 2KB
curl_rand.c 2KB
curl_memrchr.c 2KB
共 221 条
- 1
- 2
- 3
资源评论
- qinmingyan0372021-03-03网上其他地方都有。
- lhx200312342021-04-16好好好不错好好好不错
vds2000nan
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功