adding vendor folder

This commit is contained in:
evilsocket 2018-03-23 15:25:11 +01:00
parent 49c65021ea
commit c304ca4696
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
1145 changed files with 369961 additions and 2 deletions

42
vendor/github.com/inconshreveable/go-vhost/http.go generated vendored Normal file
View file

@ -0,0 +1,42 @@
package vhost
import (
"bufio"
"net"
"net/http"
)
type HTTPConn struct {
*sharedConn
Request *http.Request
}
// HTTP parses the head of the first HTTP request on conn and returns
// a new, unread connection with metadata for virtual host muxing
func HTTP(conn net.Conn) (httpConn *HTTPConn, err error) {
c, rd := newShared(conn)
httpConn = &HTTPConn{sharedConn: c}
if httpConn.Request, err = http.ReadRequest(bufio.NewReader(rd)); err != nil {
return
}
// You probably don't need access to the request body and this makes the API
// simpler by allowing you to call Free() optionally
httpConn.Request.Body.Close()
return
}
// Free sets Request to nil so that it can be garbage collected
func (c *HTTPConn) Free() {
c.Request = nil
}
func (c *HTTPConn) Host() string {
if c.Request == nil {
return ""
}
return c.Request.Host
}