1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

http: windows - make https requests work in threads

This commit is contained in:
joe-conigliaro
2019-08-29 19:33:20 +10:00
committed by Alexander Medvednikov
parent 4f62e8235f
commit cd625b04eb
3 changed files with 138 additions and 143 deletions

View File

@ -20,31 +20,28 @@
// Define here to be sure
#define SP_PROT_TLS1_2_CLIENT 0x00000800
typedef struct TlsContext TlsContext;
static struct TlsContext new_tls_context();
TlsContext new_tls_context();
static void vschannel_init();
static void vschannel_init(TlsContext *tls_ctx);
static void vschannel_cleanup();
static void vschannel_cleanup(TlsContext *tls_ctx);
static INT request(INT iport, CHAR *host, CHAR *req, CHAR **out);
static INT request(TlsContext *tls_ctx, INT iport, CHAR *host, CHAR *req, CHAR **out);
static SECURITY_STATUS https_make_request(
CHAR *req, CHAR **out, int *length);
static SECURITY_STATUS https_make_request(TlsContext *tls_ctx, CHAR *req, CHAR **out, int *length);
static INT connect_to_server(CHAR *host, INT port_number);
static INT connect_to_server(TlsContext *tls_ctx, CHAR *host, INT port_number);
static LONG disconnect_from_server();
static LONG disconnect_from_server(TlsContext *tls_ctx);
static SECURITY_STATUS perform_client_handshake(
CHAR *host, SecBuffer *pExtraData);
static SECURITY_STATUS perform_client_handshake(TlsContext *tls_ctx, CHAR *host, SecBuffer *pExtraData);
static SECURITY_STATUS client_handshake_loop(
BOOL fDoInitialRead, SecBuffer *pExtraData);
static SECURITY_STATUS client_handshake_loop(TlsContext *tls_ctx, BOOL fDoInitialRead, SecBuffer *pExtraData);
static DWORD verify_server_certificate(
PCCERT_CONTEXT pServerCert, PSTR host, DWORD dwCertFlags);
static DWORD verify_server_certificate(PCCERT_CONTEXT pServerCert, PSTR host, DWORD dwCertFlags);
static SECURITY_STATUS create_credentials();
static SECURITY_STATUS create_credentials(TlsContext *tls_ctx);
static void get_new_client_credentials();
static void get_new_client_credentials(TlsContext *tls_ctx);