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
85209ac4
Commit
85209ac4
authored
Aug 19, 2013
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted contributions by jmucchiello
parent
a58e82b3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
44 deletions
+17
-44
mongoose.c
mongoose.c
+17
-43
mongoose.h
mongoose.h
+0
-1
No files found.
mongoose.c
View file @
85209ac4
...
...
@@ -955,8 +955,6 @@ static void send_http_error(struct mg_connection *conn, int status,
int
len
=
0
;
conn
->
status_code
=
status
;
if
(
conn
->
ctx
->
callbacks
.
http_error
==
NULL
||
conn
->
ctx
->
callbacks
.
http_error
(
conn
,
status
))
{
buf
[
0
]
=
'\0'
;
// Errors 1xx, 204 and 304 MUST NOT send a body
...
...
@@ -975,7 +973,6 @@ static void send_http_error(struct mg_connection *conn, int status,
"Connection: %s
\r\n\r\n
"
,
status
,
reason
,
len
,
suggest_connection_header
(
conn
));
conn
->
num_bytes_sent
+=
mg_printf
(
conn
,
"%s"
,
buf
);
}
}
#if defined(_WIN32) && !defined(__SYMBIAN32__)
...
...
@@ -1628,24 +1625,6 @@ int mg_write(struct mg_connection *conn, const void *buf, size_t len) {
return
(
int
)
total
;
}
// Alternative alloc_vprintf() for non-compliant C runtimes
static
int
alloc_vprintf2
(
char
**
buf
,
const
char
*
fmt
,
va_list
ap
)
{
va_list
ap_copy
;
int
size
=
MG_BUF_LEN
;
int
len
=
-
1
;
*
buf
=
NULL
;
while
(
len
==
-
1
)
{
if
(
*
buf
)
free
(
*
buf
);
*
buf
=
malloc
(
size
*=
4
);
if
(
!*
buf
)
break
;
va_copy
(
ap_copy
,
ap
);
len
=
vsnprintf
(
*
buf
,
size
,
fmt
,
ap_copy
);
}
return
len
;
}
// Print message to buffer. If buffer is large enough to hold the message,
// return buffer. If buffer is to small, allocate large enough buffer on heap,
// and return allocated buffer.
...
...
@@ -1661,12 +1640,7 @@ static int alloc_vprintf(char **buf, size_t size, const char *fmt, va_list ap) {
va_copy
(
ap_copy
,
ap
);
len
=
vsnprintf
(
NULL
,
0
,
fmt
,
ap_copy
);
if
(
len
<
0
)
{
// C runtime is not standard compliant, vsnprintf() returned -1.
// Switch to alternative code path that uses incremental allocations.
va_copy
(
ap_copy
,
ap
);
len
=
alloc_vprintf2
(
buf
,
fmt
,
ap
);
}
else
if
(
len
>
(
int
)
size
&&
if
(
len
>
(
int
)
size
&&
(
size
=
len
+
1
)
>
0
&&
(
*
buf
=
(
char
*
)
malloc
(
size
))
==
NULL
)
{
len
=
-
1
;
// Allocation failed, mark failure
...
...
mongoose.h
View file @
85209ac4
...
...
@@ -120,7 +120,6 @@ struct mg_callbacks {
// Implementing this callback allows to create custom error pages.
// Parameters:
// status: HTTP error status code.
int
(
*
http_error
)(
struct
mg_connection
*
,
int
status
);
};
// Start web server.
...
...
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