2002-09-03 19:52:59 +08:00
|
|
|
/***************************************************************************
|
2004-10-06 15:50:18 +08:00
|
|
|
* _ _ ____ _
|
|
|
|
* Project ___| | | | _ \| |
|
|
|
|
* / __| | | | |_) | |
|
|
|
|
* | (__| |_| | _ <| |___
|
1999-12-29 22:20:26 +08:00
|
|
|
* \___|\___/|_| \_\_____|
|
|
|
|
*
|
2023-01-02 20:51:48 +08:00
|
|
|
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2002-09-03 19:52:59 +08:00
|
|
|
* This software is licensed as described in the file COPYING, which
|
|
|
|
* you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
* are also available at https://curl.se/docs/copyright.html.
|
2004-10-06 15:50:18 +08:00
|
|
|
*
|
2001-01-03 17:29:33 +08:00
|
|
|
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
* copies of the Software, and permit persons to whom the Software is
|
2002-09-03 19:52:59 +08:00
|
|
|
* furnished to do so, under the terms of the COPYING file.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2001-01-03 17:29:33 +08:00
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
1999-12-29 22:20:26 +08:00
|
|
|
*
|
2002-09-03 19:52:59 +08:00
|
|
|
* SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
*
|
2002-09-03 19:52:59 +08:00
|
|
|
***************************************************************************/
|
1999-12-29 22:20:26 +08:00
|
|
|
|
2013-01-07 02:06:49 +08:00
|
|
|
#include "curl_setup.h"
|
2000-08-24 22:26:33 +08:00
|
|
|
|
2004-11-12 07:13:06 +08:00
|
|
|
#ifndef CURL_DISABLE_DICT
|
|
|
|
|
2011-07-25 11:30:14 +08:00
|
|
|
#ifdef HAVE_NETINET_IN_H
|
1999-12-29 22:20:26 +08:00
|
|
|
#include <netinet/in.h>
|
2011-07-25 11:30:14 +08:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NETDB_H
|
1999-12-29 22:20:26 +08:00
|
|
|
#include <netdb.h>
|
2011-07-25 11:30:14 +08:00
|
|
|
#endif
|
1999-12-29 22:20:26 +08:00
|
|
|
#ifdef HAVE_ARPA_INET_H
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_NET_IF_H
|
|
|
|
#include <net/if.h>
|
|
|
|
#endif
|
2008-11-15 07:17:32 +08:00
|
|
|
#ifdef HAVE_SYS_IOCTL_H
|
1999-12-29 22:20:26 +08:00
|
|
|
#include <sys/ioctl.h>
|
2008-11-15 07:17:32 +08:00
|
|
|
#endif
|
1999-12-29 22:20:26 +08:00
|
|
|
|
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_SELECT_H
|
|
|
|
#include <sys/select.h>
|
2020-03-30 21:52:43 +08:00
|
|
|
#elif defined(HAVE_UNISTD_H)
|
|
|
|
#include <unistd.h>
|
1999-12-29 22:20:26 +08:00
|
|
|
#endif
|
|
|
|
|
2013-01-04 09:50:28 +08:00
|
|
|
#include "urldata.h"
|
1999-12-29 22:20:26 +08:00
|
|
|
#include <curl/curl.h>
|
2013-01-04 09:50:28 +08:00
|
|
|
#include "transfer.h"
|
|
|
|
#include "sendf.h"
|
2016-10-05 00:56:45 +08:00
|
|
|
#include "escape.h"
|
2013-01-04 09:50:28 +08:00
|
|
|
#include "progress.h"
|
|
|
|
#include "dict.h"
|
2020-09-28 20:14:25 +08:00
|
|
|
#include "curl_printf.h"
|
2016-10-01 00:54:02 +08:00
|
|
|
#include "strcase.h"
|
2012-11-17 07:59:42 +08:00
|
|
|
#include "curl_memory.h"
|
2006-05-10 19:44:31 +08:00
|
|
|
/* The last #include file should be: */
|
2013-01-04 09:50:28 +08:00
|
|
|
#include "memdebug.h"
|
2006-05-10 19:44:31 +08:00
|
|
|
|
2007-10-12 21:36:37 +08:00
|
|
|
/*
|
|
|
|
* Forward declarations.
|
|
|
|
*/
|
|
|
|
|
2021-01-09 00:58:15 +08:00
|
|
|
static CURLcode dict_do(struct Curl_easy *data, bool *done);
|
2007-10-12 21:36:37 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* DICT protocol handler.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const struct Curl_handler Curl_handler_dict = {
|
2024-05-07 22:55:23 +08:00
|
|
|
"dict", /* scheme */
|
2007-10-18 00:58:32 +08:00
|
|
|
ZERO_NULL, /* setup_connection */
|
2007-12-09 06:50:55 +08:00
|
|
|
dict_do, /* do_it */
|
2007-10-18 00:58:32 +08:00
|
|
|
ZERO_NULL, /* done */
|
|
|
|
ZERO_NULL, /* do_more */
|
|
|
|
ZERO_NULL, /* connect_it */
|
|
|
|
ZERO_NULL, /* connecting */
|
|
|
|
ZERO_NULL, /* doing */
|
|
|
|
ZERO_NULL, /* proto_getsock */
|
|
|
|
ZERO_NULL, /* doing_getsock */
|
2011-10-22 05:36:54 +08:00
|
|
|
ZERO_NULL, /* domore_getsock */
|
2008-12-20 05:14:52 +08:00
|
|
|
ZERO_NULL, /* perform_getsock */
|
2007-10-18 00:58:32 +08:00
|
|
|
ZERO_NULL, /* disconnect */
|
lib: replace readwrite with write_resp
This clarifies the handling of server responses by folding the code for
the complicated protocols into their protocol handlers. This concerns
mainly HTTP and its bastard sibling RTSP.
The terms "read" and "write" are often used without clear context if
they refer to the connect or the client/application side of a
transfer. This PR uses "read/write" for operations on the client side
and "send/receive" for the connection, e.g. server side. If this is
considered useful, we can revisit renaming of further methods in another
PR.
Curl's protocol handler `readwrite()` method been changed:
```diff
- CURLcode (*readwrite)(struct Curl_easy *data, struct connectdata *conn,
- const char *buf, size_t blen,
- size_t *pconsumed, bool *readmore);
+ CURLcode (*write_resp)(struct Curl_easy *data, const char *buf, size_t blen,
+ bool is_eos, bool *done);
```
The name was changed to clarify that this writes reponse data to the
client side. The parameter changes are:
* `conn` removed as it always operates on `data->conn`
* `pconsumed` removed as the method needs to handle all data on success
* `readmore` removed as no longer necessary
* `is_eos` as indicator that this is the last call for the transfer
response (end-of-stream).
* `done` TRUE on return iff the transfer response is to be treated as
finished
This change affects many files only because of updated comments in
handlers that provide no implementation. The real change is that the
HTTP protocol handlers now provide an implementation.
The HTTP protocol handlers `write_resp()` implementation will get passed
**all** raw data of a server response for the transfer. The HTTP/1.x
formatted status and headers, as well as the undecoded response
body. `Curl_http_write_resp_hds()` is used internally to parse the
response headers and pass them on. This method is public as the RTSP
protocol handler also uses it.
HTTP/1.1 "chunked" transport encoding is now part of the general
*content encoding* writer stack, just like other encodings. A new flag
`CLIENTWRITE_EOS` was added for the last client write. This allows
writers to verify that they are in a valid end state. The chunked
decoder will check if it indeed has seen the last chunk.
The general response handling in `transfer.c:466` happens in function
`readwrite_data()`. This mainly operates now like:
```
static CURLcode readwrite_data(data, ...)
{
do {
Curl_xfer_recv_resp(data, buf)
...
Curl_xfer_write_resp(data, buf)
...
} while(interested);
...
}
```
All the response data handling is implemented in
`Curl_xfer_write_resp()`. It calls the protocol handler's `write_resp()`
implementation if available, or does the default behaviour.
All raw response data needs to pass through this function. Which also
means that anyone in possession of such data may call
`Curl_xfer_write_resp()`.
Closes #12480
2023-12-01 20:50:32 +08:00
|
|
|
ZERO_NULL, /* write_resp */
|
2024-03-21 19:15:59 +08:00
|
|
|
ZERO_NULL, /* write_resp_hd */
|
2017-05-31 19:09:56 +08:00
|
|
|
ZERO_NULL, /* connection_check */
|
2021-05-17 14:54:00 +08:00
|
|
|
ZERO_NULL, /* attach connection */
|
2007-10-12 21:36:37 +08:00
|
|
|
PORT_DICT, /* defport */
|
2011-03-15 05:52:14 +08:00
|
|
|
CURLPROTO_DICT, /* protocol */
|
2020-09-21 19:45:24 +08:00
|
|
|
CURLPROTO_DICT, /* family */
|
|
|
|
PROTOPT_NONE | PROTOPT_NOURLQUERY /* flags */
|
2007-10-12 21:36:37 +08:00
|
|
|
};
|
|
|
|
|
2023-01-29 05:05:11 +08:00
|
|
|
#define DYN_DICT_WORD 10000
|
|
|
|
static char *unescape_word(const char *input)
|
2006-05-10 19:44:31 +08:00
|
|
|
{
|
2023-01-29 05:05:11 +08:00
|
|
|
struct dynbuf out;
|
|
|
|
const char *ptr;
|
|
|
|
CURLcode result = CURLE_OK;
|
|
|
|
Curl_dyn_init(&out, DYN_DICT_WORD);
|
|
|
|
|
|
|
|
/* According to RFC2229 section 2.2, these letters need to be escaped with
|
|
|
|
\[letter] */
|
|
|
|
for(ptr = input; *ptr; ptr++) {
|
|
|
|
char ch = *ptr;
|
|
|
|
if((ch <= 32) || (ch == 127) ||
|
|
|
|
(ch == '\'') || (ch == '\"') || (ch == '\\'))
|
|
|
|
result = Curl_dyn_addn(&out, "\\", 1);
|
|
|
|
if(!result)
|
|
|
|
result = Curl_dyn_addn(&out, ptr, 1);
|
|
|
|
if(result)
|
|
|
|
return NULL;
|
2006-05-10 19:44:31 +08:00
|
|
|
}
|
2023-01-29 05:05:11 +08:00
|
|
|
return Curl_dyn_ptr(&out);
|
2006-05-10 19:44:31 +08:00
|
|
|
}
|
|
|
|
|
2020-09-28 20:14:25 +08:00
|
|
|
/* sendf() sends formatted data to the server */
|
2024-02-14 19:09:32 +08:00
|
|
|
static CURLcode sendf(struct Curl_easy *data,
|
|
|
|
const char *fmt, ...) CURL_PRINTF(2, 3);
|
2023-12-08 21:05:09 +08:00
|
|
|
|
2024-02-14 19:09:32 +08:00
|
|
|
static CURLcode sendf(struct Curl_easy *data, const char *fmt, ...)
|
2020-09-28 20:14:25 +08:00
|
|
|
{
|
lib: Curl_read/Curl_write clarifications
- replace `Curl_read()`, `Curl_write()` and `Curl_nwrite()` to
clarify when and at what level they operate
- send/recv of transfer related data is now done via
`Curl_xfer_send()/Curl_xfer_recv()` which no longer has
socket/socketindex as parameter. It decides on the transfer
setup of `conn->sockfd` and `conn->writesockfd` on which
connection filter chain to operate.
- send/recv on a specific connection filter chain is done via
`Curl_conn_send()/Curl_conn_recv()` which get the socket index
as parameter.
- rename `Curl_setup_transfer()` to `Curl_xfer_setup()` for
naming consistency
- clarify that the special CURLE_AGAIN hangling to return
`CURLE_OK` with length 0 only applies to `Curl_xfer_send()`
and CURLE_AGAIN is returned by all other send() variants.
- fix a bug in websocket `curl_ws_recv()` that mixed up data
when it arrived in more than a single chunk
The method for sending not just raw bytes, but bytes that are either
"headers" or "body". The send abstraction stack, to to bottom, now is:
* `Curl_req_send()`: has parameter to indicate amount of header bytes,
buffers all data.
* `Curl_xfer_send()`: knows on which socket index to send, returns
amount of bytes sent.
* `Curl_conn_send()`: called with socket index, returns amount of bytes
sent.
In addition there is `Curl_req_flush()` for writing out all buffered
bytes.
`Curl_req_send()` is active for requests without body,
`Curl_buffer_send()` still being used for others. This is because the
special quirks need to be addressed in future parts:
* `expect-100` handling
* `Curl_fillreadbuffer()` needs to add directly to the new
`data->req.sendbuf`
* special body handlings, like `chunked` encodings and line end
conversions will be moved into something like a Client Reader.
In functions of the pattern `CURLcode xxx_send(..., ssize_t *written)`,
replace the `ssize_t` with a `size_t`. It makes no sense to allow for negative
values as the returned `CURLcode` already specifies error conditions. This
allows easier handling of lengths without casting.
Closes #12964
2024-02-15 23:22:53 +08:00
|
|
|
size_t bytes_written;
|
2020-09-28 20:14:25 +08:00
|
|
|
size_t write_len;
|
|
|
|
CURLcode result = CURLE_OK;
|
|
|
|
char *s;
|
|
|
|
char *sptr;
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
s = vaprintf(fmt, ap); /* returns an allocated string */
|
|
|
|
va_end(ap);
|
|
|
|
if(!s)
|
|
|
|
return CURLE_OUT_OF_MEMORY; /* failure */
|
|
|
|
|
|
|
|
bytes_written = 0;
|
|
|
|
write_len = strlen(s);
|
|
|
|
sptr = s;
|
|
|
|
|
|
|
|
for(;;) {
|
|
|
|
/* Write the buffer to the socket */
|
2024-02-14 19:09:32 +08:00
|
|
|
result = Curl_xfer_send(data, sptr, write_len, &bytes_written);
|
2020-09-28 20:14:25 +08:00
|
|
|
|
|
|
|
if(result)
|
|
|
|
break;
|
|
|
|
|
2020-11-03 00:34:04 +08:00
|
|
|
Curl_debug(data, CURLINFO_DATA_OUT, sptr, (size_t)bytes_written);
|
2020-09-28 20:14:25 +08:00
|
|
|
|
|
|
|
if((size_t)bytes_written != write_len) {
|
|
|
|
/* if not all was written at once, we must advance the pointer, decrease
|
|
|
|
the size left and try again! */
|
|
|
|
write_len -= bytes_written;
|
|
|
|
sptr += bytes_written;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
free(s); /* free the output string */
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-01-09 00:58:15 +08:00
|
|
|
static CURLcode dict_do(struct Curl_easy *data, bool *done)
|
1999-12-29 22:20:26 +08:00
|
|
|
{
|
|
|
|
char *word;
|
2023-01-29 05:05:11 +08:00
|
|
|
char *eword = NULL;
|
1999-12-29 22:20:26 +08:00
|
|
|
char *ppath;
|
|
|
|
char *database = NULL;
|
|
|
|
char *strategy = NULL;
|
|
|
|
char *nthdef = NULL; /* This is not part of the protocol, but required
|
|
|
|
by RFC 2229 */
|
2023-01-29 05:05:11 +08:00
|
|
|
CURLcode result;
|
2000-05-22 22:12:12 +08:00
|
|
|
|
2023-01-29 05:05:11 +08:00
|
|
|
char *path;
|
2000-05-22 22:12:12 +08:00
|
|
|
|
2005-02-09 21:06:40 +08:00
|
|
|
*done = TRUE; /* unconditionally */
|
|
|
|
|
2023-01-29 05:05:11 +08:00
|
|
|
/* url-decode path before further evaluation */
|
|
|
|
result = Curl_urldecode(data->state.up.path, 0, &path, NULL, REJECT_CTRL);
|
|
|
|
if(result)
|
|
|
|
return result;
|
|
|
|
|
2016-10-01 00:54:02 +08:00
|
|
|
if(strncasecompare(path, DICT_MATCH, sizeof(DICT_MATCH)-1) ||
|
|
|
|
strncasecompare(path, DICT_MATCH2, sizeof(DICT_MATCH2)-1) ||
|
|
|
|
strncasecompare(path, DICT_MATCH3, sizeof(DICT_MATCH3)-1)) {
|
2004-10-06 15:50:18 +08:00
|
|
|
|
1999-12-29 22:20:26 +08:00
|
|
|
word = strchr(path, ':');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(word) {
|
1999-12-29 22:20:26 +08:00
|
|
|
word++;
|
|
|
|
database = strchr(word, ':');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(database) {
|
1999-12-29 22:20:26 +08:00
|
|
|
*database++ = (char)0;
|
|
|
|
strategy = strchr(database, ':');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(strategy) {
|
1999-12-29 22:20:26 +08:00
|
|
|
*strategy++ = (char)0;
|
|
|
|
nthdef = strchr(strategy, ':');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(nthdef) {
|
2009-06-11 05:26:11 +08:00
|
|
|
*nthdef = (char)0;
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-10-06 15:50:18 +08:00
|
|
|
|
2021-04-19 16:46:11 +08:00
|
|
|
if(!word || (*word == (char)0)) {
|
2021-07-06 23:05:17 +08:00
|
|
|
infof(data, "lookup word is missing");
|
2017-09-10 05:09:06 +08:00
|
|
|
word = (char *)"default";
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
2021-04-19 16:46:11 +08:00
|
|
|
if(!database || (*database == (char)0)) {
|
2001-08-14 16:18:35 +08:00
|
|
|
database = (char *)"!";
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
2021-04-19 16:46:11 +08:00
|
|
|
if(!strategy || (*strategy == (char)0)) {
|
2001-08-14 16:18:35 +08:00
|
|
|
strategy = (char *)".";
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
2004-10-06 15:50:18 +08:00
|
|
|
|
2022-02-03 20:04:30 +08:00
|
|
|
eword = unescape_word(word);
|
2023-01-29 05:05:11 +08:00
|
|
|
if(!eword) {
|
|
|
|
result = CURLE_OUT_OF_MEMORY;
|
|
|
|
goto error;
|
|
|
|
}
|
2006-05-10 19:44:31 +08:00
|
|
|
|
2024-02-14 19:09:32 +08:00
|
|
|
result = sendf(data,
|
2020-09-28 20:14:25 +08:00
|
|
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
|
|
|
"MATCH "
|
|
|
|
"%s " /* database */
|
|
|
|
"%s " /* strategy */
|
|
|
|
"%s\r\n" /* word */
|
|
|
|
"QUIT\r\n",
|
|
|
|
database,
|
|
|
|
strategy,
|
|
|
|
eword);
|
2006-05-10 19:44:31 +08:00
|
|
|
|
2010-04-17 05:43:04 +08:00
|
|
|
if(result) {
|
2001-10-31 22:48:10 +08:00
|
|
|
failf(data, "Failed sending DICT request");
|
2023-01-29 05:05:11 +08:00
|
|
|
goto error;
|
2010-04-17 05:43:04 +08:00
|
|
|
}
|
2024-02-14 19:09:32 +08:00
|
|
|
Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1); /* no upload */
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
2016-10-01 00:54:02 +08:00
|
|
|
else if(strncasecompare(path, DICT_DEFINE, sizeof(DICT_DEFINE)-1) ||
|
|
|
|
strncasecompare(path, DICT_DEFINE2, sizeof(DICT_DEFINE2)-1) ||
|
|
|
|
strncasecompare(path, DICT_DEFINE3, sizeof(DICT_DEFINE3)-1)) {
|
2004-10-06 15:50:18 +08:00
|
|
|
|
1999-12-29 22:20:26 +08:00
|
|
|
word = strchr(path, ':');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(word) {
|
1999-12-29 22:20:26 +08:00
|
|
|
word++;
|
|
|
|
database = strchr(word, ':');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(database) {
|
1999-12-29 22:20:26 +08:00
|
|
|
*database++ = (char)0;
|
|
|
|
nthdef = strchr(database, ':');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(nthdef) {
|
2009-06-11 05:26:11 +08:00
|
|
|
*nthdef = (char)0;
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-10-06 15:50:18 +08:00
|
|
|
|
2021-04-19 16:46:11 +08:00
|
|
|
if(!word || (*word == (char)0)) {
|
2021-07-06 23:05:17 +08:00
|
|
|
infof(data, "lookup word is missing");
|
2017-09-10 05:09:06 +08:00
|
|
|
word = (char *)"default";
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
2021-04-19 16:46:11 +08:00
|
|
|
if(!database || (*database == (char)0)) {
|
2001-08-14 16:18:35 +08:00
|
|
|
database = (char *)"!";
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
2004-10-06 15:50:18 +08:00
|
|
|
|
2022-02-03 20:04:30 +08:00
|
|
|
eword = unescape_word(word);
|
2023-01-29 05:05:11 +08:00
|
|
|
if(!eword) {
|
|
|
|
result = CURLE_OUT_OF_MEMORY;
|
|
|
|
goto error;
|
|
|
|
}
|
2006-05-10 19:44:31 +08:00
|
|
|
|
2024-02-14 19:09:32 +08:00
|
|
|
result = sendf(data,
|
2020-09-28 20:14:25 +08:00
|
|
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
|
|
|
"DEFINE "
|
|
|
|
"%s " /* database */
|
|
|
|
"%s\r\n" /* word */
|
|
|
|
"QUIT\r\n",
|
|
|
|
database,
|
|
|
|
eword);
|
2006-05-10 19:44:31 +08:00
|
|
|
|
2010-04-17 05:43:04 +08:00
|
|
|
if(result) {
|
2001-10-31 22:48:10 +08:00
|
|
|
failf(data, "Failed sending DICT request");
|
2023-01-29 05:05:11 +08:00
|
|
|
goto error;
|
2010-04-17 05:43:04 +08:00
|
|
|
}
|
2024-02-14 19:09:32 +08:00
|
|
|
Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
|
|
|
else {
|
2004-10-06 15:50:18 +08:00
|
|
|
|
1999-12-29 22:20:26 +08:00
|
|
|
ppath = strchr(path, '/');
|
2007-11-07 17:21:35 +08:00
|
|
|
if(ppath) {
|
1999-12-29 22:20:26 +08:00
|
|
|
int i;
|
2004-10-06 15:50:18 +08:00
|
|
|
|
1999-12-29 22:20:26 +08:00
|
|
|
ppath++;
|
2011-04-20 21:17:42 +08:00
|
|
|
for(i = 0; ppath[i]; i++) {
|
2007-11-07 17:21:35 +08:00
|
|
|
if(ppath[i] == ':')
|
1999-12-29 22:20:26 +08:00
|
|
|
ppath[i] = ' ';
|
|
|
|
}
|
2024-02-14 19:09:32 +08:00
|
|
|
result = sendf(data,
|
2020-09-28 20:14:25 +08:00
|
|
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
|
|
|
"%s\r\n"
|
|
|
|
"QUIT\r\n", ppath);
|
2010-04-17 05:43:04 +08:00
|
|
|
if(result) {
|
2001-10-31 22:48:10 +08:00
|
|
|
failf(data, "Failed sending DICT request");
|
2023-01-29 05:05:11 +08:00
|
|
|
goto error;
|
2010-04-17 05:43:04 +08:00
|
|
|
}
|
|
|
|
|
2024-02-14 19:09:32 +08:00
|
|
|
Curl_xfer_setup(data, FIRSTSOCKET, -1, FALSE, -1);
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-18 12:54:18 +08:00
|
|
|
error:
|
2023-01-29 05:05:11 +08:00
|
|
|
free(eword);
|
|
|
|
free(path);
|
|
|
|
return result;
|
1999-12-29 22:20:26 +08:00
|
|
|
}
|
2022-10-31 00:38:16 +08:00
|
|
|
#endif /* CURL_DISABLE_DICT */
|