Skip to content

Commit ace64dc

Browse files
committed
Add scheme to ReqStart
1 parent 40bec15 commit ace64dc

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

vsl/records.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,11 +571,12 @@ type ReqStartRecord struct {
571571
ClientIP net.IP // Client IP4/6 address (0.0.0.0 for UDS)
572572
ClientPort int // Client Port number (0 for Unix domain sockets)
573573
Listener string // Listener name (from -a)
574+
Scheme string // Protocol scheme ("http" or "https")
574575
}
575576

576577
func NewReqStartRecord(blr BaseRecord) (ReqStartRecord, error) {
577578
parts := strings.Fields(blr.GetRawValue())
578-
if len(parts) != 3 {
579+
if len(parts) < 3 {
579580
return ReqStartRecord{}, fmt.Errorf("conversion to ReqStartRecord failed, incorrect len on line %q", blr.GetRawLog())
580581
}
581582

@@ -589,7 +590,13 @@ func NewReqStartRecord(blr BaseRecord) (ReqStartRecord, error) {
589590
return ReqStartRecord{}, fmt.Errorf("conversion to BackendOpenRecord failed, bad clientPort on line %q", blr.GetRawLog())
590591
}
591592

592-
return ReqStartRecord{BaseRecord: blr, ClientIP: clientIP, ClientPort: clientPort, Listener: parts[2]}, nil
593+
r := ReqStartRecord{BaseRecord: blr, ClientIP: clientIP, ClientPort: clientPort, Listener: parts[2]}
594+
595+
if len(parts) >= 4 {
596+
r.Scheme = parts[3]
597+
}
598+
599+
return r, nil
593600
}
594601

595602
func (r ReqStartRecord) String() string {

0 commit comments

Comments
 (0)