Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
d4b14ca3
Commit
d4b14ca3
authored
Mar 26, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better API documentation
parent
f0994896
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
API.md
docs/API.md
+6
-2
mongoose.h
mongoose.h
+1
-1
No files found.
docs/API.md
View file @
d4b14ca3
...
@@ -84,10 +84,10 @@ occur. Sequence of events for the accepted connection is this:
...
@@ -84,10 +84,10 @@ occur. Sequence of events for the accepted connection is this:
*
`MG_HTTP_ERROR`
sent when Mongoose is about to send HTTP error back
*
`MG_HTTP_ERROR`
sent when Mongoose is about to send HTTP error back
to the client. Event handler can choose to send a reply itself, in which
to the client. Event handler can choose to send a reply itself, in which
case event handler must return
`MG_TRUE`
. Otherwise, event handler must
case event handler must return
`MG_TRUE`
. Otherwise, event handler must
return
`MG_FALSE`
return
`MG_FALSE`
.
*
`MG_CLOSE`
is sent when the connection is closed. This event is used
*
`MG_CLOSE`
is sent when the connection is closed. This event is used
to cleanup per-connection state stored in
`connection_param`
to cleanup per-connection state stored in
`connection_param`
if it was allocated.
if it was allocated.
Event handler return value is ignored.
Sequence of events for the client connection is this:
Sequence of events for the client connection is this:
...
@@ -96,7 +96,11 @@ Sequence of events for the client connection is this:
...
@@ -96,7 +96,11 @@ Sequence of events for the client connection is this:
Connection status is held in
`mg_connection::status_code`
: if zero,
Connection status is held in
`mg_connection::status_code`
: if zero,
then connection was successful, otherwise connection was not established.
then connection was successful, otherwise connection was not established.
User should send a request upon successful connection.
User should send a request upon successful connection.
Event handler should return
`MG_TRUE`
if connection was successful and
HTTP request has been sent. Otherwise, it should send
`MG_FALSE`
.
*
`MG_REPLY`
is sent when response has been received from the remote host.
*
`MG_REPLY`
is sent when response has been received from the remote host.
If event handler sends another request, then it should return
`MG_TRUE`
.
Otherwise it should return
`MG_FALSE`
and Mongoose will close the connection.
*
`MG_CLOSE`
same as for the accepted connection.
*
`MG_CLOSE`
same as for the accepted connection.
...
...
mongoose.h
View file @
d4b14ca3
...
@@ -66,7 +66,7 @@ enum mg_event {
...
@@ -66,7 +66,7 @@ enum mg_event {
MG_AUTH
,
// If callback returns MG_FALSE, authentication fails
MG_AUTH
,
// If callback returns MG_FALSE, authentication fails
MG_REQUEST
,
// If callback returns MG_FALSE, Mongoose continues with req
MG_REQUEST
,
// If callback returns MG_FALSE, Mongoose continues with req
MG_REPLY
,
// If callback returns MG_FALSE, Mongoose closes connection
MG_REPLY
,
// If callback returns MG_FALSE, Mongoose closes connection
MG_CLOSE
,
// Connection is closed
MG_CLOSE
,
// Connection is closed
, callback return value is ignored
MG_LUA
,
// Called before LSP page invoked
MG_LUA
,
// Called before LSP page invoked
MG_HTTP_ERROR
// If callback returns MG_FALSE, Mongoose continues with err
MG_HTTP_ERROR
// If callback returns MG_FALSE, Mongoose continues with err
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment