@@ -27,22 +27,22 @@ func parseRequest(req *http.Request) (*parsedMessage, error) {
2727 if err != nil {
2828 return nil , fmt .Errorf ("cannot parse query: %s" , req .URL .RawQuery )
2929 }
30- url := req .URL
31- if url .Host == "" {
32- url .Host = req .Host
30+ u := req .URL
31+ if u .Host == "" {
32+ u .Host = req .Host
3333 }
34- if url .Scheme == "" {
34+ if u .Scheme == "" {
3535 if req .TLS == nil {
36- url .Scheme = "http"
36+ u .Scheme = "http"
3737 } else {
38- url .Scheme = "https"
38+ u .Scheme = "https"
3939 }
4040 }
41- return & parsedMessage {derived : generateReqDerivedComponents (req ), url : url , headers : normalizeHeaderNames (req .Header ), qParams : values }, nil
41+ return & parsedMessage {derived : generateReqDerivedComponents (req ), url : u , headers : normalizeHeaderNames (req .Header ), qParams : values }, nil
4242}
4343
4444func normalizeHeaderNames (header http.Header ) http.Header {
45- var t http. Header = http.Header {}
45+ var t = http.Header {}
4646 for k , v := range header {
4747 t [strings .ToLower (k )] = v
4848 }
@@ -77,20 +77,20 @@ func foldFields(fields []string) string {
7777 return ff
7878}
7979
80- func specialtyComponent (name , v string , components components ) {
80+ func derivedComponent (name , v string , components components ) {
8181 components [name ] = v
8282}
8383
8484func generateReqDerivedComponents (req * http.Request ) components {
8585 components := components {}
86- specialtyComponent ("@method" , scMethod (req ), components )
86+ derivedComponent ("@method" , scMethod (req ), components )
8787 theURL := req .URL
88- specialtyComponent ("@target-uri" , scTargetURI (theURL ), components )
89- specialtyComponent ("@path" , scPath (theURL ), components )
90- specialtyComponent ("@authority" , scAuthority (req ), components )
91- specialtyComponent ("@scheme" , scScheme (theURL ), components )
92- specialtyComponent ("@request-target" , scRequestTarget (theURL ), components )
93- specialtyComponent ("@query" , scQuery (theURL ), components )
88+ derivedComponent ("@target-uri" , scTargetURI (theURL ), components )
89+ derivedComponent ("@path" , scPath (theURL ), components )
90+ derivedComponent ("@authority" , scAuthority (req ), components )
91+ derivedComponent ("@scheme" , scScheme (theURL ), components )
92+ derivedComponent ("@request-target" , scRequestTarget (theURL ), components )
93+ derivedComponent ("@query" , scQuery (theURL ), components )
9494 // @request-response does not belong here
9595 return components
9696}
@@ -128,7 +128,7 @@ func scMethod(req *http.Request) string {
128128
129129func generateResDerivedComponents (res * http.Response ) components {
130130 components := components {}
131- specialtyComponent ("@status" , scStatus (res ), components )
131+ derivedComponent ("@status" , scStatus (res ), components )
132132 return components
133133}
134134
0 commit comments