master
1#ifndef HEADER_CURL_NGH2_SHIM_H
2#define HEADER_CURL_NGH2_SHIM_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#ifdef USE_NGHTTP2
30/* From the nghttp2 documentation:
31 * > The errors < :enum:`nghttp2_error.NGHTTP2_ERR_FATAL` mean that
32 * > the library is under unexpected condition and processing was
33 * > terminated (e.g., out of memory). If application receives this
34 * > error code, it must stop using that :type:`nghttp2_session`
35 * > object and only allowed operation for that object is deallocate
36 * > it using `nghttp2_session_del()`.
37 *
38 * This shim protects further calls into a nghttp2 session once
39 * a fatal error occurred.
40 */
41struct curl_ngh2 {
42 nghttp2_session *s;
43 int fatal_rv; /* != 0 once nghttp2 session has entered FATAL state */
44};
46/* True if nghttp2 session exists and is not in fatal state */
47bool Curl_ngh2_valid(struct curl_ngh2 *ngh2);
48/* True if `rv` is fatal or nghttp2 session already is in fatal state */
49bool Curl_ngh2_is_fatal(struct curl_ngh2 *ngh2, int rv);
50/* != 0 and the fatal error if nghttp2 is in fatal state */
51int Curl_ngh2_fatal(struct curl_ngh2 *ngh2);
53void Curl_ngh2_del(struct curl_ngh2 *ngh2);
54int Curl_ngh2_submit_settings(
55 struct curl_ngh2 *ngh2, uint8_t flags,
56 const nghttp2_settings_entry *iv, size_t niv);
57void *Curl_ngh2_session_get_stream_user_data(
58 struct curl_ngh2 *ngh2, int32_t stream_id);
59int Curl_ngh2_session_set_stream_user_data(
60 struct curl_ngh2 *ngh2, int32_t stream_id, void *stream_user_data);
61uint32_t Curl_ngh2_session_get_remote_settings(
62 struct curl_ngh2 *ngh2, nghttp2_settings_id id);
63int32_t Curl_ngh2_session_get_stream_effective_local_window_size(
64 struct curl_ngh2 *ngh2, int32_t stream_id);
65int32_t Curl_ngh2_session_get_local_window_size(
66 struct curl_ngh2 *ngh2);
67int32_t Curl_ngh2_session_get_stream_remote_window_size(
68 struct curl_ngh2 *ngh2, int32_t stream_id);
69int32_t Curl_ngh2_session_get_remote_window_size(
70 struct curl_ngh2 *ngh2);
71int Curl_ngh2_session_set_local_window_size(
72 struct curl_ngh2 *ngh2, uint8_t flags,
73 int32_t stream_id, int32_t window_size);
74int Curl_ngh2_submit_window_update(
75 struct curl_ngh2 *ngh2, uint8_t flags,
76 int32_t stream_id, int32_t window_size_increment);
77int Curl_ngh2_submit_rst_stream(
78 struct curl_ngh2 *ngh2, uint8_t flags,
79 int32_t stream_id, uint32_t error_code);
80int Curl_ngh2_session_send(struct curl_ngh2 *ngh2);
81int Curl_ngh2_session_client_new3(
82 struct curl_ngh2 *ngh2, const nghttp2_session_callbacks *callbacks,
83 void *user_data, const nghttp2_option *option, nghttp2_mem *mem);
84int Curl_ngh2_session_want_read(struct curl_ngh2 *ngh2);
85int Curl_ngh2_session_want_write(struct curl_ngh2 *ngh2);
86ssize_t Curl_ngh2_session_mem_recv(
87 struct curl_ngh2 *ngh2, const uint8_t *in, size_t inlen);
88int Curl_ngh2_session_check_request_allowed(struct curl_ngh2 *ngh2);
89int Curl_ngh2_submit_ping(
90 struct curl_ngh2 *ngh2, uint8_t flags, const uint8_t *opaque_data);
91int32_t Curl_ngh2_session_get_stream_effective_recv_data_length(
92 struct curl_ngh2 *ngh2, int32_t stream_id);
93int Curl_ngh2_session_resume_data(
94 struct curl_ngh2 *ngh2, int32_t stream_id);
95int Curl_ngh2_session_consume(
96 struct curl_ngh2 *ngh2, int32_t stream_id, size_t size);
97int Curl_ngh2_submit_priority(
98 struct curl_ngh2 *ngh2, uint8_t flags,
99 int32_t stream_id, const nghttp2_priority_spec *pri_spec);
100int32_t Curl_ngh2_submit_request(
101 struct curl_ngh2 *ngh2, const nghttp2_priority_spec *pri_spec,
102 const nghttp2_nv *nva, size_t nvlen, const nghttp2_data_provider *data_prd,
103 void *stream_user_data);
104int Curl_ngh2_session_upgrade2(
105 struct curl_ngh2 *ngh2, const uint8_t *settings_payload,
106 size_t settings_payloadlen, int head_request, void *stream_user_data);
107int Curl_ngh2_submit_goaway(
108 struct curl_ngh2 *ngh2, uint8_t flags, int32_t last_stream_id,
109 uint32_t error_code, const uint8_t *opaque_data, size_t opaque_data_len);
112#endif /* USE_NGHTTP2 */
114#endif /* HEADER_CURL_NGH2_SHIM_H */
Diagnostics4 git calls · 35 ms
CallStatusSizeTime035 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 · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=30 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 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.6 KiB · hit30 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1614 git.response.cache=HIT git.response.duration_ms=30 git.fetch.wants=6227fd71cd1cbf54d7ad3f36ee9018a74d20b336 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=1614 git.pkt.payload.max=1593 git.sideband.band1.bytes=1592 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
- a5e3223a1d675aae
- Request
- dcad98db…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format