Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
mongoose
Commits
aa90972a
Commit
aa90972a
authored
Nov 06, 2011
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set code 302 automatically if CGI reply has Location: header present
parent
8601b03e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
mongoose.c
mongoose.c
+7
-2
test.pl
test/test.pl
+1
-0
No files found.
mongoose.c
View file @
aa90972a
...
@@ -2974,8 +2974,13 @@ static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
...
@@ -2974,8 +2974,13 @@ static void handle_cgi_request(struct mg_connection *conn, const char *prog) {
parse_http_headers
(
&
pbuf
,
&
ri
);
parse_http_headers
(
&
pbuf
,
&
ri
);
// Make up and send the status line
// Make up and send the status line
status
=
get_header
(
&
ri
,
"Status"
);
if
((
status
=
get_header
(
&
ri
,
"Status"
))
!=
NULL
)
{
conn
->
request_info
.
status_code
=
status
==
NULL
?
200
:
atoi
(
status
);
conn
->
request_info
.
status_code
=
atoi
(
status
);
}
else
if
(
get_header
(
&
ri
,
"Location"
)
!=
NULL
)
{
conn
->
request_info
.
status_code
=
302
;
}
else
{
conn
->
request_info
.
status_code
=
200
;
}
(
void
)
mg_printf
(
conn
,
"HTTP/1.1 %d OK
\r\n
"
,
conn
->
request_info
.
status_code
);
(
void
)
mg_printf
(
conn
,
"HTTP/1.1 %d OK
\r\n
"
,
conn
->
request_info
.
status_code
);
// Send headers
// Send headers
...
...
test/test.pl
View file @
aa90972a
...
@@ -322,6 +322,7 @@ unless (scalar(@ARGV) > 0 and $ARGV[0] eq "basic_tests") {
...
@@ -322,6 +322,7 @@ unless (scalar(@ARGV) > 0 and $ARGV[0] eq "basic_tests") {
unlink
"$root/.htpasswd"
;
unlink
"$root/.htpasswd"
;
o
(
"GET /env.cgi HTTP/1.0\n\r\n"
,
'HTTP/1.1 200 OK'
,
'GET CGI file'
);
o
(
"GET /env.cgi HTTP/1.0\n\r\n"
,
'HTTP/1.1 200 OK'
,
'GET CGI file'
);
o
(
"GET /redirect.cgi HTTP/1.0\n\n"
,
'HTTP/1.1 302'
,
'Redirect'
);
o
(
"GET /sh.cgi HTTP/1.0\n\r\n"
,
'shell script CGI'
,
o
(
"GET /sh.cgi HTTP/1.0\n\r\n"
,
'shell script CGI'
,
'GET sh CGI file'
)
unless
on_windows
();
'GET sh CGI file'
)
unless
on_windows
();
o
(
"GET /env.cgi?var=HELLO HTTP/1.0\n\n"
,
'QUERY_STRING=var=HELLO'
,
o
(
"GET /env.cgi?var=HELLO HTTP/1.0\n\n"
,
'QUERY_STRING=var=HELLO'
,
...
...
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