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
fb9493a0
Commit
fb9493a0
authored
Nov 29, 2010
by
Arnout Vandecappelle (Essensium/Mind)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix of Issue #180: mg_read() should accept PUT requests.
parent
11951a57
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
mongoose.c
mongoose.c
+1
-2
embed.c
test/embed.c
+3
-1
test.pl
test/test.pl
+4
-0
No files found.
mongoose.c
View file @
fb9493a0
...
@@ -1322,8 +1322,7 @@ int mg_read(struct mg_connection *conn, void *buf, size_t len) {
...
@@ -1322,8 +1322,7 @@ int mg_read(struct mg_connection *conn, void *buf, size_t len) {
DEBUG_TRACE
((
"%p %zu %lld %lld"
,
buf
,
len
,
DEBUG_TRACE
((
"%p %zu %lld %lld"
,
buf
,
len
,
conn
->
content_len
,
conn
->
consumed_content
));
conn
->
content_len
,
conn
->
consumed_content
));
nread
=
0
;
nread
=
0
;
if
(
strcmp
(
conn
->
request_info
.
request_method
,
"POST"
)
==
0
&&
if
(
conn
->
consumed_content
<
conn
->
content_len
)
{
conn
->
consumed_content
<
conn
->
content_len
)
{
// Adjust number of bytes to read.
// Adjust number of bytes to read.
int64_t
to_read
=
conn
->
content_len
-
conn
->
consumed_content
;
int64_t
to_read
=
conn
->
content_len
-
conn
->
consumed_content
;
...
...
test/embed.c
View file @
fb9493a0
...
@@ -51,7 +51,9 @@ static void test_get_var(struct mg_connection *conn,
...
@@ -51,7 +51,9 @@ static void test_get_var(struct mg_connection *conn,
var
=
buf
=
NULL
;
var
=
buf
=
NULL
;
cl
=
mg_get_header
(
conn
,
"Content-Length"
);
cl
=
mg_get_header
(
conn
,
"Content-Length"
);
mg_printf
(
conn
,
"cl: %p
\n
"
,
cl
);
mg_printf
(
conn
,
"cl: %p
\n
"
,
cl
);
if
(
!
strcmp
(
ri
->
request_method
,
"POST"
)
&&
cl
!=
NULL
)
{
printf
(
"reqeust method = %s
\n
"
,
ri
->
request_method
);
if
((
!
strcmp
(
ri
->
request_method
,
"POST"
)
||
!
strcmp
(
ri
->
request_method
,
"PUT"
))
&&
cl
!=
NULL
)
{
buf_len
=
atoi
(
cl
);
buf_len
=
atoi
(
cl
);
buf
=
malloc
(
buf_len
);
buf
=
malloc
(
buf_len
);
mg_read
(
conn
,
buf
,
buf_len
);
mg_read
(
conn
,
buf
,
buf_len
);
...
...
test/test.pl
View file @
fb9493a0
...
@@ -425,6 +425,10 @@ sub do_embedded_test {
...
@@ -425,6 +425,10 @@ sub do_embedded_test {
o
(
"POST /test_get_var HTTP/1.0\nContent-Length: 64007\n\n"
.
o
(
"POST /test_get_var HTTP/1.0\nContent-Length: 64007\n\n"
.
"my_var=$my_var"
,
'Value size: \[64000\]'
,
'mg_get_var 10'
,
0
);
"my_var=$my_var"
,
'Value size: \[64000\]'
,
'mg_get_var 10'
,
0
);
# Other methods should also work
o
(
"PUT /test_get_var HTTP/1.0\nContent-Length: 10\n\n"
.
"my_var=foo"
,
'Value: \[foo\]'
,
'mg_get_var 11'
,
0
);
o
(
"POST /test_get_request_info?xx=yy HTTP/1.0\nFoo: bar\n"
.
o
(
"POST /test_get_request_info?xx=yy HTTP/1.0\nFoo: bar\n"
.
"Content-Length: 3\n\na=b"
,
"Content-Length: 3\n\na=b"
,
'Method: \[POST\].URI: \[/test_get_request_info\].'
.
'Method: \[POST\].URI: \[/test_get_request_info\].'
.
...
...
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