func RawURL(request *http.Request) string {
	return strings.Join([]string{request.URL.Scheme, "://", request.URL.Host, request.RequestURI}, "")
}
RawURL returns URL built out of the provided request's Request-URI, to avoid un-escaping.
Note: it assumes that scheme and host for the provided request's URL are defined.
package netutils
import (
	"encoding/base64"
	"fmt"
	"net/http"
	"net/url"
	"strings"
)
func CopyUrl(in *url.URL) *url.URL {
	out := new(url.URL)
	*out = *in
	if in.User != nil {
		*out.User = *in.User
	}
	return out
}
func RawPath(in string) (string, error) {
	u, err := url.ParseRequestURI(in)
	if err != nil {
		return "", err
	}
	path := ""
	if u.Opaque != "" {
		path = u.Opaque
	} else if u.Host == "" {
		path = in
	} else {
		vals := strings.SplitN(in, u.Host, 2)
		if len(vals) != 2 {
			return "", fmt.Errorf("failed to parse url")
		}
		path = vals[1]
	}
	idx := strings.IndexRune(path, '?')
	if idx == -1 {
		return path, nil
	}
	return path[:idx], nil
}