2010-01-25 12:36:13 +08:00
|
|
|
#ifndef HEADER_CURL_SENDF_H
|
|
|
|
#define HEADER_CURL_SENDF_H
|
2002-09-03 19:52:59 +08:00
|
|
|
/***************************************************************************
|
2004-10-01 04:50:34 +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-01 04:50:34 +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"
|
2007-03-23 20:01:19 +08:00
|
|
|
|
2023-08-03 23:32:25 +08:00
|
|
|
#include "curl_trc.h"
|
2001-01-05 18:11:41 +08:00
|
|
|
|
2023-09-19 18:31:31 +08:00
|
|
|
/**
|
|
|
|
* Type of data that is being written to the client (application)
|
2023-10-03 22:44:13 +08:00
|
|
|
* - data written can be either BODY or META data
|
2023-09-19 18:31:31 +08:00
|
|
|
* - META data is either INFO or HEADER
|
|
|
|
* - INFO is meta information, e.g. not BODY, that cannot be interpreted
|
|
|
|
* as headers of a response. Example FTP/IMAP pingpong answers.
|
|
|
|
* - HEADER can have additional bits set (more than one)
|
|
|
|
* - STATUS special "header", e.g. response status line in HTTP
|
|
|
|
* - CONNECT header was received during proxying the connection
|
|
|
|
* - 1XX header is part of an intermediate response, e.g. HTTP 1xx code
|
|
|
|
* - TRAILER header is trailing response data, e.g. HTTP trailers
|
|
|
|
* BODY, INFO and HEADER should not be mixed, as this would lead to
|
|
|
|
* confusion on how to interpret/format/convert the data.
|
|
|
|
*/
|
|
|
|
#define CLIENTWRITE_BODY (1<<0) /* non-meta information, BODY */
|
|
|
|
#define CLIENTWRITE_INFO (1<<1) /* meta information, not a HEADER */
|
|
|
|
#define CLIENTWRITE_HEADER (1<<2) /* meta information, HEADER */
|
|
|
|
#define CLIENTWRITE_STATUS (1<<3) /* a special status HEADER */
|
|
|
|
#define CLIENTWRITE_CONNECT (1<<4) /* a CONNECT related HEADER */
|
|
|
|
#define CLIENTWRITE_1XX (1<<5) /* a 1xx response related HEADER */
|
|
|
|
#define CLIENTWRITE_TRAILER (1<<6) /* a trailer HEADER */
|
2000-10-03 19:01:32 +08:00
|
|
|
|
2021-01-09 00:58:15 +08:00
|
|
|
CURLcode Curl_client_write(struct Curl_easy *data, int type, char *ptr,
|
2014-12-08 22:29:30 +08:00
|
|
|
size_t len) WARN_UNUSED_RESULT;
|
2000-10-03 19:01:32 +08:00
|
|
|
|
2023-09-19 18:31:31 +08:00
|
|
|
CURLcode Curl_client_unpause(struct Curl_easy *data);
|
2023-09-20 17:59:16 +08:00
|
|
|
void Curl_client_cleanup(struct Curl_easy *data);
|
|
|
|
|
|
|
|
struct contenc_writer {
|
|
|
|
const struct content_encoding *handler; /* Encoding handler. */
|
|
|
|
struct contenc_writer *downstream; /* Downstream writer. */
|
|
|
|
unsigned int order; /* Ordering within writer stack. */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Content encoding writer. */
|
|
|
|
struct content_encoding {
|
|
|
|
const char *name; /* Encoding name. */
|
|
|
|
const char *alias; /* Encoding name alias. */
|
|
|
|
CURLcode (*init_writer)(struct Curl_easy *data,
|
|
|
|
struct contenc_writer *writer);
|
|
|
|
CURLcode (*unencode_write)(struct Curl_easy *data,
|
|
|
|
struct contenc_writer *writer,
|
|
|
|
const char *buf, size_t nbytes);
|
|
|
|
void (*close_writer)(struct Curl_easy *data,
|
|
|
|
struct contenc_writer *writer);
|
|
|
|
size_t writersize;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
CURLcode Curl_client_create_writer(struct contenc_writer **pwriter,
|
|
|
|
struct Curl_easy *data,
|
|
|
|
const struct content_encoding *ce_handler,
|
|
|
|
int order);
|
|
|
|
|
|
|
|
void Curl_client_free_writer(struct Curl_easy *data,
|
|
|
|
struct contenc_writer *writer);
|
|
|
|
|
|
|
|
CURLcode Curl_client_add_writer(struct Curl_easy *data,
|
|
|
|
struct contenc_writer *writer);
|
|
|
|
|
2023-09-19 18:31:31 +08:00
|
|
|
|
2001-01-25 20:20:30 +08:00
|
|
|
/* internal read-function, does plain socket, SSL and krb4 */
|
2021-01-09 00:58:15 +08:00
|
|
|
CURLcode Curl_read(struct Curl_easy *data, curl_socket_t sockfd,
|
2010-05-07 21:05:34 +08:00
|
|
|
char *buf, size_t buffersize,
|
|
|
|
ssize_t *n);
|
2021-01-09 00:58:15 +08:00
|
|
|
|
2008-06-20 18:43:32 +08:00
|
|
|
/* internal write-function, does plain socket, SSL, SCP, SFTP and krb4 */
|
2021-01-09 00:58:15 +08:00
|
|
|
CURLcode Curl_write(struct Curl_easy *data,
|
2004-03-11 00:01:47 +08:00
|
|
|
curl_socket_t sockfd,
|
2008-05-09 19:27:54 +08:00
|
|
|
const void *mem, size_t len,
|
2002-01-16 22:49:51 +08:00
|
|
|
ssize_t *written);
|
2001-01-25 20:20:30 +08:00
|
|
|
|
2023-09-05 19:44:13 +08:00
|
|
|
/* internal write-function, using sockindex for connection destination */
|
|
|
|
CURLcode Curl_nwrite(struct Curl_easy *data,
|
|
|
|
int sockindex,
|
|
|
|
const void *buf,
|
|
|
|
size_t blen,
|
|
|
|
ssize_t *pnwritten);
|
|
|
|
|
2010-01-25 12:36:13 +08:00
|
|
|
#endif /* HEADER_CURL_SENDF_H */
|