Lines Matching defs:handler
49 // when a Handler set a Content-Length response header with a
58 // A Handler responds to an HTTP request.
79 // RST_STREAM, depending on the HTTP protocol. To abort a handler so
82 type Handler interface {
86 // A ResponseWriter interface is used by an HTTP handler to
89 // A ResponseWriter may not be used after the Handler.ServeHTTP method
106 // keys not known to the Handler until after the first Write,
152 // an HTTP handler to flush buffered data to the client.
168 // an HTTP handler to take over the connection.
208 // After the Handler has returned, there is no guarantee
225 // started the handler. The associated value will be of
254 // This is the value of a Handler's (*Request).RemoteAddr.
288 // by a Handler with the Hijacker interface.
329 // in cases where the handler's final output is smaller than the buffer
425 calledHeader bool // handler accessed handlerHeader via Header
432 // updated after response from handler if there's a
446 // trailers are the headers to be sent after the handler
452 handlerDone atomicBool // set true when the handler exits
480 // finalTrailers is called after the Handler exits and returns a non-nil
481 // value if the Handler set any trailers.
1005 // reading from req.Header after their Handler starts
1047 // consumed by a handler that the server will read from the client
1157 // total body size was small and the handler has already finished
1170 // state of the handler, we either own the map or not. If we
1214 // If the handler is done but never sent a Content-Length
1220 // 0 actual bytes and 0 bytes because the handler noticed it
1222 // HEAD, the handler should either write the Content-Length or
1224 // handler never looked at the Request.Method, we just don't
1275 // replying, if the handler hasn't already done so. But we
1294 // Body was closed in handler with non-EOF error.
1466 // Handler starts. No header has been sent. The handler can either
1470 // If the handler didn't declare a Content-Length up front, we either
1471 // go into chunking mode or, if the handler finishes running before
1475 // Likewise, if the handler didn't set a Content-Type, we sniff that
1559 // It must only be called after the handler is done executing.
1563 // handler indicated we shouldn't reuse this
1695 // ErrAbortHandler is a sentinel panic value to abort a handler.
1699 var ErrAbortHandler = errors.New("net/http: abort Handler")
1825 // so we might as well run the handler in this goroutine.
1942 // Handler that calls f.
1966 // NotFoundHandler returns a simple request handler
1968 func NotFoundHandler() Handler { return HandlerFunc(NotFound) }
1970 // StripPrefix returns a handler that serves HTTP requests
1972 // and invoking the handler h. StripPrefix handles a
1975 func StripPrefix(prefix string, h Handler) Handler {
2088 // RedirectHandler returns a request handler that redirects
2094 func RedirectHandler(url string, code int) Handler {
2100 // patterns and calls the handler for the pattern that
2107 // and "/images/thumbnails/", the latter handler will be
2126 // general patterns, so that a handler might register for the two patterns
2140 h Handler
2195 // Find a handler on a handler map given a path string.
2197 func (mux *ServeMux) match(path string) (h Handler, pattern string) {
2220 // This occurs when a handler for path + "/" was already registered, but
2233 // path+"/". This should happen if a handler is registered for path+"/" but
2257 // Handler returns the handler to use for the given request,
2259 // a non-nil handler. If the path is not in its canonical form, the
2260 // handler will be an internally-generated handler that redirects
2266 // Handler also returns the registered pattern that matches the
2270 // If there is no registered handler that applies to the request,
2271 // Handler returns a ``page not found'' handler and an empty pattern.
2272 func (mux *ServeMux) Handler(r *Request) (h Handler, pattern string) {
2276 // If r.URL.Path is /tree and its handler is not registered,
2283 return mux.handler(r.Host, r.URL.Path)
2287 // before passing to mux.handler.
2291 // If the given path is /tree and its handler is not registered,
2298 _, pattern = mux.handler(host, path)
2304 return mux.handler(host, r.URL.Path)
2307 // handler is the main implementation of Handler.
2309 func (mux *ServeMux) handler(host, path string) (h Handler, pattern string) {
2326 // ServeHTTP dispatches the request to the handler whose
2336 h, _ := mux.Handler(r)
2340 // Handle registers the handler for the given pattern.
2341 // If a handler already exists for pattern, Handle panics.
2342 func (mux *ServeMux) Handle(pattern string, handler Handler) {
2349 if handler == nil {
2350 panic("http: nil handler")
2359 mux.m[pattern] = muxEntry{h: handler, pattern: pattern}
2366 // HandleFunc registers the handler function for the given pattern.
2367 func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) {
2368 mux.Handle(pattern, HandlerFunc(handler))
2371 // Handle registers the handler for the given pattern
2374 func Handle(pattern string, handler Handler) { DefaultServeMux.Handle(pattern, handler) }
2376 // HandleFunc registers the handler function for the given pattern
2379 func HandleFunc(pattern string, handler func(ResponseWriter, *Request)) {
2380 DefaultServeMux.HandleFunc(pattern, handler)
2385 // read requests and then call handler to reply to them.
2386 // Handler is typically nil, in which case the DefaultServeMux is used.
2387 func Serve(l net.Listener, handler Handler) error {
2388 srv := &Server{Handler: handler}
2394 // read requests and then call handler to reply to them.
2396 // Handler is typically nil, in which case the DefaultServeMux is used.
2402 func ServeTLS(l net.Listener, handler Handler, certFile, keyFile string) error {
2403 srv := &Server{Handler: handler}
2411 Handler Handler // handler to invoke, http.DefaultServeMux if nil
2433 // after reading the headers and the Handler can decide what
2459 // name negotiated. The Handler argument should be used to
2465 TLSNextProto map[string]func(*Server, *tls.Conn, Handler)
2641 // StateActive fires before the request has entered a handler
2680 // serverHandler delegates to either the server's Handler or
2687 handler := sh.srv.Handler
2688 if handler == nil {
2689 handler = DefaultServeMux
2692 handler = globalOptionsHandler{}
2694 handler.ServeHTTP(rw, req)
2744 // then call srv.Handler to reply to them.
2801 // then call srv.Handler to reply to them.
2940 // and then calls Serve with handler to handle requests
2943 // Handler is typically nil, in which case the DefaultServeMux is
2967 func ListenAndServe(addr string, handler Handler) error {
2968 server := &Server{Addr: addr, Handler: handler}
2985 // func handler(w http.ResponseWriter, req *http.Request) {
2991 // http.HandleFunc("/", handler)
3000 func ListenAndServeTLS(addr, certFile, keyFile string, handler Handler) error {
3001 server := &Server{Addr: addr, Handler: handler}
3079 // TimeoutHandler returns a Handler that runs h with the given time limit.
3081 // The new Handler calls h.ServeHTTP to handle each request, but if a
3082 // call runs for longer than its time limit, the handler responds with
3088 // TimeoutHandler buffers all Handler writes to memory and does not
3090 func TimeoutHandler(h Handler, dt time.Duration, msg string) Handler {
3092 handler: h,
3100 var ErrHandlerTimeout = errors.New("http: Handler timeout")
3103 handler Handler
3139 h.handler.ServeHTTP(tw, r)
3241 // initNPNRequest is an HTTP handler that initializes certain