You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
voicebot/icspacketparser/icshttpparser.go

44 lines
656 B
Go

3 years ago
/*
RFC 2616/7230/7231
*/
package icspacketparser
import (
"fmt"
"net/http"
"gitlab.com/cinnamon/voiceagent/icserror"
)
type HTTP struct {
Method int
ContentType int
ContentLength int
Payload string
Msg string
}
func NewHTTP() HTTP {
http := HTTP{}
return http
}
func (h *HTTP) HTTPParser(req *http.Request) (err *icserror.IcsError) {
fmt.Println("HTTPParser")
return nil
}
func (h *HTTP) GetPacketData(packet interface{}) (err *icserror.IcsError) {
fmt.Println("HTTP.GetPacketData")
switch v := packet.(type) {
case *http.Request:
if err = h.HTTPParser(v); err != nil {
return err
}
}
return nil
}