call-seq:
uc.resolve("/someuri") -> "/someuri", "", handler
uc.resolve("/someuri/pathinfo") -> "/someuri", "/pathinfo", handler
uc.resolve("/notfound/orhere") -> nil, nil, nil
uc.resolve("/") -> "/", "/", handler # if uc.register("/", handler)
uc.resolve("/path/from/root") -> "/", "/path/from/root", handler # if uc.register("/", handler)
Attempts to resolve either the whole URI or at the longest prefix, returning the prefix (as script_info), path (as path_info), and registered handler (usually an HttpHandler). If it doesn‘t find a handler registered at the longest match then it returns nil,nil,nil.
Because the resolver uses a trie you are able to register a handler at any character in the URI and it will be handled as long as it‘s the longest prefix. So, if you registered handler 1 at "/something/lik", and 2 at "/something/like/that", then a a search for "/something/like" would give you 1. A search for "/something/like/that/too" would give you 2.
This is very powerful since it means you can also attach handlers to parts of the ; (semi-colon) separated path params, any part of the path, use off chars, anything really. It also means that it‘s very efficient to do this only taking as long as the URI has characters.
A slight modification to the CGI 1.2 standard is given for handlers registered to "/". CGI expects all CGI scripts to be at some script path, so it doesn‘t really say anything about a script that handles the root. To make this work, the resolver will detect that the requested handler is at "/", and return that for script_name, and then simply return the full URI back as path_info.
It expects strings with no embedded ’\0’ characters. Don‘t try other string-like stuff yet.
| HTTP_STATUS_CODES | = | { 100 => 'Continue', 101 => 'Switching Protocols', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Moved Temporarily', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported' | Every standard HTTP code mapped to the appropriate message. These are used so frequently that they are placed directly in Mongrel for easy access rather than Mongrel::Const. |