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
c4e2cf96
Commit
c4e2cf96
authored
Apr 11, 2016
by
Matt Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #737 from tw4452852/closeNotifier
http.CloseNotifier implementation for http.ResponseWriter wrapper
parents
6a7b777f
c64cf218
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
middleware/gzip/gzip.go
middleware/gzip/gzip.go
+9
-0
middleware/recorder.go
middleware/recorder.go
+9
-0
No files found.
middleware/gzip/gzip.go
View file @
c4e2cf96
...
...
@@ -141,3 +141,12 @@ func (w *gzipResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
}
return
nil
,
nil
,
fmt
.
Errorf
(
"not a Hijacker"
)
}
// CloseNotify implements http.CloseNotifier.
// It just inherits the underlying ResponseWriter's CloseNotify method.
func
(
w
*
gzipResponseWriter
)
CloseNotify
()
<-
chan
bool
{
if
cn
,
ok
:=
w
.
ResponseWriter
.
(
http
.
CloseNotifier
);
ok
{
return
cn
.
CloseNotify
()
}
panic
(
"not a CloseNotifier"
)
}
middleware/recorder.go
View file @
c4e2cf96
...
...
@@ -87,3 +87,12 @@ func (r *ResponseRecorder) Flush() {
panic
(
"not a Flusher"
)
// should be recovered at the beginning of middleware stack
}
}
// CloseNotify implements http.CloseNotifier.
// It just inherits the underlying ResponseWriter's CloseNotify method.
func
(
r
*
ResponseRecorder
)
CloseNotify
()
<-
chan
bool
{
if
cn
,
ok
:=
r
.
ResponseWriter
.
(
http
.
CloseNotifier
);
ok
{
return
cn
.
CloseNotify
()
}
panic
(
"not a CloseNotifier"
)
}
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