Godeps
This commit is contained in:
parent
d3a51031c3
commit
198a319fd6
1361 changed files with 239071 additions and 28102 deletions
13
Godeps/_workspace/src/github.com/emicklei/go-restful/compress.go
generated
vendored
13
Godeps/_workspace/src/github.com/emicklei/go-restful/compress.go
generated
vendored
|
|
@ -5,10 +5,12 @@ package restful
|
|||
// that can be found in the LICENSE file.
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"compress/gzip"
|
||||
"compress/zlib"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
|
@ -69,6 +71,17 @@ func (c *CompressingResponseWriter) isCompressorClosed() bool {
|
|||
return nil == c.compressor
|
||||
}
|
||||
|
||||
// Hijack implements the Hijacker interface
|
||||
// This is especially useful when combining Container.EnabledContentEncoding
|
||||
// in combination with websockets (for instance gorilla/websocket)
|
||||
func (c *CompressingResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
hijacker, ok := c.writer.(http.Hijacker)
|
||||
if !ok {
|
||||
return nil, nil, errors.New("ResponseWriter doesn't support Hijacker interface")
|
||||
}
|
||||
return hijacker.Hijack()
|
||||
}
|
||||
|
||||
// WantsCompressedResponse reads the Accept-Encoding header to see if and which encoding is requested.
|
||||
func wantsCompressedResponse(httpRequest *http.Request) (bool, string) {
|
||||
header := httpRequest.Header.Get(HEADER_AcceptEncoding)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue