func (r *Request) hasBody() bool {
	return r.Chunking || r.ContLen > 0
}
Message body in request is signaled by the inclusion of a Content-Length
or Transfer-Encoding header.
Refer to http://stackoverflow.com/a/299696/306935
package main
import (
	"bytes"
	"errors"
	"fmt"
	"github.com/cyfdecyf/bufio"
	"net"
	"strconv"
	"strings"
	"time"
)
const CRLF = "\r\n"
const (
	statusCodeContinue = 100
)
const (
	statusBadReq         = "400 Bad Request"
	statusForbidden      = "403 Forbidden"
	statusExpectFailed   = "417 Expectation Failed"
	statusRequestTimeout = "408 Request Timeout"
)
var CustomHttpErr = errors.New("CustomHttpErr")
type Header struct {
	ContLen             int64
	KeepAlive           time.Duration
	ProxyAuthorization  string
	Chunking            bool
	Trailer             bool
	ConnectionKeepAlive bool
	ExpectContinue      bool
	Host                string
}
type rqState byte
const (
	rsCreated  rqState = iota
	rsSent              
	rsRecvBody          
	rsDone
)
type Request struct {
	Method  string
	URL     *URL
	raw     *bytes.Buffer  
	rawByte []byte         
	reqLnStart int  
	headStart  int  
	bodyStart  int  
	Header
	isConnect bool
	partial   bool  
	state     rqState
	tryCnt    byte
}
var zeroRequest = Request{Header: Header{ConnectionKeepAlive: true}}
func (r *Request) reset() {
	b := r.rawByte
	raw := r.raw
	*r = zeroRequest  
	if raw != nil {
		raw.Reset()
		r.rawByte = b
		r.raw = raw
	} else {
		r.rawByte = httpBuf.Get()
		r.raw = bytes.NewBuffer(r.rawByte[:0])  
	}
}
func (r *Request) String() (s string) {
	return fmt.Sprintf("%s %s%s", r.Method, r.URL.HostPort, r.URL.Path)
}
func (r *Request) Verbose() []byte {
	var rqbyte []byte
	if r.isConnect {
		rqbyte = r.rawBeforeBody()
	} else {
		rqbyte = r.raw.Bytes()
	}
	return rqbyte
}