Skip to content

Commit 65beef2

Browse files
authored
chore: add p12 cert support to curl (#239)
* chore: add p12 cert support to curl * chore: update docs
1 parent a20ff06 commit 65beef2

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

β€Žcore/util/webhunter.goβ€Ž

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ type Request struct {
163163
basicAuthUsername string
164164
basicAuthPassword string
165165
Context context.Context
166+
167+
168+
//curl only
169+
P12File string
170+
P12Password string
166171
}
167172

168173
func NewRequest(method, url string) *Request {
@@ -288,6 +293,16 @@ func ExecuteRequestViaCurl(req *Request) (*Result, error) {
288293
args = append(args, "-H", fmt.Sprintf("User-Agent: %s", req.Agent))
289294
}
290295

296+
// Add P12/PFX client certificate
297+
if req.P12File != "" {
298+
if req.P12Password != "" {
299+
args = append(args, "--cert", fmt.Sprintf("%s:%s", req.P12File, req.P12Password))
300+
} else {
301+
args = append(args, "--cert", req.P12File)
302+
}
303+
args = append(args, "--cert-type", "P12")
304+
}
305+
291306
// Add body data
292307
if len(req.Body) > 0 {
293308
// Create temporary file for body content
@@ -316,6 +331,8 @@ func ExecuteRequestViaCurl(req *Request) (*Result, error) {
316331
// Execute curl command
317332
cmd := exec.Command("curl", args...)
318333

334+
log.Debug(args)
335+
319336
var stdout, stderr bytes.Buffer
320337
cmd.Stdout = &stdout
321338
cmd.Stderr = &stderr

β€Ždocs/content.en/docs/release-notes/_index.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Information about release notes of INFINI Framework is provided here.
1313
### πŸš€ Features
1414
### πŸ› Bug fix
1515
### ✈️ Improvements
16+
- chore: add p12 cert support to curl #239
1617

1718
## 1.3.0 (2025-11-19)
1819
### ❌ Breaking changes

0 commit comments

Comments
Β (0)