master
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 ***************************************************************************/
27#include "curl.h"
29#ifdef __cplusplus
30extern "C" {
31#endif
33/* the error codes for the URL API */
34typedef enum {
35 CURLUE_OK,
36 CURLUE_BAD_HANDLE, /* 1 */
37 CURLUE_BAD_PARTPOINTER, /* 2 */
38 CURLUE_MALFORMED_INPUT, /* 3 */
39 CURLUE_BAD_PORT_NUMBER, /* 4 */
40 CURLUE_UNSUPPORTED_SCHEME, /* 5 */
41 CURLUE_URLDECODE, /* 6 */
42 CURLUE_OUT_OF_MEMORY, /* 7 */
43 CURLUE_USER_NOT_ALLOWED, /* 8 */
44 CURLUE_UNKNOWN_PART, /* 9 */
45 CURLUE_NO_SCHEME, /* 10 */
46 CURLUE_NO_USER, /* 11 */
47 CURLUE_NO_PASSWORD, /* 12 */
48 CURLUE_NO_OPTIONS, /* 13 */
49 CURLUE_NO_HOST, /* 14 */
50 CURLUE_NO_PORT, /* 15 */
51 CURLUE_NO_QUERY, /* 16 */
52 CURLUE_NO_FRAGMENT, /* 17 */
53 CURLUE_NO_ZONEID, /* 18 */
54 CURLUE_BAD_FILE_URL, /* 19 */
55 CURLUE_BAD_FRAGMENT, /* 20 */
56 CURLUE_BAD_HOSTNAME, /* 21 */
57 CURLUE_BAD_IPV6, /* 22 */
58 CURLUE_BAD_LOGIN, /* 23 */
59 CURLUE_BAD_PASSWORD, /* 24 */
60 CURLUE_BAD_PATH, /* 25 */
61 CURLUE_BAD_QUERY, /* 26 */
62 CURLUE_BAD_SCHEME, /* 27 */
63 CURLUE_BAD_SLASHES, /* 28 */
64 CURLUE_BAD_USER, /* 29 */
65 CURLUE_LACKS_IDN, /* 30 */
66 CURLUE_TOO_LARGE, /* 31 */
67 CURLUE_BACKSLASH, /* 32 */
68 CURLUE_LAST
69} CURLUcode;
71typedef enum {
72 CURLUPART_URL,
73 CURLUPART_SCHEME,
74 CURLUPART_USER,
75 CURLUPART_PASSWORD,
76 CURLUPART_OPTIONS,
77 CURLUPART_HOST,
78 CURLUPART_PORT,
79 CURLUPART_PATH,
80 CURLUPART_QUERY,
81 CURLUPART_FRAGMENT,
82 CURLUPART_ZONEID /* added in 7.65.0 */
83} CURLUPart;
85#define CURLU_DEFAULT_PORT (1 << 0) /* return default port number */
86#define CURLU_NO_DEFAULT_PORT (1 << 1) /* act as if no port number was set,
87 if the port number matches the
88 default for the scheme */
89#define CURLU_DEFAULT_SCHEME (1 << 2) /* return default scheme if
90 missing */
91#define CURLU_NON_SUPPORT_SCHEME (1 << 3) /* allow non-supported scheme */
92#define CURLU_PATH_AS_IS (1 << 4) /* leave dot sequences */
93#define CURLU_DISALLOW_USER (1 << 5) /* no user+password allowed */
94#define CURLU_URLDECODE (1 << 6) /* URL decode on get */
95#define CURLU_URLENCODE (1 << 7) /* URL encode on set */
96#define CURLU_APPENDQUERY (1 << 8) /* append a form style part */
97#define CURLU_GUESS_SCHEME (1 << 9) /* legacy curl-style guessing */
98#define CURLU_NO_AUTHORITY (1 << 10) /* Allow empty authority when the
99 scheme is unknown. */
100#define CURLU_ALLOW_SPACE (1 << 11) /* Allow spaces in the URL */
101#define CURLU_PUNYCODE (1 << 12) /* get the hostname in punycode */
102#define CURLU_PUNY2IDN (1 << 13) /* punycode => IDN conversion */
103#define CURLU_GET_EMPTY (1 << 14) /* allow empty queries and fragments
104 when extracting the URL or the
105 components */
106#define CURLU_NO_GUESS_SCHEME (1 << 15) /* for get, do not accept a guess */
108typedef struct Curl_URL CURLU;
110/*
111 * curl_url() creates a new CURLU handle and returns a pointer to it.
112 * Must be freed with curl_url_cleanup().
113 */
114CURL_EXTERN CURLU *curl_url(void);
116/*
117 * curl_url_cleanup() frees the CURLU handle and related resources used for
118 * the URL parsing. It does not free strings previously returned with the URL
119 * API.
120 */
121CURL_EXTERN void curl_url_cleanup(CURLU *u);
123/*
124 * curl_url_dup() duplicates a CURLU handle and returns a new copy. The new
125 * handle must also be freed with curl_url_cleanup().
126 */
127CURL_EXTERN CURLU *curl_url_dup(const CURLU *in);
129/*
130 * curl_url_get() extracts a specific part of the URL from a CURLU
131 * handle. Returns error code. The returned pointer MUST be freed with
132 * curl_free() afterwards.
133 */
134CURL_EXTERN CURLUcode curl_url_get(const CURLU *u, CURLUPart what,
135 char **part, unsigned int flags);
137/*
138 * curl_url_set() sets a specific part of the URL in a CURLU handle. Returns
139 * error code. The passed in string is copied. Passing a NULL instead of
140 * a part string, clears that part.
141 */
142CURL_EXTERN CURLUcode curl_url_set(CURLU *u, CURLUPart what,
143 const char *part, unsigned int flags);
145/*
146 * curl_url_strerror() turns a CURLUcode value into the equivalent human
147 * readable error string. This is useful for printing meaningful error
148 * messages.
149 */
150CURL_EXTERN const char *curl_url_strerror(CURLUcode error);
152#ifdef __cplusplus
153} /* end of extern "C" */
154#endif
156#endif /* CURLINC_URLAPI_H */
Diagnostics4 git calls · 41 ms
CallStatusSizeTime041 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=2 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2002.2 KiB · hit37 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=37 git.response.bytes=2210 git.response.cache=HIT git.response.duration_ms=37 git.fetch.wants=02553dfebfcba5143108ccec90074a58125a5d66 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=2210 git.pkt.payload.max=2189 git.sideband.band1.bytes=2188 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e2bb76fe5bcfc3
- Request
- b71615aa…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format