mirror of
https://github.com/lammertb/libhttp.git
synced 2025-08-07 16:02:55 +03:00
Made httplib_strdup global
This commit is contained in:
@@ -1014,6 +1014,7 @@ LIBHTTP_API void httplib_send_file( struct httplib_connection *conn, const char
|
|||||||
LIBHTTP_API void httplib_set_alloc_callback_func( httplib_alloc_callback_func log_func );
|
LIBHTTP_API void httplib_set_alloc_callback_func( httplib_alloc_callback_func log_func );
|
||||||
LIBHTTP_API int httplib_strcasecmp( const char *s1, const char *s2 );
|
LIBHTTP_API int httplib_strcasecmp( const char *s1, const char *s2 );
|
||||||
LIBHTTP_API const char * httplib_strcasestr( const char *big_str, const char *small_str );
|
LIBHTTP_API const char * httplib_strcasestr( const char *big_str, const char *small_str );
|
||||||
|
LIBHTTP_API char * httplib_strdup( const char *str );
|
||||||
LIBHTTP_API void httplib_strlcpy( char *dst, const char *src, size_t len );
|
LIBHTTP_API void httplib_strlcpy( char *dst, const char *src, size_t len );
|
||||||
LIBHTTP_API int httplib_strncasecmp( const char *s1, const char *s2, size_t len );
|
LIBHTTP_API int httplib_strncasecmp( const char *s1, const char *s2, size_t len );
|
||||||
LIBHTTP_API char * httplib_strndup( const char *str, size_t len );
|
LIBHTTP_API char * httplib_strndup( const char *str, size_t len );
|
||||||
|
@@ -93,7 +93,7 @@ int XX_httplib_connect_socket( struct httplib_context *ctx, const char *host, in
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
size_t l = strlen(host+1);
|
size_t l = strlen(host+1);
|
||||||
char *h = (l > 1) ? XX_httplib_strdup(host+1) : NULL;
|
char *h = (l > 1) ? httplib_strdup(host+1) : NULL;
|
||||||
|
|
||||||
if ( h != NULL ) {
|
if ( h != NULL ) {
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@ void XX_httplib_dir_scan_callback( struct de *de, void *data ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
dsd->entries[dsd->num_entries].file_name = XX_httplib_strdup( de->file_name );
|
dsd->entries[dsd->num_entries].file_name = httplib_strdup( de->file_name );
|
||||||
dsd->entries[dsd->num_entries].file = de->file;
|
dsd->entries[dsd->num_entries].file = de->file;
|
||||||
dsd->entries[dsd->num_entries].conn = de->conn;
|
dsd->entries[dsd->num_entries].conn = de->conn;
|
||||||
dsd->num_entries++;
|
dsd->num_entries++;
|
||||||
|
@@ -41,7 +41,7 @@ void XX_httplib_get_system_name( char **sysName ) {
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#if defined(_WIN32_WCE)
|
#if defined(_WIN32_WCE)
|
||||||
|
|
||||||
*sysName = XX_httplib_strdup( "WinCE" );
|
*sysName = httplib_strdup( "WinCE" );
|
||||||
|
|
||||||
#else /* _WIN32_WCE */
|
#else /* _WIN32_WCE */
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ void XX_httplib_get_system_name( char **sysName ) {
|
|||||||
(void)dwBuild;
|
(void)dwBuild;
|
||||||
|
|
||||||
sprintf( name, "Windows %u.%u", (unsigned)dwMajorVersion, (unsigned)dwMinorVersion );
|
sprintf( name, "Windows %u.%u", (unsigned)dwMajorVersion, (unsigned)dwMinorVersion );
|
||||||
*sysName = XX_httplib_strdup( name );
|
*sysName = httplib_strdup( name );
|
||||||
|
|
||||||
#endif /* _WIN32_WCE */
|
#endif /* _WIN32_WCE */
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
@@ -79,7 +79,7 @@ void XX_httplib_get_system_name( char **sysName ) {
|
|||||||
|
|
||||||
memset( & name, 0, sizeof(name) );
|
memset( & name, 0, sizeof(name) );
|
||||||
uname( & name );
|
uname( & name );
|
||||||
*sysName = XX_httplib_strdup( name.sysname );
|
*sysName = httplib_strdup( name.sysname );
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
@@ -141,7 +141,7 @@ int XX_httplib_parse_auth_header(struct httplib_connection *conn, char *buf, siz
|
|||||||
* CGI needs it as REMOTE_USER
|
* CGI needs it as REMOTE_USER
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ah->user != NULL ) conn->request_info.remote_user = XX_httplib_strdup( ah->user );
|
if ( ah->user != NULL ) conn->request_info.remote_user = httplib_strdup( ah->user );
|
||||||
else return 0;
|
else return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -145,7 +145,7 @@ void XX_httplib_set_handler_type( struct httplib_context *ctx, const char *uri,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_rh->uri = XX_httplib_strdup( uri );
|
tmp_rh->uri = httplib_strdup( uri );
|
||||||
|
|
||||||
if ( tmp_rh->uri == NULL ) {
|
if ( tmp_rh->uri == NULL ) {
|
||||||
|
|
||||||
|
@@ -108,10 +108,10 @@ void XX_httplib_ssl_get_client_cert_info( struct httplib_connection *conn ) {
|
|||||||
|
|
||||||
if ( conn->request_info.client_cert ) {
|
if ( conn->request_info.client_cert ) {
|
||||||
|
|
||||||
conn->request_info.client_cert->subject = XX_httplib_strdup( str_subject );
|
conn->request_info.client_cert->subject = httplib_strdup( str_subject );
|
||||||
conn->request_info.client_cert->issuer = XX_httplib_strdup( str_issuer );
|
conn->request_info.client_cert->issuer = httplib_strdup( str_issuer );
|
||||||
conn->request_info.client_cert->serial = XX_httplib_strdup( str_serial );
|
conn->request_info.client_cert->serial = httplib_strdup( str_serial );
|
||||||
conn->request_info.client_cert->finger = XX_httplib_strdup( str_finger );
|
conn->request_info.client_cert->finger = httplib_strdup( str_finger );
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@@ -163,7 +163,7 @@ struct httplib_context *httplib_start( const struct httplib_callbacks *callbacks
|
|||||||
httplib_free( ctx->config[idx] );
|
httplib_free( ctx->config[idx] );
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->config[idx] = XX_httplib_strdup( value );
|
ctx->config[idx] = httplib_strdup( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -173,7 +173,7 @@ struct httplib_context *httplib_start( const struct httplib_callbacks *callbacks
|
|||||||
for (i=0; XX_httplib_config_options[i].name != NULL; i++) {
|
for (i=0; XX_httplib_config_options[i].name != NULL; i++) {
|
||||||
|
|
||||||
default_value = XX_httplib_config_options[i].default_value;
|
default_value = XX_httplib_config_options[i].default_value;
|
||||||
if ( ctx->config[i] == NULL && default_value != NULL ) ctx->config[i] = XX_httplib_strdup( default_value );
|
if ( ctx->config[i] == NULL && default_value != NULL ) ctx->config[i] = httplib_strdup( default_value );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(NO_FILES)
|
#if defined(NO_FILES)
|
||||||
|
@@ -23,6 +23,5 @@
|
|||||||
|
|
||||||
|
|
||||||
void XX_httplib_snprintf( const struct httplib_connection *conn, int *truncated, char *buf, size_t buflen, PRINTF_FORMAT_STRING(const char *fmt), ... ) PRINTF_ARGS(5, 6);
|
void XX_httplib_snprintf( const struct httplib_connection *conn, int *truncated, char *buf, size_t buflen, PRINTF_FORMAT_STRING(const char *fmt), ... ) PRINTF_ARGS(5, 6);
|
||||||
char * XX_httplib_strdup( const char *str );
|
|
||||||
int XX_httplib_vprintf( struct httplib_connection *conn, const char *fmt, va_list ap );
|
int XX_httplib_vprintf( struct httplib_connection *conn, const char *fmt, va_list ap );
|
||||||
void XX_httplib_vsnprintf( const struct httplib_connection *conn, int *truncated, char *buf, size_t buflen, const char *fmt, va_list ap );
|
void XX_httplib_vsnprintf( const struct httplib_connection *conn, int *truncated, char *buf, size_t buflen, const char *fmt, va_list ap );
|
||||||
|
Reference in New Issue
Block a user