[internal.http.request] -> [internal.http.upgrade.request]
[http.upgrade.request] minmod
This commit is contained in:
parent
45a3166dcc
commit
ca472fb80c
|
@ -2,7 +2,7 @@ package request
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"git.xdrm.io/gws/internal/http/request/parser/header"
|
||||
"git.xdrm.io/gws/internal/http/upgrade/request/parser/header"
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -6,11 +6,12 @@ import (
|
|||
"io"
|
||||
)
|
||||
|
||||
// Parse parses a byte array build a request object
|
||||
func Parse(r io.Reader) (request *T, err error) {
|
||||
// Parse builds an upgrade HTTP request
|
||||
// from a reader (typically bufio.NewRead of the socket)
|
||||
func Build(r io.Reader) (request *T, err error) {
|
||||
|
||||
/* (1) Get chunk reader */
|
||||
cr, err := reader.NewReader(r)
|
||||
cr := reader.NewReader(r)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error while creating chunk reader: %s", err)
|
||||
}
|
||||
|
@ -40,8 +41,6 @@ func Parse(r io.Reader) (request *T, err error) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* (2) GET {uri} HTTP/{version}
|
||||
---------------------------------------------------------*/
|
||||
/* (1) Break apart */
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
package request
|
||||
|
||||
import "git.xdrm.io/gws/internal/http/request/parser/reqline"
|
||||
import "git.xdrm.io/gws/internal/http/upgrade/request/parser/reqline"
|
||||
|
||||
// T represents an HTTP Upgrade request
|
||||
type T struct {
|
||||
request reqline.T
|
||||
|
||||
host string
|
||||
port uint16
|
||||
|
||||
origin string
|
||||
key []byte
|
||||
protocols []string
|
||||
version int
|
||||
|
||||
first bool // whether the first line has been read (GET uri HTTP/version)
|
||||
|
||||
Err error
|
||||
// request line
|
||||
request reqline.T
|
||||
|
||||
// http data
|
||||
host string
|
||||
port uint16 // 0 if not set
|
||||
origin string
|
||||
|
||||
// ws data
|
||||
key []byte
|
||||
protocols []string
|
||||
version byte
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue