Coverage Report

Created: 2025-08-24 06:08

/src/curl/lib/url.h
Line
Count
Source (jump to first uncovered line)
1
#ifndef HEADER_CURL_URL_H
2
#define HEADER_CURL_URL_H
3
/***************************************************************************
4
 *                                  _   _ ____  _
5
 *  Project                     ___| | | |  _ \| |
6
 *                             / __| | | | |_) | |
7
 *                            | (__| |_| |  _ <| |___
8
 *                             \___|\___/|_| \_\_____|
9
 *
10
 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
11
 *
12
 * This software is licensed as described in the file COPYING, which
13
 * you should have received as part of this distribution. The terms
14
 * are also available at https://curl.se/docs/copyright.html.
15
 *
16
 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17
 * copies of the Software, and permit persons to whom the Software is
18
 * furnished to do so, under the terms of the COPYING file.
19
 *
20
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21
 * KIND, either express or implied.
22
 *
23
 * SPDX-License-Identifier: curl
24
 *
25
 ***************************************************************************/
26
#include "curl_setup.h"
27
28
/*
29
 * Prototypes for library-wide functions provided by url.c
30
 */
31
32
CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn);
33
CURLcode Curl_open(struct Curl_easy **curl);
34
CURLcode Curl_init_userdefined(struct Curl_easy *data);
35
36
void Curl_freeset(struct Curl_easy *data);
37
CURLcode Curl_uc_to_curlcode(CURLUcode uc);
38
CURLcode Curl_close(struct Curl_easy **datap); /* opposite of curl_open() */
39
CURLcode Curl_connect(struct Curl_easy *, bool *async, bool *protocol_connect);
40
CURLcode Curl_setup_conn(struct Curl_easy *data,
41
                         struct Curl_dns_entry *dns,
42
                         bool *protocol_done);
43
void Curl_conn_free(struct Curl_easy *data, struct connectdata *conn);
44
CURLcode Curl_parse_login_details(const char *login, const size_t len,
45
                                  char **userptr, char **passwdptr,
46
                                  char **optionsptr);
47
48
/* Attach/Clear/Get meta data for an easy handle. Needs to provide
49
 * a destructor, will be automatically called when the easy handle
50
 * is reset or closed. */
51
typedef void Curl_meta_dtor(void *key, size_t key_len, void *meta_data);
52
53
/* Set the transfer meta data for the key. Any existing entry for that
54
 * key will be destroyed.
55
 * Takes ownership of `meta_data` and destroys it when the call fails. */
56
CURLcode Curl_meta_set(struct Curl_easy *data, const char *key,
57
                       void *meta_data, Curl_meta_dtor *meta_dtor);
58
void Curl_meta_remove(struct Curl_easy *data, const char *key);
59
void *Curl_meta_get(struct Curl_easy *data, const char *key);
60
void Curl_meta_reset(struct Curl_easy *data);
61
62
/* Set connection meta data for the key. Any existing entry for that
63
 * key will be destroyed.
64
 * Takes ownership of `meta_data` and destroys it when the call fails. */
65
CURLcode Curl_conn_meta_set(struct connectdata *conn, const char *key,
66
                            void *meta_data, Curl_meta_dtor *meta_dtor);
67
void Curl_conn_meta_remove(struct connectdata *conn, const char *key);
68
void *Curl_conn_meta_get(struct connectdata *conn, const char *key);
69
70
/* Get protocol handler for a URI scheme
71
 * @param scheme URI scheme, case-insensitive
72
 * @return NULL of handler not found
73
 */
74
const struct Curl_handler *Curl_get_scheme_handler(const char *scheme);
75
const struct Curl_handler *Curl_getn_scheme_handler(const char *scheme,
76
                                                    size_t len);
77
78
0
#define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */
79
0
#define CURL_DEFAULT_HTTPS_PROXY_PORT 443 /* default https proxy port unless
80
                                             specified */
81
82
/**
83
 * Return TRUE iff the given connection is considered dead.
84
 * @param nowp      NULL or pointer to time being checked against.
85
 */
86
bool Curl_conn_seems_dead(struct connectdata *conn,
87
                          struct Curl_easy *data,
88
                          struct curltime *nowp);
89
90
/**
91
 * Perform upkeep operations on the connection.
92
 */
93
CURLcode Curl_conn_upkeep(struct Curl_easy *data,
94
                          struct connectdata *conn,
95
                          struct curltime *now);
96
97
/**
98
 * Always eval all arguments, return the first result != CURLE_OK.
99
 * A non-short-circuit evaluation.
100
 */
101
CURLcode Curl_1st_err(CURLcode r1, CURLcode r2);
102
103
/**
104
 * Always eval all arguments, return the first
105
 * result != (CURLE_OK|CURLE_AGAIN) or `r1`.
106
 * A non-short-circuit evaluation.
107
 */
108
CURLcode Curl_1st_fatal(CURLcode r1, CURLcode r2);
109
110
#if defined(USE_HTTP2) || defined(USE_HTTP3)
111
void Curl_data_priority_clear_state(struct Curl_easy *data);
112
#else
113
#define Curl_data_priority_clear_state(x)
114
#endif /* USE_HTTP2 || USE_HTTP3 */
115
116
#ifdef USE_NGHTTP2
117
CURLcode Curl_data_priority_add_child(struct Curl_easy *parent,
118
                                      struct Curl_easy *child,
119
                                      bool exclusive);
120
#else
121
#define Curl_data_priority_add_child(x, y, z) CURLE_NOT_BUILT_IN
122
#endif
123
124
#endif /* HEADER_CURL_URL_H */