jrushford closed pull request #2865: modified the remap.RequestURI() function 
so that it deals with full request uris.
URL: https://github.com/apache/trafficcontrol/pull/2865
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/grove/remap/remap.go b/grove/remap/remap.go
index af0e825ba..f65656dd1 100644
--- a/grove/remap/remap.go
+++ b/grove/remap/remap.go
@@ -141,10 +141,19 @@ var ErrNoMoreRetries = errors.New("retry num exceeded")
 
 // RequestURI returns the URI of the given request. This must be used, because 
Go does not populate the scheme of requests that come in from clients.
 func RequestURI(r *http.Request, scheme string) string {
-       return scheme + "://" + r.Host + r.RequestURI
+       newUrl,err := url.Parse(r.RequestURI)
+       if err != nil {
+               log.Errorf("parsing r.RequestURI: %v, error: %v", r.RequestURI, 
err)
+               return ""
+       }
+       newUrl.Scheme = scheme
+       newUrl.Host = r.Host
+       return newUrl.String()
 }
+
 func (hr simpleHTTPRequestRemapper) RemappingProducer(r *http.Request, scheme 
string) (*RemappingProducer, error) {
        uri := RequestURI(r, scheme)
+       log.Debugf("remapped data r.Host: %v, r.RequestURI: %v, uri: %v", 
r.Host, r.RequestURI, uri)
        rule, ok := hr.remapper.Remap(uri)
        if !ok {
                return nil, ErrRuleNotFound


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to