1) Change default gofmt default settings for

parsing and printing to new syntax.

   Use -oldparser to parse the old syntax,
   use -oldprinter to print the old syntax.

2) Change default gofmt formatting settings
   to use tabs for indentation only and to use
   spaces for alignment. This will make the code
   alignment insensitive to an editor's tabwidth.

   Use -spaces=false to use tabs for alignment.

3) Manually changed src/exp/parser/parser_test.go
   so that it doesn't try to parse the parser's
   source files using the old syntax (they have
   new syntax now).

4) gofmt -w src misc test/bench

5th and last set of files.

R=rsc
CC=golang-dev
https://golang.org/cl/180050
This commit is contained in:
Robert Griesemer 2009-12-15 15:41:46 -08:00
parent d65a5cce89
commit 45ca9f7a9e
59 changed files with 5907 additions and 5907 deletions

View file

@ -5,8 +5,8 @@
package websocket
import (
"http";
"io";
"http"
"io"
)
// Handler is a interface that use a WebSocket.
@ -39,35 +39,35 @@ func (f Handler) ServeHTTP(c *http.Conn, req *http.Request) {
if req.Method != "GET" || req.Proto != "HTTP/1.1" ||
req.Header["Upgrade"] != "WebSocket" ||
req.Header["Connection"] != "Upgrade" {
c.WriteHeader(http.StatusNotFound);
io.WriteString(c, "must use websocket to connect here");
return;
c.WriteHeader(http.StatusNotFound)
io.WriteString(c, "must use websocket to connect here")
return
}
rwc, buf, err := c.Hijack();
rwc, buf, err := c.Hijack()
if err != nil {
panic("Hijack failed: ", err.String());
return;
panic("Hijack failed: ", err.String())
return
}
defer rwc.Close();
origin := req.Header["Origin"];
location := "ws://" + req.Host + req.URL.Path;
defer rwc.Close()
origin := req.Header["Origin"]
location := "ws://" + req.Host + req.URL.Path
// TODO(ukai): verify origin,location,protocol.
buf.WriteString("HTTP/1.1 101 Web Socket Protocol Handshake\r\n");
buf.WriteString("Upgrade: WebSocket\r\n");
buf.WriteString("Connection: Upgrade\r\n");
buf.WriteString("WebSocket-Origin: " + origin + "\r\n");
buf.WriteString("WebSocket-Location: " + location + "\r\n");
protocol := "";
buf.WriteString("HTTP/1.1 101 Web Socket Protocol Handshake\r\n")
buf.WriteString("Upgrade: WebSocket\r\n")
buf.WriteString("Connection: Upgrade\r\n")
buf.WriteString("WebSocket-Origin: " + origin + "\r\n")
buf.WriteString("WebSocket-Location: " + location + "\r\n")
protocol := ""
// canonical header key of WebSocket-Protocol.
if protocol, found := req.Header["Websocket-Protocol"]; found {
buf.WriteString("WebSocket-Protocol: " + protocol + "\r\n")
}
buf.WriteString("\r\n");
buf.WriteString("\r\n")
if err := buf.Flush(); err != nil {
return
}
ws := newConn(origin, location, protocol, buf, rwc);
f(ws);
ws := newConn(origin, location, protocol, buf, rwc)
f(ws)
}