summaryrefslogtreecommitdiff
path: root/src/pkg/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/http')
-rw-r--r--src/pkg/http/client.go2
-rw-r--r--src/pkg/http/client_test.go2
-rw-r--r--src/pkg/http/fs.go4
-rw-r--r--src/pkg/http/request.go2
-rw-r--r--src/pkg/http/server.go2
-rw-r--r--src/pkg/http/url_test.go8
6 files changed, 10 insertions, 10 deletions
diff --git a/src/pkg/http/client.go b/src/pkg/http/client.go
index 9c1951d28..284106c1a 100644
--- a/src/pkg/http/client.go
+++ b/src/pkg/http/client.go
@@ -40,7 +40,7 @@ type Response struct {
// response headers with the given key, it returns the empty string and
// false. Keys are not case sensitive.
func (r *Response) GetHeader(key string) (value string) {
- value, present := r.Header[CanonicalHeaderKey(key)];
+ value, _ = r.Header[CanonicalHeaderKey(key)];
return;
}
diff --git a/src/pkg/http/client_test.go b/src/pkg/http/client_test.go
index 69938f030..32f2c17b2 100644
--- a/src/pkg/http/client_test.go
+++ b/src/pkg/http/client_test.go
@@ -17,7 +17,7 @@ func TestClient(t *testing.T) {
// TODO: add a proper test suite. Current test merely verifies that
// we can retrieve the Google robots.txt file.
- r, url, err := Get("http://www.google.com/robots.txt");
+ r, _, err := Get("http://www.google.com/robots.txt");
var b []byte;
if err == nil {
b, err = io.ReadAll(r.Body);
diff --git a/src/pkg/http/fs.go b/src/pkg/http/fs.go
index e8dda1d30..b56a10155 100644
--- a/src/pkg/http/fs.go
+++ b/src/pkg/http/fs.go
@@ -58,7 +58,7 @@ func dirList(c *Conn, f *os.File) {
if err != nil || len(dirs) == 0 {
break
}
- for i, d := range dirs {
+ for _, d := range dirs {
name := d.Name;
if d.IsDirectory() {
name += "/"
@@ -141,7 +141,7 @@ func serveFileInternal(c *Conn, r *Request, name string, redirect bool) {
} else {
// read first chunk to decide between utf-8 text and binary
var buf [1024]byte;
- n, err := io.ReadFull(f, &buf);
+ n, _ := io.ReadFull(f, &buf);
b := buf[0:n];
if isText(b) {
c.SetHeader("Content-Type", "text-plain; charset=utf-8");
diff --git a/src/pkg/http/request.go b/src/pkg/http/request.go
index 2467222bb..2b425b732 100644
--- a/src/pkg/http/request.go
+++ b/src/pkg/http/request.go
@@ -508,7 +508,7 @@ func ReadRequest(b *bufio.Reader) (req *Request, err os.Error) {
// like
// Cache-Control: no-cache
if v, present := req.Header["Pragma"]; present && v == "no-cache" {
- if cc, presentcc := req.Header["Cache-Control"]; !presentcc {
+ if _, presentcc := req.Header["Cache-Control"]; !presentcc {
req.Header["Cache-Control"] = "no-cache"
}
}
diff --git a/src/pkg/http/server.go b/src/pkg/http/server.go
index b7a81905c..2944e50bc 100644
--- a/src/pkg/http/server.go
+++ b/src/pkg/http/server.go
@@ -367,7 +367,7 @@ func Redirect(c *Conn, url string, code int) {
// no leading http://server
if url == "" || url[0] != '/' {
// make relative path absolute
- olddir, oldfile := path.Split(oldpath);
+ olddir, _ := path.Split(oldpath);
url = olddir + url;
}
diff --git a/src/pkg/http/url_test.go b/src/pkg/http/url_test.go
index 6a3cdb0c5..9e7ec94e5 100644
--- a/src/pkg/http/url_test.go
+++ b/src/pkg/http/url_test.go
@@ -190,7 +190,7 @@ func ufmt(u *URL) string {
}
func DoTest(t *testing.T, parse func(string) (*URL, os.Error), name string, tests []URLTest) {
- for i, tt := range tests {
+ for _, tt := range tests {
u, err := parse(tt.in);
if err != nil {
t.Errorf("%s(%q) returned error %s", name, tt.in, err);
@@ -214,7 +214,7 @@ func TestParseURLReference(t *testing.T) {
}
func DoTestString(t *testing.T, parse func(string) (*URL, os.Error), name string, tests []URLTest) {
- for i, tt := range tests {
+ for _, tt := range tests {
u, err := parse(tt.in);
if err != nil {
t.Errorf("%s(%q) returned error %s", name, tt.in, err);
@@ -305,7 +305,7 @@ var unescapeTests = []URLEscapeTest {
}
func TestURLUnescape(t *testing.T) {
- for i, tt := range unescapeTests {
+ for _, tt := range unescapeTests {
actual, err := URLUnescape(tt.in);
if actual != tt.out || (err != nil) != (tt.err != nil) {
t.Errorf("URLUnescape(%q) = %q, %s; want %q, %s", tt.in, actual, err, tt.out, tt.err);
@@ -342,7 +342,7 @@ var escapeTests = []URLEscapeTest {
}
func TestURLEscape(t *testing.T) {
- for i, tt := range escapeTests {
+ for _, tt := range escapeTests {
actual := URLEscape(tt.in);
if tt.out != actual {
t.Errorf("URLEscape(%q) = %q, want %q", tt.in, actual, tt.out);