Standby for Go v1.8. Read HISTORY.md for previous commits: iris.DestroyAllSessions/DestroySessionByID.

This commit is contained in:
Gerasimos (Makis) Maropoulos 2017-01-08 07:40:43 +02:00
parent 081d01d459
commit e5ca3d0868
2 changed files with 88 additions and 0 deletions

View File

@ -160,6 +160,45 @@ func (w *ResponseRecorder) Flush() {
w.ResetBody()
}
// NOTE: Users: Uncomment the below code if you are already using Go from master branch.
// HTTP/2 Go 1.8 Push feature,
// as described in the source code(master):
// https://github.com/golang/go/blob/master/src/net/http/http.go#L119 .
// I have already tested the feature on my machine, but
// in order to avoid breaking the users' workspace:
// Uncomment these when 1.8 released (I guess in the middle of February)
// TODO:
//
// // Push initiates an HTTP/2 server push. This constructs a synthetic
// // request using the given target and options, serializes that request
// // into a PUSH_PROMISE frame, then dispatches that request using the
// // server's request handler. If opts is nil, default options are used.
// //
// // The target must either be an absolute path (like "/path") or an absolute
// // URL that contains a valid host and the same scheme as the parent request.
// // If the target is a path, it will inherit the scheme and host of the
// // parent request.
// //
// // The HTTP/2 spec disallows recursive pushes and cross-authority pushes.
// // Push may or may not detect these invalid pushes; however, invalid
// // pushes will be detected and canceled by conforming clients.
// //
// // Handlers that wish to push URL X should call Push before sending any
// // data that may trigger a request for URL X. This avoids a race where the
// // client issues requests for X before receiving the PUSH_PROMISE for X.
// //
// // Push returns ErrNotSupported if the client has disabled push or if push
// // is not supported on the underlying connection.
// func (w *ResponseRecorder) Push(target string, opts *http.PushOptions) error {
// w.flushResponse()
// err := w.responseWriter.Push(target, opts)
// // NOTE: we have to reset them even if the push failed.
// w.ResetBody()
// w.ResetHeaders()
//
// return err
// }
// clone returns a clone of this response writer
// it copies the header, status code, headers and the beforeFlush finally returns a new ResponseRecorder
func (w *ResponseRecorder) clone() ResponseWriter {

View File

@ -61,6 +61,16 @@ type ResponseWriter interface {
http.Flusher
http.Hijacker
http.CloseNotifier
// NOTE: Users: Uncomment the below code if you are already using Go from master branch.
// HTTP/2 Go 1.8 Push feature,
// as described in the source code(master):
// https://github.com/golang/go/blob/master/src/net/http/http.go#L119 .
// I have already tested the feature on my machine, but
// in order to avoid breaking the users' workspace:
// Uncomment these when 1.8 released (I guess in the middle of February)
// TODO:
//
// http.Pusher
Writef(format string, a ...interface{}) (n int, err error)
WriteString(s string) (n int, err error)
@ -212,6 +222,45 @@ func (w *responseWriter) Flush() {
}
}
// NOTE: Users: Uncomment the below code if you are already using Go from master branch.
// HTTP/2 Go 1.8 Push feature,
// as described in the source code(master):
// https://github.com/golang/go/blob/master/src/net/http/http.go#L119 .
// I have already tested the feature on my machine, but
// in order to avoid breaking the users' workspace:
// Uncomment these when 1.8 released (I guess in the middle of February)
// TODO:
//
//
// // Push initiates an HTTP/2 server push. This constructs a synthetic
// // request using the given target and options, serializes that request
// // into a PUSH_PROMISE frame, then dispatches that request using the
// // server's request handler. If opts is nil, default options are used.
// //
// // The target must either be an absolute path (like "/path") or an absolute
// // URL that contains a valid host and the same scheme as the parent request.
// // If the target is a path, it will inherit the scheme and host of the
// // parent request.
// //
// // The HTTP/2 spec disallows recursive pushes and cross-authority pushes.
// // Push may or may not detect these invalid pushes; however, invalid
// // pushes will be detected and canceled by conforming clients.
// //
// // Handlers that wish to push URL X should call Push before sending any
// // data that may trigger a request for URL X. This avoids a race where the
// // client issues requests for X before receiving the PUSH_PROMISE for X.
// //
// // Push returns ErrNotSupported if the client has disabled push or if push
// // is not supported on the underlying connection.
// func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
//
// if pusher, isPusher := w.ResponseWriter.(http.Pusher); isPusher {
// return pusher.Push(target, opts)
// }
//
// return errors.New("HTTP/2 Push feature is not supported, yet.")
// }
// CloseNotify returns a channel that receives at most a
// single value (true) when the client connection has gone
// away.