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
14500d82
Commit
14500d82
authored
Nov 02, 2016
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
header: Implement Flusher and CloseNotifier
parent
a2900e46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
caddyhttp/header/header.go
caddyhttp/header/header.go
+20
-0
No files found.
caddyhttp/header/header.go
View file @
14500d82
...
...
@@ -115,3 +115,23 @@ func (rww *responseWriterWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error)
}
return
nil
,
nil
,
httpserver
.
NonHijackerError
{
Underlying
:
rww
.
w
}
}
// Flush implements http.Flusher. It simply wraps the underlying
// ResponseWriter's Flush method if there is one, or panics.
func
(
rww
*
responseWriterWrapper
)
Flush
()
{
if
f
,
ok
:=
rww
.
w
.
(
http
.
Flusher
);
ok
{
f
.
Flush
()
}
else
{
panic
(
httpserver
.
NonFlusherError
{
Underlying
:
rww
.
w
})
// should be recovered at the beginning of middleware stack
}
}
// CloseNotify implements http.CloseNotifier.
// It just inherits the underlying ResponseWriter's CloseNotify method.
// It panics if the underlying ResponseWriter is not a CloseNotifier.
func
(
rww
*
responseWriterWrapper
)
CloseNotify
()
<-
chan
bool
{
if
cn
,
ok
:=
rww
.
w
.
(
http
.
CloseNotifier
);
ok
{
return
cn
.
CloseNotify
()
}
panic
(
httpserver
.
NonCloseNotifierError
{
Underlying
:
rww
.
w
})
}
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