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
535f9566
Commit
535f9566
authored
9 years ago
by
Abiola Ibrahim
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #86 from abiosoft/master
FastCGI: support for unix sockets.
parents
6b3b04ff
4e94b85e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
middleware/fastcgi/fastcgi.go
middleware/fastcgi/fastcgi.go
+12
-2
No files found.
middleware/fastcgi/fastcgi.go
View file @
535f9566
...
...
@@ -58,7 +58,14 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
}
// Connect to FastCGI gateway
fcgi
,
err
:=
Dial
(
"tcp"
,
rule
.
Address
)
var
fcgi
*
FCGIClient
// check if unix socket or tcp
if
strings
.
HasPrefix
(
rule
.
Address
,
"/"
)
{
fcgi
,
err
=
Dial
(
"unix"
,
rule
.
Address
)
}
else
{
fcgi
,
err
=
Dial
(
"tcp"
,
rule
.
Address
)
}
if
err
!=
nil
{
return
http
.
StatusBadGateway
,
err
}
...
...
@@ -83,7 +90,10 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
default
:
return
http
.
StatusMethodNotAllowed
,
nil
}
defer
resp
.
Body
.
Close
()
if
resp
.
Body
!=
nil
{
defer
resp
.
Body
.
Close
()
}
if
err
!=
nil
&&
err
!=
io
.
EOF
{
return
http
.
StatusBadGateway
,
err
...
...
This diff is collapsed.
Click to expand it.
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