Lines Matching defs:Server
5 // HTTP server. See RFC 2616.
34 // Errors used by the HTTP server.
67 // any intermediaries between the client and the Go server, it may not
75 // If ServeHTTP panics, the server (the caller of ServeHTTP) assumes
77 // It recovers the panic, logs a stack trace to the server error log,
80 // the client sees an interrupted response but the server doesn't log
128 // may be unavailable. For HTTP/2 requests, the Go HTTP server permits
147 // Server sends automatically when the Request.Body is read.
176 // After a call to Hijack the HTTP server library
184 // Server. It is the caller's responsibility to set
198 // This mechanism can be used to cancel long operations on the server
224 // handlers with context.WithValue to access the server that
226 // type *Server.
227 ServerContextKey = &contextKey{"http-server"}
236 // A conn represents the server side of an HTTP connection.
238 // server is the server on which the connection arrived.
240 server *Server
406 // A response represents the server side of an HTTP response.
605 // debugServerConnections controls whether all server connections are wrapped
610 func (srv *Server) newConn(rwc net.Conn) *conn {
612 server: srv,
616 c.rwc = newLoggingConn("server", c.rwc)
838 // This can be overridden by setting Server.MaxHeaderBytes.
841 func (srv *Server) maxHeaderBytes() int {
848 func (srv *Server) initialReadLimitSize() int64 {
925 if d := c.server.readHeaderTimeout(); d != 0 {
928 if d := c.server.ReadTimeout; d != 0 {
932 if d := c.server.WriteTimeout; d != 0 {
938 c.r.setReadLimit(c.server.initialReadLimitSize())
1018 // http1ServerSupportsRequest reports whether Go's HTTP/1.x server
1047 // consumed by a handler that the server will read from the client
1049 // this then the server to be paranoid instead sends a "Connection:
1076 w.conn.server.logf("http: response.WriteHeader on hijacked connection")
1080 w.conn.server.logf("http: multiple response.WriteHeader calls")
1096 w.conn.server
1166 keepAlivesEnabled := w.conn.server.doKeepAlives()
1356 w.conn.server.logf("http: WriteHeader called with both Transfer-Encoding of %q and a Content-Length of %d",
1372 // recommended in the Server-Sent Events candidate recommendation 11,
1510 w.conn.server.logf("http: response.Write on hijacked connection")
1664 srv := c.server
1688 // badRequestError is a literal string (used by in the server in HTML,
1698 // trace to the server's error log.
1727 c.server.logf("http: panic serving %v: %v\n%s", c.remoteAddr, err, buf)
1736 if d := c.server.ReadTimeout; d != 0 {
1739 if d := c.server.WriteTimeout; d != 0 {
1743 c.server.logf("http: TLS handshake error from %s: %v", c.rwc.RemoteAddr(), err)
1749 if fn := c.server.TLSNextProto[proto]; fn != nil {
1750 h := initNPNRequest{tlsConn, serverHandler{c.server}}
1751 fn(c.server, tlsConn, h)
1769 if c.r.remain != c.server.initialReadLimitSize() {
1824 // Until the server replies to this request, it can't read another,
1830 serverHandler{c.server}.ServeHTTP(w, w.req)
1845 if !w.conn.server.doKeepAlives() {
1853 if d := c.server.idleTimeout(); d != 0 {
1872 // "If a server receives a request containing an
2023 // no leading http://server
2388 srv := &Server{Handler: handler}
2399 // for the server must be provided. If the certificate is signed by a
2401 // of the server's certificate, any intermediates, and the CA's certificate.
2403 srv := &Server{Handler: handler}
2407 // A Server defines parameters for running an HTTP server.
2408 // The zero value for Server is a valid configuration.
2409 type Server struct {
2418 // SetSessionTicketKeys, use Server.Serve with a TLS Listener
2450 // server will read parsing the request header's keys and
2465 TLSNextProto map[string]func(*Server, *tls.Conn, Handler)
2490 func (s *Server) getDoneChan() <-chan struct{} {
2496 func (s *Server) getDoneChanLocked() chan struct{} {
2503 func (s *Server) closeDoneChanLocked() {
2522 // Close returns any error returned from closing the Server's
2524 func (srv *Server) Close() error {
2537 // during Server.Shutdown. This is lower during tests, to
2545 // Shutdown gracefully shuts down the server without interrupting any
2551 // error returned from closing the Server's underlying Listener(s).
2562 func (srv *Server) Shutdown(ctx context.Context) error {
2593 func (srv *Server) RegisterOnShutdown(f func()) {
2600 // server is quiescent.
2601 func (s *Server) closeIdleConns() bool {
2617 func (s *Server) closeListenersLocked() error {
2628 // A ConnState represents the state of a client connection to a server.
2629 // It's used by the optional Server.ConnState hook.
2640 // bytes of a request. The Server.ConnState hook for
2680 // serverHandler delegates to either the server's Handler or
2683 srv *Server
2702 func (srv *Server) ListenAndServe() error {
2714 var testHookServerServe func(*Server, net.Listener) // used if non-nil
2716 // shouldDoServeHTTP2 reports whether Server.Serve should configure
2718 func (srv *Server) shouldConfigureHTTP2ForServe() bool {
2722 // didn't set it on the http.Server, but did pass it to
2728 // The user specified a TLSConfig on their http.Server.
2738 // ErrServerClosed is returned by the Server's Serve, ServeTLS, ListenAndServe,
2740 var ErrServerClosed = errors.New("http: Server closed")
2753 func (srv *Server) Serve(l net.Listener) error {
2804 // the server must be provided if neither the Server's TLSConfig.Certificates
2807 // server's certificate, any intermediates, and the CA's certificate.
2816 func (srv *Server) ServeTLS(l net.Listener, certFile, keyFile string) error {
2842 func (s *Server) trackListener(ln net.Listener, add bool) {
2849 // If the *Server is being reused after a previous
2860 func (s *Server) trackConn(c *conn, add bool) {
2873 func (s *Server) idleTimeout() time.Duration {
2880 func (s *Server) readHeaderTimeout() time.Duration {
2887 func (s *Server) doKeepAlives() bool {
2891 func (s *Server) shuttingDown() bool {
2899 func (srv *Server) SetKeepAlivesEnabled(v bool) {
2919 func (s *Server) logf(format string, args ...interface{}) {
2927 // logf prints to the ErrorLog of the *Server associated with request r
2928 // via ServerContextKey. If there's no associated server, or if ErrorLog
2931 s, _ := r.Context().Value(ServerContextKey).(*Server)
2946 // A trivial example server is:
2956 // // hello world, the web server
2968 server := &Server{Addr: addr, Handler: handler}
2969 return server.ListenAndServe()
2974 // matching private key for the server must be provided. If the certificate
2976 // of the server's certificate, any intermediates, and the CA's certificate.
2978 // A trivial example server is:
2987 // w.Write([]byte("This is an example server.\n"))
3001 server := &Server{Addr: addr, Handler: handler}
3002 return server.ListenAndServeTLS(certFile, keyFile)
3010 // server must be provided if neither the Server's TLSConfig.Certificates
3013 // concatenation of the server's certificate, any intermediates, and
3019 func (srv *Server) ListenAndServeTLS(certFile, keyFile string) error {
3038 func (srv *Server) setupHTTP2_ServeTLS() error {
3043 // setupHTTP2_Serve is called from (*Server).Serve and conditionally
3051 func (srv *Server) setupHTTP2_Serve() error {
3056 func (srv *Server) onceSetNextProtoDefaults_Serve() {
3065 func (srv *Server) onceSetNextProtoDefaults() {
3233 // over that is considered a waste of server resources