mirror of
https://github.com/curl/curl.git
synced 2026-08-25 12:03:39 +03:00
- 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.
This commit is contained in:
parent
d72efff878
commit
514592b892
16 changed files with 454 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue