aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-17 19:37:09 +0800
committerFelix Lange <fjl@twurst.com>2015-02-17 19:37:09 +0800
commitbb346a3ae1b6c250fdcb28b97280d3512a7fe219 (patch)
tree9fcb677ad983827e30194b644381dde229681eca /Godeps
parent34d0e1b2c32d1bfe3aaa8519cf760ce499315ad5 (diff)
downloadgo-tangerine-bb346a3ae1b6c250fdcb28b97280d3512a7fe219.tar
go-tangerine-bb346a3ae1b6c250fdcb28b97280d3512a7fe219.tar.gz
go-tangerine-bb346a3ae1b6c250fdcb28b97280d3512a7fe219.tar.bz2
go-tangerine-bb346a3ae1b6c250fdcb28b97280d3512a7fe219.tar.lz
go-tangerine-bb346a3ae1b6c250fdcb28b97280d3512a7fe219.tar.xz
go-tangerine-bb346a3ae1b6c250fdcb28b97280d3512a7fe219.tar.zst
go-tangerine-bb346a3ae1b6c250fdcb28b97280d3512a7fe219.zip
rpc/ws: switch to golang.org/x/net
code.google.com/p/go.net is deprecated and will cause problems in future versions of Go.
Diffstat (limited to 'Godeps')
-rw-r--r--Godeps/Godeps.json9
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/client.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/client.go)18
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/exampledial_test.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/exampledial_test.go)2
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/examplehandler_test.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/examplehandler_test.go)2
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/hybi.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/hybi.go)0
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/hybi_test.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/hybi_test.go)0
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/server.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/server.go)0
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/websocket.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/websocket.go)0
-rw-r--r--Godeps/_workspace/src/golang.org/x/net/websocket/websocket_test.go (renamed from Godeps/_workspace/src/code.google.com/p/go.net/websocket/websocket_test.go)73
9 files changed, 95 insertions, 9 deletions
diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index 9fa7373c8..37176ddba 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -31,11 +31,6 @@
"Rev": "69e2a90ed92d03812364aeb947b7068dc42e561e"
},
{
- "ImportPath": "code.google.com/p/go.net/websocket",
- "Comment": "null-173",
- "Rev": "4231557d7c726df4cf9a4e8cdd8a417c8c200bdb"
- },
- {
"ImportPath": "code.google.com/p/snappy-go/snappy",
"Comment": "null-15",
"Rev": "12e4b4183793ac4b061921e7980845e750679fd0"
@@ -106,6 +101,10 @@
"Rev": "4ed45ec682102c643324fae5dff8dab085b6c300"
},
{
+ "ImportPath": "golang.org/x/net/websocket",
+ "Rev": "59b0df9b1f7abda5aab0495ee54f408daf182ce7"
+ },
+ {
"ImportPath": "gopkg.in/check.v1",
"Rev": "64131543e7896d5bcc6bd5a76287eb75ea96c673"
},
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/client.go b/Godeps/_workspace/src/golang.org/x/net/websocket/client.go
index a861bb92c..ef11a51e4 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/client.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/client.go
@@ -64,6 +64,20 @@ func Dial(url_, protocol, origin string) (ws *Conn, err error) {
return DialConfig(config)
}
+var portMap = map[string]string{
+ "ws": "80",
+ "wss": "443",
+}
+
+func parseAuthority(location *url.URL) string {
+ if _, ok := portMap[location.Scheme]; ok {
+ if _, _, err := net.SplitHostPort(location.Host); err != nil {
+ return net.JoinHostPort(location.Host, portMap[location.Scheme])
+ }
+ }
+ return location.Host
+}
+
// DialConfig opens a new client connection to a WebSocket with a config.
func DialConfig(config *Config) (ws *Conn, err error) {
var client net.Conn
@@ -75,10 +89,10 @@ func DialConfig(config *Config) (ws *Conn, err error) {
}
switch config.Location.Scheme {
case "ws":
- client, err = net.Dial("tcp", config.Location.Host)
+ client, err = net.Dial("tcp", parseAuthority(config.Location))
case "wss":
- client, err = tls.Dial("tcp", config.Location.Host, config.TlsConfig)
+ client, err = tls.Dial("tcp", parseAuthority(config.Location), config.TlsConfig)
default:
err = ErrBadScheme
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/exampledial_test.go b/Godeps/_workspace/src/golang.org/x/net/websocket/exampledial_test.go
index 777a66895..72bb9d48e 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/exampledial_test.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/exampledial_test.go
@@ -8,7 +8,7 @@ import (
"fmt"
"log"
- "code.google.com/p/go.net/websocket"
+ "golang.org/x/net/websocket"
)
// This example demonstrates a trivial client.
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/examplehandler_test.go b/Godeps/_workspace/src/golang.org/x/net/websocket/examplehandler_test.go
index 47b0bb9b5..f22a98fcd 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/examplehandler_test.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/examplehandler_test.go
@@ -8,7 +8,7 @@ import (
"io"
"net/http"
- "code.google.com/p/go.net/websocket"
+ "golang.org/x/net/websocket"
)
// Echo the data received on the WebSocket.
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/hybi.go b/Godeps/_workspace/src/golang.org/x/net/websocket/hybi.go
index f8c0b2e29..f8c0b2e29 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/hybi.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/hybi.go
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/hybi_test.go b/Godeps/_workspace/src/golang.org/x/net/websocket/hybi_test.go
index d6a19108a..d6a19108a 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/hybi_test.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/hybi_test.go
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/server.go b/Godeps/_workspace/src/golang.org/x/net/websocket/server.go
index 70322133c..70322133c 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/server.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/server.go
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/websocket.go b/Godeps/_workspace/src/golang.org/x/net/websocket/websocket.go
index 0f4917bf7..0f4917bf7 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/websocket.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/websocket.go
diff --git a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/websocket_test.go b/Godeps/_workspace/src/golang.org/x/net/websocket/websocket_test.go
index 48f14b696..a376abacf 100644
--- a/Godeps/_workspace/src/code.google.com/p/go.net/websocket/websocket_test.go
+++ b/Godeps/_workspace/src/golang.org/x/net/websocket/websocket_test.go
@@ -339,3 +339,76 @@ func TestSmallBuffer(t *testing.T) {
}
conn.Close()
}
+
+var parseAuthorityTests = []struct {
+ in *url.URL
+ out string
+}{
+ {
+ &url.URL{
+ Scheme: "ws",
+ Host: "www.google.com",
+ },
+ "www.google.com:80",
+ },
+ {
+ &url.URL{
+ Scheme: "wss",
+ Host: "www.google.com",
+ },
+ "www.google.com:443",
+ },
+ {
+ &url.URL{
+ Scheme: "ws",
+ Host: "www.google.com:80",
+ },
+ "www.google.com:80",
+ },
+ {
+ &url.URL{
+ Scheme: "wss",
+ Host: "www.google.com:443",
+ },
+ "www.google.com:443",
+ },
+ // some invalid ones for parseAuthority. parseAuthority doesn't
+ // concern itself with the scheme unless it actually knows about it
+ {
+ &url.URL{
+ Scheme: "http",
+ Host: "www.google.com",
+ },
+ "www.google.com",
+ },
+ {
+ &url.URL{
+ Scheme: "http",
+ Host: "www.google.com:80",
+ },
+ "www.google.com:80",
+ },
+ {
+ &url.URL{
+ Scheme: "asdf",
+ Host: "127.0.0.1",
+ },
+ "127.0.0.1",
+ },
+ {
+ &url.URL{
+ Scheme: "asdf",
+ Host: "www.google.com",
+ },
+ "www.google.com",
+ },
+}
+
+func TestParseAuthority(t *testing.T) {
+ for _, tt := range parseAuthorityTests {
+ out := parseAuthority(tt.in)
+ if out != tt.out {
+ t.Errorf("got %v; want %v", out, tt.out)
+ }
+ }
+}