From e484b1746deaa842d4aaa31547c376560f644877 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Amiel Date: Tue, 4 Jun 2024 17:23:44 +0200 Subject: [PATCH] Fix typo in issuer field when exporting SSL certificate to JSON --- integration/hurl/ssl/cacert.ps1 | 2 +- integration/hurl/ssl/cacert.sh | 2 +- integration/hurl/ssl/cacert_to_json.exit | 1 + integration/hurl/ssl/cacert_to_json.out.pattern | 1 + integration/hurl/ssl/cacert_to_json.ps1 | 3 +++ integration/hurl/ssl/cacert_to_json.sh | 3 +++ packages/hurl/src/json/result.rs | 5 ++--- 7 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 integration/hurl/ssl/cacert_to_json.exit create mode 100644 integration/hurl/ssl/cacert_to_json.out.pattern create mode 100644 integration/hurl/ssl/cacert_to_json.ps1 create mode 100755 integration/hurl/ssl/cacert_to_json.sh diff --git a/integration/hurl/ssl/cacert.ps1 b/integration/hurl/ssl/cacert.ps1 index 8544da65e..bbd80b7db 100644 --- a/integration/hurl/ssl/cacert.ps1 +++ b/integration/hurl/ssl/cacert.ps1 @@ -1,3 +1,3 @@ Set-StrictMode -Version latest $ErrorActionPreference = 'Stop' -hurl ssl/cacert.hurl --cacert ssl/ca/cert.pem --ssl-no-revoke --verbose +hurl --cacert ssl/ca/cert.pem --ssl-no-revoke ssl/cacert.hurl diff --git a/integration/hurl/ssl/cacert.sh b/integration/hurl/ssl/cacert.sh index 7962b8137..bd955029c 100755 --- a/integration/hurl/ssl/cacert.sh +++ b/integration/hurl/ssl/cacert.sh @@ -1,3 +1,3 @@ #!/bin/bash set -Eeuo pipefail -hurl ssl/cacert.hurl --cacert ssl/ca/cert.pem --verbose +hurl --cacert ssl/ca/cert.pem ssl/cacert.hurl diff --git a/integration/hurl/ssl/cacert_to_json.exit b/integration/hurl/ssl/cacert_to_json.exit new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/integration/hurl/ssl/cacert_to_json.exit @@ -0,0 +1 @@ +0 diff --git a/integration/hurl/ssl/cacert_to_json.out.pattern b/integration/hurl/ssl/cacert_to_json.out.pattern new file mode 100644 index 000000000..068e078f6 --- /dev/null +++ b/integration/hurl/ssl/cacert_to_json.out.pattern @@ -0,0 +1 @@ +{"cookies":[],"entries":[{"asserts":[{"line":5,"success":true},{"line":5,"success":true},{"line":6,"success":true}],"calls":[{"request":{"cookies":[],"headers":[{"name":"Host","value":"localhost:8002"},{"name":"Accept","value":"*/*"},{"name":"User-Agent","value":"hurl/~~~"}],"method":"GET","queryString":[],"url":"https://localhost:8002/hello"},"response":{"certificate":{"expire_date":"2025-03-15 10:48:00 UTC","issuer":"C~=~US, ST~=~Denial, L~=~Springfield, O~=~Dis, CN~=~myCA","serial_number":"3e:23:bb:87:21:f8:10:85:36:c2:72:c9:64:34:d6:15:d1:8c:69:15","start_date":"2022-12-11 10:48:00 UTC","subject":"C~=~US, ST~=~Denial, L~=~Springfield, O~=~Dis, CN~=~localhost"},"cookies":[],"headers":[{"name":"Server","value":"Werkzeug/~~~ Python/~~~"},{"name":"Date","value":"~~~"},{"name":"Content-Type","value":"text/html; charset=utf-8"},{"name":"Content-Length","value":"12"},{"name":"Connection","value":"close"}],"httpVersion":"HTTP/1.1","status":200},"timings":{"app_connect":~~~,"begin_call":"~~~","connect":~~~,"end_call":"~~~","name_lookup":~~~,"pre_transfer":~~~,"start_transfer":~~~,"total":~~~}}],"captures":[],"index":1,"line":3,"time":~~~}],"filename":"ssl/cacert.hurl","success":true,"time":~~~} diff --git a/integration/hurl/ssl/cacert_to_json.ps1 b/integration/hurl/ssl/cacert_to_json.ps1 new file mode 100644 index 000000000..610c32e50 --- /dev/null +++ b/integration/hurl/ssl/cacert_to_json.ps1 @@ -0,0 +1,3 @@ +Set-StrictMode -Version latest +$ErrorActionPreference = 'Stop' +hurl --cacert ssl/ca/cert.pem --ssl-no-revoke --json ssl/cacert.hurl diff --git a/integration/hurl/ssl/cacert_to_json.sh b/integration/hurl/ssl/cacert_to_json.sh new file mode 100755 index 000000000..327dd4d1f --- /dev/null +++ b/integration/hurl/ssl/cacert_to_json.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -Eeuo pipefail +hurl --cacert ssl/ca/cert.pem --json ssl/cacert.hurl diff --git a/packages/hurl/src/json/result.rs b/packages/hurl/src/json/result.rs index 76a1008b1..1d9c5a865 100644 --- a/packages/hurl/src/json/result.rs +++ b/packages/hurl/src/json/result.rs @@ -179,8 +179,7 @@ struct ResponseCookieJson { #[derive(Serialize)] struct CertificateJson { subject: String, - // FIXME: should be issuer - issue: String, + issuer: String, start_date: String, expire_date: String, serial_number: String, @@ -407,7 +406,7 @@ impl CertificateJson { fn from_certificate(c: &Certificate) -> Self { CertificateJson { subject: c.subject.clone(), - issue: c.issuer.to_string(), + issuer: c.issuer.to_string(), start_date: c.start_date.to_string(), expire_date: c.expire_date.to_string(), serial_number: c.serial_number.to_string(),