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
d7cba57e
Commit
d7cba57e
authored
Apr 24, 2011
by
valenok
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make source g++ friendly
parent
cb601b77
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
main.c
main.c
+1
-1
mongoose.c
mongoose.c
+8
-5
mongoose.h
mongoose.h
+1
-1
No files found.
main.c
View file @
d7cba57e
...
...
@@ -126,7 +126,7 @@ static void verify_document_root(const char *root) {
static
char
*
sdup
(
const
char
*
str
)
{
char
*
p
;
if
((
p
=
malloc
(
strlen
(
str
)
+
1
))
!=
NULL
)
{
if
((
p
=
(
char
*
)
malloc
(
strlen
(
str
)
+
1
))
!=
NULL
)
{
strcpy
(
p
,
str
);
}
return
p
;
...
...
mongoose.c
View file @
d7cba57e
...
...
@@ -23,6 +23,7 @@
#else
#define _XOPEN_SOURCE 600 // For flockfile() on Linux
#define _LARGEFILE_SOURCE // Enable 64-bit file offsets
#define __STDC_FORMAT_MACROS // <inttypes.h> wants this for C++
#endif
#if defined(__SYMBIAN32__)
...
...
@@ -743,7 +744,7 @@ static const char *next_option(const char *list, struct vec *val,
* so that val points to "x", and eq_val points to "y".
*/
eq_val
->
len
=
0
;
eq_val
->
ptr
=
memchr
(
val
->
ptr
,
'='
,
val
->
len
);
eq_val
->
ptr
=
(
const
char
*
)
memchr
(
val
->
ptr
,
'='
,
val
->
len
);
if
(
eq_val
->
ptr
!=
NULL
)
{
eq_val
->
ptr
++
;
/* Skip over '=' character */
eq_val
->
len
=
val
->
ptr
+
val
->
len
-
eq_val
->
ptr
;
...
...
@@ -1602,7 +1603,8 @@ static struct mg_connection *mg_connect(struct mg_connection *conn,
cry
(
conn
,
"%s: connect(%s:%d): %s"
,
__func__
,
host
,
port
,
strerror
(
ERRNO
));
closesocket
(
sock
);
}
else
if
((
newconn
=
calloc
(
1
,
sizeof
(
*
newconn
)))
==
NULL
)
{
}
else
if
((
newconn
=
(
struct
mg_connection
*
)
calloc
(
1
,
sizeof
(
*
newconn
)))
==
NULL
)
{
cry
(
conn
,
"%s: calloc: %s"
,
__func__
,
strerror
(
ERRNO
));
closesocket
(
sock
);
}
else
{
...
...
@@ -3357,7 +3359,8 @@ static int set_ports_option(struct mg_context *ctx) {
cry
(
fc
(
ctx
),
"%s: cannot bind to %.*s: %s"
,
__func__
,
vec
.
len
,
vec
.
ptr
,
strerror
(
ERRNO
));
success
=
0
;
}
else
if
((
listener
=
calloc
(
1
,
sizeof
(
*
listener
)))
==
NULL
)
{
}
else
if
((
listener
=
(
struct
socket
*
)
calloc
(
1
,
sizeof
(
*
listener
)))
==
NULL
)
{
closesocket
(
sock
);
cry
(
fc
(
ctx
),
"%s: %s"
,
__func__
,
strerror
(
ERRNO
));
success
=
0
;
...
...
@@ -3872,7 +3875,7 @@ static void worker_thread(struct mg_context *ctx) {
struct
mg_connection
*
conn
;
int
buf_size
=
atoi
(
ctx
->
config
[
MAX_REQUEST_SIZE
]);
conn
=
calloc
(
1
,
sizeof
(
*
conn
)
+
buf_size
);
conn
=
(
struct
mg_connection
*
)
calloc
(
1
,
sizeof
(
*
conn
)
+
buf_size
);
conn
->
buf_size
=
buf_size
;
conn
->
buf
=
(
char
*
)
(
conn
+
1
);
assert
(
conn
!=
NULL
);
...
...
@@ -4062,7 +4065,7 @@ struct mg_context *mg_start(mg_callback_t user_callback, void *user_data,
// Allocate context and initialize reasonable general case defaults.
// TODO(lsm): do proper error handling here.
ctx
=
calloc
(
1
,
sizeof
(
*
ctx
));
ctx
=
(
struct
mg_context
*
)
calloc
(
1
,
sizeof
(
*
ctx
));
ctx
->
user_callback
=
user_callback
;
ctx
->
user_data
=
user_data
;
...
...
mongoose.h
View file @
d7cba57e
...
...
@@ -54,7 +54,7 @@ enum mg_event {
MG_NEW_REQUEST
,
// New HTTP request has arrived from the client
MG_HTTP_ERROR
,
// HTTP error must be returned to the client
MG_EVENT_LOG
,
// Mongoose logs an event, request_info.log_message
MG_INIT_SSL
,
// Mongoose initializes SSL. Instead of mg_connection *,
MG_INIT_SSL
// Mongoose initializes SSL. Instead of mg_connection *,
// SSL context is passed to the callback function.
};
...
...
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