diff --git a/internal/http/upgrade/request/parser/reqline/public.go b/internal/http/upgrade/request/parser/reqline/public.go index 340428d..0d242de 100644 --- a/internal/http/upgrade/request/parser/reqline/public.go +++ b/internal/http/upgrade/request/parser/reqline/public.go @@ -36,4 +36,10 @@ func (r *T) Parse(b []byte) error { return nil +} + + +// GetURI returns the actual URI +func (r T) GetURI() string { + return r.uri } \ No newline at end of file diff --git a/internal/http/upgrade/request/public.go b/internal/http/upgrade/request/public.go index 12eb5d7..46fe126 100644 --- a/internal/http/upgrade/request/public.go +++ b/internal/http/upgrade/request/public.go @@ -58,19 +58,6 @@ func Parse(r io.Reader) (request *T, err error) { -// String returns a textual representation of the upgrade request -func (r T) String() string{ - - l1 := fmt.Sprintf("Upgrade Request\n - host: %s\n - port: %d\n - origin: %s\n", r.host, r.port, r.origin) - l2 := fmt.Sprintf(" - origin policy: %t\n - connection header: %t\n - upgrade header: %t\n - valid ws version: %t\n", r.validPolicy, r.hasConnection, r.hasUpgrade, r.hasVersion) - l3 := fmt.Sprintf(" - key: %s\n - protocols: %s\n", r.key, r.protocols) - l4 := fmt.Sprintf(" - current status: %d %s\n", r.code, r.code.Message()) - - - return fmt.Sprintf("%s%s%s%s", l1, l2, l3, l4) -} - - // StatusCode returns the status current func (r T) StatusCode() response.StatusCode { return r.code @@ -95,4 +82,11 @@ func (r *T) BuildResponse() *response.T{ inst.ProcessKey(r.key) return inst -} \ No newline at end of file +} + + + +// GetURI returns the actual URI +func (r T) GetURI() string{ + return r.request.GetURI() +} diff --git a/internal/http/upgrade/response/public.go b/internal/http/upgrade/response/public.go index e575fe8..c906077 100644 --- a/internal/http/upgrade/response/public.go +++ b/internal/http/upgrade/response/public.go @@ -58,4 +58,9 @@ func (r T) Send(w io.Writer) (int, error) { return written, err +} + +// GetProtocol returns the choosen protocol if set, else nil +func (r T) GetProtocol() []byte { + return r.protocol } \ No newline at end of file