generated from treeform/nimtemplate
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding "ignore self-signed certificate" option (#68)
* added insecure option added the insecure option to the type Request * added the insecure option to newRequest function added the insecure option to the newRequest function, by default it is false (meaning secure) * added insecure options for curl is the option for insecure is set, then the insecure options for curl or set. That being to disable peer, and host verification. * added flags and error to windef added flags for setting insecure options, and an error for secure failure. * added another error to windefs added the error to check for a resend request., because sometimes Negotiate authorization handshakes may return this error * added WinHttpSetOption added the WinHttpSetOption function from the dynamic library winhttp. This will allow us the set security options on the request. * added another flag, and another error Added the WINHTTP_OPTION_SECURITY_FLAGS for setting security options, and the ERROR_INTERNET_INVALID_CA error, for catching another security error * added insecure option for windows This implementation allows for insecure connection if specified. This required adding some more definitions, and procedures to windefs.nim * added setAllowsAnyHTTPSCertificate adding the setAllowsAnyHTTPSCerfiticate function. * Update test.nim * added python test server This python server utilizes self signed certificates for HTTPS communication for testing the insecure ssl PR draft. * added self signed certs added self signed certificates utilizing openSSL. * removed testing variables I've forgot to remove some variables for testing when making the test server. * added requested updates Thank you @guzba for giving great ideas to add to this PR, I've added a smaller test server, updated the variable name, and thanks again @guzba for showing me how to use https without a loop for windows. * fixing commit pull messup messed up on commit pull, this might fix confilcts * again messing up the commit Been a while working on this repository, hopefully this fixes an conflicts. * added requested fixes... again Alright somethings I'll have to fix in my script, but I went back and edited them manually. Please let me know if I've forgotten anything. * added function parameters I've added the function parameters requested, must've forgotten about them during manual editing. * removed exception Removed the exception at the line specified to remove at.
- Loading branch information
1 parent
26ec743
commit 0016aae
Showing
10 changed files
with
206 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDazCCAlOgAwIBAgIUL6WPqwJb9MBbrqL3v1gIX42hySMwDQYJKoZIhvcNAQEL | ||
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM | ||
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMjAyMjMwNzI1MjFaFw0yMzAy | ||
MjMwNzI1MjFaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw | ||
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB | ||
AQUAA4IBDwAwggEKAoIBAQCqA9pvOjC8Jg7wiX3aiXedg7LKS/V3coINi/Xzh7zY | ||
1YERUyda/nRpFjmONtJkRipxA59ZZfNfMLoOtl5BhcE4LlLC81m48KQt7/eR3SMx | ||
tkqFByOA5WltulhXHKghyJhyjy0UDIrBHy5Ic7X8dkR1n9spqpfWyM6VMyDOX9Fl | ||
8N5H03ioicvjZ4n6Mrc2sCMl39G5GFyUgBX6UAAsPg4xrfPL5Yz+TGSeCV7UtFDc | ||
nfpR4l5WQERqU4IJCNQj5MxweNZNa00sTOP5s7zuzFiGVQqkCz7FWzpZVUbMggBo | ||
0UfhCNlnFGPMzddG/IsN0ojCRFzBufFa3jC5AzuhwZk/AgMBAAGjUzBRMB0GA1Ud | ||
DgQWBBSodOQnZd0tc3IMtnEDIoPzw8tMWzAfBgNVHSMEGDAWgBSodOQnZd0tc3IM | ||
tnEDIoPzw8tMWzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAm | ||
9IJBZ0xiQUSsUyBe0bZ+1iBkzX8ci1df1rqGooVIIkF3L5HYq8MME0oi5YdQrpqJ | ||
I4OArRBwz06SUqMP16KTibOgnc8EYM0ZdhqkdK5dZQnyCBpExtlz73U0ELnMvdGE | ||
a+1ZsnPKXgYXaEfbWWs5EN6avbAkURuzzt4eg7t4XCxm8T/MJqL7D3xoT7ion1v0 | ||
iXsdbBVoC5A0nvPWdraOvB7PI4Z951bywuj/7VRIPlMYUFmrYbOGo5oJudZHwrl8 | ||
N3vDHkgr5GFeB5cyqlPjUNrfjxTQP6Mim3AtaHC30NhhABmxQVjj53Hn+oDuNeF6 | ||
GSj2EtzNm76AU377GrBi | ||
-----END CERTIFICATE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQCqA9pvOjC8Jg7w | ||
iX3aiXedg7LKS/V3coINi/Xzh7zY1YERUyda/nRpFjmONtJkRipxA59ZZfNfMLoO | ||
tl5BhcE4LlLC81m48KQt7/eR3SMxtkqFByOA5WltulhXHKghyJhyjy0UDIrBHy5I | ||
c7X8dkR1n9spqpfWyM6VMyDOX9Fl8N5H03ioicvjZ4n6Mrc2sCMl39G5GFyUgBX6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LloVhyO0w4v89IL8CgYEA | ||
gkx7IRWix50AKKW+xRBHhhZ1ThS2gdXI4lN7eJiR8c7BkPqQ/XPkRvzz2bs8SMd7 | ||
X0X5D1maclP5AHNV4qS7WcghmAMKEQ+Jfc1iwLBYKlX2lrsezzOcBu+merCPETS/ | ||
gCX3jfz7umfD9T9LsKoFqSfRtTO3efnE5Z2D3M0pTIECgYEAwxe+eDuqKVNEorJn | ||
/3mN5SzC0kXMOiT3UEgMcPAJaizzNjD7d0oIz7afzgJJggGsnerFRFe3Bmw0GJJ5 | ||
lVyanZW3kumPw1B86kakkiaeEAy3uAD6QPcU6vlSlwREkxAujr/K2sCaNtpYwWly | ||
SCT+0J/TkI28lbnzl1eSG2aQUbA= | ||
-----END PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from http.server import HTTPServer, BaseHTTPRequestHandler | ||
import ssl | ||
|
||
host = ("0.0.0.0", 443) | ||
|
||
class ExecuteServer(BaseHTTPRequestHandler): | ||
def do_GET(self): | ||
if self.path == "/connect": | ||
try: | ||
self.send_response(200) | ||
self.send_header("Content-type", "text/html") | ||
self.end_headers() | ||
self.wfile.write(bytes("test", "utf8")) | ||
except: | ||
pass | ||
|
||
def do_POST(self): | ||
if self.path == "/plain": | ||
content_len = int(self.headers.get("Content-Length")) | ||
post_body = self.rfile.read(content_len) | ||
self.send_response(200) | ||
self.send_header("Content-type", "text/html") | ||
self.end_headers() | ||
|
||
post_body = str(post_body.decode()) | ||
print(post_body) | ||
|
||
def log_message(self, format, *args): | ||
pass | ||
|
||
def start_server(): | ||
server = HTTPServer(host, ExecuteServer) | ||
server.socket = ssl.wrap_socket(server.socket, | ||
server_side=True, | ||
certfile="tests/data/ssl.crt", | ||
keyfile="tests/data/ssl.key", | ||
ssl_version=ssl.PROTOCOL_TLS) | ||
|
||
print(f"Starting server, listening on port {host[1]}") | ||
server.serve_forever() | ||
|
||
def main(): | ||
start_server() | ||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.