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
b5704850
Commit
b5704850
authored
Jul 08, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://github.com/valenok/mongoose
parents
9c67e896
d3dff4e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
mjpg.c
examples/mjpg.c
+1
-1
mongoose.c
mongoose.c
+9
-7
No files found.
examples/mjpg.c
View file @
b5704850
...
...
@@ -13,7 +13,7 @@ static void send_file(struct mg_connection *conn, const char *path) {
if
(
stat
(
path
,
&
st
)
==
0
&&
(
fp
=
fopen
(
path
,
"rb"
))
!=
NULL
)
{
mg_printf
(
conn
,
"--myboundary
\r\n
Content-Type: image/jpeg
\r\n
"
"Content-Length: %
zu
\r\n\r\n
"
,
st
.
st_size
);
"Content-Length: %
llu
\r\n\r\n
"
,
(
unsigned
long
long
)
st
.
st_size
);
while
((
n
=
fread
(
buf
,
1
,
sizeof
(
buf
),
fp
))
>
0
)
{
mg_write
(
conn
,
buf
,
n
);
}
...
...
mongoose.c
View file @
b5704850
...
...
@@ -1638,7 +1638,7 @@ size_t mg_printf(struct mg_connection *conn, const char *fmt, ...) {
}
static
void
ns_forward
(
struct
ns_connection
*
from
,
struct
ns_connection
*
to
)
{
DBG
((
"%p -> %p %
zu bytes"
,
from
,
to
,
from
->
recv_iobuf
.
len
));
DBG
((
"%p -> %p %
lu bytes"
,
from
,
to
,
(
unsigned
long
)
from
->
recv_iobuf
.
len
));
ns_send
(
to
,
from
->
recv_iobuf
.
buf
,
from
->
recv_iobuf
.
len
);
iobuf_remove
(
&
from
->
recv_iobuf
,
from
->
recv_iobuf
.
len
);
}
...
...
@@ -3443,7 +3443,7 @@ static void handle_put(struct connection *conn, const char *path) {
#endif
send_http_error
(
conn
,
500
,
"open(%s): %s"
,
path
,
strerror
(
errno
));
}
else
{
DBG
((
"PUT [%s] %
zu"
,
path
,
conn
->
ns_conn
->
recv_iobuf
.
len
));
DBG
((
"PUT [%s] %
lu"
,
path
,
(
unsigned
long
)
conn
->
ns_conn
->
recv_iobuf
.
len
));
conn
->
endpoint_type
=
EP_PUT
;
ns_set_close_on_exec
(
conn
->
endpoint
.
fd
);
range
=
mg_get_header
(
&
conn
->
mg_conn
,
"Content-Range"
);
...
...
@@ -4067,7 +4067,7 @@ int mg_terminate_ssl(struct mg_connection *c, const char *cert) {
// When clear-text reply is pushed to client, switch to SSL mode.
n
=
send
(
conn
->
ns_conn
->
sock
,
ok
,
sizeof
(
ok
)
-
1
,
0
);
DBG
((
"%p %
zu %d SEND"
,
c
,
sizeof
(
ok
)
-
1
,
n
));
DBG
((
"%p %
lu %d SEND"
,
c
,
(
unsigned
long
)
sizeof
(
ok
)
-
1
,
n
));
conn
->
ns_conn
->
send_iobuf
.
len
=
0
;
conn
->
endpoint_type
=
EP_USER
;
// To keep-alive in close_local_endpoint()
close_local_endpoint
(
conn
);
// Clean up current CONNECT request
...
...
@@ -4226,8 +4226,8 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
if
((
strcmp
(
conn
->
mg_conn
.
request_method
,
"POST"
)
==
0
||
strcmp
(
conn
->
mg_conn
.
request_method
,
"PUT"
)
==
0
)
&&
(
cl
==
NULL
||
to64
(
cl
)
>
MONGOOSE_POST_SIZE_LIMIT
))
{
send_http_error
(
conn
,
500
,
"POST size > %
z
u"
,
(
size_t
)
MONGOOSE_POST_SIZE_LIMIT
);
send_http_error
(
conn
,
500
,
"POST size > %
l
u"
,
(
unsigned
long
)
MONGOOSE_POST_SIZE_LIMIT
);
}
}
#endif
...
...
@@ -4266,6 +4266,8 @@ static void open_local_endpoint(struct connection *conn, int skip_user) {
close_local_endpoint
(
conn
);
#endif
#ifndef MONGOOSE_NO_DAV
}
else
if
(
must_hide_file
(
conn
,
path
))
{
send_http_error
(
conn
,
404
,
NULL
);
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"PROPFIND"
))
{
handle_propfind
(
conn
,
path
,
&
st
,
exists
);
}
else
if
(
!
strcmp
(
conn
->
mg_conn
.
request_method
,
"MKCOL"
))
{
...
...
@@ -4345,7 +4347,7 @@ static void on_recv_data(struct connection *conn) {
}
try_parse
(
conn
);
DBG
((
"%p %d %
zu %d"
,
conn
,
conn
->
request_len
,
io
->
len
,
conn
->
ns_conn
->
flags
));
DBG
((
"%p %d %
lu %d"
,
conn
,
conn
->
request_len
,
(
unsigned
long
)
io
->
len
,
conn
->
ns_conn
->
flags
));
if
(
conn
->
request_len
<
0
||
(
conn
->
request_len
>
0
&&
!
is_valid_uri
(
conn
->
mg_conn
.
uri
)))
{
send_http_error
(
conn
,
400
,
NULL
);
...
...
@@ -4399,7 +4401,7 @@ static void process_response(struct connection *conn) {
struct
iobuf
*
io
=
&
conn
->
ns_conn
->
recv_iobuf
;
try_parse
(
conn
);
DBG
((
"%p %d %
zu"
,
conn
,
conn
->
request_len
,
io
->
len
));
DBG
((
"%p %d %
lu"
,
conn
,
conn
->
request_len
,
(
unsigned
long
)
io
->
len
));
if
(
conn
->
request_len
<
0
||
(
conn
->
request_len
==
0
&&
io
->
len
>
MAX_REQUEST_SIZE
))
{
call_http_client_handler
(
conn
);
...
...
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