diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-25 21:54:22 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2012-01-25 21:54:22 +0000 |
commit | af92e385667da3fc91ac7f9f0867a56c111110b8 (patch) | |
tree | c8e8990a2197e33f6fe50a28a16714aafe982102 /libgo/go/websocket | |
parent | df1304ee03f41aed179545d1e8b4684cfd22bbdf (diff) | |
download | gcc-af92e385667da3fc91ac7f9f0867a56c111110b8.zip gcc-af92e385667da3fc91ac7f9f0867a56c111110b8.tar.gz gcc-af92e385667da3fc91ac7f9f0867a56c111110b8.tar.bz2 |
libgo: Update to weekly.2012-01-20.
From-SVN: r183540
Diffstat (limited to 'libgo/go/websocket')
-rw-r--r-- | libgo/go/websocket/hixie.go | 8 | ||||
-rw-r--r-- | libgo/go/websocket/hybi.go | 4 | ||||
-rw-r--r-- | libgo/go/websocket/websocket.go | 27 |
3 files changed, 20 insertions, 19 deletions
diff --git a/libgo/go/websocket/hixie.go b/libgo/go/websocket/hixie.go index d0ddbee..22dbc1f 100644 --- a/libgo/go/websocket/hixie.go +++ b/libgo/go/websocket/hixie.go @@ -343,7 +343,7 @@ func hixie76ClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) } // 4.1. Opening handshake. // Step 5. send a request line. - bw.WriteString("GET " + config.Location.RawPath + " HTTP/1.1\r\n") + bw.WriteString("GET " + config.Location.RequestURI() + " HTTP/1.1\r\n") // Step 6-14. push request headers in fields. fields := []string{ @@ -456,7 +456,7 @@ func hixie75ClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) if config.Version != ProtocolVersionHixie75 { panic("wrong protocol version.") } - bw.WriteString("GET " + config.Location.RawPath + " HTTP/1.1\r\n") + bw.WriteString("GET " + config.Location.RequestURI() + " HTTP/1.1\r\n") bw.WriteString("Upgrade: WebSocket\r\n") bw.WriteString("Connection: Upgrade\r\n") bw.WriteString("Host: " + config.Location.Host + "\r\n") @@ -557,7 +557,7 @@ func (c *hixie76ServerHandshaker) ReadHandshake(buf *bufio.Reader, req *http.Req } else { scheme = "ws" } - c.Location, err = url.ParseRequest(scheme + "://" + req.Host + req.URL.RawPath) + c.Location, err = url.ParseRequest(scheme + "://" + req.Host + req.URL.RequestURI()) if err != nil { return http.StatusBadRequest, err } @@ -653,7 +653,7 @@ func (c *hixie75ServerHandshaker) ReadHandshake(buf *bufio.Reader, req *http.Req } else { scheme = "ws" } - c.Location, err = url.ParseRequest(scheme + "://" + req.Host + req.URL.RawPath) + c.Location, err = url.ParseRequest(scheme + "://" + req.Host + req.URL.RequestURI()) if err != nil { return http.StatusBadRequest, err } diff --git a/libgo/go/websocket/hybi.go b/libgo/go/websocket/hybi.go index ff386dc..6b0c528 100644 --- a/libgo/go/websocket/hybi.go +++ b/libgo/go/websocket/hybi.go @@ -390,7 +390,7 @@ func hybiClientHandshake(config *Config, br *bufio.Reader, bw *bufio.Writer) (er panic("wrong protocol version.") } - bw.WriteString("GET " + config.Location.RawPath + " HTTP/1.1\r\n") + bw.WriteString("GET " + config.Location.RequestURI() + " HTTP/1.1\r\n") bw.WriteString("Host: " + config.Location.Host + "\r\n") bw.WriteString("Upgrade: websocket\r\n") @@ -505,7 +505,7 @@ func (c *hybiServerHandshaker) ReadHandshake(buf *bufio.Reader, req *http.Reques } else { scheme = "ws" } - c.Location, err = url.ParseRequest(scheme + "://" + req.Host + req.URL.RawPath) + c.Location, err = url.ParseRequest(scheme + "://" + req.Host + req.URL.RequestURI()) if err != nil { return http.StatusBadRequest, err } diff --git a/libgo/go/websocket/websocket.go b/libgo/go/websocket/websocket.go index df4416e..f7aabc9 100644 --- a/libgo/go/websocket/websocket.go +++ b/libgo/go/websocket/websocket.go @@ -17,6 +17,7 @@ import ( "net/http" "net/url" "sync" + "time" ) const ( @@ -243,30 +244,30 @@ func (ws *Conn) RemoteAddr() net.Addr { return &Addr{ws.config.Origin} } -var errSetTimeout = errors.New("websocket: cannot set timeout: not using a net.Conn") +var errSetDeadline = errors.New("websocket: cannot set deadline: not using a net.Conn") -// SetTimeout sets the connection's network timeout in nanoseconds. -func (ws *Conn) SetTimeout(nsec int64) error { +// SetDeadline sets the connection's network read & write deadlines. +func (ws *Conn) SetDeadline(t time.Time) error { if conn, ok := ws.rwc.(net.Conn); ok { - return conn.SetTimeout(nsec) + return conn.SetDeadline(t) } - return errSetTimeout + return errSetDeadline } -// SetReadTimeout sets the connection's network read timeout in nanoseconds. -func (ws *Conn) SetReadTimeout(nsec int64) error { +// SetReadDeadline sets the connection's network read deadline. +func (ws *Conn) SetReadDeadline(t time.Time) error { if conn, ok := ws.rwc.(net.Conn); ok { - return conn.SetReadTimeout(nsec) + return conn.SetReadDeadline(t) } - return errSetTimeout + return errSetDeadline } -// SetWriteTimeout sets the connection's network write timeout in nanoseconds. -func (ws *Conn) SetWriteTimeout(nsec int64) error { +// SetWriteDeadline sets the connection's network write deadline. +func (ws *Conn) SetWriteDeadline(t time.Time) error { if conn, ok := ws.rwc.(net.Conn); ok { - return conn.SetWriteTimeout(nsec) + return conn.SetWriteDeadline(t) } - return errSetTimeout + return errSetDeadline } // Config returns the WebSocket config. |