aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/cancelreq_go14.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-02-11 22:16:52 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-02-11 22:16:52 +0800
commitb019f3ee29ce55c3d515ee8bafe0f4bb14221c0a (patch)
tree26e023be6c99a10e82a5a0ebadd1e42cefe9bd3c /Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/cancelreq_go14.go
parentb05e472c076d30035233d6a8b5fb3360b236e3ff (diff)
downloadgo-tangerine-b019f3ee29ce55c3d515ee8bafe0f4bb14221c0a.tar.gz
go-tangerine-b019f3ee29ce55c3d515ee8bafe0f4bb14221c0a.tar.zst
go-tangerine-b019f3ee29ce55c3d515ee8bafe0f4bb14221c0a.zip
Godeps: update all dependencies to latest code
Diffstat (limited to 'Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/cancelreq_go14.go')
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/cancelreq_go14.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/cancelreq_go14.go b/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/cancelreq_go14.go
new file mode 100644
index 000000000..56bcbadb8
--- /dev/null
+++ b/Godeps/_workspace/src/golang.org/x/net/context/ctxhttp/cancelreq_go14.go
@@ -0,0 +1,23 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !go1.5
+
+package ctxhttp
+
+import "net/http"
+
+type requestCanceler interface {
+ CancelRequest(*http.Request)
+}
+
+func canceler(client *http.Client, req *http.Request) func() {
+ rc, ok := client.Transport.(requestCanceler)
+ if !ok {
+ return func() {}
+ }
+ return func() {
+ rc.CancelRequest(req)
+ }
+}