mongrel 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +4 -2
- data/bin/mongrel_rails +65 -101
- data/bin/mongrel_rails_service +1 -1
- data/bin/mongrel_rails_svc +131 -115
- data/doc/rdoc/classes/Class.html +197 -0
- data/doc/rdoc/classes/Class.src/M000001.html +24 -0
- data/doc/rdoc/classes/Class.src/M000002.html +62 -0
- data/doc/rdoc/classes/Class.src/M000003.html +21 -0
- data/doc/rdoc/classes/Class.src/M000004.html +20 -0
- data/doc/rdoc/classes/IO.html +170 -0
- data/doc/rdoc/classes/IO.src/M000005.html +19 -0
- data/doc/rdoc/classes/IO.src/M000006.html +19 -0
- data/doc/rdoc/classes/Kernel.html +159 -0
- data/doc/rdoc/classes/Kernel.src/M000025.html +19 -0
- data/doc/rdoc/classes/Kernel.src/M000026.html +25 -0
- data/doc/rdoc/classes/Mongrel.html +181 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.html +383 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000090.html +24 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000091.html +47 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000092.html +34 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000093.html +27 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000094.html +25 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000095.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000096.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000097.html +18 -0
- data/doc/rdoc/classes/Mongrel/CGIWrapper.src/M000098.html +19 -0
- data/doc/rdoc/classes/Mongrel/Camping.html +177 -0
- data/doc/rdoc/classes/Mongrel/Camping.src/M000048.html +22 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.html +165 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000049.html +18 -0
- data/doc/rdoc/classes/Mongrel/Camping/CampingHandler.src/M000050.html +27 -0
- data/doc/rdoc/classes/Mongrel/Command.html +119 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.html +337 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000029.html +24 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000030.html +41 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000031.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000032.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000033.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000034.html +22 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000035.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000036.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000037.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Base.src/M000038.html +18 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.html +192 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000039.html +20 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000040.html +25 -0
- data/doc/rdoc/classes/Mongrel/Command/Registry.src/M000041.html +46 -0
- data/doc/rdoc/classes/Mongrel/Configurator.html +563 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000099.html +24 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000100.html +23 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000101.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000102.html +32 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000103.html +19 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000104.html +31 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000105.html +33 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000106.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000107.html +25 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000108.html +19 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000109.html +22 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000110.html +21 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000111.html +18 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000112.html +27 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000113.html +46 -0
- data/doc/rdoc/classes/Mongrel/Configurator.src/M000114.html +18 -0
- data/doc/rdoc/classes/Mongrel/Const.html +286 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.html +288 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000058.html +20 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000059.html +42 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000060.html +40 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000061.html +51 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000062.html +40 -0
- data/doc/rdoc/classes/Mongrel/DirHandler.src/M000063.html +18 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.html +171 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000115.html +18 -0
- data/doc/rdoc/classes/Mongrel/Error404Handler.src/M000116.html +18 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.html +185 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000072.html +18 -0
- data/doc/rdoc/classes/Mongrel/HeaderOut.src/M000073.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.html +152 -0
- data/doc/rdoc/classes/Mongrel/HttpHandler.src/M000074.html +17 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.html +169 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000027.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpHandlerPlugin.src/M000028.html +17 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.html +271 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000051.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000052.html +29 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000053.html +29 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000054.html +41 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000055.html +27 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000056.html +27 -0
- data/doc/rdoc/classes/Mongrel/HttpParser.src/M000057.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.html +222 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000117.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000118.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000119.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpRequest.src/M000120.html +32 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.html +371 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000075.html +26 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000076.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000077.html +25 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000078.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000079.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000080.html +23 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000081.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000082.html +20 -0
- data/doc/rdoc/classes/Mongrel/HttpResponse.src/M000083.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.html +360 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000064.html +24 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000065.html +65 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000066.html +24 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000067.html +60 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000068.html +28 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000069.html +18 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000070.html +22 -0
- data/doc/rdoc/classes/Mongrel/HttpServer.src/M000071.html +18 -0
- data/doc/rdoc/classes/Mongrel/Rails.html +112 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.html +223 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000042.html +35 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000043.html +25 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsConfigurator.src/M000044.html +32 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.html +250 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000045.html +22 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000046.html +48 -0
- data/doc/rdoc/classes/Mongrel/Rails/RailsHandler.src/M000047.html +23 -0
- data/doc/rdoc/classes/Mongrel/StopServer.html +117 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.html +301 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000084.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000085.html +18 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000086.html +39 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000087.html +51 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000088.html +36 -0
- data/doc/rdoc/classes/Mongrel/URIClassifier.src/M000089.html +83 -0
- data/doc/rdoc/classes/MongrelDbg.html +209 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000020.html +19 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000021.html +20 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000022.html +22 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000023.html +21 -0
- data/doc/rdoc/classes/MongrelDbg.src/M000024.html +18 -0
- data/doc/rdoc/classes/ObjectTracker.html +176 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000016.html +22 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000017.html +18 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000018.html +18 -0
- data/doc/rdoc/classes/ObjectTracker.src/M000019.html +46 -0
- data/doc/rdoc/classes/RequestLog.html +113 -0
- data/doc/rdoc/classes/RequestLog/Files.html +144 -0
- data/doc/rdoc/classes/RequestLog/Files.src/M000121.html +19 -0
- data/doc/rdoc/classes/RequestLog/Objects.html +144 -0
- data/doc/rdoc/classes/RequestLog/Objects.src/M000122.html +19 -0
- data/doc/rdoc/classes/RequestLog/Params.html +144 -0
- data/doc/rdoc/classes/RequestLog/Params.src/M000123.html +19 -0
- data/doc/rdoc/classes/Stats.html +306 -0
- data/doc/rdoc/classes/Stats.src/M000009.html +19 -0
- data/doc/rdoc/classes/Stats.src/M000010.html +23 -0
- data/doc/rdoc/classes/Stats.src/M000011.html +26 -0
- data/doc/rdoc/classes/Stats.src/M000012.html +18 -0
- data/doc/rdoc/classes/Stats.src/M000013.html +18 -0
- data/doc/rdoc/classes/Stats.src/M000014.html +19 -0
- data/doc/rdoc/classes/Stats.src/M000015.html +20 -0
- data/doc/rdoc/classes/TCPServer.html +173 -0
- data/doc/rdoc/classes/TCPServer.src/M000007.html +19 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +756 -0
- data/doc/rdoc/files/LICENSE.html +756 -0
- data/doc/rdoc/files/README.html +302 -0
- data/doc/rdoc/files/ext/http11/http11_c.html +101 -0
- data/doc/rdoc/files/lib/mongrel/camping_rb.html +108 -0
- data/doc/rdoc/files/lib/mongrel/cgi_rb.html +108 -0
- data/doc/rdoc/files/lib/mongrel/command_rb.html +111 -0
- data/doc/rdoc/files/lib/mongrel/debug_rb.html +110 -0
- data/doc/rdoc/files/lib/mongrel/handlers_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel/init_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel/rails_rb.html +111 -0
- data/doc/rdoc/files/lib/mongrel/stats_rb.html +117 -0
- data/doc/rdoc/files/lib/mongrel/tcphack_rb.html +109 -0
- data/doc/rdoc/files/lib/mongrel_rb.html +118 -0
- data/doc/rdoc/fr_class_index.html +60 -0
- data/doc/rdoc/fr_file_index.html +40 -0
- data/doc/rdoc/fr_method_index.html +149 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/examples/builder.rb +29 -0
- data/examples/camping/blog.rb +11 -2
- data/examples/simpletest.rb +20 -7
- data/ext/http11/http11.c +71 -14
- data/ext/http11/http11_parser.c +27 -24
- data/ext/http11/http11_parser.h +2 -1
- data/lib/http11.bundle +0 -0
- data/lib/mongrel.rb +498 -135
- data/lib/mongrel/command.rb +1 -1
- data/lib/mongrel/debug.rb +259 -0
- data/lib/mongrel/handlers.rb +76 -22
- data/lib/mongrel/rails.rb +165 -72
- data/lib/mongrel/stats.rb +71 -0
- data/test/test_configurator.rb +67 -0
- data/test/test_debug.rb +31 -0
- data/test/test_http11.rb +16 -0
- data/test/test_response.rb +5 -0
- data/test/test_stats.rb +28 -0
- metadata +224 -2
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Mongrel::URIClassifier</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Mongrel::URIClassifier</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/mongrel_rb.html">
|
|
59
|
+
lib/mongrel.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
<a href="../../files/ext/http11/http11_c.html">
|
|
63
|
+
ext/http11/http11.c
|
|
64
|
+
</a>
|
|
65
|
+
<br />
|
|
66
|
+
</td>
|
|
67
|
+
</tr>
|
|
68
|
+
|
|
69
|
+
<tr class="top-aligned-row">
|
|
70
|
+
<td><strong>Parent:</strong></td>
|
|
71
|
+
<td>
|
|
72
|
+
Object
|
|
73
|
+
</td>
|
|
74
|
+
</tr>
|
|
75
|
+
</table>
|
|
76
|
+
</div>
|
|
77
|
+
<!-- banner header -->
|
|
78
|
+
|
|
79
|
+
<div id="bodyContent">
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
<div id="contextContent">
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div id="method-list">
|
|
90
|
+
<h3 class="section-bar">Methods</h3>
|
|
91
|
+
|
|
92
|
+
<div class="name-list">
|
|
93
|
+
<a href="#M000085">inspect</a>
|
|
94
|
+
<a href="#M000086">new</a>
|
|
95
|
+
<a href="#M000087">register</a>
|
|
96
|
+
<a href="#M000089">resolve</a>
|
|
97
|
+
<a href="#M000088">unregister</a>
|
|
98
|
+
<a href="#M000084">uris</a>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
<!-- if includes -->
|
|
106
|
+
|
|
107
|
+
<div id="section">
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
<!-- if method_list -->
|
|
117
|
+
<div id="methods">
|
|
118
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
119
|
+
|
|
120
|
+
<div id="method-M000086" class="method-detail">
|
|
121
|
+
<a name="M000086"></a>
|
|
122
|
+
|
|
123
|
+
<div class="method-heading">
|
|
124
|
+
<a href="URIClassifier.src/M000086.html" target="Code" class="method-signature"
|
|
125
|
+
onclick="popupCode('URIClassifier.src/M000086.html');return false;">
|
|
126
|
+
<span class="method-name">URIClassifier.new → URIClassifier<br />
|
|
127
|
+
</span>
|
|
128
|
+
</a>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div class="method-description">
|
|
132
|
+
<p>
|
|
133
|
+
Initializes a new <a href="URIClassifier.html">URIClassifier</a> object
|
|
134
|
+
that you can use to associate URI sequences with objects. You can actually
|
|
135
|
+
use it with any string sequence and any objects, but it’s mostly used
|
|
136
|
+
with URIs.
|
|
137
|
+
</p>
|
|
138
|
+
<p>
|
|
139
|
+
It uses TST from <a
|
|
140
|
+
href="http://www.octavian.org/cs/software.html">www.octavian.org/cs/software.html</a>
|
|
141
|
+
to build an ternary search trie to hold all of the URIs. It uses this to do
|
|
142
|
+
an initial search for the a URI prefix, and then to break the URI into
|
|
143
|
+
SCRIPT_NAME and PATH_INFO portions. It actually will do two searches most
|
|
144
|
+
of the time in order to find the right handler for the registered prefix
|
|
145
|
+
portion.
|
|
146
|
+
</p>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
151
|
+
|
|
152
|
+
<div id="method-M000085" class="method-detail">
|
|
153
|
+
<a name="M000085"></a>
|
|
154
|
+
|
|
155
|
+
<div class="method-heading">
|
|
156
|
+
<a href="URIClassifier.src/M000085.html" target="Code" class="method-signature"
|
|
157
|
+
onclick="popupCode('URIClassifier.src/M000085.html');return false;">
|
|
158
|
+
<span class="method-name">inspect</span><span class="method-args">()</span>
|
|
159
|
+
</a>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div class="method-description">
|
|
163
|
+
<p>
|
|
164
|
+
Simply does an inspect that looks like a Hash inspect.
|
|
165
|
+
</p>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
|
|
169
|
+
<div id="method-M000087" class="method-detail">
|
|
170
|
+
<a name="M000087"></a>
|
|
171
|
+
|
|
172
|
+
<div class="method-heading">
|
|
173
|
+
<a href="URIClassifier.src/M000087.html" target="Code" class="method-signature"
|
|
174
|
+
onclick="popupCode('URIClassifier.src/M000087.html');return false;">
|
|
175
|
+
<span class="method-name">uc.register("/someuri", SampleHandler.new) → nil<br />
|
|
176
|
+
</span>
|
|
177
|
+
</a>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
<div class="method-description">
|
|
181
|
+
<p>
|
|
182
|
+
Registers the SampleHandler (one for all requests) with the
|
|
183
|
+
"/someuri". When URIClassifier::resolve is called with
|
|
184
|
+
"/someuri" it’ll return SampleHandler immediately. When
|
|
185
|
+
called with "/someuri/iwant" it’ll also return SomeHandler
|
|
186
|
+
immediatly, with no additional searches, but it will return path info with
|
|
187
|
+
"/iwant".
|
|
188
|
+
</p>
|
|
189
|
+
<p>
|
|
190
|
+
You actually can reuse this class to register nearly anything and quickly
|
|
191
|
+
resolve it. This could be used for caching, fast mapping, etc. The downside
|
|
192
|
+
is it uses much more memory than a Hash, but it can be a lot faster.
|
|
193
|
+
It’s main advantage is that it works on prefixes, which is damn hard
|
|
194
|
+
to get right with a Hash.
|
|
195
|
+
</p>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
|
|
199
|
+
<div id="method-M000089" class="method-detail">
|
|
200
|
+
<a name="M000089"></a>
|
|
201
|
+
|
|
202
|
+
<div class="method-heading">
|
|
203
|
+
<a href="URIClassifier.src/M000089.html" target="Code" class="method-signature"
|
|
204
|
+
onclick="popupCode('URIClassifier.src/M000089.html');return false;">
|
|
205
|
+
<span class="method-name">uc.resolve("/someuri") → "/someuri", "", handler<br />
|
|
206
|
+
uc.resolve("/someuri/pathinfo") → "/someuri", "/pathinfo", handler<br />
|
|
207
|
+
uc.resolve("/notfound/orhere") → nil, nil, nil<br />
|
|
208
|
+
uc.resolve("/") → "/", "/", handler # if uc.register("/", handler)<br />
|
|
209
|
+
uc.resolve("/path/from/root") → "/", "/path/from/root", handler # if uc.register("/", handler) <br />
|
|
210
|
+
</span>
|
|
211
|
+
</a>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<div class="method-description">
|
|
215
|
+
<p>
|
|
216
|
+
Attempts to resolve either the whole URI or at the longest prefix,
|
|
217
|
+
returning the prefix (as script_info), path (as path_info), and registered
|
|
218
|
+
handler (usually an <a href="HttpHandler.html">HttpHandler</a>). If it
|
|
219
|
+
doesn’t find a handler registered at the longest match then it
|
|
220
|
+
returns nil,nil,nil.
|
|
221
|
+
</p>
|
|
222
|
+
<p>
|
|
223
|
+
Because the resolver uses a trie you are able to register a handler at
|
|
224
|
+
<b>any</b> character in the URI and it will be handled as long as
|
|
225
|
+
it’s the longest prefix. So, if you registered handler 1 at
|
|
226
|
+
"/something/lik", and 2 at "/something/like/that", then
|
|
227
|
+
a a search for "/something/like" would give you 1. A search for
|
|
228
|
+
"/something/like/that/too" would give you 2.
|
|
229
|
+
</p>
|
|
230
|
+
<p>
|
|
231
|
+
This is very powerful since it means you can also attach handlers to parts
|
|
232
|
+
of the ; (semi-colon) separated path params, any part of the path, use off
|
|
233
|
+
chars, anything really. It also means that it’s very efficient to do
|
|
234
|
+
this only taking as long as the URI has characters.
|
|
235
|
+
</p>
|
|
236
|
+
<p>
|
|
237
|
+
A slight modification to the CGI 1.2 standard is given for handlers
|
|
238
|
+
registered to "/". CGI expects all CGI scripts to be at some
|
|
239
|
+
script path, so it doesn’t really say anything about a script that
|
|
240
|
+
handles the root. To make this work, the resolver will detect that the
|
|
241
|
+
requested handler is at "/", and return that for script_name, and
|
|
242
|
+
then simply return the full URI back as path_info.
|
|
243
|
+
</p>
|
|
244
|
+
<p>
|
|
245
|
+
It expects strings with no embedded ’\0’ characters.
|
|
246
|
+
Don‘t try other string-like stuff yet.
|
|
247
|
+
</p>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
<div id="method-M000088" class="method-detail">
|
|
252
|
+
<a name="M000088"></a>
|
|
253
|
+
|
|
254
|
+
<div class="method-heading">
|
|
255
|
+
<a href="URIClassifier.src/M000088.html" target="Code" class="method-signature"
|
|
256
|
+
onclick="popupCode('URIClassifier.src/M000088.html');return false;">
|
|
257
|
+
<span class="method-name">uc.unregister("/someuri")<br />
|
|
258
|
+
</span>
|
|
259
|
+
</a>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div class="method-description">
|
|
263
|
+
<p>
|
|
264
|
+
Yep, just removes this uri and it’s handler from the trie.
|
|
265
|
+
</p>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
<div id="method-M000084" class="method-detail">
|
|
270
|
+
<a name="M000084"></a>
|
|
271
|
+
|
|
272
|
+
<div class="method-heading">
|
|
273
|
+
<a href="URIClassifier.src/M000084.html" target="Code" class="method-signature"
|
|
274
|
+
onclick="popupCode('URIClassifier.src/M000084.html');return false;">
|
|
275
|
+
<span class="method-name">uris</span><span class="method-args">()</span>
|
|
276
|
+
</a>
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
<div class="method-description">
|
|
280
|
+
<p>
|
|
281
|
+
Returns the URIs that have been registered with this classifier so far. The
|
|
282
|
+
URIs returned should not be modified as this will cause a memory leak. You
|
|
283
|
+
can use this to inspect the contents of the <a
|
|
284
|
+
href="URIClassifier.html">URIClassifier</a>.
|
|
285
|
+
</p>
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
<div id="validator-badges">
|
|
297
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
298
|
+
</div>
|
|
299
|
+
|
|
300
|
+
</body>
|
|
301
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>uris (Mongrel::URIClassifier)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 21</span>
|
|
14
|
+
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uris</span>
|
|
15
|
+
22: <span class="ruby-ivar">@handler_map</span>.<span class="ruby-identifier">keys</span>
|
|
16
|
+
23: <span class="ruby-keyword kw">end</span></pre>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>inspect (Mongrel::URIClassifier)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/mongrel.rb, line 26</span>
|
|
14
|
+
26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
|
15
|
+
27: <span class="ruby-ivar">@handler_map</span>.<span class="ruby-identifier">inspect</span>
|
|
16
|
+
28: <span class="ruby-keyword kw">end</span></pre>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>new (Mongrel::URIClassifier)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre>/**
|
|
14
|
+
* call-seq:
|
|
15
|
+
* URIClassifier.new -> URIClassifier
|
|
16
|
+
*
|
|
17
|
+
* Initializes a new URIClassifier object that you can use to associate URI sequences
|
|
18
|
+
* with objects. You can actually use it with any string sequence and any objects,
|
|
19
|
+
* but it's mostly used with URIs.
|
|
20
|
+
*
|
|
21
|
+
* It uses TST from http://www.octavian.org/cs/software.html to build an ternary search
|
|
22
|
+
* trie to hold all of the URIs. It uses this to do an initial search for the a URI
|
|
23
|
+
* prefix, and then to break the URI into SCRIPT_NAME and PATH_INFO portions. It actually
|
|
24
|
+
* will do two searches most of the time in order to find the right handler for the
|
|
25
|
+
* registered prefix portion.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
VALUE URIClassifier_init(VALUE self)
|
|
29
|
+
{
|
|
30
|
+
VALUE hash;
|
|
31
|
+
|
|
32
|
+
// we create an internal hash to protect stuff from the GC
|
|
33
|
+
hash = rb_hash_new();
|
|
34
|
+
rb_ivar_set(self, id_handler_map, hash);
|
|
35
|
+
|
|
36
|
+
return self;
|
|
37
|
+
}</pre>
|
|
38
|
+
</body>
|
|
39
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>register (Mongrel::URIClassifier)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre>/**
|
|
14
|
+
* call-seq:
|
|
15
|
+
* uc.register("/someuri", SampleHandler.new) -> nil
|
|
16
|
+
*
|
|
17
|
+
* Registers the SampleHandler (one for all requests) with the "/someuri".
|
|
18
|
+
* When URIClassifier::resolve is called with "/someuri" it'll return
|
|
19
|
+
* SampleHandler immediately. When called with "/someuri/iwant" it'll also
|
|
20
|
+
* return SomeHandler immediatly, with no additional searches, but it will
|
|
21
|
+
* return path info with "/iwant".
|
|
22
|
+
*
|
|
23
|
+
* You actually can reuse this class to register nearly anything and
|
|
24
|
+
* quickly resolve it. This could be used for caching, fast mapping, etc.
|
|
25
|
+
* The downside is it uses much more memory than a Hash, but it can be
|
|
26
|
+
* a lot faster. It's main advantage is that it works on prefixes, which
|
|
27
|
+
* is damn hard to get right with a Hash.
|
|
28
|
+
*/
|
|
29
|
+
VALUE URIClassifier_register(VALUE self, VALUE uri, VALUE handler)
|
|
30
|
+
{
|
|
31
|
+
int rc = 0;
|
|
32
|
+
void *ptr = NULL;
|
|
33
|
+
struct tst *tst = NULL;
|
|
34
|
+
DATA_GET(self, struct tst, tst);
|
|
35
|
+
|
|
36
|
+
rc = tst_insert((unsigned char *)StringValueCStr(uri), (void *)handler , tst, 0, &ptr);
|
|
37
|
+
|
|
38
|
+
if(rc == TST_DUPLICATE_KEY) {
|
|
39
|
+
rb_raise(rb_eStandardError, "Handler already registered with that name");
|
|
40
|
+
} else if(rc == TST_ERROR) {
|
|
41
|
+
rb_raise(rb_eStandardError, "Memory error registering handler");
|
|
42
|
+
} else if(rc == TST_NULL_KEY) {
|
|
43
|
+
rb_raise(rb_eStandardError, "URI was empty");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
rb_hash_aset(rb_ivar_get(self, id_handler_map), uri, handler);
|
|
47
|
+
|
|
48
|
+
return Qnil;
|
|
49
|
+
}</pre>
|
|
50
|
+
</body>
|
|
51
|
+
</html>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html>
|
|
7
|
+
<head>
|
|
8
|
+
<title>unregister (Mongrel::URIClassifier)</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
+
</head>
|
|
12
|
+
<body class="standalone-code">
|
|
13
|
+
<pre>/**
|
|
14
|
+
* call-seq:
|
|
15
|
+
* uc.unregister("/someuri")
|
|
16
|
+
*
|
|
17
|
+
* Yep, just removes this uri and it's handler from the trie.
|
|
18
|
+
*/
|
|
19
|
+
VALUE URIClassifier_unregister(VALUE self, VALUE uri)
|
|
20
|
+
{
|
|
21
|
+
void *handler = NULL;
|
|
22
|
+
struct tst *tst = NULL;
|
|
23
|
+
DATA_GET(self, struct tst, tst);
|
|
24
|
+
|
|
25
|
+
handler = tst_delete((unsigned char *)StringValueCStr(uri), tst);
|
|
26
|
+
|
|
27
|
+
if(handler) {
|
|
28
|
+
rb_hash_delete(rb_ivar_get(self, id_handler_map), uri);
|
|
29
|
+
|
|
30
|
+
return (VALUE)handler;
|
|
31
|
+
} else {
|
|
32
|
+
return Qnil;
|
|
33
|
+
}
|
|
34
|
+
}</pre>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|