Browse Source

Gofix for the Go 1 package reorganization.

Andy Balholm 7 years ago
parent
commit
53f06d29e1
9 changed files with 23 additions and 19 deletions
  1. 2 0
      .hgignore
  2. 1 1
      Makefile
  3. 1 1
      bridge.go
  4. 2 2
      example/redirect.go
  5. 2 2
      mux.go
  6. 10 9
      request.go
  7. 3 2
      response.go
  8. 1 1
      server.go
  9. 1 1
      status.go

+ 2 - 0
.hgignore

@@ -3,3 +3,5 @@
 \.[568]$
 \.out$
 ^_
+\.orig$
+example/example

+ 1 - 1
Makefile

@@ -1,6 +1,6 @@
 include $(GOROOT)/src/Make.inc
 
-TARG=icap
+TARG=go-icap.googlecode.com/hg
 
 GOFILES= \
 	request.go \

+ 1 - 1
bridge.go

@@ -29,8 +29,8 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
 package icap
 
 import (
-	"http"
 	"log"
+	"net/http"
 	"time"
 )
 

+ 2 - 2
example/redirect.go

@@ -18,8 +18,8 @@ package main
 
 import (
 	"fmt"
-	"http"
 	"go-icap.googlecode.com/hg"
+	"net/http"
 	"os"
 )
 
@@ -27,7 +27,7 @@ var ISTag = "\"GOLANG\""
 
 func main() {
 	// Set the files to be made available under http://gateway/
-	http.Handle("/", http.FileServer(http.Dir(os.Getenv("HOME") + "/Sites")))
+	http.Handle("/", http.FileServer(http.Dir(os.Getenv("HOME")+"/Sites")))
 
 	icap.HandleFunc("/golang", toGolang)
 	icap.ListenAndServe(":11344", icap.HandlerFunc(toGolang))

+ 2 - 2
mux.go

@@ -26,10 +26,10 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
 package icap
 
 import (
-	"http"
+	"net/http"
+	"net/url"
 	"path"
 	"strings"
-	"url"
 )
 
 // ServeMux is an ICAP request multiplexer.

+ 10 - 9
request.go

@@ -29,16 +29,17 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
 package icap
 
 import (
-	"http"
-	"net/textproto"
+	"bufio"
+	"bytes"
+	"fmt"
 	"io"
 	"io/ioutil"
-	"strings"
-	"fmt"
-	"bufio"
+	"net/http"
+	"net/http/httputil"
+	"net/textproto"
+	"net/url"
 	"strconv"
-	"bytes"
-	"url"
+	"strings"
 )
 
 type badStringError struct {
@@ -169,7 +170,7 @@ func ReadRequest(b *bufio.Reader) (req *Request, err error) {
 		}
 
 		if hasBody && req.Method == "REQMOD" {
-			req.Request.Body = ioutil.NopCloser(http.NewChunkedReader(b))
+			req.Request.Body = ioutil.NopCloser(httputil.NewChunkedReader(b))
 		} else {
 			req.Request.Body = emptyReader(0)
 		}
@@ -187,7 +188,7 @@ func ReadRequest(b *bufio.Reader) (req *Request, err error) {
 		}
 
 		if hasBody && req.Method == "RESPMOD" {
-			req.Response.Body = ioutil.NopCloser(http.NewChunkedReader(b))
+			req.Response.Body = ioutil.NopCloser(httputil.NewChunkedReader(b))
 		} else {
 			req.Response.Body = emptyReader(0)
 		}

+ 3 - 2
response.go

@@ -31,9 +31,10 @@ import (
 	"bytes"
 	"errors"
 	"fmt"
-	"http"
 	"io"
 	"log"
+	"net/http"
+	"net/http/httputil"
 	"strconv"
 	"strings"
 	"time"
@@ -151,7 +152,7 @@ func (w *respWriter) WriteHeader(code int, httpMessage interface{}, hasBody bool
 	w.wroteHeader = true
 
 	if hasBody {
-		w.cw = http.NewChunkedWriter(w.conn.buf.Writer)
+		w.cw = httputil.NewChunkedWriter(w.conn.buf.Writer)
 	}
 }
 

+ 1 - 1
server.go

@@ -31,9 +31,9 @@ import (
 	"bufio"
 	"bytes"
 	"fmt"
-	"http"
 	"log"
 	"net"
+	"net/http"
 	"runtime/debug"
 )
 

+ 1 - 1
status.go

@@ -28,7 +28,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
 package icap
 
 import (
-	"http"
+	"net/http"
 )
 
 var statusText = map[int]string{