summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/http/conn.go11
-rw-r--r--src/lib/io.go6
2 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/http/conn.go b/src/lib/http/conn.go
index e7024ed60..15c0707f3 100644
--- a/src/lib/http/conn.go
+++ b/src/lib/http/conn.go
@@ -11,16 +11,9 @@ import (
"os"
)
-// Read/write/close interface.
-type RWC interface {
- Read(p *[]byte) (n int, err *os.Error);
- Write(p *[]byte) (n int, err *os.Error);
- Close() *os.Error;
-}
-
// Active HTTP connection (server side).
export type Conn struct {
- rwc RWC;
+ rwc io.ReadWriteClose;
br *bufio.BufRead;
bw *bufio.BufWrite;
close bool;
@@ -28,7 +21,7 @@ export type Conn struct {
}
// Create new connection from rwc.
-export func NewConn(rwc RWC) (c *Conn, err *os.Error) {
+export func NewConn(rwc io.ReadWriteClose) (c *Conn, err *os.Error) {
c = new(Conn);
c.rwc = rwc;
if c.br, err = bufio.NewBufRead(rwc); err != nil {
diff --git a/src/lib/io.go b/src/lib/io.go
index 8ab751a02..20b7b9029 100644
--- a/src/lib/io.go
+++ b/src/lib/io.go
@@ -19,6 +19,12 @@ export type ReadWrite interface {
Write(p *[]byte) (n int, err *os.Error);
}
+export type ReadWriteClose interface {
+ Read(p *[]byte) (n int, err *os.Error);
+ Write(p *[]byte) (n int, err *os.Error);
+ Close() *os.Error;
+}
+
export func WriteString(w Write, s string) (n int, err *os.Error) {
b := new([]byte, len(s)+1);
if !syscall.StringToBytes(b, s) {