Codebergdnkl
foot
master
1#include "url-mode.h"
3#include <stdlib.h>
4#include <string.h>
5#include <wctype.h>
6#include <unistd.h>
7#include <regex.h>
9#include <sys/stat.h>
10#include <fcntl.h>
12#define LOG_MODULE "url-mode"
13#define LOG_ENABLE_DBG 0
14#include "log.h"
15#include "char32.h"
16#include "grid.h"
17#include "key-binding.h"
18#include "quirks.h"
19#include "render.h"
20#include "selection.h"
21#include "spawn.h"
22#include "terminal.h"
23#include "uri.h"
24#include "util.h"
25#include "xmalloc.h"
27static void url_destroy(struct url *url);
29static bool
30execute_binding(struct seat *seat, struct terminal *term,
31 const struct key_binding *binding, uint32_t serial)
32{
33 const enum bind_action_url action = binding->action;
35 switch (action) {
36 case BIND_ACTION_URL_NONE:
37 return false;
39 case BIND_ACTION_URL_CANCEL:
40 urls_reset(term);
41 return true;
43 case BIND_ACTION_URL_TOGGLE_URL_ON_JUMP_LABEL:
44 term->url.show_uri_on_jump_label = !term->url.show_uri_on_jump_label;
45 render_refresh_urls(term);
46 return true;
48 case BIND_ACTION_URL_COUNT:
49 return false;
51 }
52 return true;
53}
55static bool
56spawn_url_launcher_with_token(struct terminal *term,
57 const char *url,
58 const char *xdg_activation_token)
59{
60 size_t argc;
61 char **argv;
63 int dev_null = open("/dev/null", O_RDWR);
65 if (dev_null < 0) {
66 LOG_ERRNO("failed to open /dev/null");
67 return false;
68 }
70 xassert(term->url.launch != NULL);
71 bool ret = false;
73 if (spawn_expand_template(
74 term->url.launch, 2,
75 (const char *[]){"url", "match"},
76 (const char *[]){url, url},
77 &argc, &argv))
78 {
79 ret = spawn(
80 term->reaper, term->cwd, argv,
81 dev_null, dev_null, dev_null, NULL, NULL, xdg_activation_token) >= 0;
83 for (size_t i = 0; i < argc; i++)
84 free(argv[i]);
85 free(argv);
86 }
88 close(dev_null);
89 return ret;
90}
92struct spawn_activation_context {
93 struct terminal *term;
94 char *url;
95};
97static void
98activation_token_done(const char *token, void *data)
99{
100 struct spawn_activation_context *ctx = data;
102 spawn_url_launcher_with_token(ctx->term, ctx->url, token);
103 free(ctx->url);
104 free(ctx);
105}
107static bool
108spawn_url_launcher(struct seat *seat, struct terminal *term, const char *url,
109 uint32_t serial)
110{
111 xassert(term->url.launch != NULL);
113 struct spawn_activation_context *ctx = xmalloc(sizeof(*ctx));
114 *ctx = (struct spawn_activation_context){
115 .term = term,
116 .url = xstrdup(url),
117 };
119 if (wayl_get_activation_token(
120 seat->wayl, seat, serial, term->window, &activation_token_done, ctx))
121 {
122 /* Context free:d by callback */
123 return true;
124 }
126 free(ctx->url);
127 free(ctx);
129 return spawn_url_launcher_with_token(term, url, NULL);
130}
132static void
133activate_url(struct seat *seat, struct terminal *term, const struct url *url,
134 uint32_t serial, bool paste_url_to_self)
135{
136 char *url_string = NULL;
138 char *scheme, *host, *path;
139 if (uri_parse(url->url, strlen(url->url), &scheme, NULL, NULL,
140 &host, NULL, &path, NULL, NULL))
141 {
142 if (strcmp(scheme, "file") == 0 && hostname_is_localhost(host)) {
143 /*
144 * This is a file in *this* computer. Pass only the
145 * filename to the URL-launcher.
146 *
147 * I.e. strip the ‘file://user@host/’ prefix.
148 */
149 url_string = path;
150 } else
151 free(path);
153 free(scheme);
154 free(host);
155 }
157 if (url_string == NULL)
158 url_string = xstrdup(url->url);
160 switch (url->action) {
161 case URL_ACTION_COPY:
162 if (paste_url_to_self) {
163 if (term->bracketed_paste)
164 term_to_slave(term, "\033[200~", 6);
166 term_to_slave(term, url_string, strlen(url_string));
168 if (term->bracketed_paste)
169 term_to_slave(term, "\033[201~", 6);
170 }
171 if (text_to_clipboard(seat, term, url_string, seat->kbd.serial)) {
172 /* Now owned by our clipboard “manager” */
173 url_string = NULL;
174 }
175 break;
177 case URL_ACTION_LAUNCH:
178 case URL_ACTION_PERSISTENT: {
179 spawn_url_launcher(seat, term, url_string, serial);
180 break;
181 }
182 }
184 free(url_string);
185}
187void
188urls_input(struct seat *seat, struct terminal *term,
189 const struct key_binding_set *bindings, uint32_t key,
190 xkb_keysym_t sym, xkb_mod_mask_t mods, xkb_mod_mask_t consumed,
191 const xkb_keysym_t *raw_syms, size_t raw_count,
192 uint32_t serial)
193{
194 /*
195 * Key bindings
196 */
198 /* Match untranslated symbols */
199 tll_foreach(bindings->url, it) {
200 const struct key_binding *bind = &it->item;
201 if (bind->mods != mods || bind->mods == 0)
202 continue;
204 for (size_t i = 0; i < raw_count; i++) {
205 if (bind->k.sym == raw_syms[i]) {
206 execute_binding(seat, term, bind, serial);
207 seat->kbd.last_shortcut_sym = sym;
208 return;
209 }
210 }
211 }
213 /* Match translated symbol */
214 tll_foreach(bindings->url, it) {
215 const struct key_binding *bind = &it->item;
217 if (bind->k.sym == sym &&
218 bind->mods == (mods & ~consumed))
219 {
220 execute_binding(seat, term, bind, serial);
221 seat->kbd.last_shortcut_sym = sym;
222 return;
223 }
225 }
227 /* Match raw key code */
228 tll_foreach(bindings->url, it) {
229 const struct key_binding *bind = &it->item;
230 if (bind->mods != mods || bind->mods == 0)
231 continue;
233 /* Match raw key code */
234 tll_foreach(bind->k.key_codes, code) {
235 if (code->item == key) {
236 execute_binding(seat, term, bind, serial);
237 seat->kbd.last_shortcut_sym = sym;
238 return;
239 }
240 }
241 }
243 size_t seq_len = c32len(term->url.keys);
245 if (sym == XKB_KEY_BackSpace) {
246 if (seq_len > 0) {
247 term->url.keys[seq_len - 1] = U'\0';
248 render_refresh_urls(term);
249 }
251 return;
252 }
254 if (mods & ~consumed)
255 return;
257 char32_t wc = xkb_state_key_get_utf32(seat->kbd.xkb_state, key);
259 /*
260 * Determine if this is a "valid" key. I.e. if there is a URL
261 * label with a key combo where this key is the next in
262 * sequence.
263 */
265 bool is_valid = false;
266 const struct url *match = NULL;
268 tll_foreach(term->url.list, it) {
269 if (it->item.key == NULL)
270 continue;
272 const struct url *url = &it->item;
273 const size_t key_len = c32len(it->item.key);
275 if (key_len >= seq_len + 1 &&
276 c32ncasecmp(url->key, term->url.keys, seq_len) == 0 &&
277 toc32lower(url->key[seq_len]) == toc32lower(wc))
278 {
279 is_valid = true;
280 if (key_len == seq_len + 1) {
281 match = url;
282 break;
283 }
284 }
285 }
287 if (match) {
288 // If the last hint character was uppercase, copy and paste
289 bool insert = term->conf->uppercase_regex_insert && wc == toc32upper(wc);
290 activate_url(seat, term, match, serial, insert);
292 switch (match->action) {
293 case URL_ACTION_COPY:
294 case URL_ACTION_LAUNCH:
295 urls_reset(term);
296 break;
298 case URL_ACTION_PERSISTENT:
299 term->url.keys[0] = U'\0';
300 render_refresh_urls(term);
301 break;
302 }
303 }
305 else if (is_valid) {
306 xassert(seq_len + 1 <= ALEN(term->url.keys));
307 term->url.keys[seq_len] = wc;
308 render_refresh_urls(term);
309 }
310}
312struct vline {
313 char *utf8;
314 size_t len; /* Length of utf8[] */
315 size_t sz; /* utf8[] allocated size */
316 struct coord *map; /* Maps utf8[ofs] to grid coordinates */
317};
319static void
320regex_detected(const struct terminal *term, enum url_action action,
321 const regex_t *preg, url_list_t *urls)
322{
323 /*
324 * Use regcomp()+regexec() to find patterns.
325 *
326 * Since we can't feed regexec() one character at a time, and
327 * since it doesn't accept wide characters, we need to build utf8
328 * strings.
329 *
330 * Each string represents a logical line (i.e. handle line-wrap).
331 * To be able to map regex matches back to the grid, we store the
332 * grid coordinates of *each* character, in the line struct as
333 * well. This is offset based; utf8[ofs] has its grid coordinates
334 * in map[ofs.
335 */
337 /* There is *at most* term->rows logical lines */
338 struct vline vlines[term->rows];
339 size_t vline_idx = 0;
341 memset(vlines, 0, sizeof(vlines));
342 struct vline *vline = &vlines[vline_idx];
344 mbstate_t ps = {0};
346 for (int r = 0; r < term->rows; r++) {
347 const struct row *row = grid_row_in_view(term->grid, r);
349 for (int c = 0; c < term->cols; c++) {
350 const struct cell *cell = &row->cells[c];
351 const char32_t *wc = &cell->wc;
352 size_t wc_count = 1;
354 /* Expand combining characters */
355 if (wc[0] >= CELL_COMB_CHARS_LO && wc[0] <= CELL_COMB_CHARS_HI) {
356 const struct composed *composed =
357 composed_lookup(term->composed, wc[0] - CELL_COMB_CHARS_LO);
358 xassert(composed != NULL);
360 wc = composed->chars;
361 wc_count = composed->count;
362 }
364 else if (wc[0] >= CELL_SPACER)
365 continue;
367 /* Convert wide character to utf8 */
368 for (size_t i = 0; i < wc_count; i++) {
369 char buf[16];
370 size_t char_len = c32rtomb(buf, wc[i], &ps);
372 if (char_len == (size_t)-1)
373 continue;
376 for (size_t j = 0; j < char_len; j++) {
377 const size_t requires_size = vline->len + char_len;
379 /* Need to grow? Remember to save at least one byte for terminator */
380 if (vline->sz == 0 || requires_size > vline->sz - 1) {
381 const size_t new_size = requires_size * 2;
382 vline->utf8 = xreallocarray(vline->utf8, new_size, 1);
383 vline->map = xreallocarray(vline->map, new_size, sizeof(vline->map[0]));
384 vline->sz = new_size;
385 }
387 vline->utf8[vline->len + j] =
388 (buf[j] == '\0') ? ' ' : buf[j];
389 vline->map[vline->len + j] = (struct coord){c, term->grid->view + r};
390 }
392 vline->len += char_len;
393 }
394 }
396 if (row->linebreak) {
397 if (vline->len > 0) {
398 vline->utf8[vline->len++] = '\0';
399 ps = (mbstate_t){0};
401 vline_idx++;
402 vline = &vlines[vline_idx];
403 }
404 }
405 }
407 /* Terminate the last line, if necessary */
408 if (vline_idx < ALEN(vlines) &&
409 vline->len > 0 && vline->utf8[vline->len - 1] != '\0')
410 {
411 vline->utf8[vline->len++] = '\0';
412 }
414 for (size_t i = 0; i < ALEN(vlines); i++) {
415 const struct vline *v = &vlines[i];
416 if (v->utf8 == NULL)
417 continue;
419 const char *search_string = v->utf8;
420 while (true) {
421 regmatch_t matches[preg->re_nsub + 1];
422 int r = regexec(preg, search_string, preg->re_nsub + 1, matches, 0);
424 if (r == REG_NOMATCH)
425 break;
427 const size_t mlen = matches[1].rm_eo - matches[1].rm_so;
428 const size_t start = &search_string[matches[1].rm_so] - v->utf8;
429 const size_t end = start + mlen;
431 LOG_DBG(
432 "regex match at row %d: %.*s (%zu bytes), row/col = %dx%d",
433 matches[1].rm_so, (int)mlen, &search_string[matches[1].rm_so],
434 mlen, v->map[start].row, v->map[start].col);
436 tll_push_back(
437 *urls,
438 ((struct url){
439 .id = (uint64_t)rand() << 32 | rand(),
440 .url = xstrndup(&v->utf8[start], mlen),
441 .range = {
442 .start = v->map[start],
443 .end = v->map[end - 1], /* Inclusive */
444 },
445 .action = action,
446 .osc8 = false}));
448 search_string += matches[0].rm_eo;
449 }
451 free(v->utf8);
452 free(v->map);
453 }
454}
456static void
457osc8_uris(const struct terminal *term, enum url_action action, url_list_t *urls)
458{
459 bool dont_touch_url_attr = false;
461 switch (term->conf->url.osc8_underline) {
462 case OSC8_UNDERLINE_URL_MODE:
463 dont_touch_url_attr = false;
464 break;
466 case OSC8_UNDERLINE_ALWAYS:
467 dont_touch_url_attr = true;
468 break;
469 }
471 for (int r = 0; r < term->rows; r++) {
472 const struct row *row = grid_row_in_view(term->grid, r);
473 const struct row_data *extra = row->extra;
475 if (extra == NULL)
476 continue;
478 for (size_t i = 0; i < extra->uri_ranges.count; i++) {
479 const struct row_range *range = &extra->uri_ranges.v[i];
481 struct coord start = {
482 .col = range->start,
483 .row = r + term->grid->view,
484 };
485 struct coord end = {
486 .col = range->end,
487 .row = r + term->grid->view,
488 };
489 tll_push_back(
490 *urls,
491 ((struct url){
492 .id = range->uri.id,
493 .url = xstrdup(range->uri.uri),
494 .range = {
495 .start = start,
496 .end = end,
497 },
498 .action = action,
499 .url_mode_dont_change_url_attr = dont_touch_url_attr,
500 .osc8 = true}));
501 }
502 }
503}
505static void
506remove_overlapping(url_list_t *urls, int cols)
507{
508 tll_foreach(*urls, outer) {
509 tll_foreach(*urls, inner) {
510 if (outer == inner)
511 continue;
513 const struct url *out = &outer->item;
514 const struct url *in = &inner->item;
516 uint64_t in_start = in->range.start.row * cols + in->range.start.col;
517 uint64_t in_end = in->range.end.row * cols + in->range.end.col;
519 uint64_t out_start = out->range.start.row * cols + out->range.start.col;
520 uint64_t out_end = out->range.end.row * cols + out->range.end.col;
522 if ((in_start <= out_start && in_end >= out_start) ||
523 (in_start <= out_end && in_end >= out_end) ||
524 (in_start >= out_start && in_end <= out_end))
525 {
526 /*
527 * OSC-8 URLs can't overlap with each
528 * other.
529 *
530 * Similarly, auto-detected URLs cannot overlap with
531 * each other.
532 *
533 * But OSC-8 URLs can overlap with auto-detected ones.
534 */
535 xassert(in->osc8 || out->osc8);
537 if (in->osc8)
538 outer->item.duplicate = true;
539 else
540 inner->item.duplicate = true;
541 }
542 }
543 }
545 tll_foreach(*urls, it) {
546 if (it->item.duplicate) {
547 url_destroy(&it->item);
548 tll_remove(*urls, it);
549 }
550 }
551}
553void
554urls_collect(const struct terminal *term, enum url_action action,
555 const regex_t *preg, bool osc8, url_list_t *urls)
556{
557 xassert(tll_length(term->url.list) == 0);
558 if (osc8)
559 osc8_uris(term, action, urls);
560 regex_detected(term, action, preg, urls);
561 remove_overlapping(urls, term->grid->num_cols);
562}
564static void
565generate_key_combos(const struct config *conf,
566 size_t count, char32_t *combos[static count])
567{
568 const char32_t *alphabet = conf->url.label_letters;
569 const size_t alphabet_len = c32len(alphabet);
571 size_t hints_count = 1;
572 char32_t **hints = xmalloc(hints_count * sizeof(hints[0]));
574 hints[0] = xc32dup(U"");
576 size_t offset = 0;
577 do {
578 const char32_t *prefix = hints[offset++];
579 const size_t prefix_len = c32len(prefix);
581 hints = xrealloc(hints, (hints_count + alphabet_len) * sizeof(hints[0]));
583 const char32_t *wc = &alphabet[0];
584 for (size_t i = 0; i < alphabet_len; i++, wc++) {
585 char32_t *hint = xmalloc((prefix_len + 1 + 1) * sizeof(char32_t));
586 hints[hints_count + i] = hint;
588 /* Will be reversed later */
589 hint[0] = *wc;
590 c32cpy(&hint[1], prefix);
591 }
592 hints_count += alphabet_len;
593 } while (hints_count - offset < count);
595 xassert(hints_count - offset >= count);
597 /* Copy slice of 'hints' array to the caller provided array */
598 for (size_t i = 0; i < hints_count; i++) {
599 if (i >= offset && i < offset + count)
600 combos[i - offset] = hints[i];
601 else
602 free(hints[i]);
603 }
604 free(hints);
606 /* Reverse all strings */
607 for (size_t i = 0; i < count; i++) {
608 const size_t len = c32len(combos[i]);
609 for (size_t j = 0; j < len / 2; j++) {
610 char32_t tmp = combos[i][j];
611 combos[i][j] = combos[i][len - j - 1];
612 combos[i][len - j - 1] = tmp;
613 }
614 }
615}
617void
618urls_assign_key_combos(const struct config *conf, url_list_t *urls)
619{
620 const size_t count = tll_length(*urls);
621 if (count == 0)
622 return;
624 char32_t *combos[count];
625 generate_key_combos(conf, count, combos);
627 size_t combo_idx = 0;
629 tll_rforeach(*urls, it) {
630 bool id_already_seen = false;
632 /* Look for already processed URLs where both the URI and the
633 * ID matches */
634 tll_rforeach(*urls, it2) {
635 if (&it->item == &it2->item)
636 break;
638 if (it->item.id == it2->item.id &&
639 streq(it->item.url, it2->item.url))
640 {
641 id_already_seen = true;
642 break;
643 }
644 }
646 if (id_already_seen)
647 continue;
649 /*
650 * Scan previous URLs, and check if *this* URL matches any of
651 * them; if so, reuse the *same* key combo.
652 */
653 bool url_already_seen = false;
654 tll_rforeach(*urls, it2) {
655 if (&it->item == &it2->item)
656 break;
658 if (streq(it->item.url, it2->item.url)) {
659 it->item.key = xc32dup(it2->item.key);
660 url_already_seen = true;
661 break;
662 }
663 }
665 if (!url_already_seen)
666 it->item.key = combos[combo_idx++];
667 }
669 /* Free combos we didn't use up */
670 for (size_t i = combo_idx; i < count; i++)
671 free(combos[i]);
673#if defined(_DEBUG) && LOG_ENABLE_DBG
674 tll_rforeach(*urls, it) {
675 if (it->item.key == NULL)
676 continue;
678 char *key = ac32tombs(it->item.key);
679 xassert(key != NULL);
681 LOG_DBG("URL: %s (key=%s, id=%"PRIu64")", it->item.url, key, it->item.id);
682 free(key);
683 }
684#endif
685}
687static void
688tag_cells_for_url(struct terminal *term, const struct url *url, bool value)
689{
690 if (url->url_mode_dont_change_url_attr)
691 return;
693 struct grid *grid = term->url.grid_snapshot;
694 xassert(grid != NULL);
696 const struct coord *start = &url->range.start;
697 const struct coord *end = &url->range.end;
699 size_t end_r = end->row & (grid->num_rows - 1);
701 size_t r = start->row & (grid->num_rows - 1);
702 size_t c = start->col;
704 struct row *row = grid->rows[r];
705 row->dirty = true;
707 while (true) {
708 struct cell *cell = &row->cells[c];
709 cell->attrs.url = value;
710 cell->attrs.clean = 0;
712 if (r == end_r && c == end->col)
713 break;
715 if (++c >= term->cols) {
716 r = (r + 1) & (grid->num_rows - 1);
717 c = 0;
719 row = grid->rows[r];
720 if (row == NULL) {
721 /* Un-allocated scrollback. This most likely means a
722 * runaway OSC-8 URL. */
723 break;
724 }
725 row->dirty = true;
726 }
727 }
728}
730void
731urls_render(struct terminal *term, const struct config_spawn_template *launch)
732{
733 struct wl_window *win = term->window;
735 if (tll_length(win->term->url.list) == 0)
736 return;
738 /* Disable IME while in URL-mode */
739 if (term_ime_is_enabled(term)) {
740 term->url.ime_reenable_after_url_mode = true;
741 term_ime_disable(term);
742 }
744 /* Dirty the last cursor, to ensure it is erased */
745 {
746 struct row *cursor_row = term->render.last_cursor.row;
747 if (cursor_row != NULL) {
748 struct cell *cell = &cursor_row->cells[term->render.last_cursor.col];
749 cell->attrs.clean = 0;
750 cursor_row->dirty = true;
751 }
752 }
753 term->render.last_cursor.row = NULL;
755 /* Clear scroll damage, to ensure we don't apply it twice (once on
756 * the snapshot:ed grid, and then later again on the real grid) */
757 tll_free(term->grid->scroll_damage);
759 /* Damage the entire view, to ensure a full screen redraw, both
760 * now, when entering URL mode, and later, when exiting it. */
761 term_damage_view(term);
763 /* Snapshot the current grid */
764 term->url.grid_snapshot = grid_snapshot(term->grid);
766 /* Remember which launcher to use */
767 term->url.launch = launch;
769 xassert(tll_length(win->urls) == 0);
770 tll_foreach(win->term->url.list, it) {
771 struct wl_url url = {.url = &it->item};
772 wayl_win_subsurface_new(win, &url.surf, false);
774 tll_push_back(win->urls, url);
775 tag_cells_for_url(term, &it->item, true);
776 }
778 render_refresh_urls(term);
779 render_refresh(term);
780}
782static void
783url_destroy(struct url *url)
784{
785 free(url->url);
786 free(url->key);
787}
789void
790urls_reset(struct terminal *term)
791{
792 if (likely(tll_length(term->url.list) == 0)) {
793 xassert(term->url.grid_snapshot == NULL);
794 return;
795 }
797 grid_free(term->url.grid_snapshot);
798 free(term->url.grid_snapshot);
799 term->url.grid_snapshot = NULL;
801 /*
802 * Make sure "last cursor" doesn't point to a row in the just
803 * free:d snapshot grid.
804 *
805 * Note that it will still be erased properly (if hasn't already),
806 * since we marked the cell as dirty *before* taking the grid
807 * snapshot.
808 */
809 term->render.last_cursor.row = NULL;
811 if (term->window != NULL) {
812 tll_foreach(term->window->urls, it) {
813 wayl_win_subsurface_destroy(&it->item.surf);
814 tll_remove(term->window->urls, it);
815 }
816 }
818 tll_foreach(term->url.list, it) {
819 url_destroy(&it->item);
820 tll_remove(term->url.list, it);
821 }
823 term->url.show_uri_on_jump_label = false;
824 memset(term->url.keys, 0, sizeof(term->url.keys));
826 /* Re-enable IME, if it was enabled before we entered URL-mode */
827 if (term->url.ime_reenable_after_url_mode) {
828 term->url.ime_reenable_after_url_mode = false;
829 term_ime_enable(term);
830 }
832 render_refresh(term);
833}
Diagnostics5 git calls · 490 ms
CallStatusSizeTime0490 ms
discover200178 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=178 git.server.agent=git/2.56.1-Linux git.server.object_format=sha1 git.server.caps=agent ls-refs fetch server-option object-format git.server.fetch=shallow wait-for-done filter git.protocol.version=2 git.pkt.frames=9 git.pkt.data=7 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=178 git.pkt.payload.max=35
ls-refs20010 KiB458 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=392 git.response.bytes=10322 git.response.cache=EXPIRED git.response.duration_ms=458 git.protocol.version=2 git.pkt.frames=108 git.pkt.data=107 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=10322 git.pkt.payload.max=106 git.ls_refs.count=107 git.ls_refs.head=refs/heads/master
fetchcombine:blob:none+tree:2 · deepen 12008.6 KiB · hit2 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=8830 git.response.cache=HIT git.response.duration_ms=2 git.fetch.filter=combine:blob:none+tree:2 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 git.fetch.haves.count=0 git.fetch.deepen=1 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=8830 git.pkt.payload.max=8730 git.sideband.band1.bytes=8730 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=14 git.pack.bytes=8730 git.fetch.wide.objects=14 git.fetch.wide.extra_bytes=9909 git.fetch.wide.blobs=0
fetchtree:0 · deepen 102009.3 KiB · hit3 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=9489 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=tree:0 git.fetch.wants=c0d2c3e95d74cb60526ff28aec9f34ee3df545e0 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=7 git.pkt.data=5 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=9489 git.pkt.payload.max=9389 git.sideband.band1.bytes=9389 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=10 git.pack.bytes=9389 git.pack.ofs_delta=0 git.pack.ref_delta=0 git.pack.chain.max=0 git.pack.trailer=de930681b6073ba5b599a0f956bfbd114762ad5a git.pack.full=10Open pack map
fetch2006.3 KiB · hit29 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=29 git.response.bytes=6482 git.response.cache=HIT git.response.duration_ms=29 git.fetch.wants=d3e1fbbfb0523dcab34b00e4de9d33dd03cd1441 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=4 git.pkt.data=3 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=6482 git.pkt.payload.max=6455 git.sideband.band1.bytes=6455 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://codeberg.org/dnkl/foot
- Ref
- refs/heads/master
- Commit
- c0d2c3e95d74cb60526ff28aec9f34ee3df545e0
- cf-ray
- a5e17087bd476102
- Request
- 0fa29f61…
- Protocol
- v2 · sha1
- Agent
- git/2.56.1-Linux
- Filter
- advertised
- Fetch
- shallow wait-for-done filter
- Capabilities
- agent ls-refs fetch server-option object-format