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
nexedi
caddy
Commits
b7fd1f4e
Commit
b7fd1f4e
authored
Dec 12, 2015
by
Abiola Ibrahim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FastCGI: separate standard and error output responses.
parent
aba0ae35
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
middleware/fastcgi/fastcgi.go
middleware/fastcgi/fastcgi.go
+14
-1
middleware/fastcgi/fcgiclient.go
middleware/fastcgi/fcgiclient.go
+17
-4
No files found.
middleware/fastcgi/fastcgi.go
View file @
b7fd1f4e
...
@@ -115,7 +115,12 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
...
@@ -115,7 +115,12 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
return
http
.
StatusBadGateway
,
err
return
http
.
StatusBadGateway
,
err
}
}
return
0
,
nil
// FastCGI stderr outputs
if
fcgi
.
stderr
.
Len
()
!=
0
{
err
=
LogError
(
fcgi
.
stderr
.
String
())
}
return
0
,
err
}
}
}
}
...
@@ -281,3 +286,11 @@ var (
...
@@ -281,3 +286,11 @@ var (
// ErrIndexMissingSplit describes an index configuration error.
// ErrIndexMissingSplit describes an index configuration error.
ErrIndexMissingSplit
=
errors
.
New
(
"configured index file(s) must include split value"
)
ErrIndexMissingSplit
=
errors
.
New
(
"configured index file(s) must include split value"
)
)
)
// LogError is a non fatal error that allows requests to go through.
type
LogError
string
// Error satisfies error interface.
func
(
l
LogError
)
Error
()
string
{
return
string
(
l
)
}
middleware/fastcgi/fcgiclient.go
View file @
b7fd1f4e
...
@@ -164,6 +164,7 @@ type FCGIClient struct {
...
@@ -164,6 +164,7 @@ type FCGIClient struct {
rwc
io
.
ReadWriteCloser
rwc
io
.
ReadWriteCloser
h
header
h
header
buf
bytes
.
Buffer
buf
bytes
.
Buffer
stderr
bytes
.
Buffer
keepAlive
bool
keepAlive
bool
reqID
uint16
reqID
uint16
}
}
...
@@ -346,11 +347,23 @@ func (w *streamReader) Read(p []byte) (n int, err error) {
...
@@ -346,11 +347,23 @@ func (w *streamReader) Read(p []byte) (n int, err error) {
if
len
(
p
)
>
0
{
if
len
(
p
)
>
0
{
if
len
(
w
.
buf
)
==
0
{
if
len
(
w
.
buf
)
==
0
{
// filter outputs for error log
for
{
rec
:=
&
record
{}
rec
:=
&
record
{}
w
.
buf
,
err
=
rec
.
read
(
w
.
c
.
rwc
)
var
buf
[]
byte
buf
,
err
=
rec
.
read
(
w
.
c
.
rwc
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
// standard error output
if
rec
.
h
.
Type
==
Stderr
{
w
.
c
.
stderr
.
Write
(
buf
)
continue
}
w
.
buf
=
buf
break
}
}
}
n
=
len
(
p
)
n
=
len
(
p
)
...
...
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