kubernetes.v0: gopkg.in/kubernetes/kubernetes.v0/pkg/util/httpstream Index | Files | Directories

package httpstream

import "gopkg.in/kubernetes/kubernetes.v0/pkg/util/httpstream"

Package httpstream adds multiplexed streaming support to HTTP requests and responses via connection upgrades.

Index

Package Files

doc.go httpstream.go

Constants

const (
    HeaderConnection = "Connection"
    HeaderUpgrade    = "Upgrade"
)

func IsUpgradeRequest Uses

func IsUpgradeRequest(req *http.Request) bool

IsUpgradeRequest returns true if the given request is a connection upgrade request

func NoOpNewStreamHandler Uses

func NoOpNewStreamHandler(stream Stream) error

NoOpNewStreamHandler is a stream handler that accepts a new stream and performs no other logic.

type Connection Uses

type Connection interface {
    // CreateStream creates a new Stream with the supplied headers.
    CreateStream(headers http.Header) (Stream, error)
    // Close resets all streams and closes the connection.
    Close() error
    // CloseChan returns a channel that is closed when the underlying connection is closed.
    CloseChan() <-chan bool
    // SetIdleTimeout sets the amount of time the connection may remain idle before
    // it is automatically closed.
    SetIdleTimeout(timeout time.Duration)
}

Connection represents an upgraded HTTP connection.

type NewStreamHandler Uses

type NewStreamHandler func(Stream) error

NewStreamHandler defines a function that is called when a new Stream is received. If no error is returned, the Stream is accepted; otherwise, the stream is rejected.

type ResponseUpgrader Uses

type ResponseUpgrader interface {
    // UpgradeResponse upgrades an HTTP response to one that supports multiplexed
    // streams. newStreamHandler will be called synchronously whenever the
    // other end of the upgraded connection creates a new stream.
    UpgradeResponse(w http.ResponseWriter, req *http.Request, newStreamHandler NewStreamHandler) Connection
}

ResponseUpgrader knows how to upgrade HTTP requests and responses to add streaming support to them.

type Stream Uses

type Stream interface {
    io.ReadWriteCloser
    // Reset closes both directions of the stream, indicating that neither client
    // or server can use it any more.
    Reset() error
    // Headers returns the headers used to create the stream.
    Headers() http.Header
}

Stream represents a bidirectional communications channel that is part of an upgraded connection.

type UpgradeRoundTripper Uses

type UpgradeRoundTripper interface {
    http.RoundTripper
    // NewConnection validates the response and creates a new Connection.
    NewConnection(resp *http.Response) (Connection, error)
}

UpgradeRoundTripper is a type of http.RoundTripper that is able to upgrade HTTP requests to support multiplexed bidirectional streams. After RoundTrip() is invoked, if the upgrade is successful, clients may retrieve the upgraded connection by calling UpgradeRoundTripper.Connection().

Directories

PathSynopsis
spdy

Package httpstream imports 4 packages (graph). Updated 2016-07-25. Refresh now. Tools for package owners.