blob: 302051a51800efcb739c5b0076a216ddf952b761 [file] [log] [blame]
Brad Fitzpatrick1358eff2016-09-01 04:28:38 +00001// Copyright 2015 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build go1.8
6
7package http2
8
Tom Berganc46f2652016-10-25 10:13:20 -07009import (
10 "crypto/tls"
11 "net/http"
12)
Brad Fitzpatrick1358eff2016-09-01 04:28:38 +000013
14func cloneTLSConfig(c *tls.Config) *tls.Config { return c.Clone() }
Tom Berganc46f2652016-10-25 10:13:20 -070015
16var _ http.Pusher = (*responseWriter)(nil)
17
18// Push implements http.Pusher.
19func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
20 internalOpts := pushOptions{}
21 if opts != nil {
22 internalOpts.Method = opts.Method
23 internalOpts.Header = opts.Header
24 }
25 return w.push(target, internalOpts)
26}
Brad Fitzpatrickb336a972016-10-27 19:58:04 +000027
28func init() {
29 configServerFuncs = append(configServerFuncs, configureServer18)
30}
31
32func configureServer18(h1 *http.Server, h2 *Server) error {
33 if h2.IdleTimeout == 0 {
34 if h1.IdleTimeout != 0 {
35 h2.IdleTimeout = h1.IdleTimeout
36 } else {
37 h2.IdleTimeout = h1.ReadTimeout
38 }
39 }
40 return nil
41}