doc/rdoc/classes/Mongrel/URIClassifier.src/M000089.html in mongrel-0.3.12.4 vs doc/rdoc/classes/Mongrel/URIClassifier.src/M000089.html in mongrel-0.3.13

- old
+ new

@@ -3,81 +3,16 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>resolve (Mongrel::URIClassifier)</title> + <title>inspect (Mongrel::URIClassifier)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> - <pre>/** - * call-seq: - * uc.resolve(&quot;/someuri&quot;) -&gt; &quot;/someuri&quot;, &quot;&quot;, handler - * uc.resolve(&quot;/someuri/pathinfo&quot;) -&gt; &quot;/someuri&quot;, &quot;/pathinfo&quot;, handler - * uc.resolve(&quot;/notfound/orhere&quot;) -&gt; nil, nil, nil - * uc.resolve(&quot;/&quot;) -&gt; &quot;/&quot;, &quot;/&quot;, handler # if uc.register(&quot;/&quot;, handler) - * uc.resolve(&quot;/path/from/root&quot;) -&gt; &quot;/&quot;, &quot;/path/from/root&quot;, handler # if uc.register(&quot;/&quot;, 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 &quot;/something/lik&quot;, and #2 at &quot;/something/like/that&quot;, then a - * a search for &quot;/something/like&quot; would give you #1. A search for &quot;/something/like/that/too&quot; - * 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 &quot;/&quot;. - * 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 &quot;/&quot;, 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. - */ -VALUE URIClassifier_resolve(VALUE self, VALUE uri) -{ - void *handler = NULL; - int pref_len = 0; - struct tst *tst = NULL; - VALUE result; - unsigned char *uri_str = NULL; - - DATA_GET(self, struct tst, tst); - uri_str = (unsigned char *)StringValueCStr(uri); - - handler = tst_search(uri_str, tst, &amp;pref_len); - - // setup for multiple return values - result = rb_ary_new(); - - if(handler) { - rb_ary_push(result, rb_str_substr (uri, 0, pref_len)); - // compensate for a script_name=&quot;/&quot; where we need to add the &quot;/&quot; to path_info to keep it consistent - if(pref_len == 1 &amp;&amp; uri_str[0] == '/') { - // matches the root URI so we have to use the whole URI as the path_info - rb_ary_push(result, uri); - } else { - // matches a script so process like normal - rb_ary_push(result, rb_str_substr(uri, pref_len, RSTRING(uri)-&gt;len)); - } - - rb_ary_push(result, (VALUE)handler); - } else { - // not found so push back nothing - rb_ary_push(result, Qnil); - rb_ary_push(result, Qnil); - rb_ary_push(result, Qnil); - } - - return result; -}</pre> + <pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 58</span> +58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span> +59: <span class="ruby-ivar">@handler_map</span>.<span class="ruby-identifier">inspect</span> +60: <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file