/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <[email protected]>, 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.
*
* $Id: url.c,v 1.579 2007-01-28 22:45:22 bagder Exp $
***************************************************************************/
/* -- WIN32 approved -- */
#include "setup.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <errno.h>
#ifdef WIN32
#include <time.h>
#include <io.h>
#else
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <netinet/in.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <netdb.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#include <sys/ioctl.h>
#include <signal.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef VMS
#include <in.h>
#include <inet.h>
#endif
#ifdef HAVE_SETJMP_H
#include <setjmp.h>
#endif
#ifndef HAVE_SOCKET
#error "We can't compile without socket() support!"
#endif
#endif
#ifdef USE_LIBIDN
#include <idna.h>
#include <tld.h>
#include <stringprep.h>
#ifdef HAVE_IDN_FREE_H
#include <idn-free.h>
#else
void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
libidn 0.4.5's make install! */
#endif
#ifndef HAVE_IDN_FREE
/* if idn_free() was not found in this version of libidn, use plain free()
instead */
#define idn_free(x) (free)(x)
#endif
#endif /* USE_LIBIDN */
#include "urldata.h"
#include "netrc.h"
#include "formdata.h"
#include "base64.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"
/* And now for the protocols */
#include "ftp.h"
#include "dict.h"
#include "telnet.h"
#include "tftp.h"
#include "http.h"
#include "file.h"
#include "ldap.h"
#include "ssh.h"
#include "url.h"
#include "connect.h"
#include "inet_ntop.h"
#include "http_ntlm.h"
#include "socks.h"
#include "ca-bundle.h"
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
#include "inet_ntoa_r.h"
#endif
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
#ifdef HAVE_KRB4
#include "krb4.h"
#endif
#include "memory.h"
/* The last #include file should be: */
#include "memdebug.h"
/* Local static prototypes */
static long ConnectionKillOne(struct SessionHandle *data);
static bool ConnectionExists(struct SessionHandle *data,
struct connectdata *needle,
struct connectdata **usethis);
static long ConnectionStore(struct SessionHandle *data,
struct connectdata *conn);
static bool IsPipeliningPossible(struct SessionHandle *handle);
static bool IsPipeliningEnabled(struct SessionHandle *handle);
static void conn_free(struct connectdata *conn);
static void signalPipeClose(struct curl_llist *pipe);
#define MAX_PIPELINE_LENGTH 5
/*
* We use this ZERO_NULL to avoid picky compiler warnings,
* when assigning a NULL pointer to a function pointer var.
*/
#define ZERO_NULL 0
#ifndef USE_ARES
/* not for ares builds */
#ifndef WIN32
/* not for WIN32 builds */
#ifdef HAVE_SIGSETJMP
extern sigjmp_buf curl_jmpenv;
#endif
#ifdef SIGALRM
static
RETSIGTYPE alarmfunc(int sig)
{
/* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */
(void)sig;
#ifdef HAVE_SIGSETJMP
siglongjmp(curl_jmpenv, 1);
#endif
return;
}
#endif /* SIGALRM */
#endif /* WIN32 */
#endif /* USE_ARES */
void Curl_safefree(void *ptr)
{
if(ptr)
free(ptr);
}
static void close_connections(struct SessionHandle *data)
{
/* Loop through all open connections and kill them one by one */
while(-1 != ConnectionKillOne(data))
; /* empty loop */
}
/*
* This is the internal function curl_easy_cleanup() calls. This should
* cleanup and free all resources associated with this sessionhandle.
*
* NOTE: if we ever add something that attempts to write to a socket or
* similar here, we must ignore SIGPIPE first. It is currently only done
* when curl_easy_perform() is invoked.
*/
CURLcode Curl_close(struct SessionHandle *data)
{
struct Curl_multi *m = data->multi;
#ifdef CURLDEBUG
/* only for debugging, scan through all connections and see if there's a
pipe reference still identifying this handle */
if(data->state.is_in_pipeline)
fprintf(stderr, "CLOSED when in pipeline!\n");
if(data->state.connc && data->state.connc->type == CONNCACHE_MULTI) {
struct conncache *c = data->state.connc;
int i;
struct curl_llist *pipe;
struct curl_llist_element *curr;
struct connectdata *connptr;
for(i=0; i< c->num; i++) {
connptr = c->connects[i];
if(!connptr)
continue;
pipe = connptr->send_pipe;
if(pipe) {
for (curr = pipe->head; curr; curr=curr->next) {
if(data == (struct SessionHandle *) curr->ptr) {
fprintf(stderr,
"MAJOR problem we %p are still in send pipe for %p done %d\n",
data, connptr, connptr->bits.done);
}
}
}
pipe = connptr->recv_pipe;
if(pipe) {
for (curr = pipe->head; curr; curr=curr->next) {
if(data == (struct SessionHandle *) curr->ptr) {
fprintf(stderr,
"MAJOR problem we %p are still in recv pipe for %p done %d\n",
data, connptr, connptr->bits.done);
}
}
}
}
}
#endif
if(m)
/* This handle is still part of a multi handle, take care of this first
and detach this handle from there. */
Curl_multi_rmeasy(data->multi, data);
data->magic = 0; /* force a clear AFTER the possibly enforced removal from
the multi handle, since that function uses the magic
field! */
if(data->state.connc) {
if(data->state.connc->type == CONNCACHE_PRIVATE) {
/* close all connections still alive that are in the private connection
cache, as we no longer have the pointer left to the shared one. */
close_connections(data);
/* free the connection cache if allocated privately */
Curl_rm_connc(data->state.connc);
}
}
if(data->state.shared_conn) {
/* marked to be used by a pending connection so we can't kill this handle
just yet */
data->state.closed = TRUE;
return CURLE_OK;
}
if ( ! (data->share && data->share->hostcache) ) {
if ( !Curl_global_host_cache_use(data)) {
Curl_hash_destroy(data->dns.hostcache);
}
}
/* Free the pathbuffer */
Curl_safefree(data->reqdata.pathbuffer);
Curl_safefree(data->reqdata.proto.generic);
/* Close down all open SSL info and sessions */
Curl_ssl_close_all(data);
Curl_safefree(data->state.first_h
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
可用于visual studio 2008的curl源码, 由于某些函数在visual studio上不支持, 因此这个包里面包含了一个WCEcompat的项目。 用法: 先编译WCEcompat,然后再编译Curl, 在编译Curl的时候要附加WECcompat.lib 注意:包含文件(include目录)需要重新设置成 你自己的环境
资源推荐
资源详情
资源评论
收起资源包目录
Curl_for_windows_ce (221个子文件)
Makefile.am 6KB
Makefile.am 142B
makefile.amiga 911B
libcurl.aps 4KB
README.ares 2KB
Makefile.b32 2KB
url.c 128KB
ftp.c 112KB
transfer.c 86KB
http.c 75KB
multi.c 63KB
ssluse.c 57KB
formdata.c 49KB
telnet.c 36KB
http_ntlm.c 33KB
mprintf.c 30KB
ssh.c 29KB
cookie.c 29KB
connect.c 25KB
hostthre.c 24KB
easy.c 24KB
tftp.c 23KB
gtls.c 19KB
ldap.c 18KB
strerror.c 18KB
sendf.c 18KB
socks.c 18KB
hostip.c 17KB
sslgen.c 15KB
progress.c 15KB
http_digest.c 14KB
hostip4.c 13KB
content_encoding.c 12KB
md5.c 12KB
security.c 12KB
krb4.c 12KB
parsedate.c 11KB
http_chunks.c 11KB
file.c 11KB
splay.c 10KB
http_negotiate.c 10KB
base64.c 9KB
hostares.c 9KB
hostip6.c 8KB
select.c 8KB
memdebug.c 8KB
hash.c 7KB
dict.c 7KB
getinfo.c 7KB
netrc.c 6KB
inet_pton.c 6KB
inet_ntop.c 6KB
version.c 6KB
share.c 6KB
hostasyn.c 5KB
escape.c 5KB
strequal.c 4KB
strtoofft.c 4KB
wce211_ctype.c 4KB
hostsyn.c 4KB
timeval.c 3KB
if2ip.c 3KB
llist.c 3KB
speedcheck.c 3KB
strtok.c 2KB
wce211_string.c 2KB
getenv.c 2KB
strdup.c 1KB
redir.cpp 35KB
time.cpp 15KB
ChildData.cpp 14KB
args.cpp 13KB
pipe.cpp 7KB
ts_string.cpp 3KB
string_extras.cpp 3KB
env.cpp 2KB
stat.cpp 2KB
io.cpp 1KB
winmain.cpp 1KB
stdlib_extras.cpp 1KB
stdio_extras.cpp 1KB
winsock_extras.cpp 1KB
assert.cpp 1KB
process.cpp 1KB
timeb.cpp 1015B
errno.cpp 958B
ca-bundle.crt 233KB
README.curlx 2KB
makefile.dj 17KB
config.dos 4KB
README.encoding 3KB
msvcproj.foot 145B
curl.h 59KB
urldata.h 52KB
multi.h 12KB
float.h 12KB
config-win32ce.h 11KB
config-win32.h 11KB
setup.h 9KB
hostip.h 9KB
共 221 条
- 1
- 2
- 3
资源评论
- 傲雪迎风2014-03-12解压都不行,curl.h文件都无法解压
- liweisdut2012-03-09不能用,缺少DLL文件
- jacksonke2013-02-25用不了呀!
- ackeep2013-12-03各种折腾,最终还是用不了
ak47_20002
- 粉丝: 2
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功