protocol specific data that then gets associated with that `Curl_easy` for
the rest of this transfer. It gets freed again at the end of the transfer.
It will be called before the `connectdata` for the transfer has been
- selected/created. Most protocols will allocate its private
- `struct [PROTOCOL]` here and assign `Curl_easy->req.protop` to point to it.
+ selected/created. Most protocols will allocate its private `struct
+ [PROTOCOL]` here and assign `Curl_easy->req.p.[protocol]` to it.
`->connect_it` allows a protocol to do some specific actions after the TCP
connect is done, that can still be considered part of the connection phase.
static CURLcode file_setup_connection(struct connectdata *conn)
{
/* allocate the FILE specific struct */
- conn->data->req.protop = calloc(1, sizeof(struct FILEPROTO));
- if(!conn->data->req.protop)
+ conn->data->req.p.file = calloc(1, sizeof(struct FILEPROTO));
+ if(!conn->data->req.p.file)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
{
struct Curl_easy *data = conn->data;
char *real_path;
- struct FILEPROTO *file = data->req.protop;
+ struct FILEPROTO *file = data->req.p.file;
int fd;
#ifdef DOS_FILESYSTEM
size_t i;
static CURLcode file_done(struct connectdata *conn,
CURLcode status, bool premature)
{
- struct FILEPROTO *file = conn->data->req.protop;
+ struct FILEPROTO *file = conn->data->req.p.file;
(void)status; /* not used */
(void)premature; /* not used */
static CURLcode file_disconnect(struct connectdata *conn,
bool dead_connection)
{
- struct FILEPROTO *file = conn->data->req.protop;
+ struct FILEPROTO *file = conn->data->req.p.file;
(void)dead_connection; /* not used */
if(file) {
static CURLcode file_upload(struct connectdata *conn)
{
- struct FILEPROTO *file = conn->data->req.protop;
+ struct FILEPROTO *file = conn->data->req.p.file;
const char *dir = strchr(file->path, DIRSEP);
int fd;
int mode;
if(data->set.upload)
return file_upload(conn);
- file = conn->data->req.protop;
+ file = conn->data->req.p.file;
/* get the fd from the connection phase */
fd = file->fd;
static CURLcode ftp_state_prepare_transfer(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct Curl_easy *data = conn->data;
if(ftp->transfer != FTPTRANSFER_BODY) {
static CURLcode ftp_state_rest(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if((ftp->transfer != FTPTRANSFER_BODY) && ftpc->file) {
static CURLcode ftp_state_size(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if((ftp->transfer == FTPTRANSFER_INFO) && ftpc->file) {
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
/* If this output is to be machine-parsed, the NLST command might be better
to use, since the LIST command output is not specified or standard in any
static CURLcode ftp_state_type(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct Curl_easy *data = conn->data;
struct ftp_conn *ftpc = &conn->proto.ftpc;
bool sizechecked)
{
CURLcode result = CURLE_OK;
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct Curl_easy *data = conn->data;
struct ftp_conn *ftpc = &conn->proto.ftpc;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
bool quote = FALSE;
struct curl_slist *item;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
switch(ftpcode) {
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if(data->set.max_filesize && (filesize > data->set.max_filesize)) {
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
if((ftpcode == 150) || (ftpcode == 125)) {
bool premature)
{
struct Curl_easy *data = conn->data;
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
struct pingpong *pp = &ftpc->pp;
ssize_t nread;
bool complete = FALSE;
/* the ftp struct is inited in ftp_connect() */
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
/* if the second connection isn't done yet, wait for it */
if(!conn->bits.tcpconnect[SECONDARYSOCKET]) {
if(conn->data->set.opt_no_body) {
/* requested no body means no transfer... */
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
ftp->transfer = FTPTRANSFER_INFO;
}
static CURLcode init_wc_data(struct connectdata *conn)
{
char *last_slash;
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
char *path = ftp->path;
struct WildcardData *wildcard = &(conn->data->wildcard);
CURLcode result = CURLE_OK;
/* filelist has at least one file, lets get first one */
struct ftp_conn *ftpc = &conn->proto.ftpc;
struct curl_fileinfo *finfo = wildcard->filelist.head->ptr;
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
char *tmp_path = aprintf("%s%s", wildcard->path, finfo->filename);
if(!tmp_path)
{
struct Curl_easy *data = conn->data;
/* the ftp struct is already inited in ftp_connect() */
- struct FTP *ftp = data->req.protop;
+ struct FTP *ftp = data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
const char *slashPos = NULL;
const char *fileName = NULL;
static CURLcode ftp_dophase_done(struct connectdata *conn,
bool connected)
{
- struct FTP *ftp = conn->data->req.protop;
+ struct FTP *ftp = conn->data->req.p.ftp;
struct ftp_conn *ftpc = &conn->proto.ftpc;
if(connected) {
char *type;
struct FTP *ftp;
- conn->data->req.protop = ftp = calloc(sizeof(struct FTP), 1);
+ conn->data->req.p.ftp = ftp = calloc(sizeof(struct FTP), 1);
if(NULL == ftp)
return CURLE_OUT_OF_MEMORY;
during this request */
struct HTTP *http;
struct Curl_easy *data = conn->data;
- DEBUGASSERT(data->req.protop == NULL);
+ DEBUGASSERT(data->req.p.http == NULL);
http = calloc(1, sizeof(struct HTTP));
if(!http)
return CURLE_OUT_OF_MEMORY;
Curl_mime_initpart(&http->form, conn->data);
- data->req.protop = http;
+ data->req.p.http = http;
if(data->set.httpversion == CURL_HTTP_VERSION_3) {
if(conn->handler->flags & PROTOPT_SSL)
static CURLcode http_perhapsrewind(struct connectdata *conn)
{
struct Curl_easy *data = conn->data;
- struct HTTP *http = data->req.protop;
+ struct HTTP *http = data->req.p.http;
curl_off_t bytessent;
curl_off_t expectsend = -1; /* default is unknown */
void *userp)
{
struct connectdata *conn = (struct connectdata *)userp;
- struct HTTP *http = conn->data->req.protop;
+ struct HTTP *http = conn->data->req.p.http;
size_t fullsize = size * nitems;
if(!http->postsize)
char *ptr;
size_t size;
struct Curl_easy *data = conn->data;
- struct HTTP *http = data->req.protop;
+ struct HTTP *http = data->req.p.http;
size_t sendsize;
curl_socket_t sockfd;
size_t headersize;
CURLcode status, bool premature)
{
struct Curl_easy *data = conn->data;
- struct HTTP *http = data->req.protop;
+ struct HTTP *http = data->req.p.http;
/* Clear multipass flag. If authentication isn't done yet, then it will get
* a chance to be set back to true when we output the next auth header */
return result;
}
}
- http = data->req.protop;
+ http = data->req.p.http;
DEBUGASSERT(http);
if(!data->state.this_is_a_follow) {
/* called from http_setup_conn */
void Curl_http2_setup_req(struct Curl_easy *data)
{
- struct HTTP *http = data->req.protop;
+ struct HTTP *http = data->req.p.http;
http->bodystarted = FALSE;
http->status_code = -1;
http->pausedata = NULL;
if(!h || !GOOD_EASY_HANDLE(h->data))
return NULL;
else {
- struct HTTP *stream = h->data->req.protop;
+ struct HTTP *stream = h->data->req.p.http;
if(num < stream->push_headers_used)
return stream->push_headers[num];
}
!strcmp(header, ":") || strchr(header + 1, ':'))
return NULL;
else {
- struct HTTP *stream = h->data->req.protop;
+ struct HTTP *stream = h->data->req.p.http;
size_t len = strlen(header);
size_t i;
for(i = 0; i<stream->push_headers_used; i++) {
(void)Curl_close(&second);
}
else {
- second->req.protop = http;
+ second->req.p.http = http;
Curl_dyn_init(&http->header_recvbuf, DYN_H2_HEADERS);
Curl_http2_setup_req(second);
second->state.stream_weight = data->state.stream_weight;
/* ask the application */
H2BUGF(infof(data, "Got PUSH_PROMISE, ask application!\n"));
- stream = data->req.protop;
+ stream = data->req.p.http;
if(!stream) {
failf(data, "Internal NULL stream!\n");
(void)Curl_close(&newhandle);
if(rv) {
DEBUGASSERT((rv > CURL_PUSH_OK) && (rv <= CURL_PUSH_ERROROUT));
/* denied, kill off the new handle again */
- http2_stream_free(newhandle->req.protop);
- newhandle->req.protop = NULL;
+ http2_stream_free(newhandle->req.p.http);
+ newhandle->req.p.http = NULL;
(void)Curl_close(&newhandle);
goto fail;
}
- newstream = newhandle->req.protop;
+ newstream = newhandle->req.p.http;
newstream->stream_id = frame->promised_stream_id;
newhandle->req.maxdownload = -1;
newhandle->req.size = -1;
rc = Curl_multi_add_perform(data->multi, newhandle, conn);
if(rc) {
infof(data, "failed to add handle to multi\n");
- http2_stream_free(newhandle->req.protop);
- newhandle->req.protop = NULL;
+ http2_stream_free(newhandle->req.p.http);
+ newhandle->req.p.http = NULL;
Curl_close(&newhandle);
rv = CURL_PUSH_DENY;
goto fail;
return 0;
}
- stream = data_s->req.protop;
+ stream = data_s->req.p.http;
if(!stream) {
H2BUGF(infof(data_s, "No proto pointer for stream: %x\n",
stream_id));
internal error more than anything else! */
return NGHTTP2_ERR_CALLBACK_FAILURE;
- stream = data_s->req.protop;
+ stream = data_s->req.p.http;
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
H2BUGF(infof(data_s, "on_stream_close(), %s (err %d), stream %u\n",
nghttp2_http2_strerror(error_code), error_code, stream_id));
- stream = data_s->req.protop;
+ stream = data_s->req.p.http;
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
return 0;
}
- stream = data_s->req.protop;
+ stream = data_s->req.p.http;
if(!stream || !stream->bodystarted) {
return 0;
}
internal error more than anything else! */
return NGHTTP2_ERR_CALLBACK_FAILURE;
- stream = data_s->req.protop;
+ stream = data_s->req.p.http;
if(!stream) {
failf(data_s, "Internal NULL stream! 5\n");
return NGHTTP2_ERR_CALLBACK_FAILURE;
internal error more than anything else! */
return NGHTTP2_ERR_CALLBACK_FAILURE;
- stream = data_s->req.protop;
+ stream = data_s->req.p.http;
if(!stream)
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
void Curl_http2_done(struct Curl_easy *data, bool premature)
{
- struct HTTP *http = data->req.protop;
+ struct HTTP *http = data->req.p.http;
struct http_conn *httpc = &data->conn->proto.httpc;
/* there might be allocated resources done before this got the 'h2' pointer
(conn->handler == &Curl_handler_http2)) {
/* make sure this is only attempted for HTTP/2 transfers */
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
struct http_conn *httpc = &conn->proto.httpc;
nghttp2_session *h2 = httpc->h2;
nghttp2_priority_spec *pri_spec)
{
struct HTTP *depstream = (data->set.stream_depends_on?
- data->set.stream_depends_on->req.protop:NULL);
+ data->set.stream_depends_on->req.p.http:NULL);
int32_t depstream_id = depstream? depstream->stream_id:0;
nghttp2_priority_spec_init(pri_spec, depstream_id, data->set.stream_weight,
data->set.stream_depends_e);
static int h2_session_send(struct Curl_easy *data,
nghttp2_session *h2)
{
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
if((data->set.stream_weight != data->state.stream_weight) ||
(data->set.stream_depends_e != data->state.stream_depends_e) ||
(data->set.stream_depends_on != data->state.stream_depends_on) ) {
ssize_t nread;
struct http_conn *httpc = &conn->proto.httpc;
struct Curl_easy *data = conn->data;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
(void)sockindex; /* we always do HTTP2 on sockindex 0 */
*/
int rv;
struct http_conn *httpc = &conn->proto.httpc;
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
nghttp2_nv *nva = NULL;
size_t nheader;
size_t i;
{
CURLcode result;
struct http_conn *httpc = &conn->proto.httpc;
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
DEBUGASSERT(conn->data->state.buffer);
struct http_conn *httpc = &conn->proto.httpc;
int rv;
struct Curl_easy *data = conn->data;
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
result = Curl_http2_setup(conn);
if(result)
return CURLE_OK;
#ifdef NGHTTP2_HAS_SET_LOCAL_WINDOW_SIZE
else {
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
struct http_conn *httpc = &data->conn->proto.httpc;
uint32_t window = !pause * HTTP2_HUGE_WINDOW_SIZE;
int rv = nghttp2_session_set_local_window_size(httpc->h2,
* This function might be called several times in the multi interface case
* if the proxy's CONNECT response is not instant.
*/
- prot_save = conn->data->req.protop;
+ prot_save = conn->data->req.p.http;
memset(&http_proxy, 0, sizeof(http_proxy));
- conn->data->req.protop = &http_proxy;
+ conn->data->req.p.http = &http_proxy;
connkeep(conn, "HTTP proxy CONNECT");
/* for the secondary socket (FTP), use the "connect to host"
else
remote_port = conn->remote_port;
result = Curl_proxyCONNECT(conn, sockindex, hostname, remote_port);
- conn->data->req.protop = prot_save;
+ conn->data->req.p.http = prot_save;
if(CURLE_OK != result)
return result;
Curl_safefree(data->state.aptr.proxyuserpwd);
static bool imap_endofresp(struct connectdata *conn, char *line, size_t len,
int *resp)
{
- struct IMAP *imap = conn->data->req.protop;
+ struct IMAP *imap = conn->data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
const char *id = imapc->resptag;
size_t id_len = strlen(id);
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.protop;
+ struct IMAP *imap = data->req.p.imap;
if(imap->custom)
/* Send the custom request */
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.protop;
+ struct IMAP *imap = data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
char *mailbox;
static CURLcode imap_perform_fetch(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct IMAP *imap = conn->data->req.protop;
+ struct IMAP *imap = conn->data->req.p.imap;
/* Check we have a UID */
if(imap->uid) {
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.protop;
+ struct IMAP *imap = data->req.p.imap;
char *mailbox;
/* Check we have a mailbox */
static CURLcode imap_perform_search(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct IMAP *imap = conn->data->req.protop;
+ struct IMAP *imap = conn->data->req.p.imap;
/* Check we have a query string */
if(!imap->query) {
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = conn->data->req.protop;
+ struct IMAP *imap = conn->data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
const char *line = data->state.buffer;
struct Curl_easy *data = conn->data;
struct IMAP *imap;
- imap = data->req.protop = calloc(sizeof(struct IMAP), 1);
+ imap = data->req.p.imap = calloc(sizeof(struct IMAP), 1);
if(!imap)
result = CURLE_OUT_OF_MEMORY;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.protop;
+ struct IMAP *imap = data->req.p.imap;
(void)premature;
/* This is IMAP and no proxy */
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.protop;
+ struct IMAP *imap = data->req.p.imap;
struct imap_conn *imapc = &conn->proto.imapc;
bool selected = FALSE;
/* Call this when the DO phase has completed */
static CURLcode imap_dophase_done(struct connectdata *conn, bool connected)
{
- struct IMAP *imap = conn->data->req.protop;
+ struct IMAP *imap = conn->data->req.p.imap;
(void)connected;
/* The imap struct is already initialised in imap_connect() */
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.protop;
+ struct IMAP *imap = data->req.p.imap;
const char *begin = &data->state.up.path[1]; /* skip leading slash */
const char *ptr = begin;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct IMAP *imap = data->req.protop;
+ struct IMAP *imap = data->req.p.imap;
const char *custom = data->set.str[STRING_CUSTOMREQUEST];
if(custom) {
during this request */
struct MQTT *mq;
struct Curl_easy *data = conn->data;
- DEBUGASSERT(data->req.protop == NULL);
+ DEBUGASSERT(data->req.p.mqtt == NULL);
mq = calloc(1, sizeof(struct MQTT));
if(!mq)
return CURLE_OUT_OF_MEMORY;
- data->req.protop = mq;
+ data->req.p.mqtt = mq;
return CURLE_OK;
}
CURLcode result = CURLE_OK;
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
struct Curl_easy *data = conn->data;
- struct MQTT *mq = data->req.protop;
+ struct MQTT *mq = data->req.p.mqtt;
ssize_t n;
result = Curl_write(conn, sockfd, buf, len, &n);
if(!result)
unsigned char *pkt = (unsigned char *)data->state.buffer;
size_t remlen;
struct mqtt_conn *mqtt = &conn->proto.mqtt;
- struct MQTT *mq = data->req.protop;
+ struct MQTT *mq = data->req.p.mqtt;
unsigned char packet;
switch(mqtt->state) {
CURLcode result = CURLE_OK;
struct mqtt_conn *mqtt = &conn->proto.mqtt;
struct Curl_easy *data = conn->data;
- struct MQTT *mq = data->req.protop;
+ struct MQTT *mq = data->req.p.mqtt;
ssize_t nread;
curl_socket_t sockfd = conn->sock[FIRSTSOCKET];
unsigned char *pkt = (unsigned char *)data->state.buffer;
if(!lr)
return CURLE_OUT_OF_MEMORY;
lr->msgid = msgid;
- data->req.protop = lr;
+ data->req.p.ldap = lr;
Curl_setup_transfer(data, FIRSTSOCKET, -1, FALSE, -1);
*done = TRUE;
return CURLE_OK;
static CURLcode ldap_done(struct connectdata *conn, CURLcode res,
bool premature)
{
- struct ldapreqinfo *lr = conn->data->req.protop;
+ struct ldapreqinfo *lr = conn->data->req.p.ldap;
(void)res;
(void)premature;
ldap_abandon_ext(li->ld, lr->msgid, NULL, NULL);
lr->msgid = 0;
}
- conn->data->req.protop = NULL;
+ conn->data->req.p.ldap = NULL;
free(lr);
}
{
struct ldapconninfo *li = conn->proto.ldapc;
struct Curl_easy *data = conn->data;
- struct ldapreqinfo *lr = data->req.protop;
+ struct ldapreqinfo *lr = data->req.p.ldap;
int rc, ret;
LDAPMessage *msg = NULL;
LDAPMessage *ent;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.protop;
+ struct POP3 *pop3 = data->req.p.pop3;
const char *command = NULL;
/* Calculate the default command */
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.protop;
+ struct POP3 *pop3 = data->req.p.pop3;
struct pop3_conn *pop3c = &conn->proto.pop3c;
struct pingpong *pp = &pop3c->pp;
struct Curl_easy *data = conn->data;
struct POP3 *pop3;
- pop3 = data->req.protop = calloc(sizeof(struct POP3), 1);
+ pop3 = data->req.p.pop3 = calloc(sizeof(struct POP3), 1);
if(!pop3)
result = CURLE_OUT_OF_MEMORY;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.protop;
+ struct POP3 *pop3 = data->req.p.pop3;
(void)premature;
{
/* This is POP3 and no proxy */
CURLcode result = CURLE_OK;
- struct POP3 *pop3 = conn->data->req.protop;
+ struct POP3 *pop3 = conn->data->req.p.pop3;
DEBUGF(infof(conn->data, "DO phase starts\n"));
{
/* The POP3 struct is already initialised in pop3_connect() */
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.protop;
+ struct POP3 *pop3 = data->req.p.pop3;
const char *path = &data->state.up.path[1]; /* skip leading path */
/* URL decode the path for the message ID */
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct POP3 *pop3 = data->req.protop;
+ struct POP3 *pop3 = data->req.p.pop3;
const char *custom = data->set.str[STRING_CUSTOMREQUEST];
/* URL decode the custom request */
{
struct RTSP *rtsp;
- conn->data->req.protop = rtsp = calloc(1, sizeof(struct RTSP));
+ conn->data->req.p.rtsp = rtsp = calloc(1, sizeof(struct RTSP));
if(!rtsp)
return CURLE_OUT_OF_MEMORY;
CURLcode status, bool premature)
{
struct Curl_easy *data = conn->data;
- struct RTSP *rtsp = data->req.protop;
+ struct RTSP *rtsp = data->req.p.rtsp;
CURLcode httpStatus;
/* Bypass HTTP empty-reply checks on receive */
struct Curl_easy *data = conn->data;
CURLcode result = CURLE_OK;
Curl_RtspReq rtspreq = data->set.rtspreq;
- struct RTSP *rtsp = data->req.protop;
+ struct RTSP *rtsp = data->req.p.rtsp;
struct dynbuf req_buffer;
curl_off_t postsize = 0; /* for ANNOUNCE and SET_PARAMETER */
curl_off_t putsize = 0; /* for ANNOUNCE and SET_PARAMETER */
/* Store the received CSeq. Match is verified in rtsp_done */
int nc = sscanf(&header[4], ": %ld", &CSeq);
if(nc == 1) {
- struct RTSP *rtsp = data->req.protop;
+ struct RTSP *rtsp = data->req.p.rtsp;
rtsp->CSeq_recv = CSeq; /* mark the request */
data->state.rtsp_CSeq_recv = CSeq; /* update the handle */
}
static void request_state(struct connectdata *conn,
enum smb_req_state newstate)
{
- struct smb_request *req = conn->data->req.protop;
+ struct smb_request *req = conn->data->req.p.smb;
#if defined(DEBUGBUILD) && !defined(CURL_DISABLE_VERBOSE_STRINGS)
/* For debug purposes */
static const char * const names[] = {
struct smb_request *req;
/* Initialize the request state */
- conn->data->req.protop = req = calloc(1, sizeof(struct smb_request));
+ conn->data->req.p.smb = req = calloc(1, sizeof(struct smb_request));
if(!req)
return CURLE_OUT_OF_MEMORY;
unsigned char cmd, size_t len)
{
struct smb_conn *smbc = &conn->proto.smbc;
- struct smb_request *req = conn->data->req.protop;
+ struct smb_request *req = conn->data->req.p.smb;
unsigned int pid;
memset(h, 0, sizeof(*h));
static CURLcode smb_send_open(struct connectdata *conn)
{
- struct smb_request *req = conn->data->req.protop;
+ struct smb_request *req = conn->data->req.p.smb;
struct smb_nt_create msg;
size_t byte_count;
static CURLcode smb_send_close(struct connectdata *conn)
{
- struct smb_request *req = conn->data->req.protop;
+ struct smb_request *req = conn->data->req.p.smb;
struct smb_close msg;
memset(&msg, 0, sizeof(msg));
static CURLcode smb_send_read(struct connectdata *conn)
{
- struct smb_request *req = conn->data->req.protop;
+ struct smb_request *req = conn->data->req.p.smb;
curl_off_t offset = conn->data->req.offset;
struct smb_read msg;
static CURLcode smb_send_write(struct connectdata *conn)
{
struct smb_write *msg;
- struct smb_request *req = conn->data->req.protop;
+ struct smb_request *req = conn->data->req.p.smb;
curl_off_t offset = conn->data->req.offset;
curl_off_t upload_size = conn->data->req.size - conn->data->req.bytecount;
CURLcode result = Curl_get_upload_buffer(conn->data);
static CURLcode smb_request_state(struct connectdata *conn, bool *done)
{
- struct smb_request *req = conn->data->req.protop;
+ struct smb_request *req = conn->data->req.p.smb;
struct smb_header *h;
struct smb_conn *smbc = &conn->proto.smbc;
enum smb_req_state next_state = SMB_DONE;
bool premature)
{
(void) premature;
- Curl_safefree(conn->data->req.protop);
+ Curl_safefree(conn->data->req.p.smb);
return status;
}
static CURLcode smb_parse_url_path(struct connectdata *conn)
{
struct Curl_easy *data = conn->data;
- struct smb_request *req = data->req.protop;
+ struct smb_request *req = data->req.p.smb;
struct smb_conn *smbc = &conn->proto.smbc;
char *path;
char *slash;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
if(smtp->rcpt) {
/* We notify the server we are sending UTF-8 data if a) it supports the
any there do, as we need to correctly identify our support for SMTPUTF8
in the envelope, as per RFC-6531 sect. 3.4 */
if(conn->proto.smtpc.utf8_supported && !utf8) {
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
struct curl_slist *rcpt = smtp->rcpt;
while(rcpt && !utf8) {
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
char *address = NULL;
struct hostname host = { NULL, NULL, NULL, NULL };
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
char *line = data->state.buffer;
size_t len = strlen(line);
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
bool is_smtp_err = FALSE;
bool is_smtp_blocking_err = FALSE;
struct Curl_easy *data = conn->data;
struct SMTP *smtp;
- smtp = data->req.protop = calloc(sizeof(struct SMTP), 1);
+ smtp = data->req.p.smtp = calloc(sizeof(struct SMTP), 1);
if(!smtp)
result = CURLE_OUT_OF_MEMORY;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
struct pingpong *pp = &conn->proto.smtpc.pp;
char *eob;
ssize_t len;
/* This is SMTP and no proxy */
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
DEBUGF(infof(conn->data, "DO phase starts\n"));
/* Call this when the DO phase has completed */
static CURLcode smtp_dophase_done(struct connectdata *conn, bool connected)
{
- struct SMTP *smtp = conn->data->req.protop;
+ struct SMTP *smtp = conn->data->req.p.smtp;
(void)connected;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
const char *custom = data->set.str[STRING_CUSTOMREQUEST];
/* URL decode the custom request */
ssize_t i;
ssize_t si;
struct Curl_easy *data = conn->data;
- struct SMTP *smtp = data->req.protop;
+ struct SMTP *smtp = data->req.p.smtp;
char *scratch = data->state.scratch;
char *newscratch = NULL;
char *oldscratch = NULL;
if(!tn)
return CURLE_OUT_OF_MEMORY;
- conn->data->req.protop = tn; /* make us known */
+ conn->data->req.p.telnet = tn; /* make us known */
tn->telrcv_state = CURL_TS_DATA;
static void negotiate(struct connectdata *conn)
{
int i;
- struct TELNET *tn = (struct TELNET *) conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *) conn->data->req.p.telnet;
for(i = 0; i < CURL_NTELOPTS; i++) {
if(i == CURL_TELOPT_ECHO)
static
void set_remote_option(struct connectdata *conn, int option, int newstate)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
if(newstate == CURL_YES) {
switch(tn->him[option]) {
case CURL_NO:
static
void rec_will(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->him[option]) {
case CURL_NO:
if(tn->him_preferred[option] == CURL_YES) {
static
void rec_wont(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->him[option]) {
case CURL_NO:
/* Already disabled */
static void
set_local_option(struct connectdata *conn, int option, int newstate)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
if(newstate == CURL_YES) {
switch(tn->us[option]) {
case CURL_NO:
static
void rec_do(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->us[option]) {
case CURL_NO:
if(tn->us_preferred[option] == CURL_YES) {
static
void rec_dont(struct connectdata *conn, int option)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
switch(tn->us[option]) {
case CURL_NO:
/* Already disabled */
char option_keyword[128] = "";
char option_arg[256] = "";
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
CURLcode result = CURLE_OK;
int binary_option;
char varname[128] = "";
char varval[128] = "";
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)data->req.protop;
+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
printsub(data, '<', (unsigned char *)tn->subbuffer, CURL_SB_LEN(tn) + 2);
switch(CURL_SB_GET(tn)) {
unsigned char *uc1, *uc2;
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)data->req.protop;
+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
switch(option) {
case CURL_TELOPT_NAWS:
int in = 0;
int startwrite = -1;
struct Curl_easy *data = conn->data;
- struct TELNET *tn = (struct TELNET *)data->req.protop;
+ struct TELNET *tn = (struct TELNET *)data->req.p.telnet;
#define startskipping() \
if(startwrite >= 0) { \
static CURLcode telnet_done(struct connectdata *conn,
CURLcode status, bool premature)
{
- struct TELNET *tn = (struct TELNET *)conn->data->req.protop;
+ struct TELNET *tn = (struct TELNET *)conn->data->req.p.telnet;
(void)status; /* unused */
(void)premature; /* not used */
curl_slist_free_all(tn->telnet_vars);
tn->telnet_vars = NULL;
- Curl_safefree(conn->data->req.protop);
+ Curl_safefree(conn->data->req.p.telnet);
return CURLE_OK;
}
if(result)
return result;
- tn = (struct TELNET *)data->req.protop;
+ tn = data->req.p.telnet;
result = check_telnet_options(conn);
if(result)
bool sending_http_headers = FALSE;
if(conn->handler->protocol&(PROTO_FAMILY_HTTP|CURLPROTO_RTSP)) {
- const struct HTTP *http = data->req.protop;
+ const struct HTTP *http = data->req.p.http;
if(http->sending == HTTPSEND_REQUEST)
/* We're sending the HTTP request headers, not the data.
CURLOPT_HTTPPOST, call app to rewind
*/
if(conn->handler->protocol & PROTO_FAMILY_HTTP) {
- struct HTTP *http = data->req.protop;
+ struct HTTP *http = data->req.p.http;
if(http->sendit)
mimepart = http->sendit;
/* HTTP pollution, this should be written nicer to become more
protocol agnostic. */
size_t fillcount;
- struct HTTP *http = k->protop;
+ struct HTTP *http = k->p.http;
if((k->exp100 == EXP100_SENDING_REQUEST) &&
(http->sending == HTTPSEND_BODY)) {
{
struct SingleRequest *k = &data->req;
struct connectdata *conn = data->conn;
- struct HTTP *http = data->req.protop;
+ struct HTTP *http = data->req.p.http;
bool httpsending = ((conn->handler->protocol&PROTO_FAMILY_HTTP) &&
(http->sending == HTTPSEND_REQUEST));
DEBUGASSERT(conn != NULL);
void Curl_free_request_state(struct Curl_easy *data)
{
- Curl_safefree(data->req.protop);
+ Curl_safefree(data->req.p.http);
Curl_safefree(data->req.newurl);
#ifndef CURL_DISABLE_DOH
and the 'upload_present' contains the number of bytes available at this
position */
char *upload_fromhere;
- void *protop; /* Allocated protocol-specific data. Each protocol
- handler makes sure this points to data it needs. */
+
+ /* Allocated protocol-specific data. Each protocol handler makes sure this
+ points to data it needs. */
+ union {
+ struct FILEPROTO *file;
+ struct FTP *ftp;
+ struct HTTP *http;
+ struct IMAP *imap;
+ struct ldapreqinfo *ldap;
+ struct MQTT *mqtt;
+ struct POP3 *pop3;
+ struct RTSP *rtsp;
+ struct smb_request *smb;
+ struct SMTP *smtp;
+ struct SSHPROTO *ssh;
+ struct TELNET *telnet;
+ } p;
#ifndef CURL_DISABLE_DOH
struct dohdata doh; /* DoH specific data for this request */
#endif
void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
(void)conn;
(void)stream_id;
(void)app_error_code;
void *user_data, void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
CURLcode result = CURLE_OK;
(void)conn;
void *user_data, void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
CURLcode result = CURLE_OK;
(void)conn;
(void)stream_id;
nghttp3_vec h3name = nghttp3_rcbuf_get_buf(name);
nghttp3_vec h3val = nghttp3_rcbuf_get_buf(value);
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
CURLcode result = CURLE_OK;
(void)conn;
(void)stream_id;
CURLcode *curlcode)
{
curl_socket_t sockfd = conn->sock[sockindex];
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
struct quicsocket *qs = conn->quic;
if(!stream->memlen) {
void *stream_user_data)
{
struct Curl_easy *data = stream_user_data;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
(void)conn;
(void)stream_id;
(void)user_data;
{
struct Curl_easy *data = stream_user_data;
size_t nread;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
(void)conn;
(void)stream_id;
(void)user_data;
static CURLcode http_request(struct connectdata *conn, const void *mem,
size_t len)
{
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
size_t nheader;
size_t i;
size_t authority_idx;
ssize_t sent;
struct quicsocket *qs = conn->quic;
curl_socket_t sockfd = conn->sock[sockindex];
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
if(!stream->h3req) {
CURLcode result = http_request(conn, mem, len);
{
if(conn->handler == &Curl_handler_http3) {
/* only for HTTP/3 transfers */
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
struct quicsocket *qs = conn->quic;
stream->upload_done = TRUE;
(void)nghttp3_conn_resume_stream(qs->h3conn, stream->stream3_id);
(void)premature;
if(data->conn->handler == &Curl_handler_http3) {
/* only for HTTP/3 transfers */
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
Curl_dyn_free(&stream->overflow);
}
}
buffer and allocated an overflow buffer. Since it's possible that
there's no more data coming on the socket, we need to keep reading
until the overflow buffer is empty. */
- const struct HTTP *stream = data->req.protop;
+ const struct HTTP *stream = data->req.p.http;
return Curl_dyn_len(&stream->overflow) > 0;
}
static CURLcode quiche_do(struct connectdata *conn, bool *done)
{
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
stream->h3req = FALSE; /* not sent */
return Curl_http(conn, done);
}
int rc;
struct h3h1header headers;
struct Curl_easy *data = conn->data;
- struct HTTP *stream = data->req.protop;
+ struct HTTP *stream = data->req.p.http;
headers.dest = buf;
headers.destlen = buffersize;
headers.nlen = 0;
ssize_t sent;
struct quicsocket *qs = conn->quic;
curl_socket_t sockfd = conn->sock[sockindex];
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
if(!stream->h3req) {
CURLcode result = http_request(conn, mem, len);
{
/*
*/
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
size_t nheader;
size_t i;
size_t authority_idx;
if(conn->handler == &Curl_handler_http3) {
/* only for HTTP/3 transfers */
ssize_t sent;
- struct HTTP *stream = conn->data->req.protop;
+ struct HTTP *stream = conn->data->req.p.http;
struct quicsocket *qs = conn->quic;
fprintf(stderr, "!!! Curl_quic_done_sending\n");
stream->upload_done = TRUE;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SSHPROTO *protop = data->req.protop;
+ struct SSHPROTO *protop = data->req.p.ssh;
struct ssh_conn *sshc = &conn->proto.sshc;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
int rc = SSH_NO_ERROR, err;
{
struct SSHPROTO *ssh;
- conn->data->req.protop = ssh = calloc(1, sizeof(struct SSHPROTO));
+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
if(!ssh)
return CURLE_OUT_OF_MEMORY;
int rc;
/* initialize per-handle data if not already */
- if(!data->req.protop)
+ if(!data->req.p.ssh)
myssh_setup_connection(conn);
/* We default to persistent connections. We set this already in this connect
static CURLcode myssh_done(struct connectdata *conn, CURLcode status)
{
CURLcode result = CURLE_OK;
- struct SSHPROTO *protop = conn->data->req.protop;
+ struct SSHPROTO *protop = conn->data->req.p.ssh;
if(!status) {
/* run the state-machine */
{
const char *cp;
struct Curl_easy *data = conn->data;
- struct SSHPROTO *protop = data->req.protop;
+ struct SSHPROTO *protop = data->req.p.ssh;
struct ssh_conn *sshc = &conn->proto.sshc;
CURLcode result;
{
CURLcode result = CURLE_OK;
struct Curl_easy *data = conn->data;
- struct SSHPROTO *sftp_scp = data->req.protop;
+ struct SSHPROTO *sftp_scp = data->req.p.ssh;
struct ssh_conn *sshc = &conn->proto.sshc;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
int rc = LIBSSH2_ERROR_NONE;
{
struct SSHPROTO *ssh;
- conn->data->req.protop = ssh = calloc(1, sizeof(struct SSHPROTO));
+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
if(!ssh)
return CURLE_OUT_OF_MEMORY;
struct Curl_easy *data = conn->data;
/* initialize per-handle data if not already */
- if(!data->req.protop)
+ if(!data->req.p.ssh)
ssh_setup_connection(conn);
/* We default to persistent connections. We set this already in this connect
static CURLcode ssh_done(struct connectdata *conn, CURLcode status)
{
CURLcode result = CURLE_OK;
- struct SSHPROTO *sftp_scp = conn->data->req.protop;
+ struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
if(!status) {
/* run the state-machine */
{
struct SSHPROTO *ssh;
- conn->data->req.protop = ssh = calloc(1, sizeof(struct SSHPROTO));
+ conn->data->req.p.ssh = ssh = calloc(1, sizeof(struct SSHPROTO));
if(!ssh)
return CURLE_OUT_OF_MEMORY;
int rc;
/* initialize per-handle data if not already */
- if(!data->req.protop)
+ if(!data->req.p.ssh)
wssh_setup_connection(conn);
/* We default to persistent connections. We set this already in this connect
CURLcode result = CURLE_OK;
struct ssh_conn *sshc = &conn->proto.sshc;
struct Curl_easy *data = conn->data;
- struct SSHPROTO *sftp_scp = data->req.protop;
+ struct SSHPROTO *sftp_scp = data->req.p.ssh;
WS_SFTPNAME *name;
int rc = 0;
*block = FALSE; /* we're not blocking by default */
static CURLcode wssh_done(struct connectdata *conn, CURLcode status)
{
CURLcode result = CURLE_OK;
- struct SSHPROTO *sftp_scp = conn->data->req.protop;
+ struct SSHPROTO *sftp_scp = conn->data->req.p.ssh;
if(!status) {
/* run the state-machine */