master
1/***************************************************************************
2 * _ _ ____ _
3 * Project ___| | | | _ \| |
4 * / __| | | | |_) | |
5 * | (__| |_| | _ <| |___
6 * \___|\___/|_| \_\_____|
7 *
8 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
9 *
10 * This software is licensed as described in the file COPYING, which
11 * you should have received as part of this distribution. The terms
12 * are also available at https://curl.se/docs/copyright.html.
13 *
14 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 * copies of the Software, and permit persons to whom the Software is
16 * furnished to do so, under the terms of the COPYING file.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 * SPDX-License-Identifier: curl
22 *
23 ***************************************************************************/
24#include "first.h"
26static CURLcode test_lib661(const char *URL)
27{
28 CURLcode result;
29 CURL *curl = NULL;
30 char *newURL = NULL;
31 struct curl_slist *slist = NULL;
33 if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
34 curl_mfprintf(stderr, "curl_global_init() failed\n");
35 return TEST_ERR_MAJOR_BAD;
36 }
38 curl = curl_easy_init();
39 if(!curl) {
40 curl_mfprintf(stderr, "curl_easy_init() failed\n");
41 result = TEST_ERR_MAJOR_BAD;
42 goto test_cleanup;
43 }
45 /* test: CURLFTPMETHOD_SINGLECWD with absolute path should
46 skip CWD to entry path */
47 newURL = curl_maprintf("%s/folderA/661", URL);
48 easy_setopt(curl, CURLOPT_URL, newURL);
49 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
50 easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
51 easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
52 result = curl_easy_perform(curl);
53 if(result != CURLE_REMOTE_FILE_NOT_FOUND)
54 goto test_cleanup;
56 curl_free(newURL);
57 newURL = curl_maprintf("%s/folderB/661", URL);
58 easy_setopt(curl, CURLOPT_URL, newURL);
59 result = curl_easy_perform(curl);
60 if(result != CURLE_REMOTE_FILE_NOT_FOUND)
61 goto test_cleanup;
63 /* test: CURLFTPMETHOD_NOCWD with absolute path should
64 never emit CWD (for both new and reused easy handle) */
65 curl_easy_cleanup(curl);
66 curl = curl_easy_init();
67 if(!curl) {
68 curl_mfprintf(stderr, "curl_easy_init() failed\n");
69 result = TEST_ERR_MAJOR_BAD;
70 goto test_cleanup;
71 }
73 curl_free(newURL);
74 newURL = curl_maprintf("%s/folderA/661", URL);
75 easy_setopt(curl, CURLOPT_URL, newURL);
76 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
77 easy_setopt(curl, CURLOPT_IGNORE_CONTENT_LENGTH, 1L);
78 easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
79 result = curl_easy_perform(curl);
80 if(result != CURLE_REMOTE_FILE_NOT_FOUND)
81 goto test_cleanup;
83 /* curve ball: CWD /folderB before reusing connection with _NOCWD */
84 curl_free(newURL);
85 newURL = curl_maprintf("%s/folderB/661", URL);
86 easy_setopt(curl, CURLOPT_URL, newURL);
87 easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
88 result = curl_easy_perform(curl);
89 if(result != CURLE_REMOTE_FILE_NOT_FOUND)
90 goto test_cleanup;
92 curl_free(newURL);
93 newURL = curl_maprintf("%s/folderA/661", URL);
94 easy_setopt(curl, CURLOPT_URL, newURL);
95 easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
96 result = curl_easy_perform(curl);
97 if(result != CURLE_REMOTE_FILE_NOT_FOUND)
98 goto test_cleanup;
100 /* test: CURLFTPMETHOD_NOCWD with home-relative path should
101 not emit CWD for first FTP access after login */
102 curl_easy_cleanup(curl);
103 curl = curl_easy_init();
104 if(!curl) {
105 curl_mfprintf(stderr, "curl_easy_init() failed\n");
106 result = TEST_ERR_MAJOR_BAD;
107 goto test_cleanup;
108 }
110 slist = curl_slist_append(NULL, "SYST");
111 if(!slist) {
112 curl_mfprintf(stderr, "curl_slist_append() failed\n");
113 result = TEST_ERR_MAJOR_BAD;
114 goto test_cleanup;
115 }
117 easy_setopt(curl, CURLOPT_URL, URL);
118 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
119 easy_setopt(curl, CURLOPT_NOBODY, 1L);
120 easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
121 easy_setopt(curl, CURLOPT_QUOTE, slist);
122 result = curl_easy_perform(curl);
123 if(result)
124 goto test_cleanup;
126 /* test: CURLFTPMETHOD_SINGLECWD with home-relative path should
127 not emit CWD for first FTP access after login */
128 curl_easy_cleanup(curl);
129 curl = curl_easy_init();
130 if(!curl) {
131 curl_mfprintf(stderr, "curl_easy_init() failed\n");
132 result = TEST_ERR_MAJOR_BAD;
133 goto test_cleanup;
134 }
136 easy_setopt(curl, CURLOPT_URL, URL);
137 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
138 easy_setopt(curl, CURLOPT_NOBODY, 1L);
139 easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_SINGLECWD);
140 easy_setopt(curl, CURLOPT_QUOTE, slist);
141 result = curl_easy_perform(curl);
142 if(result)
143 goto test_cleanup;
145 /* test: CURLFTPMETHOD_NOCWD with home-relative path should
146 not emit CWD for second FTP access when not needed +
147 bonus: see if path buffering survives curl_easy_reset() */
148 curl_easy_reset(curl);
149 easy_setopt(curl, CURLOPT_URL, URL);
150 easy_setopt(curl, CURLOPT_VERBOSE, 1L);
151 easy_setopt(curl, CURLOPT_NOBODY, 1L);
152 easy_setopt(curl, CURLOPT_FTP_FILEMETHOD, CURLFTPMETHOD_NOCWD);
153 easy_setopt(curl, CURLOPT_QUOTE, slist);
154 result = curl_easy_perform(curl);
156test_cleanup:
158 if(result)
159 curl_mfprintf(stderr, "test encountered error %d\n", (int)result);
160 curl_slist_free_all(slist);
161 curl_free(newURL);
162 curl_easy_cleanup(curl);
163 curl_global_cleanup();
165 return result;
166}
Diagnostics4 git calls · 115 ms
CallStatusSizeTime0115 ms
discover200152 B3 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 · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 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=110 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.4 KiB110 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1411 git.response.cache=MISS git.response.duration_ms=110 git.fetch.wants=80d46e8738bfe184ae21bf16e41eb17fe4539158 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=1411 git.pkt.payload.max=1390 git.sideband.band1.bytes=1389 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
- a5e3256e697198f1
- Request
- 95cf00b3…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format