Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more winhttp cert error to work with allowAnyHttpsCertificate #84

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/puppy/platforms/win32/platform.nim
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ proc fetch*(req: Request): Response {.raises: [PuppyError].} =
) == 0:

let error = GetLastError()
if error in {ERROR_WINHTTP_SECURE_FAILURE, ERROR_INTERNET_INVALID_CA} and
if error in {ERROR_WINHTTP_SECURE_FAILURE, ERROR_INTERNET_INVALID_CA, ERROR_INTERNET_SEC_CERT_DATE_INVALID, ERROR_INTERNET_SEC_INVALID_CERT, ERROR_INTERNET_SEC_CERT_CN_INVALID, ERROR_INTERNET_SEC_CERT_NO_REV, ERROR_INTERNET_SEC_CERT_REV_FAILED, ERROR_INTERNET_SEC_CERT_REVOKED, ERROR_INTERNET_SEC_CERT_ERRORS} and
req.allowAnyHttpsCertificate:
# If this is a certificate error but we should allow any HTTPS cert,
# we need to set some options and retry sending the request.
Expand Down
8 changes: 8 additions & 0 deletions src/puppy/platforms/win32/windefs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ const
ERROR_INSUFFICIENT_BUFFER* = 122
ERROR_WINHTTP_SECURE_FAILURE* = 12175
ERROR_INTERNET_INVALID_CA* = 12045
ERROR_INTERNET_SEC_CERT_DATE_INVALID* = 12037
ERROR_INTERNET_SEC_INVALID_CERT* = 12169
ERROR_INTERNET_SEC_CERT_ERRORS* = 12055
ERROR_INTERNET_SEC_CERT_NO_REV* = 12056
ERROR_INTERNET_SEC_CERT_CN_INVALID* = 12038
ERROR_INTERNET_SEC_CERT_REV_FAILED* = 12057
ERROR_INTERNET_SEC_CERT_REVOKED* = 12170

WINHTTP_OPTION_SECURITY_FLAGS* = 31
SECURITY_FLAG_IGNORE_UNKNOWN_CA* = 0x00000100
# SECURITY_FLAG_IGNORE_WRONG_USAGE* = 0x00000200
Expand Down