mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-06 05:02:40 +03:00
Made httplib_base64_encode global
This commit is contained in:
@@ -986,6 +986,7 @@ LIBHTTP_API void * XX_httplib_realloc_ex( void *memory, size_t newsize, const c
|
||||
|
||||
LIBHTTP_API int httplib_atomic_dec( volatile int *addr );
|
||||
LIBHTTP_API int httplib_atomic_inc( volatile int *addr );
|
||||
LIBHTTP_API int httplib_base64_encode( const unsigned char *src, int src_len, char *dst, int dst_len );
|
||||
LIBHTTP_API int httplib_closedir( DIR *dir );
|
||||
LIBHTTP_API int httplib_kill( pid_t pid, int sig_num );
|
||||
LIBHTTP_API int httplib_mkdir( const char *path, int mode );
|
||||
|
@@ -29,6 +29,8 @@
|
||||
#include "httplib_string.h"
|
||||
#include "httplib_utils.h"
|
||||
|
||||
#define B64_SHA_LEN (sizeof(sha)*2)
|
||||
|
||||
/*
|
||||
* int XX_httplib_send_websocket_handshake( struct httplib_connection *conn, const char *websock_key );
|
||||
*
|
||||
@@ -44,7 +46,7 @@ int XX_httplib_send_websocket_handshake( struct httplib_connection *conn, const
|
||||
const char *protocol;
|
||||
char buf[100];
|
||||
char sha[20];
|
||||
char b64_sha[sizeof(sha) * 2];
|
||||
char b64_sha[B64_SHA_LEN];
|
||||
SHA1_CTX sha_ctx;
|
||||
int truncated;
|
||||
|
||||
@@ -65,7 +67,7 @@ int XX_httplib_send_websocket_handshake( struct httplib_connection *conn, const
|
||||
SHA1Update( & sha_ctx, (unsigned char *)buf, (uint32_t)strlen(buf) );
|
||||
SHA1Final( (unsigned char *)sha, &sha_ctx );
|
||||
|
||||
XX_httplib_base64_encode( (unsigned char *)sha, sizeof(sha), b64_sha );
|
||||
httplib_base64_encode( (unsigned char *)sha, sizeof(sha), b64_sha, B64_SHA_LEN );
|
||||
httplib_printf( conn,
|
||||
"HTTP/1.1 101 Switching Protocols\r\n"
|
||||
"Upgrade: websocket\r\n"
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#define LEAP_YEAR(x) ( ((x)%4) == 0 && ( ((x)%100) != 0 || ((x)%400) == 0 ) )
|
||||
|
||||
void XX_httplib_addenv( struct cgi_environment *env, PRINTF_FORMAT_STRING(const char *fmt), ... ) PRINTF_ARGS(2, 3);
|
||||
void XX_httplib_base64_encode( const unsigned char *src, int src_len, char *dst );
|
||||
double XX_httplib_difftimespec( const struct timespec *ts_now, const struct timespec *ts_before );
|
||||
uint64_t XX_httplib_get_random( void );
|
||||
void XX_httplib_gmt_time_string( char *buf, size_t buf_len, time_t *t );
|
||||
|
Reference in New Issue
Block a user