golanggohlsrtmpwebrtcmedia-serverobs-studiortcprtmp-proxyrtmp-serverrtprtsprtsp-proxyrtsp-relayrtsp-serversrtstreamingwebrtc-proxy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
359 B
22 lines
359 B
package httpserv |
|
|
|
import "net/url" |
|
|
|
// LocationWithTrailingSlash returns the URL in a relative format, with a trailing slash. |
|
func LocationWithTrailingSlash(u *url.URL) string { |
|
l := "./" |
|
|
|
for i := 1; i < len(u.Path); i++ { |
|
if u.Path[i] == '/' { |
|
l += "../" |
|
} |
|
} |
|
|
|
l += u.Path[1:] + "/" |
|
|
|
if u.RawQuery != "" { |
|
l += "?" + u.RawQuery |
|
} |
|
|
|
return l |
|
}
|
|
|