diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-04 15:01:11 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-04 15:01:11 +0000 |
commit | c92b1bc7f829182c2a5276ebd4567f54f6cc713d (patch) | |
tree | df1037674f2c69011469485414315a50607f9d08 /libgo/go/net | |
parent | c4ded1f63a3daf6467bd2caa4a1f4807f4983830 (diff) | |
download | gcc-c92b1bc7f829182c2a5276ebd4567f54f6cc713d.tar.gz |
libgo: Update to Go 1.0.1 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187163 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net')
-rw-r--r-- | libgo/go/net/http/example_test.go | 5 | ||||
-rw-r--r-- | libgo/go/net/http/server.go | 6 | ||||
-rw-r--r-- | libgo/go/net/iprawsock_posix.go | 4 | ||||
-rw-r--r-- | libgo/go/net/tcpsock_posix.go | 6 | ||||
-rw-r--r-- | libgo/go/net/udpsock_posix.go | 4 | ||||
-rw-r--r-- | libgo/go/net/unixsock_posix.go | 6 | ||||
-rw-r--r-- | libgo/go/net/url/url.go | 8 | ||||
-rw-r--r-- | libgo/go/net/url/url_test.go | 4 |
8 files changed, 21 insertions, 22 deletions
diff --git a/libgo/go/net/http/example_test.go b/libgo/go/net/http/example_test.go index 2584afc439e..ec814407ddb 100644 --- a/libgo/go/net/http/example_test.go +++ b/libgo/go/net/http/example_test.go @@ -49,3 +49,8 @@ func ExampleGet() { res.Body.Close() fmt.Printf("%s", robots) } + +func ExampleFileServer() { + // we use StripPrefix so that /tmpfiles/somefile will access /tmp/somefile + http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer(http.Dir("/tmp")))) +} diff --git a/libgo/go/net/http/server.go b/libgo/go/net/http/server.go index 228ac401968..924ffd34815 100644 --- a/libgo/go/net/http/server.go +++ b/libgo/go/net/http/server.go @@ -785,8 +785,10 @@ var htmlReplacer = strings.NewReplacer( "&", "&", "<", "<", ">", ">", - `"`, """, - "'", "'", + // """ is shorter than """. + `"`, """, + // "'" is shorter than "'" and apos was not in HTML until HTML5. + "'", "'", ) func htmlEscape(s string) string { diff --git a/libgo/go/net/iprawsock_posix.go b/libgo/go/net/iprawsock_posix.go index 6bbe67c3d9a..9fc7ecdb942 100644 --- a/libgo/go/net/iprawsock_posix.go +++ b/libgo/go/net/iprawsock_posix.go @@ -83,9 +83,7 @@ func (c *IPConn) Close() error { if !c.ok() { return syscall.EINVAL } - err := c.fd.Close() - c.fd = nil - return err + return c.fd.Close() } // LocalAddr returns the local network address. diff --git a/libgo/go/net/tcpsock_posix.go b/libgo/go/net/tcpsock_posix.go index 15f8efdd701..e6b1937fb2c 100644 --- a/libgo/go/net/tcpsock_posix.go +++ b/libgo/go/net/tcpsock_posix.go @@ -108,9 +108,7 @@ func (c *TCPConn) Close() error { if !c.ok() { return syscall.EINVAL } - err := c.fd.Close() - c.fd = nil - return err + return c.fd.Close() } // CloseRead shuts down the reading side of the TCP connection. @@ -359,5 +357,5 @@ func (l *TCPListener) SetDeadline(t time.Time) error { // File returns a copy of the underlying os.File, set to blocking mode. // It is the caller's responsibility to close f when finished. -// Closing c does not affect f, and closing f does not affect c. +// Closing l does not affect f, and closing f does not affect l. func (l *TCPListener) File() (f *os.File, err error) { return l.fd.dup() } diff --git a/libgo/go/net/udpsock_posix.go b/libgo/go/net/udpsock_posix.go index 9e820e1c57a..9c6b6d39336 100644 --- a/libgo/go/net/udpsock_posix.go +++ b/libgo/go/net/udpsock_posix.go @@ -88,9 +88,7 @@ func (c *UDPConn) Close() error { if !c.ok() { return syscall.EINVAL } - err := c.fd.Close() - c.fd = nil - return err + return c.fd.Close() } // LocalAddr returns the local network address. diff --git a/libgo/go/net/unixsock_posix.go b/libgo/go/net/unixsock_posix.go index 37a2b1e09ec..57d784c71cf 100644 --- a/libgo/go/net/unixsock_posix.go +++ b/libgo/go/net/unixsock_posix.go @@ -141,9 +141,7 @@ func (c *UnixConn) Close() error { if !c.ok() { return syscall.EINVAL } - err := c.fd.Close() - c.fd = nil - return err + return c.fd.Close() } // LocalAddr returns the local network address, a *UnixAddr. @@ -406,7 +404,7 @@ func (l *UnixListener) SetDeadline(t time.Time) (err error) { // File returns a copy of the underlying os.File, set to blocking mode. // It is the caller's responsibility to close f when finished. -// Closing c does not affect f, and closing f does not affect c. +// Closing l does not affect f, and closing f does not affect l. func (l *UnixListener) File() (f *os.File, err error) { return l.fd.dup() } // ListenUnixgram listens for incoming Unix datagram packets addressed to the diff --git a/libgo/go/net/url/url.go b/libgo/go/net/url/url.go index 88ff7ebfef3..b6e79adc29a 100644 --- a/libgo/go/net/url/url.go +++ b/libgo/go/net/url/url.go @@ -61,16 +61,16 @@ func (e EscapeError) Error() string { } // Return true if the specified character should be escaped when -// appearing in a URL string, according to RFC 2396. +// appearing in a URL string, according to RFC 3986. // When 'all' is true the full range of reserved characters are matched. func shouldEscape(c byte, mode encoding) bool { - // RFC 2396 §2.3 Unreserved characters (alphanum) + // §2.3 Unreserved characters (alphanum) if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' { return false } - // TODO: Update the character sets after RFC 3986. + switch c { - case '-', '_', '.', '!', '~', '*', '\'', '(', ')': // §2.3 Unreserved characters (mark) + case '-', '_', '.', '~': // §2.3 Unreserved characters (mark) return false case '$', '&', '+', ',', '/', ':', ';', '=', '?', '@': // §2.2 Reserved characters (reserved) diff --git a/libgo/go/net/url/url_test.go b/libgo/go/net/url/url_test.go index 2d911ed505a..d8b253142f0 100644 --- a/libgo/go/net/url/url_test.go +++ b/libgo/go/net/url/url_test.go @@ -394,8 +394,8 @@ var escapeTests = []EscapeTest{ nil, }, { - " ?&=#+%!<>#\"{}|\\^[]`☺\t", - "+%3F%26%3D%23%2B%25!%3C%3E%23%22%7B%7D%7C%5C%5E%5B%5D%60%E2%98%BA%09", + " ?&=#+%!<>#\"{}|\\^[]`☺\t:/@$'()*,;", + "+%3F%26%3D%23%2B%25%21%3C%3E%23%22%7B%7D%7C%5C%5E%5B%5D%60%E2%98%BA%09%3A%2F%40%24%27%28%29%2A%2C%3B", nil, }, } |