diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-05-12 21:43:24 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-05-12 21:43:24 +0000 |
commit | 514592b89207e83d13b5a4e79bc247aa6f74c4b7 (patch) | |
tree | 9c9df12cf0f9b8f5e2aa835c4379ae7be9e3805d /lib/getinfo.c | |
parent | d72efff878a352e24d3a7cc8cf7c2f8b0b65f409 (diff) |
- Introducing curl_easy_send() and curl_easy_recv(). They can be used to send
and receive data over a connection previously setup with curl_easy_perform()
and its CURLOPT_CONNECT_ONLY option. The sendrecv.c example was added to
show how they can be used.
Diffstat (limited to 'lib/getinfo.c')
-rw-r--r-- | lib/getinfo.c | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/lib/getinfo.c b/lib/getinfo.c index 145a71b22..078154246 100644 --- a/lib/getinfo.c +++ b/lib/getinfo.c @@ -34,6 +34,7 @@ #include <stdlib.h> #include "memory.h" #include "sslgen.h" +#include "connect.h" /* Curl_getconnectinfo() */ /* Make this the last #include */ #include "memdebug.h" @@ -75,9 +76,6 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) double *param_doublep=NULL; char **param_charp=NULL; struct curl_slist **param_slistp=NULL; -#ifdef MSG_PEEK - char buf; -#endif int type; if(!data) @@ -205,31 +203,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...) *param_charp = data->state.most_recent_ftp_entrypath; break; case CURLINFO_LASTSOCKET: - if((data->state.lastconnect != -1) && - (data->state.connc->connects[data->state.lastconnect] != NULL)) { - struct connectdata *c = data->state.connc->connects - [data->state.lastconnect]; - *param_longp = c->sock[FIRSTSOCKET]; - /* we have a socket connected, let's determine if the server shut down */ - /* determine if ssl */ - if(c->ssl[FIRSTSOCKET].use) { - /* use the SSL context */ - if(!Curl_ssl_check_cxn(c)) - *param_longp = -1; /* FIN received */ - } -/* Minix 3.1 doesn't support any flags on recv; just assume socket is OK */ -#ifdef MSG_PEEK - else { - /* use the socket */ - if(recv((RECV_TYPE_ARG1)c->sock[FIRSTSOCKET], (RECV_TYPE_ARG2)&buf, - (RECV_TYPE_ARG3)1, (RECV_TYPE_ARG4)MSG_PEEK) == 0) { - *param_longp = -1; /* FIN received */ - } - } -#endif - } - else - *param_longp = -1; + (void)Curl_getconnectinfo(data, param_longp, NULL); break; case CURLINFO_REDIRECT_URL: /* Return the URL this request would have been redirected to if that |