master
1 * curl simple URL request (free-format RPG)
2 *
3 ctl-opt dftactgrp(*NO) actgrp(*NEW)
4 option(*NOSHOWCPY)
5 bnddir('CURL');
6 *
7 **************************************************************************
8 * _ _ ____ _
9 * Project ___| | | | _ \| |
10 * / __| | | | |_) | |
11 * | (__| |_| | _ <| |___
12 * \___|\___/|_| \_\_____|
13 *
14 * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
15 *
16 * This software is licensed as described in the file COPYING, which
17 * you should have received as part of this distribution. The terms
18 * are also available at https://curl.se/docs/copyright.html.
19 *
20 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
21 * copies of the Software, and permit persons to whom the Software is
22 * furnished to do so, under the terms of the COPYING file.
23 *
24 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
25 * ANY KIND, either express or implied.
26 *
27 * SPDX-License-Identifier: curl
28 *
29 **************************************************************************
31 /include H,CURL.INC
33 * Simple free-format RPG program to request the URL given as command line
34 * parameter and output its response.
36 dcl-pi *N;
37 url char(120);
38 end-pi;
40 dcl-s urllen int(10); // URL length
42 **************************************************************************
44 urllen = trimmed_length(url: %len(url));
46 // Do the curl stuff.
48 curl_global_init(CURL_GLOBAL_ALL);
49 main();
50 curl_global_cleanup();
51 *inlr = *on; // Exit
53 **************************************************************************
54 * Main procedure: do the curl job.
55 **************************************************************************
57 dcl-proc main;
58 dcl-pi *N end-pi;
60 dcl-s h pointer; // Easy handle
61 dcl-s result like(CURLcode) inz(CURLE_OUT_OF_MEMORY); // Curl return code
62 dcl-s errmsgp pointer; // Error string pointer
63 dcl-s response char(52); // For error display
65 // Create and fill curl handle.
67 h = curl_easy_init();
68 if h <> *NULL;
69 curl_easy_setopt_ccsid(h: CURLOPT_URL: %subst(url: 1: urllen):
70 0);
71 curl_easy_setopt(h: CURLOPT_FOLLOWLOCATION: 1);
73 // Perform the request.
75 result = curl_easy_perform(h);
76 curl_easy_cleanup(h); // Release handle
77 endif;
79 // Check for error and report if some.
81 if result <> CURLE_OK;
82 errmsgp = curl_easy_strerror_ccsid(result: 0);
83 response = %str(errmsgp);
84 dsply '' '*EXT' response;
85 endif;
86 end-proc;
87 *
88 **************************************************************************
89 * Get the length of right-trimmed string
90 **************************************************************************
91 *
92 dcl-proc trimmed_length;
93 dcl-pi *N uns(10);
94 string char(9999999) const options(*varsize);
95 length uns(10) value;
96 end-pi;
98 dcl-s len uns(10);
100 len = %scan(X'00': string: 1: length); // Limit to null-terminated string
101 if len = 0;
102 len = length + 1;
103 endif;
104 if len <= 1;
105 return 0;
106 endif;
107 return %checkr(' ': string: len - 1); // Trim right
108 end-proc;
Diagnostics4 git calls · 24 ms
CallStatusSizeTime024 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 · hit3 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=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.5 KiB · hit19 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=19 git.response.bytes=1493 git.response.cache=HIT git.response.duration_ms=19 git.fetch.wants=2fead8517cdbbb8948870f6723c6d747a72b62ba 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=1493 git.pkt.payload.max=1472 git.sideband.band1.bytes=1471 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
- a5e2d128eb15cf3a
- Request
- bc05e3ed…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format