mirror of
https://github.com/curl/curl.git
synced 2026-04-11 12:01:42 +08:00
docs: some nitpicks
- replaced double spaces with single space where applicable - replaced "favourite" with "favorite" - added language identifiers to code blocks in markdown files - added extra line after code blocks and after headings in markdown files Cloes #20748
This commit is contained in:
parent
aea5552a64
commit
006f561f6e
1
.github/scripts/badwords.txt
vendored
1
.github/scripts/badwords.txt
vendored
@ -91,3 +91,4 @@ file names\b:filenames
|
|||||||
---Curl Corporation
|
---Curl Corporation
|
||||||
\bmanpages[^./;=&{:-]:man pages
|
\bmanpages[^./;=&{:-]:man pages
|
||||||
\bmanpage[^si./;=&{:-]:man page
|
\bmanpage[^si./;=&{:-]:man page
|
||||||
|
favour:favor
|
||||||
|
|||||||
@ -9,7 +9,7 @@ libcurl bindings
|
|||||||
|
|
||||||
Creative people have written bindings or interfaces for various environments
|
Creative people have written bindings or interfaces for various environments
|
||||||
and programming languages. Using one of these allows you to take advantage of
|
and programming languages. Using one of these allows you to take advantage of
|
||||||
curl powers from within your favourite language or system.
|
curl powers from within your favorite language or system.
|
||||||
|
|
||||||
This is a list of all known interfaces as of this writing.
|
This is a list of all known interfaces as of this writing.
|
||||||
|
|
||||||
|
|||||||
@ -78,6 +78,7 @@ OpenSSL (1.1.1+, curl 7.61.0+), LibreSSL (3.4.1+, curl 8.3.0+),
|
|||||||
wolfSSL (curl 8.10.0+) and mbedTLS (3.6.0+, curl 8.10.0+).
|
wolfSSL (curl 8.10.0+) and mbedTLS (3.6.0+, curl 8.10.0+).
|
||||||
|
|
||||||
The list of cipher suites that can be used for the `--tls13-ciphers` option:
|
The list of cipher suites that can be used for the `--tls13-ciphers` option:
|
||||||
|
|
||||||
```
|
```
|
||||||
TLS_AES_128_GCM_SHA256
|
TLS_AES_128_GCM_SHA256
|
||||||
TLS_AES_256_GCM_SHA384
|
TLS_AES_256_GCM_SHA384
|
||||||
@ -118,6 +119,7 @@ A shortened list (based on [recommendations by
|
|||||||
Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS)) of cipher suites,
|
Mozilla](https://wiki.mozilla.org/Security/Server_Side_TLS)) of cipher suites,
|
||||||
which are (mostly) supported by all SSL backends, that can be used for the
|
which are (mostly) supported by all SSL backends, that can be used for the
|
||||||
`--ciphers` option:
|
`--ciphers` option:
|
||||||
|
|
||||||
```
|
```
|
||||||
ECDHE-ECDSA-AES128-GCM-SHA256
|
ECDHE-ECDSA-AES128-GCM-SHA256
|
||||||
ECDHE-RSA-AES128-GCM-SHA256
|
ECDHE-RSA-AES128-GCM-SHA256
|
||||||
@ -180,6 +182,7 @@ curl \
|
|||||||
ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305 \
|
ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305 \
|
||||||
https://example.com/
|
https://example.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
Restrict ciphers to `aes128-gcm` and `chacha20`. Works with OpenSSL, LibreSSL,
|
Restrict ciphers to `aes128-gcm` and `chacha20`. Works with OpenSSL, LibreSSL,
|
||||||
mbedTLS and wolfSSL.
|
mbedTLS and wolfSSL.
|
||||||
|
|
||||||
@ -189,6 +192,7 @@ curl \
|
|||||||
--tls13-ciphers TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256 \
|
--tls13-ciphers TLS_AES_128_GCM_SHA256:TLS_CHACHA20_POLY1305_SHA256 \
|
||||||
https://example.com/
|
https://example.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
Restrict to only TLS 1.3 with `aes128-gcm` and `chacha20` ciphers. Works with
|
Restrict to only TLS 1.3 with `aes128-gcm` and `chacha20` ciphers. Works with
|
||||||
OpenSSL, LibreSSL, mbedTLS, wolfSSL and Schannel.
|
OpenSSL, LibreSSL, mbedTLS, wolfSSL and Schannel.
|
||||||
|
|
||||||
@ -198,6 +202,7 @@ curl \
|
|||||||
ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305 \
|
ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305 \
|
||||||
https://example.com/
|
https://example.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
Restrict TLS 1.2 ciphers to `aes128-gcm` and `chacha20`, use default TLS 1.3
|
Restrict TLS 1.2 ciphers to `aes128-gcm` and `chacha20`, use default TLS 1.3
|
||||||
ciphers (if TLS 1.3 is available). Works with OpenSSL, LibreSSL, BoringSSL,
|
ciphers (if TLS 1.3 is available). Works with OpenSSL, LibreSSL, BoringSSL,
|
||||||
mbedTLS and wolfSSL.
|
mbedTLS and wolfSSL.
|
||||||
@ -244,6 +249,7 @@ curl \
|
|||||||
--ciphers '-CIPHER_ALL:+AES-128-GCM:+CHACHA20-POLY1305' \
|
--ciphers '-CIPHER_ALL:+AES-128-GCM:+CHACHA20-POLY1305' \
|
||||||
https://example.com/
|
https://example.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
Restrict ciphers to `aes128-gcm` and `chacha20` in GnuTLS.
|
Restrict ciphers to `aes128-gcm` and `chacha20` in GnuTLS.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -251,6 +257,7 @@ curl \
|
|||||||
--ciphers 'NORMAL:-VERS-ALL:+TLS1.3:-AES-256-GCM' \
|
--ciphers 'NORMAL:-VERS-ALL:+TLS1.3:-AES-256-GCM' \
|
||||||
https://example.com/
|
https://example.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
Restrict to only TLS 1.3 without the `aes256-gcm` cipher.
|
Restrict to only TLS 1.3 without the `aes256-gcm` cipher.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@ -258,9 +265,11 @@ curl \
|
|||||||
--ciphers 'NORMAL:-VERS-ALL:+TLS1.2:-CIPHER_ALL:+CAMELLIA-128-GCM' \
|
--ciphers 'NORMAL:-VERS-ALL:+TLS1.2:-CIPHER_ALL:+CAMELLIA-128-GCM' \
|
||||||
https://example.com/
|
https://example.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
Restrict to only TLS 1.2 with the `CAMELLIA-128-GCM` cipher.
|
Restrict to only TLS 1.2 with the `CAMELLIA-128-GCM` cipher.
|
||||||
|
|
||||||
## Further reading
|
## Further reading
|
||||||
|
|
||||||
- [OpenSSL cipher suite names documentation](https://docs.openssl.org/master/man1/openssl-ciphers/#cipher-suite-names)
|
- [OpenSSL cipher suite names documentation](https://docs.openssl.org/master/man1/openssl-ciphers/#cipher-suite-names)
|
||||||
- [wolfSSL cipher support documentation](https://www.wolfssl.com/documentation/manuals/wolfssl/chapter04.html#cipher-support)
|
- [wolfSSL cipher support documentation](https://www.wolfssl.com/documentation/manuals/wolfssl/chapter04.html#cipher-support)
|
||||||
- [mbedTLS cipher suites reference](https://mbed-tls.readthedocs.io/projects/api/en/development/api/file/ssl__ciphersuites_8h/)
|
- [mbedTLS cipher suites reference](https://mbed-tls.readthedocs.io/projects/api/en/development/api/file/ssl__ciphersuites_8h/)
|
||||||
|
|||||||
@ -370,7 +370,7 @@ make
|
|||||||
There are some known issues with the ECH implementation in wolfSSL:
|
There are some known issues with the ECH implementation in wolfSSL:
|
||||||
|
|
||||||
- The main issue is that the client currently handles HelloRetryRequest
|
- The main issue is that the client currently handles HelloRetryRequest
|
||||||
incorrectly. [HRR issue](https://github.com/wolfSSL/wolfssl/issues/6802).)
|
incorrectly. [HRR issue](https://github.com/wolfSSL/wolfssl/issues/6802).)
|
||||||
The HRR issue means that the client does not work for
|
The HRR issue means that the client does not work for
|
||||||
[this ECH test web site](https://tls-ech.dev/) and any other similarly
|
[this ECH test web site](https://tls-ech.dev/) and any other similarly
|
||||||
configured sites.
|
configured sites.
|
||||||
@ -461,7 +461,7 @@ In another window:
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd $HOME/code/curl/
|
cd $HOME/code/curl/
|
||||||
./src/curl -vvv --insecure --connect-to foo.example.com:8443:localhost:8443 --ech ecl:AD7+DQA6uwAgACBix2B78sX+EQhEbxMspDOc8Z3xVS5aQpYP0Cxpc2AWPAAEAAEAAQALZXhhbXBsZS5jb20AAA==
|
./src/curl -vvv --insecure --connect-to foo.example.com:8443:localhost:8443 --ech ecl:AD7+DQA6uwAgACBix2B78sX+EQhEbxMspDOc8Z3xVS5aQpYP0Cxpc2AWPAAEAAEAAQALZXhhbXBsZS5jb20AAA==
|
||||||
```
|
```
|
||||||
|
|
||||||
### Automated use of ``retry_configs`` not supported so far...
|
### Automated use of ``retry_configs`` not supported so far...
|
||||||
|
|||||||
@ -603,11 +603,11 @@ disabling support for some features (run `./configure --help` to see them all):
|
|||||||
- `--disable-libcurl-option` (--libcurl C code generation support)
|
- `--disable-libcurl-option` (--libcurl C code generation support)
|
||||||
- `--disable-manual` (--manual built-in documentation)
|
- `--disable-manual` (--manual built-in documentation)
|
||||||
- `--disable-mime` (MIME API)
|
- `--disable-mime` (MIME API)
|
||||||
- `--disable-netrc` (.netrc file)
|
- `--disable-netrc` (.netrc file)
|
||||||
- `--disable-progress-meter` (graphical progress meter in library)
|
- `--disable-progress-meter` (graphical progress meter in library)
|
||||||
- `--disable-proxy` (HTTP and SOCKS proxies)
|
- `--disable-proxy` (HTTP and SOCKS proxies)
|
||||||
- `--disable-socketpair` (socketpair for asynchronous name resolving)
|
- `--disable-socketpair` (socketpair for asynchronous name resolving)
|
||||||
- `--disable-threaded-resolver` (threaded name resolver)
|
- `--disable-threaded-resolver` (threaded name resolver)
|
||||||
- `--disable-tls-srp` (Secure Remote Password authentication for TLS)
|
- `--disable-tls-srp` (Secure Remote Password authentication for TLS)
|
||||||
- `--disable-unix-sockets` (Unix sockets)
|
- `--disable-unix-sockets` (Unix sockets)
|
||||||
- `--disable-verbose` (eliminates debugging strings and error code strings)
|
- `--disable-verbose` (eliminates debugging strings and error code strings)
|
||||||
|
|||||||
@ -5,6 +5,7 @@ SPDX-License-Identifier: curl
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
# IPFS
|
# IPFS
|
||||||
|
|
||||||
For an overview about IPFS, visit the [IPFS project site](https://ipfs.tech/).
|
For an overview about IPFS, visit the [IPFS project site](https://ipfs.tech/).
|
||||||
|
|
||||||
In IPFS there are two protocols. IPFS and IPNS (their workings are explained
|
In IPFS there are two protocols. IPFS and IPNS (their workings are explained
|
||||||
@ -64,12 +65,12 @@ in this link:
|
|||||||
The IPFS integration in curl hides this gateway logic for you. Instead of
|
The IPFS integration in curl hides this gateway logic for you. Instead of
|
||||||
providing a full URL to a file on IPFS like this:
|
providing a full URL to a file on IPFS like this:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl http://127.0.0.1:8080/ipfs/bafybeigagd5nmnn2iys2f3doro7ydrevyr2mzarwidgadawmamiteydbzi
|
curl http://127.0.0.1:8080/ipfs/bafybeigagd5nmnn2iys2f3doro7ydrevyr2mzarwidgadawmamiteydbzi
|
||||||
```
|
```
|
||||||
|
|
||||||
You can provide it with the IPFS protocol instead:
|
You can provide it with the IPFS protocol instead:
|
||||||
```
|
```sh
|
||||||
curl ipfs://bafybeigagd5nmnn2iys2f3doro7ydrevyr2mzarwidgadawmamiteydbzi
|
curl ipfs://bafybeigagd5nmnn2iys2f3doro7ydrevyr2mzarwidgadawmamiteydbzi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ to and read from. It manages read and write positions and has a maximum size.
|
|||||||
Its basic read/write functions have a similar signature and return code
|
Its basic read/write functions have a similar signature and return code
|
||||||
handling as many internal curl read and write ones.
|
handling as many internal curl read and write ones.
|
||||||
|
|
||||||
```
|
```c
|
||||||
ssize_t Curl_bufq_write(struct bufq *q, const unsigned char *buf, size_t len, CURLcode *err);
|
ssize_t Curl_bufq_write(struct bufq *q, const unsigned char *buf, size_t len, CURLcode *err);
|
||||||
|
|
||||||
- returns the length written into `q` or -1 on error.
|
- returns the length written into `q` or -1 on error.
|
||||||
@ -29,7 +29,7 @@ ssize_t Curl_bufq_read(struct bufq *q, unsigned char *buf, size_t len, CURLcode
|
|||||||
|
|
||||||
To pass data into a `bufq` without an extra copy, read callbacks can be used.
|
To pass data into a `bufq` without an extra copy, read callbacks can be used.
|
||||||
|
|
||||||
```
|
```c
|
||||||
typedef ssize_t Curl_bufq_reader(void *reader_ctx, unsigned char *buf, size_t len,
|
typedef ssize_t Curl_bufq_reader(void *reader_ctx, unsigned char *buf, size_t len,
|
||||||
CURLcode *err);
|
CURLcode *err);
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ once or only read in a maximum amount of bytes.
|
|||||||
|
|
||||||
The analog mechanism for write out buffer data is:
|
The analog mechanism for write out buffer data is:
|
||||||
|
|
||||||
```
|
```c
|
||||||
typedef ssize_t Curl_bufq_writer(void *writer_ctx, const unsigned char *buf, size_t len,
|
typedef ssize_t Curl_bufq_writer(void *writer_ctx, const unsigned char *buf, size_t len,
|
||||||
CURLcode *err);
|
CURLcode *err);
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ remove the amount that `writer` reports.
|
|||||||
|
|
||||||
It is possible to get access to the memory of data stored in a `bufq` with:
|
It is possible to get access to the memory of data stored in a `bufq` with:
|
||||||
|
|
||||||
```
|
```c
|
||||||
bool Curl_bufq_peek(const struct bufq *q, const unsigned char **pbuf, size_t *plen);
|
bool Curl_bufq_peek(const struct bufq *q, const unsigned char **pbuf, size_t *plen);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ may read. This is only valid until another operation on `bufq` is performed.
|
|||||||
|
|
||||||
Instead of reading `bufq` data, one may simply skip it:
|
Instead of reading `bufq` data, one may simply skip it:
|
||||||
|
|
||||||
```
|
```c
|
||||||
void Curl_bufq_skip(struct bufq *q, size_t amount);
|
void Curl_bufq_skip(struct bufq *q, size_t amount);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ This removes `amount` number of bytes from the `bufq`.
|
|||||||
`bufq` is initialized and freed similar to the `dynbuf` module. Code using
|
`bufq` is initialized and freed similar to the `dynbuf` module. Code using
|
||||||
`bufq` holds a `struct bufq` somewhere. Before it uses it, it invokes:
|
`bufq` holds a `struct bufq` somewhere. Before it uses it, it invokes:
|
||||||
|
|
||||||
```
|
```c
|
||||||
void Curl_bufq_init(struct bufq *q, size_t chunk_size, size_t max_chunks);
|
void Curl_bufq_init(struct bufq *q, size_t chunk_size, size_t max_chunks);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -91,12 +91,13 @@ about memory management.
|
|||||||
|
|
||||||
The user of the `bufq` has the responsibility to call:
|
The user of the `bufq` has the responsibility to call:
|
||||||
|
|
||||||
```
|
```c
|
||||||
void Curl_bufq_free(struct bufq *q);
|
void Curl_bufq_free(struct bufq *q);
|
||||||
```
|
```
|
||||||
|
|
||||||
to free all resources held by `q`. It is possible to reset a `bufq` to empty via:
|
to free all resources held by `q`. It is possible to reset a `bufq` to empty via:
|
||||||
|
|
||||||
```
|
```c
|
||||||
void Curl_bufq_reset(struct bufq *q);
|
void Curl_bufq_reset(struct bufq *q);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -154,7 +155,7 @@ the `bufq` from growing ever larger and larger.
|
|||||||
A `struct bufc_pool` may be used to create chunks for a `bufq` and keep spare
|
A `struct bufc_pool` may be used to create chunks for a `bufq` and keep spare
|
||||||
ones around. It is initialized and used via:
|
ones around. It is initialized and used via:
|
||||||
|
|
||||||
```
|
```c
|
||||||
void Curl_bufcp_init(struct bufc_pool *pool, size_t chunk_size, size_t spare_max);
|
void Curl_bufcp_init(struct bufc_pool *pool, size_t chunk_size, size_t spare_max);
|
||||||
|
|
||||||
void Curl_bufq_initp(struct bufq *q, struct bufc_pool *pool, size_t max_chunks, int opts);
|
void Curl_bufq_initp(struct bufq *q, struct bufc_pool *pool, size_t max_chunks, int opts);
|
||||||
|
|||||||
@ -28,7 +28,7 @@ The transfer loop that sends and receives, is using `Curl_client_read()` to get
|
|||||||
more data to send for a transfer. If no specific reader has been installed yet,
|
more data to send for a transfer. If no specific reader has been installed yet,
|
||||||
the default one that uses `CURLOPT_READFUNCTION` is added. The prototype is
|
the default one that uses `CURLOPT_READFUNCTION` is added. The prototype is
|
||||||
|
|
||||||
```
|
```c
|
||||||
CURLcode Curl_client_read(struct Curl_easy *data, char *buf, size_t blen,
|
CURLcode Curl_client_read(struct Curl_easy *data, char *buf, size_t blen,
|
||||||
size_t *nread, bool *eos);
|
size_t *nread, bool *eos);
|
||||||
```
|
```
|
||||||
@ -44,7 +44,7 @@ The chain of readers allows processing of the data to send.
|
|||||||
|
|
||||||
The definition of a reader is:
|
The definition of a reader is:
|
||||||
|
|
||||||
```
|
```c
|
||||||
struct Curl_crtype {
|
struct Curl_crtype {
|
||||||
const char *name; /* writer name. */
|
const char *name; /* writer name. */
|
||||||
CURLcode (*do_init)(struct Curl_easy *data, struct Curl_creader *writer);
|
CURLcode (*do_init)(struct Curl_easy *data, struct Curl_creader *writer);
|
||||||
@ -78,7 +78,7 @@ the order in which they are called is relevant for the outcome. When a reader
|
|||||||
is created, it gets the `phase` property in which it operates. Reader phases
|
is created, it gets the `phase` property in which it operates. Reader phases
|
||||||
are defined like:
|
are defined like:
|
||||||
|
|
||||||
```
|
```c
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CURL_CR_NET, /* data send to the network (connection filters) */
|
CURL_CR_NET, /* data send to the network (connection filters) */
|
||||||
CURL_CR_TRANSFER_ENCODE, /* add transfer-encodings */
|
CURL_CR_TRANSFER_ENCODE, /* add transfer-encodings */
|
||||||
|
|||||||
@ -29,13 +29,13 @@ All code in `libcurl` that handles response data is ultimately expected to
|
|||||||
forward this data via `Curl_client_write()` to the application. The exact
|
forward this data via `Curl_client_write()` to the application. The exact
|
||||||
prototype of this function is:
|
prototype of this function is:
|
||||||
|
|
||||||
```
|
```c
|
||||||
CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf, size_t blen);
|
CURLcode Curl_client_write(struct Curl_easy *data, int type, const char *buf, size_t blen);
|
||||||
```
|
```
|
||||||
|
|
||||||
The `type` argument specifies what the bytes in `buf` actually are.
|
The `type` argument specifies what the bytes in `buf` actually are.
|
||||||
The following bits are defined:
|
The following bits are defined:
|
||||||
```
|
```c
|
||||||
#define CLIENTWRITE_BODY (1 << 0) /* non-meta information, BODY */
|
#define CLIENTWRITE_BODY (1 << 0) /* non-meta information, BODY */
|
||||||
#define CLIENTWRITE_INFO (1 << 1) /* meta information, not a HEADER */
|
#define CLIENTWRITE_INFO (1 << 1) /* meta information, not a HEADER */
|
||||||
#define CLIENTWRITE_HEADER (1 << 2) /* meta information, HEADER */
|
#define CLIENTWRITE_HEADER (1 << 2) /* meta information, HEADER */
|
||||||
@ -56,7 +56,7 @@ application callbacks. This is similar to the design of connection filters:
|
|||||||
client writers can be chained to process the bytes written through them. The
|
client writers can be chained to process the bytes written through them. The
|
||||||
definition is:
|
definition is:
|
||||||
|
|
||||||
```
|
```c
|
||||||
struct Curl_cwtype {
|
struct Curl_cwtype {
|
||||||
const char *name;
|
const char *name;
|
||||||
CURLcode (*do_init)(struct Curl_easy *data,
|
CURLcode (*do_init)(struct Curl_easy *data,
|
||||||
@ -87,7 +87,7 @@ in which the are called is relevant for the outcome. When a writer is created,
|
|||||||
one property it gets is the `phase` in which it operates. Writer phases are
|
one property it gets is the `phase` in which it operates. Writer phases are
|
||||||
defined like:
|
defined like:
|
||||||
|
|
||||||
```
|
```c
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CURL_CW_RAW, /* raw data written, before any decoding */
|
CURL_CW_RAW, /* raw data written, before any decoding */
|
||||||
CURL_CW_TRANSFER_DECODE, /* remove transfer-encodings */
|
CURL_CW_TRANSFER_DECODE, /* remove transfer-encodings */
|
||||||
|
|||||||
@ -76,7 +76,7 @@ etc.
|
|||||||
|
|
||||||
Each filter does in principle the following:
|
Each filter does in principle the following:
|
||||||
|
|
||||||
```
|
```c
|
||||||
static CURLcode myfilter_cf_connect(struct Curl_cfilter *cf,
|
static CURLcode myfilter_cf_connect(struct Curl_cfilter *cf,
|
||||||
struct Curl_easy *data,
|
struct Curl_easy *data,
|
||||||
bool *done)
|
bool *done)
|
||||||
@ -109,7 +109,7 @@ transfers.
|
|||||||
|
|
||||||
The memory footprint of a filter is relatively small:
|
The memory footprint of a filter is relatively small:
|
||||||
|
|
||||||
```
|
```c
|
||||||
struct Curl_cfilter {
|
struct Curl_cfilter {
|
||||||
const struct Curl_cftype *cft; /* the type providing implementation */
|
const struct Curl_cftype *cft; /* the type providing implementation */
|
||||||
struct Curl_cfilter *next; /* next filter in chain */
|
struct Curl_cfilter *next; /* next filter in chain */
|
||||||
@ -138,13 +138,14 @@ zero cost *if the filter does not transform the data*. An http proxy or socks
|
|||||||
filter, once it is connected, just passes the calls through. Those filters
|
filter, once it is connected, just passes the calls through. Those filters
|
||||||
implementations look like this:
|
implementations look like this:
|
||||||
|
|
||||||
```
|
```c
|
||||||
ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
ssize_t Curl_cf_def_send(struct Curl_cfilter *cf, struct Curl_easy *data,
|
||||||
const void *buf, size_t len, CURLcode *err)
|
const void *buf, size_t len, CURLcode *err)
|
||||||
{
|
{
|
||||||
return cf->next->cft->do_send(cf->next, data, buf, len, err);
|
return cf->next->cft->do_send(cf->next, data, buf, len, err);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The `recv` implementation is equivalent.
|
The `recv` implementation is equivalent.
|
||||||
|
|
||||||
## Filter Types
|
## Filter Types
|
||||||
@ -231,7 +232,7 @@ Users of `curl` may activate them by adding the name of the filter type to the
|
|||||||
`--trace-config` argument. For example, in order to get more detailed tracing
|
`--trace-config` argument. For example, in order to get more detailed tracing
|
||||||
of an HTTP/2 request, invoke curl with:
|
of an HTTP/2 request, invoke curl with:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
> curl -v --trace-config ids,time,http/2 https://curl.se/
|
> curl -v --trace-config ids,time,http/2 https://curl.se/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ locally build `src/curl` (by default).
|
|||||||
|
|
||||||
A typical invocation for measuring performance of HTTP/2 downloads would be:
|
A typical invocation for measuring performance of HTTP/2 downloads would be:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl> python3 tests/http/scorecard.py -d h2
|
curl> python3 tests/http/scorecard.py -d h2
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ JSON instead of text.
|
|||||||
|
|
||||||
Help for all command line options are available via:
|
Help for all command line options are available via:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl> python3 tests/http/scorecard.py -h
|
curl> python3 tests/http/scorecard.py -h
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ specify these in some way if you are just interested in a particular case.
|
|||||||
For example, to run downloads of a 1 MB resource only, 100 times with at max 6
|
For example, to run downloads of a 1 MB resource only, 100 times with at max 6
|
||||||
parallel transfers, use:
|
parallel transfers, use:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl> python3 tests/http/scorecard.py -d --download-sizes=1mb --download-count=100 --download-parallel=6 h2
|
curl> python3 tests/http/scorecard.py -d --download-sizes=1mb --download-count=100 --download-parallel=6 h2
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ interactive SVG. Either clone the `Flamegraph` repository next to your `curl`
|
|||||||
project or set the environment variable `FLAMEGRAPH` to the location of your
|
project or set the environment variable `FLAMEGRAPH` to the location of your
|
||||||
clone. Then run scorecard with the `--flame` option, like
|
clone. Then run scorecard with the `--flame` option, like
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl> FLAMEGRAPH=/Users/sei/projects/FlameGraph python3 tests/http/scorecard.py \
|
curl> FLAMEGRAPH=/Users/sei/projects/FlameGraph python3 tests/http/scorecard.py \
|
||||||
-r --request-count=50000 --request-parallels=100 --samples=1 --flame h2
|
-r --request-count=50000 --request-parallels=100 --samples=1 --flame h2
|
||||||
```
|
```
|
||||||
|
|||||||
@ -28,7 +28,7 @@ typedef enum {
|
|||||||
CURLIOE_LAST /* never use */
|
CURLIOE_LAST /* never use */
|
||||||
} curlioerr;
|
} curlioerr;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CURLIOCMD_NOP, /* no operation */
|
CURLIOCMD_NOP, /* no operation */
|
||||||
CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
|
CURLIOCMD_RESTARTREAD, /* restart the read stream from start */
|
||||||
CURLIOCMD_LAST /* never use */
|
CURLIOCMD_LAST /* never use */
|
||||||
|
|||||||
@ -22,7 +22,7 @@ CURLOPT_OPENSOCKETFUNCTION - callback for opening socket
|
|||||||
~~~c
|
~~~c
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
|
CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
|
||||||
} curlsocktype;
|
} curlsocktype;
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ CURLOPT_SOCKOPTFUNCTION - callback for setting socket options
|
|||||||
~~~c
|
~~~c
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
|
CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */
|
||||||
CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
|
CURLSOCKTYPE_ACCEPT, /* socket created by accept() call */
|
||||||
CURLSOCKTYPE_LAST /* never use */
|
CURLSOCKTYPE_LAST /* never use */
|
||||||
|
|||||||
@ -16,7 +16,7 @@ The test cases and necessary files are in `tests/http`. You can invoke
|
|||||||
`pytest` from there or from the top level curl checkout and it finds all
|
`pytest` from there or from the top level curl checkout and it finds all
|
||||||
tests.
|
tests.
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl> pytest test/http
|
curl> pytest test/http
|
||||||
platform darwin -- Python 3.9.15, pytest-6.2.0, py-1.10.0, pluggy-0.13.1
|
platform darwin -- Python 3.9.15, pytest-6.2.0, py-1.10.0, pluggy-0.13.1
|
||||||
rootdir: /Users/sei/projects/curl
|
rootdir: /Users/sei/projects/curl
|
||||||
@ -30,7 +30,7 @@ times. `-k <expr>` can be used to run only matching test cases. The `expr` can
|
|||||||
be something resembling a python test or just a string that needs to match
|
be something resembling a python test or just a string that needs to match
|
||||||
test cases in their names.
|
test cases in their names.
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl/tests/http> pytest -vv -k test_01_02
|
curl/tests/http> pytest -vv -k test_01_02
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -76,21 +76,21 @@ Several test cases are parameterized, for example with the HTTP version to
|
|||||||
use. If you want to run a test with a particular protocol only, use a command
|
use. If you want to run a test with a particular protocol only, use a command
|
||||||
line like:
|
line like:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl/tests/http> pytest -k "test_02_06 and h2"
|
curl/tests/http> pytest -k "test_02_06 and h2"
|
||||||
```
|
```
|
||||||
|
|
||||||
Test cases can be repeated, with the `pytest-repeat` module (`pip install
|
Test cases can be repeated, with the `pytest-repeat` module (`pip install
|
||||||
pytest-repeat`). Like in:
|
pytest-repeat`). Like in:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl/tests/http> pytest -k "test_02_06 and h2" --count=100
|
curl/tests/http> pytest -k "test_02_06 and h2" --count=100
|
||||||
```
|
```
|
||||||
|
|
||||||
which then runs this test case a hundred times. In case of flaky tests, you
|
which then runs this test case a hundred times. In case of flaky tests, you
|
||||||
can make pytest stop on the first one with:
|
can make pytest stop on the first one with:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl/tests/http> pytest -k "test_02_06 and h2" --count=100 --maxfail=1
|
curl/tests/http> pytest -k "test_02_06 and h2" --count=100 --maxfail=1
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ of log files, the verbosity of pytest is also used to collect curl trace
|
|||||||
output. If you specify `-v` three times, the `curl` command is started with
|
output. If you specify `-v` three times, the `curl` command is started with
|
||||||
`--trace`:
|
`--trace`:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
curl/tests/http> pytest -vvv -k "test_02_06 and h2" --count=100 --maxfail=1
|
curl/tests/http> pytest -vvv -k "test_02_06 and h2" --count=100 --maxfail=1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -328,7 +328,7 @@ fail:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* pickoneauth() selects the most favourable authentication method from the
|
/* pickoneauth() selects the most favorable authentication method from the
|
||||||
* ones available and the ones we want.
|
* ones available and the ones we want.
|
||||||
*
|
*
|
||||||
* return TRUE if one was picked
|
* return TRUE if one was picked
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user