1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-08-09 03:22:45 +03:00

Function checked and renamed to httplib_

This commit is contained in:
lammertb
2016-12-13 09:59:05 +01:00
parent 9ef767b2ee
commit 78a0db16de
9 changed files with 19 additions and 21 deletions

View File

@@ -32,7 +32,7 @@ the API can be found in [Embedding.md](Embedding.md).
* [`mg_connect_websocket_client( host, port, use_ssl, error_buffer, error_buffer_size, path, origin, data_func, close_func, user_data);`](api/mg_connect_websocket_client.md)
* [`mg_cry( conn, fmt, ... );`](api/mg_cry.md)
* [`mg_download( host, port, use_ssl, error_buffer, error_buffer_size, fmt, ... );`](api/mg_download.md)
* [`mg_get_builtin_mime_type( file_name );`](api/mg_get_builtin_mime_type.md)
* [`httplib_get_builtin_mime_type( file_name );`](api/httplib_get_builtin_mime_type.md)
* [`mg_get_context( conn );`](api/mg_get_context.md)
* [`mg_get_cookie( cookie, var_name, buf, buf_len );`](api/mg_get_cookie.md)
* [`mg_get_header( conn, name );`](api/mg_get_header.md)

View File

@@ -1,6 +1,6 @@
# LibHTTP API Reference
### `mg_get_builtin_mime_type( file_name );`
### `httplib_get_builtin_mime_type( file_name );`
### Parameters
@@ -16,7 +16,7 @@
### Description
The function `mg_get_builtin_mime_type()` tries to determine the MIME type of a given file. If the MIME type cannot be determined, the value `text/plain` is returned. Please note that this function does not an intelligent check of the file contents. The MIME type is solely determined based on the file name extension.
The function `httplib_get_builtin_mime_type()` tries to determine the MIME type of a given file. If the MIME type cannot be determined, the value `text/plain` is returned. Please note that this function does not an intelligent check of the file contents. The MIME type is solely determined based on the file name extension.
### See Also

View File

@@ -21,5 +21,5 @@ The function `mg_get_response_code_text()` returns a pointer to a human readable
### See Also
* [`mg_get_builtin_mime_type();`](mg_get_builtin_mime_type.md)
* [`httplib_get_builtin_mime_type();`](httplib_get_builtin_mime_type.md)
* [`mg_version();`](mg_version.md)

View File

@@ -20,7 +20,7 @@ The function `mg_send_mime_file()` sends a file over a connection including the
### See Also
* [`mg_get_builtin_mime_type();`](mg_get_builtin_mime_type.md)
* [`httplib_get_builtin_mime_type();`](httplib_get_builtin_mime_type.md)
* [`mg_printf();`](mg_printf.md)
* [`mg_send_file();`](mg_send_file.md)
* [`mg_send_mime_file2();`](mg_send_mime_file2.md)

View File

@@ -23,7 +23,7 @@ Additional custom header fields can be added as a parameter. Please make sure th
### See Also
* [`mg_get_builtin_mime_type();`](mg_get_builtin_mime_type.md)
* [`httplib_get_builtin_mime_type();`](httplib_get_builtin_mime_type.md)
* [`mg_printf();`](mg_printf.md)
* [`mg_send_file();`](mg_send_file.md)
* [`mg_send_mime_file();`](mg_send_mime_file.md)

View File

@@ -803,9 +803,7 @@ typedef void *(*mg_thread_func_t)(void *);
CIVETWEB_API int mg_start_thread(mg_thread_func_t f, void *p);
/* Return builtin mime type for the given file name.
For unrecognized extensions, "text/plain" is returned. */
CIVETWEB_API const char *mg_get_builtin_mime_type(const char *file_name);
CIVETWEB_API const char * httplib_get_builtin_mime_type( const char *file_name );
/* Get text representation of HTTP status code. */

View File

@@ -534,19 +534,19 @@ static const struct {
/*
* const char *mg_get_builtin_mime_type( const char *path );
* const char *httplib_get_builtin_mime_type( const char *path );
*
* The function mg_get_builtin_mime_type() returns the mime type associated
* with the file with a given extension which is passed as a parameter. The
* function performs a binary search through the list of MIME types which is
* very efficient and only needs 10 steps for 1000 items in the list or 20
* steps for 1000000 items.
* The function httplib_get_builtin_mime_type() returns the mime type
* associated with the file with a given extension which is passed as a
* parameter. The function performs a binary search through the list of MIME
* types which is very efficient and only needs 10 steps for 1000 items in the
* list or 20 steps for 1000000 items.
*
* If no matching file extension could be found in the list, the default value
* of "text/plain" is returned instead.
*/
const char *mg_get_builtin_mime_type( const char *path ) {
const char *httplib_get_builtin_mime_type( const char *path ) {
int start;
int eind;
@@ -579,7 +579,7 @@ const char *mg_get_builtin_mime_type( const char *path ) {
return "text/plain";
} /* mg_get_builtin_mime_type */
} /* httplib_get_builtin_mime_type */

View File

@@ -54,7 +54,7 @@ void XX_httplib_get_mime_type( struct mg_context *ctx, const char *path, struct
}
}
vec->ptr = mg_get_builtin_mime_type(path);
vec->ptr = httplib_get_builtin_mime_type( path );
vec->len = strlen( vec->ptr );
} /* XX_httplib_get_mime_type */

View File

@@ -68,13 +68,13 @@ int main( void ) {
} while ( p1 != NULL && p2 != NULL );
printf( "Mime type van CSV: \"%s\"\n", mg_get_builtin_mime_type( "fiets.CsV" ) );
printf( "Mime type of CSV: \"%s\"\n", httplib_get_builtin_mime_type( "car.CsV" ) );
for (a=0; a<index; a++) {
XX_httplib_snprintf( NULL, NULL, buffer, BUFLEN, "filename%s", XX_httplib_builtin_mime_ext( a ) );
p1 = XX_httplib_builtin_mime_type( a );
p2 = mg_get_builtin_mime_type( buffer );
p2 = httplib_get_builtin_mime_type( buffer );
if ( p1 != p2 ) {