Download raw body.
[PATCH] ocspcheck: Display parsed HTTP headers
This patch updates the code to use hget->head
for displaying HTTP headers.
The current variables are outdated and do not
display the headers.
The output after this change as follows:
```
$ ./bin/ocspcheck -vv server_chain.crt
Built an 106 byte ocsp request
Using http to host <URL>, port 80, path /
DNS returns <IP> for <URL>
Server at ocsp3.acsoluti.com.br returns:
[Status]=[HTTP/1.1 200 OK]
[Date]=[Wed, 04 Dec 2024 02:13:38 GMT]
[Server]=[]
[Content-Type]=[application/ocsp-response]
[Content-Length]=[1830]
[Connection]=[close]
[Body]=[1830 bytes]
```
Signed-off-by: Kenjiro Nakayama <nakayamakenjiro@gmail.com>
---
src/usr.sbin/ocspcheck/ocspcheck.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git src/usr.sbin/ocspcheck/ocspcheck.c src/usr.sbin/ocspcheck/ocspcheck.c
index 9739e398e..1e12f4ee6 100644
--- src/usr.sbin/ocspcheck/ocspcheck.c
+++ src/usr.sbin/ocspcheck/ocspcheck.c
@@ -556,8 +556,7 @@ main(int argc, char **argv)
struct source sources[MAX_SERVERS_DNS];
int i, ch, staplefd = -1, infd = -1, nonce = 1;
ocsp_request *request = NULL;
- size_t rescount, httphsz = 0, instaplesz = 0;
- struct httphead *httph = NULL;
+ size_t rescount, instaplesz = 0;
struct httpget *hget;
X509_STORE *castore;
ssize_t written, w;
@@ -682,8 +681,8 @@ main(int argc, char **argv)
}
dspew("Server at %s returns:\n", host);
- for (i = 0; i < httphsz; i++)
- dspew(" [%s]=[%s]\n", httph[i].key, httph[i].val);
+ for (i = 0; i < hget->headsz; i++)
+ dspew(" [%s]=[%s]\n", hget->head[i].key, hget->head[i].val);
dspew(" [Body]=[%zu bytes]\n", hget->bodypartsz);
if (hget->bodypartsz <= 0)
errx(1, "No body in reply from %s", host);
--
2.39.3 (Apple Git-146)
[PATCH] ocspcheck: Display parsed HTTP headers