Beispiel #1
0
func serve(q *http.Query) {
	req := q.GetRequest()
	if req.Body != nil {
		req.Body.Close()
	}
	resp := process(req, q.RemoteAddr())
	asc := q.Hijack()
	asc.Write(req, resp)
	conn, _, _ := asc.Close()
	if conn != nil {
		conn.Close()
	}
}
Beispiel #2
0
func serve(q *http.Query) {
	req := q.GetRequest()
	if req.Body != nil {
		buf := make([]byte, 4096*10) // Max 40K
		n, err := req.Body.Read(buf)
		req.Body.Close()
		if n < len(buf) && (err == nil || err == os.EOF) {
			process(buf[0:n])
		}
	}
	asc := q.Hijack()
	conn, _, _ := asc.Close()
	if conn != nil {
		conn.Close()
	}
}
Beispiel #3
0
func (fe *FrontEnd) wwwConnect(q *http.Query) {
	req := q.GetRequest()
	resp, conn2 := fe.wwwclient.Connect(req)
	if conn2 == nil {
		q.Continue()
		q.Write(resp)
		return
	}
	err := q.Write(resp)
	if err != nil {
		return
	}
	asc := q.Hijack()
	conn1, r1, _ := asc.Close()
	if conn1 == nil {
		conn2.Close()
		return
	}
	http.MakeBridge(conn1, r1, conn2, nil)
}