Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
urlapi.h
Go to the documentation of this file.
1#ifndef CURLINC_URLAPI_H
2#define CURLINC_URLAPI_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
27#include "curl.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33/* the error codes for the URL API */
69
83
84#define CURLU_DEFAULT_PORT (1<<0) /* return default port number */
85#define CURLU_NO_DEFAULT_PORT (1<<1) /* act as if no port number was set,
86 if the port number matches the
87 default for the scheme */
88#define CURLU_DEFAULT_SCHEME (1<<2) /* return default scheme if
89 missing */
90#define CURLU_NON_SUPPORT_SCHEME (1<<3) /* allow non-supported scheme */
91#define CURLU_PATH_AS_IS (1<<4) /* leave dot sequences */
92#define CURLU_DISALLOW_USER (1<<5) /* no user+password allowed */
93#define CURLU_URLDECODE (1<<6) /* URL decode on get */
94#define CURLU_URLENCODE (1<<7) /* URL encode on set */
95#define CURLU_APPENDQUERY (1<<8) /* append a form style part */
96#define CURLU_GUESS_SCHEME (1<<9) /* legacy curl-style guessing */
97#define CURLU_NO_AUTHORITY (1<<10) /* Allow empty authority when the
98 scheme is unknown. */
99#define CURLU_ALLOW_SPACE (1<<11) /* Allow spaces in the URL */
100#define CURLU_PUNYCODE (1<<12) /* get the hostname in punycode */
101#define CURLU_PUNY2IDN (1<<13) /* punycode => IDN conversion */
102#define CURLU_GET_EMPTY (1<<14) /* allow empty queries and fragments
103 when extracting the URL or the
104 components */
105#define CURLU_NO_GUESS_SCHEME (1<<15) /* for get, do not accept a guess */
106
107typedef struct Curl_URL CURLU;
108
109/*
110 * curl_url() creates a new CURLU handle and returns a pointer to it.
111 * Must be freed with curl_url_cleanup().
112 */
115/*
116 * curl_url_cleanup() frees the CURLU handle and related resources used for
117 * the URL parsing. It will not free strings previously returned with the URL
118 * API.
119 */
121
122/*
123 * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
124 * handle must also be freed with curl_url_cleanup().
125 */
128/*
129 * curl_url_get() extracts a specific part of the URL from a CURLU
130 * handle. Returns error code. The returned pointer MUST be freed with
131 * curl_free() afterwards.
132 */
134 char **part, unsigned int flags);
136/*
137 * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
138 * error code. The passed in string will be copied. Passing a NULL instead of
139 * a part string, clears that part.
140 */
142 const char *part, unsigned int flags);
144/*
145 * curl_url_strerror() turns a CURLUcode value into the equivalent human
146 * readable error string. This is useful for printing meaningful error
147 * messages.
148 */
150
151#ifdef __cplusplus
152} /* end of extern "C" */
153#endif
154
155#endif /* CURLINC_URLAPI_H */
#define CURL_EXTERN
Definition curl.h:137
CURL_EXTERN CURLU * curl_url_dup(const CURLU *in)
CURL_EXTERN CURLUcode curl_url_set(CURLU *handle, CURLUPart what, const char *part, unsigned int flags)
CURL_EXTERN CURLU * curl_url(void)
CURL_EXTERN void curl_url_cleanup(CURLU *handle)
CURLUcode
Definition urlapi.h:34
@ CURLUE_URLDECODE
Definition urlapi.h:41
@ CURLUE_BAD_PARTPOINTER
Definition urlapi.h:37
@ CURLUE_NO_PASSWORD
Definition urlapi.h:47
@ CURLUE_BAD_PORT_NUMBER
Definition urlapi.h:39
@ CURLUE_BAD_IPV6
Definition urlapi.h:57
@ CURLUE_BAD_SCHEME
Definition urlapi.h:62
@ CURLUE_BAD_LOGIN
Definition urlapi.h:58
@ CURLUE_LAST
Definition urlapi.h:67
@ CURLUE_UNSUPPORTED_SCHEME
Definition urlapi.h:40
@ CURLUE_NO_ZONEID
Definition urlapi.h:53
@ CURLUE_NO_SCHEME
Definition urlapi.h:45
@ CURLUE_BAD_PATH
Definition urlapi.h:60
@ CURLUE_OK
Definition urlapi.h:35
@ CURLUE_NO_FRAGMENT
Definition urlapi.h:52
@ CURLUE_BAD_USER
Definition urlapi.h:64
@ CURLUE_BAD_FILE_URL
Definition urlapi.h:54
@ CURLUE_BAD_SLASHES
Definition urlapi.h:63
@ CURLUE_NO_QUERY
Definition urlapi.h:51
@ CURLUE_LACKS_IDN
Definition urlapi.h:65
@ CURLUE_NO_USER
Definition urlapi.h:46
@ CURLUE_BAD_FRAGMENT
Definition urlapi.h:55
@ CURLUE_USER_NOT_ALLOWED
Definition urlapi.h:43
@ CURLUE_NO_OPTIONS
Definition urlapi.h:48
@ CURLUE_MALFORMED_INPUT
Definition urlapi.h:38
@ CURLUE_NO_HOST
Definition urlapi.h:49
@ CURLUE_TOO_LARGE
Definition urlapi.h:66
@ CURLUE_BAD_HANDLE
Definition urlapi.h:36
@ CURLUE_OUT_OF_MEMORY
Definition urlapi.h:42
@ CURLUE_NO_PORT
Definition urlapi.h:50
@ CURLUE_BAD_QUERY
Definition urlapi.h:61
@ CURLUE_UNKNOWN_PART
Definition urlapi.h:44
@ CURLUE_BAD_PASSWORD
Definition urlapi.h:59
@ CURLUE_BAD_HOSTNAME
Definition urlapi.h:56
CURLUPart
Definition urlapi.h:70
@ CURLUPART_PASSWORD
Definition urlapi.h:74
@ CURLUPART_USER
Definition urlapi.h:73
@ CURLUPART_HOST
Definition urlapi.h:76
@ CURLUPART_OPTIONS
Definition urlapi.h:75
@ CURLUPART_PATH
Definition urlapi.h:78
@ CURLUPART_URL
Definition urlapi.h:71
@ CURLUPART_SCHEME
Definition urlapi.h:72
@ CURLUPART_FRAGMENT
Definition urlapi.h:80
@ CURLUPART_ZONEID
Definition urlapi.h:81
@ CURLUPART_PORT
Definition urlapi.h:77
@ CURLUPART_QUERY
Definition urlapi.h:79
CURL_EXTERN const char * curl_url_strerror(CURLUcode)
struct Curl_URL CURLU
Definition urlapi.h:101
CURL_EXTERN CURLUcode curl_url_get(const CURLU *handle, CURLUPart what, char **part, unsigned int flags)