|
|
|
@ -21,7 +21,7 @@ func ParseURLEncodedRequest(received string) (*Request, Error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Split into 2 substrings by '?'. URL path and query
|
|
|
|
|
rawPath, params := splitBy(received, "?")
|
|
|
|
|
rawPath, params := SplitBy(received, "?")
|
|
|
|
|
|
|
|
|
|
// Unescape path
|
|
|
|
|
rawPath, err := url.PathUnescape(rawPath)
|
|
|
|
@ -35,7 +35,7 @@ func ParseURLEncodedRequest(received string) (*Request, Error) {
|
|
|
|
|
|
|
|
|
|
// ParseInternalRequest parses an internal request string based on the current directory
|
|
|
|
|
func ParseInternalRequest(p *Path, line string) *Request {
|
|
|
|
|
rawPath, params := splitBy(line, "?")
|
|
|
|
|
rawPath, params := SplitBy(line, "?")
|
|
|
|
|
if path.IsAbs(rawPath) {
|
|
|
|
|
return &Request{getRequestPath(rawPath), params}
|
|
|
|
|
}
|
|
|
|
@ -46,7 +46,7 @@ func ParseInternalRequest(p *Path, line string) *Request {
|
|
|
|
|
func getRequestPathUserDirEnabled(rawPath string) *Path {
|
|
|
|
|
if userPath := strings.TrimPrefix(rawPath, "/"); strings.HasPrefix(userPath, "~") {
|
|
|
|
|
// We found a user path! Split into the user part, and remaining path
|
|
|
|
|
user, remaining := splitBy(userPath, "/")
|
|
|
|
|
user, remaining := SplitBy(userPath, "/")
|
|
|
|
|
|
|
|
|
|
// Empty user, we been duped! Return server root
|
|
|
|
|
if len(user) <= 1 {
|
|
|
|
|