Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
2aaaa368
Commit
2aaaa368
authored
May 17, 2018
by
Alexander Danilov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add REQUEST_SCHEME to fastcgi envs
Fixes
https://github.com/mholt/caddy/issues/2152
parent
4829cc6a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
caddyhttp/fastcgi/fastcgi.go
caddyhttp/fastcgi/fastcgi.go
+6
-0
caddyhttp/fastcgi/fastcgi_test.go
caddyhttp/fastcgi/fastcgi_test.go
+6
-0
No files found.
caddyhttp/fastcgi/fastcgi.go
View file @
2aaaa368
...
@@ -285,6 +285,11 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
...
@@ -285,6 +285,11 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
// Retrieve name of remote user that was set by some downstream middleware such as basicauth.
// Retrieve name of remote user that was set by some downstream middleware such as basicauth.
remoteUser
,
_
:=
r
.
Context
()
.
Value
(
httpserver
.
RemoteUserCtxKey
)
.
(
string
)
remoteUser
,
_
:=
r
.
Context
()
.
Value
(
httpserver
.
RemoteUserCtxKey
)
.
(
string
)
requestScheme
:=
"http"
if
r
.
TLS
!=
nil
{
requestScheme
=
"https"
}
// Some variables are unused but cleared explicitly to prevent
// Some variables are unused but cleared explicitly to prevent
// the parent environment from interfering.
// the parent environment from interfering.
env
=
map
[
string
]
string
{
env
=
map
[
string
]
string
{
...
@@ -301,6 +306,7 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
...
@@ -301,6 +306,7 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
"REMOTE_IDENT"
:
""
,
// Not used
"REMOTE_IDENT"
:
""
,
// Not used
"REMOTE_USER"
:
remoteUser
,
"REMOTE_USER"
:
remoteUser
,
"REQUEST_METHOD"
:
r
.
Method
,
"REQUEST_METHOD"
:
r
.
Method
,
"REQUEST_SCHEME"
:
requestScheme
,
"SERVER_NAME"
:
h
.
ServerName
,
"SERVER_NAME"
:
h
.
ServerName
,
"SERVER_PORT"
:
h
.
ServerPort
,
"SERVER_PORT"
:
h
.
ServerPort
,
"SERVER_PROTOCOL"
:
r
.
Proto
,
"SERVER_PROTOCOL"
:
r
.
Proto
,
...
...
caddyhttp/fastcgi/fastcgi_test.go
View file @
2aaaa368
...
@@ -248,6 +248,12 @@ func TestBuildEnv(t *testing.T) {
...
@@ -248,6 +248,12 @@ func TestBuildEnv(t *testing.T) {
envExpected
[
"SCRIPT_NAME"
]
=
"/fgci_test.php"
envExpected
[
"SCRIPT_NAME"
]
=
"/fgci_test.php"
envExpected
[
"SCRIPT_FILENAME"
]
=
filepath
.
FromSlash
(
"/fgci_test.php"
)
envExpected
[
"SCRIPT_FILENAME"
]
=
filepath
.
FromSlash
(
"/fgci_test.php"
)
testBuildEnv
(
r
,
rule
,
fpath
,
envExpected
)
testBuildEnv
(
r
,
rule
,
fpath
,
envExpected
)
// 8. Test REQUEST_SCHEME in env
r
=
newReq
()
envExpected
=
newEnv
()
envExpected
[
"REQUEST_SCHEME"
]
=
"http"
testBuildEnv
(
r
,
rule
,
fpath
,
envExpected
)
}
}
func
TestReadTimeout
(
t
*
testing
.
T
)
{
func
TestReadTimeout
(
t
*
testing
.
T
)
{
...
...
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