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
e79a8885
Commit
e79a8885
authored
Jun 12, 2015
by
Tw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
let middleware.responseRecorder be a http.Hijacker
Signed-off-by:
Tw
<
tw19881113@gmail.com
>
parent
01aca02e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
middleware/recorder.go
middleware/recorder.go
+12
-0
No files found.
middleware/recorder.go
View file @
e79a8885
package
middleware
package
middleware
import
(
import
(
"bufio"
"errors"
"net"
"net/http"
"net/http"
"time"
"time"
)
)
...
@@ -48,3 +51,12 @@ func (r *responseRecorder) Write(buf []byte) (int, error) {
...
@@ -48,3 +51,12 @@ func (r *responseRecorder) Write(buf []byte) (int, error) {
}
}
return
n
,
err
return
n
,
err
}
}
// Hijacker is a wrapper of http.Hijacker underearth if any,
// otherwise it just returns an error.
func
(
r
*
responseRecorder
)
Hijack
()
(
net
.
Conn
,
*
bufio
.
ReadWriter
,
error
)
{
if
hj
,
ok
:=
r
.
ResponseWriter
.
(
http
.
Hijacker
);
ok
{
return
hj
.
Hijack
()
}
return
nil
,
nil
,
errors
.
New
(
"I'm not a Hijacker"
)
}
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