소스 검색

Rename parameter "domain" to "realm", to use the same parameter names

bel2125 7 년 전
부모
커밋
b06c3f90da
4개의 변경된 파일25개의 추가작업 그리고 13개의 파일을 삭제
  1. 1 1
      docs/api/mg_modify_passwords_file.md
  2. 18 12
      include/civetweb.h
  3. 1 0
      test/protected/.htpasswd
  4. 5 0
      test/protected/content.txt

+ 1 - 1
docs/api/mg_modify_passwords_file.md

@@ -7,7 +7,7 @@
 | Parameter | Type | Description |
 | :--- | :--- | :--- |
 |**`passwords_file_name`**|`const char *`|The path to the passwords file|
-|**`domain`**|`const char *`|The domain of the user record|
+|**`realm`**|`const char *`|The authentication realm (domain) of the user record|
 |**`user`**|`const char *`|Username of the record to be added, changed or deleted|
 |**`password`**|`const char *`|Password associated with the user or NULL if the record must be deleted|
 

+ 18 - 12
include/civetweb.h

@@ -609,19 +609,25 @@ mg_get_ports(const struct mg_context *ctx, size_t size, int *ports, int *ssl);
 
 
 /* Add, edit or delete the entry in the passwords file.
-
-   This function allows an application to manipulate .htpasswd files on the
-   fly by adding, deleting and changing user records. This is one of the
-   several ways of implementing authentication on the server side. For another,
-   cookie-based way please refer to the examples/chat in the source tree.
-
-   If password is not NULL, entry is added (or modified if already exists).
-   If password is NULL, entry is deleted.
-
-   Return:
-     1 on success, 0 on error. */
+ *
+ * This function allows an application to manipulate .htpasswd files on the
+ * fly by adding, deleting and changing user records. This is one of the
+ * several ways of implementing authentication on the server side. For another,
+ * cookie-based way please refer to the examples/chat in the source tree.
+ *
+ * Parameter:
+ *   passwords_file_name: Path and name of a file storing multiple passwords
+ *   realm: HTTP authentication realm (authentication domain) name
+ *   user: User name
+ *   password:
+ *     If password is not NULL, entry modified or added.
+ *     If password is NULL, entry is deleted.
+ *
+ *  Return:
+ *    1 on success, 0 on error.
+ */
 CIVETWEB_API int mg_modify_passwords_file(const char *passwords_file_name,
-                                          const char *domain,
+                                          const char *realm,
                                           const char *user,
                                           const char *password);
 

+ 1 - 0
test/protected/.htpasswd

@@ -0,0 +1 @@
+user:mydomain.com:1aeed57ec85c6126e335a54789c2ecfa

+ 5 - 0
test/protected/content.txt

@@ -0,0 +1,5 @@
+Protected directory.
+
+username: user
+password: pass
+