Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mongoose
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
Ganil-acq
GANILinux
linux-service
library
mongoose
Commits
1da09867
Commit
1da09867
authored
11 years ago
by
Sergey Lyubka
Browse files
Options
Downloads
Patches
Plain Diff
Moved docstrings to API.md
parent
f852a4db
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/API.md
+24
-7
24 additions, 7 deletions
docs/API.md
mongoose.h
+1
-20
1 addition, 20 deletions
mongoose.h
with
25 additions
and
27 deletions
docs/API.md
+
24
−
7
View file @
1da09867
...
@@ -33,7 +33,6 @@ Here is a list of well-commented embedding examples:
...
@@ -33,7 +33,6 @@ Here is a list of well-commented embedding examples:
# API Reference
# API Reference
## mg\_start()
struct mg_context *mg_start(const char **configuration_options
struct mg_context *mg_start(const char **configuration_options
int (*event_handler_func)(struct mg_event *),
int (*event_handler_func)(struct mg_event *),
void *user_data);
void *user_data);
...
@@ -58,8 +57,6 @@ used to handle incoming requests.
...
@@ -58,8 +57,6 @@ used to handle incoming requests.
`SIGCHLD`
handler must be set up to reap CGI zombie processes.
`SIGCHLD`
handler must be set up to reap CGI zombie processes.
## mg\_stop()
void mg_stop(struct mg_context *);
void mg_stop(struct mg_context *);
Stop the web server. This function blocks until all Mongoose
Stop the web server. This function blocks until all Mongoose
...
@@ -129,8 +126,6 @@ initialization. Return value is ignored by Mongoose.
...
@@ -129,8 +126,6 @@ initialization. Return value is ignored by Mongoose.
Called when Mongoose is about to terminate a thread. Used to clean up
Called when Mongoose is about to terminate a thread. Used to clean up
the state initialized by
`MG_THREAD_BEGIN`
handling. Return value is ignored.
the state initialized by
`MG_THREAD_BEGIN`
handling. Return value is ignored.
## mg\_get\_option()
const char *mg_get_option(const struct mg_context *ctx, const char *name);
const char *mg_get_option(const struct mg_context *ctx, const char *name);
Get the value of particular configuration parameter. The value returned is
Get the value of particular configuration parameter. The value returned is
...
@@ -139,8 +134,6 @@ given parameter name is not valid, NULL is returned. For valid names, return
...
@@ -139,8 +134,6 @@ given parameter name is not valid, NULL is returned. For valid names, return
value is guaranteed to be non-NULL. If parameter is not set, zero-length string
value is guaranteed to be non-NULL. If parameter is not set, zero-length string
is returned.
is returned.
## mg\_get\_valid\_option\_names()
const char **mg_get_valid_option_names(void);
const char **mg_get_valid_option_names(void);
Return array of strings that represent valid configuration options. For each
Return array of strings that represent valid configuration options. For each
...
@@ -148,6 +141,30 @@ option, option name and default value is returned, i.e. the number of entries
...
@@ -148,6 +141,30 @@ option, option name and default value is returned, i.e. the number of entries
in the array equals to number_of_options x 2. Array is NULL terminated.
in the array equals to number_of_options x 2. Array is NULL terminated.
int mg_modify_passwords_file(const char *passwords_file_name,
const char *domain,
const char *user,
const char *password);
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.c 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.
int mg_write(struct mg_connection *, const void *buf, int len);
Send data to the client. This function attempts to send all requested data,
unlike
`write()`
standard library call, which might send only a portion of
requested data.
Return: number of bytes written to the client. If return value is less then
`len`
, client has closed the connection.
## Embedding Examples
## Embedding Examples
The common pattern is to handle
`MG_REQUEST_BEGIN`
and serve static files
The common pattern is to handle
`MG_REQUEST_BEGIN`
and serve static files
...
...
This diff is collapsed.
Click to expand it.
mongoose.h
+
1
−
20
View file @
1da09867
...
@@ -72,32 +72,13 @@ void mg_stop(struct mg_context *);
...
@@ -72,32 +72,13 @@ void mg_stop(struct mg_context *);
void
mg_websocket_handshake
(
struct
mg_connection
*
);
void
mg_websocket_handshake
(
struct
mg_connection
*
);
int
mg_websocket_read
(
struct
mg_connection
*
,
int
*
bits
,
char
**
data
);
int
mg_websocket_read
(
struct
mg_connection
*
,
int
*
bits
,
char
**
data
);
const
char
*
mg_get_option
(
const
struct
mg_context
*
ctx
,
const
char
*
name
);
const
char
*
mg_get_option
(
const
struct
mg_context
*
ctx
,
const
char
*
name
);
const
char
**
mg_get_valid_option_names
(
void
);
const
char
**
mg_get_valid_option_names
(
void
);
// 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.c 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.
int
mg_modify_passwords_file
(
const
char
*
passwords_file_name
,
int
mg_modify_passwords_file
(
const
char
*
passwords_file_name
,
const
char
*
domain
,
const
char
*
domain
,
const
char
*
user
,
const
char
*
user
,
const
char
*
password
);
const
char
*
password
);
// Send data to the client.
// Return:
// 0 when the connection has been closed
// -1 on error
// >0 number of bytes written on success
int
mg_write
(
struct
mg_connection
*
,
const
void
*
buf
,
int
len
);
int
mg_write
(
struct
mg_connection
*
,
const
void
*
buf
,
int
len
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment