diff options
author | Lucas Eckels <eckels@google.com> | 2012-08-06 15:07:02 -0700 |
---|---|---|
committer | Lucas Eckels <eckels@google.com> | 2012-08-08 09:28:48 -0700 |
commit | 9bd90e6e25f1e55f50201c87a1b5837de7e5b64a (patch) | |
tree | d2061a00d7d0ee884170bc955fceeed2d0edf284 /lib/getinfo.c | |
parent | e6f2b03027b5feb92b30f5d47801ec3fabe9fd95 (diff) | |
download | external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.gz external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.tar.bz2 external_curl-9bd90e6e25f1e55f50201c87a1b5837de7e5b64a.zip |
Add Music Manager's curl 7.21.2 source.
Change-Id: I259a43fa52d581524a5ce8ae1711467acb1d9d50
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r-- | lib/getinfo.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c index 7a0ed71a..c00e675e 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -66,6 +66,12 @@ CURLcode Curl_initinfo(struct SessionHandle *data) info->header_size = 0; info->request_size = 0; info->numconnects = 0; + + info->ip[0] = 0; + info->port = 0; + info->localip[0] = 0; + info->localport = 0; + return CURLE_OK; } @@ -77,6 +83,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) char **param_charp=NULL; struct curl_slist **param_slistp=NULL; int type; + curl_socket_t sockfd; union { struct curl_certinfo * to_certinfo; @@ -213,7 +220,16 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) *param_charp = data->state.most_recent_ftp_entrypath; break; case CURLINFO_LASTSOCKET: - (void)Curl_getconnectinfo(data, param_longp, NULL); + sockfd = Curl_getconnectinfo(data, NULL); + + /* note: this is not a good conversion for systems with 64 bit sockets and + 32 bit longs */ + if(sockfd != CURL_SOCKET_BAD) + *param_longp = (long)sockfd; + else + /* this interface is documented to return -1 in case of badness, which + may not be the same as the CURL_SOCKET_BAD value */ + *param_longp = -1; break; case CURLINFO_REDIRECT_URL: /* Return the URL this request would have been redirected to if that @@ -224,6 +240,19 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) /* Return the ip address of the most recent (primary) connection */ *param_charp = data->info.ip; break; + case CURLINFO_PRIMARY_PORT: + /* Return the (remote) port of the most recent (primary) connection */ + *param_longp = data->info.port; + break; + case CURLINFO_LOCAL_IP: + /* Return the source/local ip address of the most recent (primary) + connection */ + *param_charp = data->info.localip; + break; + case CURLINFO_LOCAL_PORT: + /* Return the local port of the most recent (primary) connection */ + *param_longp = data->info.localport; + break; case CURLINFO_CERTINFO: /* Return the a pointer to the certinfo struct. Not really an slist pointer but we can pretend it is here */ |