Selaa lähdekoodia

Added function descriptions

lammertb 8 vuotta sitten
vanhempi
commit
a3ea465dd5

+ 5 - 1
docs/api/mg_form_data_handler.md

@@ -20,7 +20,11 @@
 ||**`FORM_FIELD_STORAGE_ABORT`** - Stop parsing the request and ignore all remaining form fields|
 |**`field_get`**|**`int field_get( const char *key, const char *value, size_t valuelen, void *user_data );`**|
 |**`field_store`**|**`int field_store( const char *path, long long file_size, void *user_data );`**|
-|**`user_data`**|**`void *`**|
+||If the callback function `field_found()` returned `FORM_FIELD_STORAGE_STORE`, Civetweb will try to store the received data in a file. If writing the file is successful, the callback function `field_store()` is called. This function is only called after completion of a full upload, not if a file has only partly been uploaded. When only part of a file is received, Civetweb will delete that partly upload in the background and not inform the main application through this callback. The following parameters are provided in the function call:|
+||**`path`** -|
+||**`file_size`** - The path on the server where the file was stored|
+||**`user_data`** - The size of the stored file in bytes|
+|**`user_data`**|**`void *`** The value of the field `user_data` when the callback functions were registered with a call to `mg_handle_form_request();`|
 ||The `user_data` field is a user supplied argument that will be passed as parameter to each of callback functions|
 
 ### Description

+ 4 - 2
docs/api/mg_get_builtin_mime_type.md

@@ -6,16 +6,18 @@
 
 | Parameter | Type | Description |
 | :--- | :--- | :--- |
-|**`file_name`**|`const char *`||
+|**`file_name`**|`const char *`|The name of the file for which the MIME type has to be determined|
 
 ### Return Value
 
 | Type | Description |
 | :--- | :--- |
-|`const char *`||
+|`const char *`|A text string describing the MIME type|
 
 ### 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.
+
 ### See Also
 
 * [`mg_send_mime_file();`](mg_send_mime_file.md)

+ 6 - 1
docs/api/mg_get_context.md

@@ -1,6 +1,6 @@
 # Civetweb API Reference
 
-### `mg_get_context( conn );
+### `mg_get_context( conn );`
 
 ### Parameters
 
@@ -16,4 +16,9 @@
 
 ### Description
 
+The function `mg_get_context()` returns the context associated with a connection.
+
 ### See Also
+
+* [`mg_start();`](mg_start.md)
+* [`mg_stop();`](mg_stop.md)

+ 3 - 3
docs/api/mg_get_cookie.md

@@ -8,14 +8,14 @@
 | :--- | :--- | :--- |
 |**`cookie`**|`const char *`||
 |**`var_name`**|`const char *`||
-|**`buf`**|`char *`||
-|**`buf_len`**|`size_t`||
+|**`buf`**|`char *`|The buffer where to store the contents of the cookie|
+|**`buf_len`**|`size_t`|The length of the cookie buffer, including the terminating NUL|
 
 ### Return Value
 
 | Type | Description |
 | :--- | :--- |
-|`int`||
+|`int`|The length of the cookie or an error code|
 
 ### Description