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
39e2d2ad
Commit
39e2d2ad
authored
Mar 04, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Appending query_string to the URI when redirecting on HTTP error
parent
27c66563
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
mongoose.c
mongoose.c
+7
-5
No files found.
mongoose.c
View file @
39e2d2ad
...
...
@@ -849,6 +849,7 @@ struct ns_connection *ns_connect(struct ns_server *server, const char *host,
struct
ns_connection
*
conn
=
NULL
;
int
connect_ret_val
;
(
void
)
use_ssl
;
if
(
host
==
NULL
||
(
he
=
gethostbyname
(
host
))
==
NULL
||
(
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
==
INVALID_SOCKET
)
{
DBG
((
"gethostbyname(%s) failed: %s"
,
host
,
strerror
(
errno
)));
...
...
@@ -1486,11 +1487,12 @@ static void send_http_error(struct connection *conn, int code,
// Handle error code rewrites
while
((
rewrites
=
next_option
(
rewrites
,
&
a
,
&
b
))
!=
NULL
)
{
if
((
match_code
=
atoi
(
a
.
ptr
))
>
0
&&
match_code
==
code
)
{
conn
->
mg_conn
.
status_code
=
302
;
mg_printf
(
&
conn
->
mg_conn
,
"HTTP/1.1 %d Moved
\r\n
"
"Location: %.*s?code=%d&orig_uri=%s
\r\n\r\n
"
,
conn
->
mg_conn
.
status_code
,
b
.
len
,
b
.
ptr
,
code
,
conn
->
mg_conn
.
uri
);
struct
mg_connection
*
c
=
&
conn
->
mg_conn
;
c
->
status_code
=
302
;
mg_printf
(
c
,
"HTTP/1.1 %d Moved
\r\n
"
"Location: %.*s?code=%d&orig_uri=%s&query_string=%s
\r\n\r\n
"
,
c
->
status_code
,
b
.
len
,
b
.
ptr
,
code
,
c
->
uri
,
c
->
query_string
==
NULL
?
""
:
c
->
query_string
);
close_local_endpoint
(
conn
);
return
;
}
...
...
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