rfuzz 0.6
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/COPYING +55 -0
- data/LICENSE +55 -0
- data/README +252 -0
- data/Rakefile +48 -0
- data/doc/rdoc/classes/RFuzz.html +146 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.html +481 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000010.html +24 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000011.html +34 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000012.html +49 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000013.html +49 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000014.html +57 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000015.html +37 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000016.html +26 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000017.html +34 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000018.html +18 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000019.html +26 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.html +294 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000001.html +26 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000002.html +18 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000003.html +26 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000004.html +18 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000005.html +32 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000006.html +18 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000007.html +20 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000008.html +20 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000009.html +32 -0
- data/doc/rdoc/classes/RFuzz/HttpResponse.html +180 -0
- data/doc/rdoc/classes/RFuzz/Notifier.html +252 -0
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000044.html +17 -0
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000045.html +17 -0
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000046.html +17 -0
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000047.html +17 -0
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000048.html +17 -0
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000049.html +17 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.html +362 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000032.html +21 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000033.html +23 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000036.html +22 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000037.html +20 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000038.html +22 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000039.html +20 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000040.html +18 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000041.html +18 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000042.html +22 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000043.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.html +383 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000056.html +19 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000057.html +23 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000058.html +26 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000059.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000060.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000061.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000062.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000063.html +19 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000064.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000065.html +23 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000066.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000067.html +20 -0
- data/doc/rdoc/classes/RFuzz/Session.html +415 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000020.html +31 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000021.html +18 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000022.html +18 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000023.html +34 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000024.html +19 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000025.html +19 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000026.html +26 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000027.html +29 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000028.html +19 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000029.html +18 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000030.html +18 -0
- data/doc/rdoc/classes/RFuzz/Session.src/M000031.html +23 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.html +242 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000050.html +19 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000051.html +19 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000052.html +18 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000053.html +18 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000054.html +28 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000055.html +18 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +168 -0
- data/doc/rdoc/files/LICENSE.html +168 -0
- data/doc/rdoc/files/README.html +473 -0
- data/doc/rdoc/files/lib/rfuzz/client_rb.html +111 -0
- data/doc/rdoc/files/lib/rfuzz/random_rb.html +116 -0
- data/doc/rdoc/files/lib/rfuzz/rfuzz_rb.html +109 -0
- data/doc/rdoc/files/lib/rfuzz/session_rb.html +111 -0
- data/doc/rdoc/files/lib/rfuzz/stats_rb.html +113 -0
- data/doc/rdoc/fr_class_index.html +35 -0
- data/doc/rdoc/fr_file_index.html +34 -0
- data/doc/rdoc/fr_method_index.html +93 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/examples/amazon_headers.rb +38 -0
- data/examples/hpricot_pudding.rb +22 -0
- data/examples/kill_routes.rb +26 -0
- data/examples/mongrel_test_suite/lib/gen.rb +24 -0
- data/examples/mongrel_test_suite/test/camping/static_files.rb +9 -0
- data/examples/mongrel_test_suite/test/camping/upload_file.rb +9 -0
- data/examples/mongrel_test_suite/test/camping/upload_progress.rb +9 -0
- data/examples/mongrel_test_suite/test/http/base_protocol.rb +23 -0
- data/examples/mongrel_test_suite/test/nitro/upload_file.rb +9 -0
- data/examples/mongrel_test_suite/test/nitro/upload_progress.rb +9 -0
- data/examples/mongrel_test_suite/test/rails/static_files.rb +9 -0
- data/examples/mongrel_test_suite/test/rails/upload_file.rb +9 -0
- data/examples/mongrel_test_suite/test/rails/upload_progress.rb +9 -0
- data/examples/perftest.rb +30 -0
- data/ext/fuzzrnd/ext_help.h +14 -0
- data/ext/fuzzrnd/extconf.rb +6 -0
- data/ext/fuzzrnd/fuzzrnd.c +149 -0
- data/ext/http11_client/ext_help.h +14 -0
- data/ext/http11_client/extconf.rb +6 -0
- data/ext/http11_client/http11_client.c +288 -0
- data/ext/http11_client/http11_parser.c +629 -0
- data/ext/http11_client/http11_parser.h +46 -0
- data/ext/http11_client/http11_parser.rl +169 -0
- data/lib/rfuzz/client.rb +498 -0
- data/lib/rfuzz/random.rb +110 -0
- data/lib/rfuzz/rfuzz.rb +12 -0
- data/lib/rfuzz/session.rb +154 -0
- data/lib/rfuzz/stats.rb +159 -0
- data/resources/defaults.yaml +2 -0
- data/resources/words.txt +3310 -0
- data/test/coverage/index.html +388 -0
- data/test/coverage/lib-rfuzz-client_rb.html +1127 -0
- data/test/coverage/lib-rfuzz-random_rb.html +739 -0
- data/test/coverage/lib-rfuzz-session_rb.html +783 -0
- data/test/coverage/lib-rfuzz-stats_rb.html +788 -0
- data/test/server.rb +101 -0
- data/test/test_client.rb +164 -0
- data/test/test_fuzzrnd.rb +31 -0
- data/test/test_httpparser.rb +48 -0
- data/test/test_random.rb +75 -0
- data/test/test_session.rb +33 -0
- data/test/test_stats.rb +45 -0
- data/tools/rakehelp.rb +119 -0
- metadata +201 -0
|
@@ -0,0 +1,481 @@
|
|
|
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: RFuzz::HttpClient</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">RFuzz::HttpClient</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/rfuzz/client_rb.html">
|
|
59
|
+
lib/rfuzz/client.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
Object
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
<!-- banner header -->
|
|
74
|
+
|
|
75
|
+
<div id="bodyContent">
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<div id="contextContent">
|
|
80
|
+
|
|
81
|
+
<div id="description">
|
|
82
|
+
<p>
|
|
83
|
+
The actual <a href="HttpClient.html">HttpClient</a> that does the work with
|
|
84
|
+
the thinnest layer between you and the protocol. All exceptions and leaks
|
|
85
|
+
are allowed to pass through since those are important when testing. It
|
|
86
|
+
doesn’t pretend to be a full client, but instead is just enough
|
|
87
|
+
client to track cookies, form proper HTTP requests, and return <a
|
|
88
|
+
href="HttpResponse.html">HttpResponse</a> hashes with the results.
|
|
89
|
+
</p>
|
|
90
|
+
<p>
|
|
91
|
+
It’s designed so that you create one client, and then you work it
|
|
92
|
+
with a minimum of parameters as you need. The initialize method lets you
|
|
93
|
+
pass in defaults for most of the parameters you’ll need, and you can
|
|
94
|
+
simple call the method you want and it’ll be translated to an HTTP
|
|
95
|
+
method (client.get => GET, client.foobar = FOOBAR).
|
|
96
|
+
</p>
|
|
97
|
+
<p>
|
|
98
|
+
Here’s a few examples:
|
|
99
|
+
</p>
|
|
100
|
+
<pre>
|
|
101
|
+
client = HttpClient.new(:head => {"X-DefaultHeader" => "ONE"})
|
|
102
|
+
resp = client.post("/test")
|
|
103
|
+
resp = client.post("/test", :head => {"X-TestSend" => "Status"}, :body => "TEST BODY")
|
|
104
|
+
resp = client.put("/testput", :query => {"q" => "test"}, :body => "SOME JUNK")
|
|
105
|
+
client.reset
|
|
106
|
+
</pre>
|
|
107
|
+
<p>
|
|
108
|
+
The <a href="HttpClient.html#M000018">HttpClient.reset</a> call clears
|
|
109
|
+
cookies that are maintained.
|
|
110
|
+
</p>
|
|
111
|
+
<p>
|
|
112
|
+
It uses <a href="HttpClient.html#M000016">method_missing</a> to do the
|
|
113
|
+
translation of .put to "PUT /testput HTTP/1.1" so you can get
|
|
114
|
+
into trouble if you’re calling unknown methods on it. By default the
|
|
115
|
+
methods are PUT, GET, POST, DELETE, HEAD. You can change the allowed
|
|
116
|
+
methods by passing :allowed_methods => [:put, :get, ..] to the
|
|
117
|
+
initialize for the object.
|
|
118
|
+
</p>
|
|
119
|
+
<h2>Notifications</h2>
|
|
120
|
+
<p>
|
|
121
|
+
You can register a "notifier" with the client that will get
|
|
122
|
+
called when different events happen. Right now the <a
|
|
123
|
+
href="Notifier.html">Notifier</a> class just has a few functions for the
|
|
124
|
+
common parts of an HTTP request that each take a symbol and some extra
|
|
125
|
+
parameters. See <a href="Notifier.html">RFuzz::Notifier</a> for more
|
|
126
|
+
information.
|
|
127
|
+
</p>
|
|
128
|
+
<h2>Parameters</h2>
|
|
129
|
+
<pre>
|
|
130
|
+
:head => {K => V} or {K => [V1,V2]}
|
|
131
|
+
:query => {K => V} or {K => [V1,V2]}
|
|
132
|
+
:body => "some body" (you must encode for now)
|
|
133
|
+
:cookies => {K => V} or {K => [V1, V2]}
|
|
134
|
+
:allowed_methods => [:put, :get, :post, :delete, :head]
|
|
135
|
+
:notifier => Notifier.new
|
|
136
|
+
:redirect => false (give it a number and it'll follow redirects for that count)
|
|
137
|
+
</pre>
|
|
138
|
+
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div id="method-list">
|
|
145
|
+
<h3 class="section-bar">Methods</h3>
|
|
146
|
+
|
|
147
|
+
<div class="name-list">
|
|
148
|
+
<a href="#M000011">build_request</a>
|
|
149
|
+
<a href="#M000016">method_missing</a>
|
|
150
|
+
<a href="#M000010">new</a>
|
|
151
|
+
<a href="#M000019">notify</a>
|
|
152
|
+
<a href="#M000013">read_chunked_encoding</a>
|
|
153
|
+
<a href="#M000012">read_chunks</a>
|
|
154
|
+
<a href="#M000014">read_response</a>
|
|
155
|
+
<a href="#M000017">redirect</a>
|
|
156
|
+
<a href="#M000018">reset</a>
|
|
157
|
+
<a href="#M000015">send_request</a>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
<!-- if includes -->
|
|
165
|
+
<div id="includes">
|
|
166
|
+
<h3 class="section-bar">Included Modules</h3>
|
|
167
|
+
|
|
168
|
+
<div id="includes-list">
|
|
169
|
+
<span class="include-name"><a href="HttpEncoding.html">HttpEncoding</a></span>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<div id="section">
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<div id="constants-list">
|
|
177
|
+
<h3 class="section-bar">Constants</h3>
|
|
178
|
+
|
|
179
|
+
<div class="name-list">
|
|
180
|
+
<table summary="Constants">
|
|
181
|
+
<tr class="top-aligned-row context-row">
|
|
182
|
+
<td class="context-item-name">TRANSFER_ENCODING</td>
|
|
183
|
+
<td>=</td>
|
|
184
|
+
<td class="context-item-value">"TRANSFER_ENCODING"</td>
|
|
185
|
+
</tr>
|
|
186
|
+
<tr class="top-aligned-row context-row">
|
|
187
|
+
<td class="context-item-name">CONTENT_LENGTH</td>
|
|
188
|
+
<td>=</td>
|
|
189
|
+
<td class="context-item-value">"CONTENT_LENGTH"</td>
|
|
190
|
+
</tr>
|
|
191
|
+
<tr class="top-aligned-row context-row">
|
|
192
|
+
<td class="context-item-name">SET_COOKIE</td>
|
|
193
|
+
<td>=</td>
|
|
194
|
+
<td class="context-item-value">"SET_COOKIE"</td>
|
|
195
|
+
</tr>
|
|
196
|
+
<tr class="top-aligned-row context-row">
|
|
197
|
+
<td class="context-item-name">LOCATION</td>
|
|
198
|
+
<td>=</td>
|
|
199
|
+
<td class="context-item-value">"LOCATION"</td>
|
|
200
|
+
</tr>
|
|
201
|
+
<tr class="top-aligned-row context-row">
|
|
202
|
+
<td class="context-item-name">HOST</td>
|
|
203
|
+
<td>=</td>
|
|
204
|
+
<td class="context-item-value">"HOST"</td>
|
|
205
|
+
</tr>
|
|
206
|
+
<tr class="top-aligned-row context-row">
|
|
207
|
+
<td class="context-item-name">HTTP_REQUEST_HEADER</td>
|
|
208
|
+
<td>=</td>
|
|
209
|
+
<td class="context-item-value">"%s %s HTTP/1.1\r\n"</td>
|
|
210
|
+
</tr>
|
|
211
|
+
</table>
|
|
212
|
+
</div>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
<div id="attribute-list">
|
|
218
|
+
<h3 class="section-bar">Attributes</h3>
|
|
219
|
+
|
|
220
|
+
<div class="name-list">
|
|
221
|
+
<table>
|
|
222
|
+
<tr class="top-aligned-row context-row">
|
|
223
|
+
<td class="context-item-name">allowed_methods</td>
|
|
224
|
+
<td class="context-item-value"> [RW] </td>
|
|
225
|
+
<td class="context-item-desc">
|
|
226
|
+
Access to the host, port, default options, and cookies currently in play
|
|
227
|
+
|
|
228
|
+
</td>
|
|
229
|
+
</tr>
|
|
230
|
+
<tr class="top-aligned-row context-row">
|
|
231
|
+
<td class="context-item-name">cookies</td>
|
|
232
|
+
<td class="context-item-value"> [RW] </td>
|
|
233
|
+
<td class="context-item-desc">
|
|
234
|
+
Access to the host, port, default options, and cookies currently in play
|
|
235
|
+
|
|
236
|
+
</td>
|
|
237
|
+
</tr>
|
|
238
|
+
<tr class="top-aligned-row context-row">
|
|
239
|
+
<td class="context-item-name">host</td>
|
|
240
|
+
<td class="context-item-value"> [RW] </td>
|
|
241
|
+
<td class="context-item-desc">
|
|
242
|
+
Access to the host, port, default options, and cookies currently in play
|
|
243
|
+
|
|
244
|
+
</td>
|
|
245
|
+
</tr>
|
|
246
|
+
<tr class="top-aligned-row context-row">
|
|
247
|
+
<td class="context-item-name">notifier</td>
|
|
248
|
+
<td class="context-item-value"> [RW] </td>
|
|
249
|
+
<td class="context-item-desc">
|
|
250
|
+
Access to the host, port, default options, and cookies currently in play
|
|
251
|
+
|
|
252
|
+
</td>
|
|
253
|
+
</tr>
|
|
254
|
+
<tr class="top-aligned-row context-row">
|
|
255
|
+
<td class="context-item-name">options</td>
|
|
256
|
+
<td class="context-item-value"> [RW] </td>
|
|
257
|
+
<td class="context-item-desc">
|
|
258
|
+
Access to the host, port, default options, and cookies currently in play
|
|
259
|
+
|
|
260
|
+
</td>
|
|
261
|
+
</tr>
|
|
262
|
+
<tr class="top-aligned-row context-row">
|
|
263
|
+
<td class="context-item-name">port</td>
|
|
264
|
+
<td class="context-item-value"> [RW] </td>
|
|
265
|
+
<td class="context-item-desc">
|
|
266
|
+
Access to the host, port, default options, and cookies currently in play
|
|
267
|
+
|
|
268
|
+
</td>
|
|
269
|
+
</tr>
|
|
270
|
+
</table>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
<!-- if method_list -->
|
|
277
|
+
<div id="methods">
|
|
278
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
279
|
+
|
|
280
|
+
<div id="method-M000010" class="method-detail">
|
|
281
|
+
<a name="M000010"></a>
|
|
282
|
+
|
|
283
|
+
<div class="method-heading">
|
|
284
|
+
<a href="HttpClient.src/M000010.html" target="Code" class="method-signature"
|
|
285
|
+
onclick="popupCode('HttpClient.src/M000010.html');return false;">
|
|
286
|
+
<span class="method-name">new</span><span class="method-args">(host, port, options = {})</span>
|
|
287
|
+
</a>
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
<div class="method-description">
|
|
291
|
+
<p>
|
|
292
|
+
Doesn‘t make the connect until you actually call a .put,.get, etc.
|
|
293
|
+
</p>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
298
|
+
|
|
299
|
+
<div id="method-M000011" class="method-detail">
|
|
300
|
+
<a name="M000011"></a>
|
|
301
|
+
|
|
302
|
+
<div class="method-heading">
|
|
303
|
+
<a href="HttpClient.src/M000011.html" target="Code" class="method-signature"
|
|
304
|
+
onclick="popupCode('HttpClient.src/M000011.html');return false;">
|
|
305
|
+
<span class="method-name">build_request</span><span class="method-args">(out, method, uri, req)</span>
|
|
306
|
+
</a>
|
|
307
|
+
</div>
|
|
308
|
+
|
|
309
|
+
<div class="method-description">
|
|
310
|
+
<p>
|
|
311
|
+
Builds a full request from the method, uri, req, and @cookies using the
|
|
312
|
+
default @options and writes it to out (should be an IO).
|
|
313
|
+
</p>
|
|
314
|
+
<p>
|
|
315
|
+
It returns the body that the caller should use (based on defaults
|
|
316
|
+
resolution).
|
|
317
|
+
</p>
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
<div id="method-M000016" class="method-detail">
|
|
322
|
+
<a name="M000016"></a>
|
|
323
|
+
|
|
324
|
+
<div class="method-heading">
|
|
325
|
+
<a href="HttpClient.src/M000016.html" target="Code" class="method-signature"
|
|
326
|
+
onclick="popupCode('HttpClient.src/M000016.html');return false;">
|
|
327
|
+
<span class="method-name">method_missing</span><span class="method-args">(symbol, *args)</span>
|
|
328
|
+
</a>
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
<div class="method-description">
|
|
332
|
+
<p>
|
|
333
|
+
Translates unknown function calls into PUT, GET, POST, DELETE, HEAD
|
|
334
|
+
methods. The allowed HTTP methods allowed are restricted by the
|
|
335
|
+
@allowed_methods attribute which you can set after construction or during
|
|
336
|
+
construction with :allowed_methods => [:put, :get, …]
|
|
337
|
+
</p>
|
|
338
|
+
</div>
|
|
339
|
+
</div>
|
|
340
|
+
|
|
341
|
+
<div id="method-M000019" class="method-detail">
|
|
342
|
+
<a name="M000019"></a>
|
|
343
|
+
|
|
344
|
+
<div class="method-heading">
|
|
345
|
+
<a href="HttpClient.src/M000019.html" target="Code" class="method-signature"
|
|
346
|
+
onclick="popupCode('HttpClient.src/M000019.html');return false;">
|
|
347
|
+
<span class="method-name">notify</span><span class="method-args">(event) {|| ...}</span>
|
|
348
|
+
</a>
|
|
349
|
+
</div>
|
|
350
|
+
|
|
351
|
+
<div class="method-description">
|
|
352
|
+
<p>
|
|
353
|
+
Sends the notifications to the registered notifier, taking a block that it
|
|
354
|
+
runs doing the :begins, :ends states around it.
|
|
355
|
+
</p>
|
|
356
|
+
<p>
|
|
357
|
+
It also catches errors transparently in order to call the notifier when an
|
|
358
|
+
attempt fails.
|
|
359
|
+
</p>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
|
|
363
|
+
<div id="method-M000013" class="method-detail">
|
|
364
|
+
<a name="M000013"></a>
|
|
365
|
+
|
|
366
|
+
<div class="method-heading">
|
|
367
|
+
<a href="HttpClient.src/M000013.html" target="Code" class="method-signature"
|
|
368
|
+
onclick="popupCode('HttpClient.src/M000013.html');return false;">
|
|
369
|
+
<span class="method-name">read_chunked_encoding</span><span class="method-args">(resp, sock, parser)</span>
|
|
370
|
+
</a>
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
<div class="method-description">
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
<div id="method-M000012" class="method-detail">
|
|
378
|
+
<a name="M000012"></a>
|
|
379
|
+
|
|
380
|
+
<div class="method-heading">
|
|
381
|
+
<a href="HttpClient.src/M000012.html" target="Code" class="method-signature"
|
|
382
|
+
onclick="popupCode('HttpClient.src/M000012.html');return false;">
|
|
383
|
+
<span class="method-name">read_chunks</span><span class="method-args">(input, out, parser)</span>
|
|
384
|
+
</a>
|
|
385
|
+
</div>
|
|
386
|
+
|
|
387
|
+
<div class="method-description">
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
|
|
391
|
+
<div id="method-M000014" class="method-detail">
|
|
392
|
+
<a name="M000014"></a>
|
|
393
|
+
|
|
394
|
+
<div class="method-heading">
|
|
395
|
+
<a href="HttpClient.src/M000014.html" target="Code" class="method-signature"
|
|
396
|
+
onclick="popupCode('HttpClient.src/M000014.html');return false;">
|
|
397
|
+
<span class="method-name">read_response</span><span class="method-args">(sock)</span>
|
|
398
|
+
</a>
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
<div class="method-description">
|
|
402
|
+
<p>
|
|
403
|
+
Reads an HTTP response from the given socket. It uses readpartial which
|
|
404
|
+
only appeared in Ruby 1.8.4. The result is a fully formed <a
|
|
405
|
+
href="HttpResponse.html">HttpResponse</a> object for you to play with.
|
|
406
|
+
</p>
|
|
407
|
+
<p>
|
|
408
|
+
As with other methods in this class it doesn’t stop any exceptions
|
|
409
|
+
from reaching your code. It’s for experts who want these exceptions
|
|
410
|
+
so either write a wrapper, use net/http, or deal with it on your end.
|
|
411
|
+
</p>
|
|
412
|
+
</div>
|
|
413
|
+
</div>
|
|
414
|
+
|
|
415
|
+
<div id="method-M000017" class="method-detail">
|
|
416
|
+
<a name="M000017"></a>
|
|
417
|
+
|
|
418
|
+
<div class="method-heading">
|
|
419
|
+
<a href="HttpClient.src/M000017.html" target="Code" class="method-signature"
|
|
420
|
+
onclick="popupCode('HttpClient.src/M000017.html');return false;">
|
|
421
|
+
<span class="method-name">redirect</span><span class="method-args">(method, resp, *args)</span>
|
|
422
|
+
</a>
|
|
423
|
+
</div>
|
|
424
|
+
|
|
425
|
+
<div class="method-description">
|
|
426
|
+
<p>
|
|
427
|
+
Keeps doing requests until it doesn’t receive a 3XX request.
|
|
428
|
+
</p>
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
|
|
432
|
+
<div id="method-M000018" class="method-detail">
|
|
433
|
+
<a name="M000018"></a>
|
|
434
|
+
|
|
435
|
+
<div class="method-heading">
|
|
436
|
+
<a href="HttpClient.src/M000018.html" target="Code" class="method-signature"
|
|
437
|
+
onclick="popupCode('HttpClient.src/M000018.html');return false;">
|
|
438
|
+
<span class="method-name">reset</span><span class="method-args">()</span>
|
|
439
|
+
</a>
|
|
440
|
+
</div>
|
|
441
|
+
|
|
442
|
+
<div class="method-description">
|
|
443
|
+
<p>
|
|
444
|
+
Clears out the cookies in use so far in order to get a clean slate.
|
|
445
|
+
</p>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
|
|
449
|
+
<div id="method-M000015" class="method-detail">
|
|
450
|
+
<a name="M000015"></a>
|
|
451
|
+
|
|
452
|
+
<div class="method-heading">
|
|
453
|
+
<a href="HttpClient.src/M000015.html" target="Code" class="method-signature"
|
|
454
|
+
onclick="popupCode('HttpClient.src/M000015.html');return false;">
|
|
455
|
+
<span class="method-name">send_request</span><span class="method-args">(method, uri, req)</span>
|
|
456
|
+
</a>
|
|
457
|
+
</div>
|
|
458
|
+
|
|
459
|
+
<div class="method-description">
|
|
460
|
+
<p>
|
|
461
|
+
Does the socket connect and then <a
|
|
462
|
+
href="HttpClient.html#M000011">build_request</a>, <a
|
|
463
|
+
href="HttpClient.html#M000014">read_response</a> calls finally returning
|
|
464
|
+
the result.
|
|
465
|
+
</p>
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
</div>
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
<div id="validator-badges">
|
|
477
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
</body>
|
|
481
|
+
</html>
|