diff --git a/docs/APIReference.md b/docs/APIReference.md index 1406cbca..79fc27db 100644 --- a/docs/APIReference.md +++ b/docs/APIReference.md @@ -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) diff --git a/docs/api/mg_get_builtin_mime_type.md b/docs/api/mg_get_builtin_mime_type.md index a82572d1..4a98eb63 100644 --- a/docs/api/mg_get_builtin_mime_type.md +++ b/docs/api/mg_get_builtin_mime_type.md @@ -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 diff --git a/docs/api/mg_get_response_code_text.md b/docs/api/mg_get_response_code_text.md index 5e193e59..23f015b9 100644 --- a/docs/api/mg_get_response_code_text.md +++ b/docs/api/mg_get_response_code_text.md @@ -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) diff --git a/docs/api/mg_send_mime_file.md b/docs/api/mg_send_mime_file.md index 733d1374..71568865 100644 --- a/docs/api/mg_send_mime_file.md +++ b/docs/api/mg_send_mime_file.md @@ -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) diff --git a/docs/api/mg_send_mime_file2.md b/docs/api/mg_send_mime_file2.md index db2938b3..541b0371 100644 --- a/docs/api/mg_send_mime_file2.md +++ b/docs/api/mg_send_mime_file2.md @@ -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) diff --git a/include/libhttp.h b/include/libhttp.h index 2c2cefd9..f0c1eb98 100644 --- a/include/libhttp.h +++ b/include/libhttp.h @@ -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. */ diff --git a/src/httplib_get_builtin_mime_type.c b/src/httplib_get_builtin_mime_type.c index b75f03c9..69cdce6a 100644 --- a/src/httplib_get_builtin_mime_type.c +++ b/src/httplib_get_builtin_mime_type.c @@ -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 */ diff --git a/src/httplib_get_mime_type.c b/src/httplib_get_mime_type.c index bf6ac9d1..fb1a06b4 100644 --- a/src/httplib_get_mime_type.c +++ b/src/httplib_get_mime_type.c @@ -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->len = strlen(vec->ptr); + vec->ptr = httplib_get_builtin_mime_type( path ); + vec->len = strlen( vec->ptr ); } /* XX_httplib_get_mime_type */ diff --git a/test/testmime.c b/test/testmime.c index d2293b0e..9aaa095b 100644 --- a/test/testmime.c +++ b/test/testmime.c @@ -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