D:/opendownloadmanager/ODM-1.x/InetFile/cURL_lib/url.c File Reference

#include "setup.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#include <errno.h>
#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"
#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"
#include <curl/mprintf.h>
#include "memory.h"
#include "memdebug.h"

Go to the source code of this file.

Defines

#define _MPRINTF_REPLACE
#define MAX_PIPELINE_LENGTH   5
#define ZERO_NULL   0
#define LEAST_PATH_ALLOC   256

Functions

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)
static struct SessionHandlegethandleathead (struct curl_llist *pipe)
void Curl_safefree (void *ptr)
static void close_connections (struct SessionHandle *data)
CURLcode Curl_close (struct SessionHandle *data)
struct conncacheCurl_mk_connc (int type, long amount)
CURLcode Curl_ch_connc (struct SessionHandle *data, struct conncache *c, long newamount)
void Curl_rm_connc (struct conncache *c)
CURLcode Curl_open (struct SessionHandle **curl)
CURLcode Curl_setopt (struct SessionHandle *data, CURLoption option, va_list param)
CURLcode Curl_disconnect (struct connectdata *conn)
static bool SocketIsDead (curl_socket_t sock)
CURLcode Curl_addHandleToPipeline (struct SessionHandle *data, struct curl_llist *pipe)
int Curl_removeHandleFromPipeline (struct SessionHandle *handle, struct curl_llist *pipe)
bool Curl_isHandleAtHead (struct SessionHandle *handle, struct curl_llist *pipe)
static void ConnectionDone (struct connectdata *conn)
static CURLcode ConnectPlease (struct SessionHandle *data, struct connectdata *conn, struct Curl_dns_entry *hostaddr, bool *connected)
static void verboseconnect (struct connectdata *conn)
int Curl_protocol_getsock (struct connectdata *conn, curl_socket_t *socks, int numsocks)
int Curl_doing_getsock (struct connectdata *conn, curl_socket_t *socks, int numsocks)
CURLcode Curl_protocol_connecting (struct connectdata *conn, bool *done)
CURLcode Curl_protocol_doing (struct connectdata *conn, bool *done)
CURLcode Curl_protocol_connect (struct connectdata *conn, bool *protocol_done)
static void fix_hostname (struct SessionHandle *data, struct connectdata *conn, struct hostname *host)
static CURLcode ParseURLAndFillConnection (struct SessionHandle *data, struct connectdata *conn)
static void llist_dtor (void *user, void *element)
static CURLcode setup_range (struct SessionHandle *data)
static CURLcode CreateConnection (struct SessionHandle *data, struct connectdata **in_connect, struct Curl_dns_entry **addr, bool *async)
static CURLcode SetupConnection (struct connectdata *conn, struct Curl_dns_entry *hostaddr, bool *protocol_done)
CURLcode Curl_connect (struct SessionHandle *data, struct connectdata **in_connect, bool *asyncp, bool *protocol_done)
CURLcode Curl_async_resolved (struct connectdata *conn, bool *protocol_done)
CURLcode Curl_done (struct connectdata **connp, CURLcode status, bool premature)
CURLcode Curl_do (struct connectdata **connp, bool *done)
CURLcode Curl_do_more (struct connectdata *conn)


Define Documentation

#define _MPRINTF_REPLACE

Definition at line 146 of file url.c.

#define LEAST_PATH_ALLOC   256

Referenced by CreateConnection().

#define MAX_PIPELINE_LENGTH   5

Definition at line 169 of file url.c.

Referenced by ConnectionExists().

#define ZERO_NULL   0

Definition at line 176 of file url.c.


Function Documentation

static void close_connections ( struct SessionHandle data  )  [static]

Definition at line 213 of file url.c.

References ConnectionKillOne().

Referenced by Curl_close().

static void conn_free ( struct connectdata conn  )  [static]

static void ConnectionDone ( struct connectdata conn  )  [static]

static bool ConnectionExists ( struct SessionHandle data,
struct connectdata needle,
struct connectdata **  usethis 
) [static]

static long ConnectionKillOne ( struct SessionHandle data  )  [static]

static long ConnectionStore ( struct SessionHandle data,
struct connectdata conn 
) [static]

static CURLcode ConnectPlease ( struct SessionHandle data,
struct connectdata conn,
struct Curl_dns_entry hostaddr,
bool connected 
) [static]

static CURLcode CreateConnection ( struct SessionHandle data,
struct connectdata **  in_connect,
struct Curl_dns_entry **  addr,
bool async 
) [static]

CreateConnection() sets up a new connectdata struct, or re-uses an already existing one, and resolves host name.

if this function returns CURLE_OK and *async is set to TRUE, the resolve response will be coming asynchronously. If *async is FALSE, the name is already resolved.

Parameters:
data The sessionhandle pointer
in_connect is set to the next connection data pointer
addr is set to the new dns entry for this connection. If this connection is re-used it will be NULL.
async is set TRUE/FALSE depending on the nature of this lookup
Returns:
CURLcode
See also:
SetupConnection()
*NOTE* this function assigns the conn->data pointer!

Definition at line 2824 of file url.c.

References UrlState::allow_port, bits, connectdata::bits, connectdata::buf_len, BUFSIZE, calloc, SessionHandle::change, checkprefix, ConnectBits::close, connectdata::connectindex, ConnectionExists(), ConnectionStore(), UserDefined::connecttimeout, connectdata::created, Curl_clone_ssl_config(), connectdata::curl_connect, connectdata::curl_connecting, CURL_DEFAULT_PASSWORD, CURL_DEFAULT_USER, Curl_dict(), connectdata::curl_disconnect, connectdata::curl_do, connectdata::curl_do_more, connectdata::curl_doing, connectdata::curl_doing_getsock, connectdata::curl_done, curl_easy_unescape(), Curl_file(), Curl_file_connect(), Curl_file_done(), Curl_free_ssl_config(), Curl_ftp(), Curl_ftp_connect(), Curl_ftp_disconnect(), Curl_ftp_doing(), Curl_ftp_done(), Curl_ftp_getsock(), Curl_ftp_multi_statemach(), Curl_ftp_nextconnect(), curl_getenv(), Curl_http(), Curl_http_connect(), Curl_http_done(), CURL_HTTP_VERSION_1_0, Curl_https_connecting(), Curl_https_getsock(), Curl_ldap(), Curl_llist_alloc(), Curl_llist_destroy(), Curl_multi_canPipeline(), CURL_NETRC_IGNORED, CURL_NETRC_REQUIRED, Curl_parsenetrc(), connectdata::curl_proto_getsock, Curl_resolv(), Curl_safefree(), Curl_setup_transfer(), CURL_SOCKET_BAD, Curl_telnet(), Curl_telnet_done(), Curl_tftp(), Curl_tftp_connect(), Curl_tftp_done(), Curl_tvdiff, Curl_tvnow, CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_RESOLVE_PROXY, CURLE_OK, CURLE_OPERATION_TIMEDOUT, CURLE_OPERATION_TIMEOUTED, CURLE_OUT_OF_MEMORY, CURLE_UNSUPPORTED_PROTOCOL, CURLE_URL_MALFORMAT, CURLFTPSSL_CONTROL, CURLPROXY_HTTP, CURLRESOLV_PENDING, connectdata::data, hostname::dispname, DOT_CHAR, elapsed_ms, failf, FALSE, FIRSTSOCKET, fix_hostname(), UserDefined::fread, connectdata::fread, connectdata::fread_in, free, UserDefined::ftp_list_only, UserDefined::ftp_ssl, UserDefined::ftp_use_eprt, ConnectBits::ftp_use_eprt, UserDefined::ftp_use_epsv, ConnectBits::ftp_use_epsv, connectdata::host, ConnectBits::httpproxy, UserDefined::httpversion, UserDefined::in, UserDefined::infilesize, infof, ConnectBits::ipv6_ip, ISXDIGIT, LEAST_PATH_ALLOC, LIBCURL_NAME, llist_dtor(), malloc, connectdata::master_buffer, MAX_CURL_PASSWORD_LENGTH, MAX_CURL_PASSWORD_LENGTH_TXT, MAX_CURL_USER_LENGTH, MAX_CURL_USER_LENGTH_TXT, SessionHandle::multi, hostname::name, ConnectBits::netrc, UserDefined::netrc_file, ConnectBits::no_body, UserDefined::no_signal, NULL, UserDefined::opt_no_body, ParseURLAndFillConnection(), connectdata::passwd, HandleData::path, HandleData::pathbuffer, connectdata::port, PORT_DICT, PORT_FTP, PORT_FTPS, PORT_HTTP, PORT_HTTPS, PORT_LDAP, PORT_SSH, PORT_TELNET, PORT_TFTP, UserDefined::prefer_ascii, PROT_DICT, PROT_FILE, PROT_FTP, PROT_FTPS, PROT_HTTP, PROT_HTTPS, PROT_LDAP, PROT_MISSING, PROT_SCP, PROT_SFTP, PROT_SSL, PROT_TELNET, PROT_TFTP, connectdata::protocol, connectdata::protostr, connectdata::proxy, UserDefined::proxy, ConnectBits::proxy, ConnectBits::proxy_user_passwd, connectdata::proxypasswd, UserDefined::proxyport, UserDefined::proxytype, connectdata::proxytype, connectdata::proxyuser, UserDefined::proxyuserpwd, hostname::rawalloc, connectdata::read_pos, connectdata::readchannel_inuse, connectdata::recv_pipe, connectdata::remote_port, SessionHandle::reqdata, ConnectBits::reuse, UserDefined::reuse_fresh, SECONDARYSOCKET, connectdata::send_pipe, SessionHandle::set, setup_range(), connectdata::sock, connectdata::socktype, UserDefined::source_url, UserDefined::ssl, connectdata::ssl, connectdata::ssl_config, SessionHandle::state, strdup, strequal, strtok_r, ConnectBits::tcpconnect, UrlState::this_is_a_follow, UserDefined::timeout, TRUE, ConnectBits::tunnel_proxy, UserDefined::tunnel_thru_httpproxy, UserDefined::upload, ConnectBits::upload_chunky, DynamicStatic::url, DynamicStatic::url_alloc, ssl_connect_data::use, UserDefined::use_netrc, UserDefined::use_port, connectdata::user, ConnectBits::user_passwd, UserDefined::userpwd, connectdata::writechannel_inuse, and ZERO_NULL.

Referenced by Curl_connect().

CURLcode Curl_addHandleToPipeline ( struct SessionHandle data,
struct curl_llist pipe 
)

CURLcode Curl_async_resolved ( struct connectdata conn,
bool protocol_done 
)

Definition at line 4188 of file url.c.

References Curl_disconnect(), CURLE_OK, and SetupConnection().

Referenced by Curl_connect_host(), Curl_do(), and multi_runsingle().

CURLcode Curl_ch_connc ( struct SessionHandle data,
struct conncache c,
long  newamount 
)

CURLcode Curl_close ( struct SessionHandle data  ) 

CURLcode Curl_connect ( struct SessionHandle data,
struct connectdata **  in_connect,
bool asyncp,
bool protocol_done 
)

CURLcode Curl_disconnect ( struct connectdata conn  ) 

CURLcode Curl_do ( struct connectdata **  connp,
bool done 
)

CURLcode Curl_do_more ( struct connectdata conn  ) 

Definition at line 4356 of file url.c.

References connectdata::curl_do_more, and CURLE_OK.

Referenced by multi_runsingle().

int Curl_doing_getsock ( struct connectdata conn,
curl_socket_t socks,
int  numsocks 
)

Definition at line 2393 of file url.c.

References connectdata::curl_doing_getsock, and GETSOCK_BLANK.

Referenced by multi_getsock().

CURLcode Curl_done ( struct connectdata **  connp,
CURLcode  status,
bool  premature 
)

bool Curl_isHandleAtHead ( struct SessionHandle handle,
struct curl_llist pipe 
)

Definition at line 1992 of file url.c.

References FALSE, curl_llist::head, and curl_llist_element::ptr.

Referenced by multi_runsingle().

struct conncache* Curl_mk_connc ( int  type,
long  amount 
) [read]

CURLcode Curl_open ( struct SessionHandle **  curl  ) 

CURLcode Curl_protocol_connect ( struct connectdata conn,
bool protocol_done 
)

CURLcode Curl_protocol_connecting ( struct connectdata conn,
bool done 
)

Definition at line 2408 of file url.c.

References connectdata::curl_connecting, CURLE_OK, FALSE, and TRUE.

Referenced by multi_runsingle().

CURLcode Curl_protocol_doing ( struct connectdata conn,
bool done 
)

Definition at line 2428 of file url.c.

References connectdata::curl_doing, CURLE_OK, FALSE, and TRUE.

Referenced by multi_runsingle().

int Curl_protocol_getsock ( struct connectdata conn,
curl_socket_t socks,
int  numsocks 
)

Definition at line 2384 of file url.c.

References connectdata::curl_proto_getsock, and GETSOCK_BLANK.

Referenced by multi_getsock().

int Curl_removeHandleFromPipeline ( struct SessionHandle handle,
struct curl_llist pipe 
)

void Curl_rm_connc ( struct conncache c  ) 

void Curl_safefree ( void *  ptr  ) 

CURLcode Curl_setopt ( struct SessionHandle data,
CURLoption  option,
va_list  param 
)

Definition at line 629 of file url.c.

References ALL_CONTENT_ENCODINGS, UserDefined::buffer_size, BUFSIZE, ssl_config_data::CAfile, Progress::callback, ssl_config_data::CApath, UserDefined::cert, UserDefined::cert_type, SessionHandle::change, checkprefix, ssl_config_data::cipher_list, UrlState::connc, UserDefined::connect_only, UserDefined::connecttimeout, UserDefined::convfromnetwork, UserDefined::convfromutf8, UserDefined::convtonetwork, UserDefined::cookie, UserDefined::cookiejar, DynamicStatic::cookielist, Curl_share::cookies, SessionHandle::cookies, UserDefined::cookiesession, UserDefined::crlf, Curl_ch_connc(), Curl_cookie_add(), Curl_cookie_cleanup(), Curl_cookie_clearall(), Curl_cookie_clearsess(), Curl_cookie_init(), Curl_global_host_cache_init(), Curl_hash_destroy(), CURL_LOCK_ACCESS_SINGLE, CURL_LOCK_DATA_SHARE, Curl_share_lock(), Curl_share_unlock(), curl_slist_append(), Curl_ssl_set_engine(), Curl_ssl_set_engine_default(), CURLAUTH_GSSNEGOTIATE, CURLAUTH_NTLM, CURLE_FAILED_INIT, CURLE_OK, CURLE_OUT_OF_MEMORY, UserDefined::customrequest, UserDefined::debugdata, UserDefined::device, Curl_share::dirty, SessionHandle::dns, UserDefined::dns_cache_timeout, ssl_config_data::egdsocket, UserDefined::encoding, UserDefined::err, UserDefined::errorbuffer, FALSE, UserDefined::fdebug, Progress::flags, UserDefined::fprogress, fread(), UserDefined::fread, free, UserDefined::fsockopt, ssl_config_data::fsslctx, ssl_config_data::fsslctxp, UserDefined::ftp_account, UserDefined::ftp_alternative_to_user, UserDefined::ftp_append, UserDefined::ftp_ccc, UserDefined::ftp_create_missing_dirs, UserDefined::ftp_filemethod, UserDefined::ftp_list_only, UserDefined::ftp_response_timeout, UserDefined::ftp_skip_ip, UserDefined::ftp_ssl, UserDefined::ftp_use_eprt, UserDefined::ftp_use_epsv, UserDefined::ftp_use_port, UserDefined::ftpport, UserDefined::ftpsslauth, fwrite(), UserDefined::fwrite, UserDefined::fwrite_header, UserDefined::get_filetime, UserDefined::global_dns_cache, UserDefined::headers, UserDefined::hide_progress, Curl_share::hostcache, Names::hostcache, Names::hostcachetype, UserDefined::http200aliases, UserDefined::http_auto_referer, UserDefined::http_ce_skip, UserDefined::http_disable_hostname_check_before_authentication, UserDefined::http_fail_on_error, UserDefined::http_follow_location, UserDefined::http_te_skip, UserDefined::httpauth, UserDefined::httppost, UserDefined::httpreq, HTTPREQ_GET, HTTPREQ_HEAD, HTTPREQ_POST, HTTPREQ_POST_FORM, HTTPREQ_PUT, UserDefined::httpversion, UserDefined::ignorecl, UserDefined::in, UserDefined::include_header, UserDefined::infilesize, UserDefined::ioctl, UserDefined::ioctl_client, UserDefined::ip_version, UserDefined::key, UserDefined::key_passwd, UserDefined::key_type, UserDefined::krb, UserDefined::krb_level, UserDefined::localport, UserDefined::localportrange, UserDefined::low_speed_limit, UserDefined::low_speed_time, UserDefined::max_filesize, UserDefined::max_recv_speed, UserDefined::max_send_speed, UserDefined::maxredirs, UserDefined::netrc_file, UserDefined::new_directory_perms, UserDefined::new_file_perms, UserDefined::no_signal, NULL, UserDefined::opt_no_body, UserDefined::out, PGRS_HIDE, UserDefined::postfields, UserDefined::postfieldsize, UserDefined::postquote, UserDefined::prefer_ascii, UserDefined::prequote, UserDefined::private_data, SessionHandle::progress, UserDefined::progress_client, UserDefined::proxy, UserDefined::proxyauth, UserDefined::proxyport, UserDefined::proxytype, UserDefined::proxyuserpwd, UserDefined::quote, ssl_config_data::random_file, DynamicStatic::referer, DynamicStatic::referer_alloc, UserDefined::reuse_forbid, UserDefined::reuse_fresh, ssl_config_data::sessionid, SessionHandle::set, UserDefined::set_range, UserDefined::set_referer, UserDefined::set_resume_from, UserDefined::set_url, SessionHandle::share, UserDefined::sockopt_client, UserDefined::ssh_auth_types, UserDefined::ssh_private_key, UserDefined::ssh_public_key, UserDefined::ssl, SessionHandle::state, strdup, strequal, UserDefined::tcp_nodelay, UserDefined::telnet_options, UserDefined::timecondition, UserDefined::timeout, UserDefined::timevalue, TRUE, UserDefined::tunnel_thru_httpproxy, UserDefined::upload, DynamicStatic::url, DynamicStatic::url_alloc, DynamicStatic::url_changed, UserDefined::use_netrc, UserDefined::use_port, UserDefined::useragent, UserDefined::userpwd, UserDefined::verbose, ssl_config_data::verifyhost, ssl_config_data::verifypeer, ssl_config_data::version, and UserDefined::writeheader.

Referenced by curl_easy_setopt().

static void fix_hostname ( struct SessionHandle data,
struct connectdata conn,
struct hostname host 
) [static]

Definition at line 2554 of file url.c.

References hostname::dispname, hostname::encalloc, infof, LIBIDN_REQUIRED_VERSION, hostname::name, and NULL.

Referenced by CreateConnection().

static struct SessionHandle * gethandleathead ( struct curl_llist pipe  )  [static, read]

Definition at line 2003 of file url.c.

References curl_llist::head, NULL, and curl_llist_element::ptr.

Referenced by ConnectionExists().

static bool IsPipeliningEnabled ( struct SessionHandle handle  )  [static]

Definition at line 1937 of file url.c.

References Curl_multi_canPipeline(), FALSE, SessionHandle::multi, and TRUE.

Referenced by ConnectionExists(), and Curl_disconnect().

static bool IsPipeliningPossible ( struct SessionHandle handle  )  [static]

static void llist_dtor ( void *  user,
void *  element 
) [static]

Definition at line 2766 of file url.c.

Referenced by CreateConnection().

static CURLcode ParseURLAndFillConnection ( struct SessionHandle data,
struct connectdata conn 
) [static]

static CURLcode setup_range ( struct SessionHandle data  )  [static]

static CURLcode SetupConnection ( struct connectdata conn,
struct Curl_dns_entry hostaddr,
bool protocol_done 
) [static]

static void signalPipeClose ( struct curl_llist pipe  )  [static]

static bool SocketIsDead ( curl_socket_t  sock  )  [static]

Definition at line 1913 of file url.c.

References CURL_SOCKET_BAD, Curl_socket_ready(), FALSE, and TRUE.

Referenced by ConnectionExists().

static void verboseconnect ( struct connectdata conn  )  [static]


Generated on Sun May 25 00:20:10 2008 by  doxygen 1.5.6