master
1#ifndef HEADER_CURL_STRPARSE_H
2#define HEADER_CURL_STRPARSE_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"
28#define STRE_OK 0
29#define STRE_BIG 1
30#define STRE_SHORT 2
31#define STRE_BEGQUOTE 3
32#define STRE_ENDQUOTE 4
33#define STRE_BYTE 5
34#define STRE_NEWLINE 6
35#define STRE_OVERFLOW 7
36#define STRE_NO_NUM 8
38/* public struct, but all accesses should be done using the provided
39 functions */
40struct Curl_str {
41 const char *str;
42 size_t len;
43};
45void curlx_str_init(struct Curl_str *out);
46void curlx_str_assign(struct Curl_str *out, const char *str, size_t len);
47void curlx_str_trim(struct Curl_str *out, size_t len);
49#define curlx_str(x) ((x)->str)
50#define curlx_strlen(x) ((x)->len)
52/* Get a word until the first space
53 return non-zero on error */
54int curlx_str_word(const char **linep, struct Curl_str *out, const size_t max);
56/* Get a word until the first DELIM or end of string
57 return non-zero on error */
58int curlx_str_until(const char **linep, struct Curl_str *out, const size_t max,
59 char delim);
61/* Get a word until a newline byte or end of string. At least one byte long.
62 return non-zero on error */
63int curlx_str_untilnl(const char **linep, struct Curl_str *out,
64 const size_t max);
66/* Get a "quoted" word. Escaped quotes are supported.
67 return non-zero on error */
68int curlx_str_quotedword(const char **linep, struct Curl_str *out,
69 const size_t max);
71/* Advance over a single character.
72 return non-zero on error */
73int curlx_str_single(const char **linep, char byte);
75/* Advance over a single space.
76 return non-zero on error */
77int curlx_str_singlespace(const char **linep);
79/* Get an unsigned decimal number. Return non-zero on error */
80int curlx_str_number(const char **linep, curl_off_t *nump, curl_off_t max);
82/* As above with CURL_OFF_T_MAX but also pass leading blanks */
83int curlx_str_numblanks(const char **str, curl_off_t *num);
85/* Get an unsigned hexadecimal number. Return non-zero on error */
86int curlx_str_hex(const char **linep, curl_off_t *nump, curl_off_t max);
88/* Get an unsigned octal number. Return non-zero on error */
89int curlx_str_octal(const char **linep, curl_off_t *nump, curl_off_t max);
91/* Check for CR or LF
92 return non-zero on error */
93int curlx_str_newline(const char **linep);
95/* case insensitive compare that the parsed string matches the
96 given string. */
97int curlx_str_casecompare(struct Curl_str *str, const char *check);
98int curlx_str_cmp(struct Curl_str *str, const char *check);
100int curlx_str_nudge(struct Curl_str *str, size_t num);
102int curlx_str_cspn(const char **linep, struct Curl_str *out,
103 const char *reject);
104void curlx_str_trimblanks(struct Curl_str *out);
105void curlx_str_passblanks(const char **linep);
107/* given a hexadecimal letter, return the binary value. '0' returns 0, 'a'
108 returns 10. THIS ONLY WORKS ON VALID HEXADECIMAL LETTER INPUT. Verify
109 before calling this. */
110extern const unsigned char curlx_hexasciitable[];
111#define curlx_hexval(x) (unsigned char)(curlx_hexasciitable[(x) - '0'] & 0x0f)
113#endif /* HEADER_CURL_STRPARSE_H */
Diagnostics4 git calls · 153 ms
CallStatusSizeTime0153 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch 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=149 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
fetch2001.5 KiB149 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1503 git.response.cache=MISS git.response.duration_ms=149 git.fetch.wants=7963dd62128aed0ec8a3f4c08e2375ab08408ece 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=1503 git.pkt.payload.max=1482 git.sideband.band1.bytes=1481 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
- a5e2dc65beeec125
- Request
- b70256b6…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format