Fix getSSLClietnDN returns DN instead CN
This commit is contained in:
@@ -168,7 +168,7 @@ func getSSLClietnDN(w http.ResponseWriter, r *http.Request, h *model.Handler) {
|
||||
httperror.ErrorJSON(w, ResourceItemNotFound, http.StatusNotFound)
|
||||
} else {
|
||||
w.Header().Add("Content-Type", "application/octet-stream")
|
||||
_, _ = w.Write([]byte(h.Request.TLS.VerifiedChains[0][0].Subject.CommonName))
|
||||
_, _ = w.Write([]byte(h.Request.TLS.VerifiedChains[0][0].Subject.String()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1237,8 +1237,8 @@ func TestGetSSLClientDNReturnsCorrectDN(t *testing.T) {
|
||||
|
||||
res := w.Result()
|
||||
|
||||
if body, _ := ioutil.ReadAll(res.Body); string(body) != h.Request.TLS.VerifiedChains[0][0].Subject.CommonName {
|
||||
t.Errorf("Body mismatch. Expected: %q, got: %q", h.Request.TLS.VerifiedChains[0][0].Subject.CommonName, string(body))
|
||||
if body, _ := ioutil.ReadAll(res.Body); string(body) != h.Request.TLS.VerifiedChains[0][0].Subject.String() {
|
||||
t.Errorf("Body mismatch. Expected: %q, got: %q", h.Request.TLS.VerifiedChains[0][0].Subject.String(), string(body))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user