-
-
Save roxlu/60e4d0d297680e463389 to your computer and use it in GitHub Desktop.
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
static void krx_https_conn_read(uv_stream_t* stream, ssize_t nbytes, uv_buf_t buf) { | |
krx_https_conn* c = (krx_https_conn*)stream->data; | |
if(!c) { | |
printf("Error: krx_https_conn_read(), user pointer not set.\n"); | |
exit(1); | |
} | |
/* disconnected or other error. */ | |
if(nbytes < 0) { | |
free(buf.base); | |
printf("- krx_https_conn_read(), %p, status: %s\n", c, uv_strerror(nbytes)); | |
krx_https_close_connection(c); | |
return; | |
} | |
/* digest incoming data */ | |
int written = BIO_write(c->in_bio, buf.base, nbytes); | |
if(written > 0) { | |
if(!SSL_is_init_finished(c->ssl)) { | |
int r = SSL_do_handshake(c->ssl); | |
if(r < 0) { | |
char buf[200]; | |
int err = SSL_get_error(c->ssl, r); | |
char* d = ERR_error_string(err,buf); | |
} | |
krx_https_ssl_check_output_buffer(c); | |
} | |
else { | |
krx_https_ssl_check_input_buffer(c); | |
} | |
} | |
free(buf.base); | |
buf.base = NULL; | |
} |
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
static void krx_https_conn_read(uv_stream_t* stream, ssize_t nbytes, uv_buf_t buf) { | |
krx_https_conn* c = (krx_https_conn*)stream->data; | |
if(!c) { | |
printf("Error: krx_https_conn_read(), user pointer not set.\n"); | |
exit(1); | |
} | |
/* disconnected or other error. */ | |
if(nbytes < 0) { | |
free(buf.base); | |
printf("- krx_https_conn_read(), %p, status: %s\n", c, uv_strerror(nbytes)); | |
krx_https_close_connection(c); | |
return; | |
} | |
/* digest incoming data */ | |
int written = BIO_write(c->in_bio, buf.base, nbytes); | |
if(written > 0) { | |
if(!SSL_is_init_finished(c->ssl)) { | |
int r = SSL_do_handshake(c->ssl); | |
if(r < 0) { | |
char buf[200]; | |
int err = SSL_get_error(c->ssl, r); | |
char* d = ERR_error_string(err,buf); | |
} | |
krx_https_ssl_check_output_buffer(c); | |
} | |
} | |
krx_https_ssl_check_input_buffer(c); | |
free(buf.base); | |
buf.base = NULL; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment