Skip to content
This repository
Browse code

Improve "make dist" remove generated doc from repo.

  • Loading branch information...
commit bf0d278a4501b03e74d9e02309d667af2182c2a3 1 parent 861f28f
ry authored October 03, 2009
3  .gitignore
@@ -3,5 +3,8 @@ build
3 3
 tags
4 4
 .lock-wscript
5 5
 *.pyc
  6
+doc/api.xml
  7
+doc/api.html
  8
+doc/node.1
6 9
 node
7 10
 node_g
26  Makefile
@@ -14,10 +14,10 @@ install:
14 14
 
15 15
 uninstall:
16 16
 	@tools/waf-light uninstall
17  
- 
  17
+
18 18
 test: all
19 19
 	python tools/test.py --mode=release
20  
-  
  20
+
21 21
 test-all: all
22 22
 	python tools/test.py --mode=debug,release
23 23
 
@@ -40,26 +40,34 @@ doc/api.xml: doc/api.txt
40 40
 	asciidoc -b docbook -d manpage -o doc/api.xml doc/api.txt
41 41
 
42 42
 doc/node.1: doc/api.xml
43  
-	xsltproc --output doc/node.1                \
44  
-		--nonet /etc/asciidoc/docbook-xsl/manpage.xsl \
45  
-		doc/api.xml
  43
+	xsltproc --output doc/node.1 --nonet doc/manpage.xsl doc/api.xml
46 44
 
47 45
 website-upload: doc
48 46
 	scp doc/* linode:~/tinyclouds/node/
49 47
 
50 48
 clean:
  49
+	@-rm doc/node.1 doc/api.xml doc/api.html
51 50
 	@tools/waf-light clean
52 51
 
53 52
 distclean:
54 53
 	@tools/waf-light distclean
55  
-	@-rm -rf _build_
56  
-	@-rm -f Makefile
57 54
 	@-rm -f *.pyc
58 55
 
59 56
 check:
60 57
 	@tools/waf-light check
61 58
 
62  
-dist:
63  
-	@tools/waf-light dist
  59
+VERSION=$(shell git-describe)
  60
+TARNAME=node-$(VERSION)
  61
+
  62
+dist: doc/node.1 doc/api.html
  63
+	git-archive --prefix=$(TARNAME)/ HEAD > $(TARNAME).tar
  64
+	mkdir -p $(TARNAME)/doc
  65
+	cp doc/node.1 $(TARNAME)/doc/node.1
  66
+	cp doc/api.html $(TARNAME)/doc/api.html
  67
+	tar rf $(TARNAME).tar   \
  68
+		$(TARNAME)/doc/node.1 \
  69
+		$(TARNAME)/doc/api.html
  70
+	rm -r $(TARNAME)
  71
+	gzip -f -9 $(TARNAME).tar
64 72
 
65 73
 .PHONY: benchmark clean dist distclean check uninstall install all test test-all website-upload
2,146  doc/api.html
... ...
@@ -1,2146 +0,0 @@
1  
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2  
-    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3  
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4  
-<head>
5  
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6  
-<meta name="generator" content="AsciiDoc 8.4.5" />
7  
-<title>NODE(1)</title>
8  
-<link rel="stylesheet" href="./pipe.css" type="text/css" />
9  
-<link rel="stylesheet" href="./pipe-quirks.css" type="text/css" />
10  
-<script type="text/javascript">
11  
-/*<![CDATA[*/
12  
-window.onload = function(){generateToc(2)}
13  
-/*]]>*/
14  
-</script>
15  
-<script type="text/javascript" src="./toc.js"></script>
16  
-</head>
17  
-<body>
18  
-<div id="header">
19  
-<h1>NODE(1)</h1>
20  
-<span id="author">Ryan Dahl</span><br />
21  
-<span id="email"><tt>&lt;<a href="mailto:ry@tinyclouds.org">ry@tinyclouds.org</a>&gt;</tt></span><br />
22  
-<span id="revnumber">version 0.1.13,</span>
23  
-<span id="revdate">2009.09.30</span>
24  
-<div id="toc">
25  
-  <div id="toctitle">Table of Contents</div>
26  
-  <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
27  
-</div>
28  
-</div>
29  
-<h2 id="_name">NAME</h2>
30  
-<div class="sectionbody">
31  
-<div class="paragraph"><p>node - evented I/O for V8 javascript</p></div>
32  
-</div>
33  
-<h2 id="_synopsis">SYNOPSIS</h2>
34  
-<div class="sectionbody">
35  
-<div class="paragraph"><p>An example of a web server written with Node which responds with "Hello
36  
-World":</p></div>
37  
-<div class="listingblock">
38  
-<div class="content">
39  
-<pre><tt>include("/utils.js");
40  
-include("/http.js");
41  
-createServer(function (request, response) {
42  
-  response.sendHeader(200, {"Content-Type": "text/plain"});
43  
-  response.sendBody("Hello World\n");
44  
-  response.finish();
45  
-}).listen(8000);
46  
-puts("Server running at http://127.0.0.1:8000/");</tt></pre>
47  
-</div></div>
48  
-<div class="paragraph"><p>To run the server, put the code into a file called <tt>example.js</tt> and execute
49  
-it with the node program</p></div>
50  
-<div class="listingblock">
51  
-<div class="content">
52  
-<pre><tt>&gt; node example.js
53  
-Server running at http://127.0.0.1:8000/</tt></pre>
54  
-</div></div>
55  
-</div>
56  
-<h2 id="_api">API</h2>
57  
-<div class="sectionbody">
58  
-<div class="paragraph"><p>Node supports 3 string encodings. UTF-8 (<tt>"utf8"</tt>), ASCII (<tt>"ascii"</tt>), and
59  
-Binary (<tt>"binary"</tt>). <tt>"ascii"</tt> and <tt>"binary"</tt> only look at the first 8 bits
60  
-of the 16bit javascript string characters. Both are relatively fast&#8212;use
61  
-them if you can. <tt>"utf8"</tt> is slower and should be avoided when possible.</p></div>
62  
-<div class="paragraph"><p>Unless otherwise noted, functions are all asynchronous and do not block
63  
-execution.</p></div>
64  
-<h3 id="_helpers">Helpers</h3><div style="clear:left"></div>
65  
-<div class="paragraph"><p>These objects are available to all programs.</p></div>
66  
-<div class="dlist"><dl>
67  
-<dt class="hdlist1">
68  
-<tt>node.cwd()</tt>
69  
-</dt>
70  
-<dd>
71  
-<p>
72  
-Returns the current working directory of the process.
73  
-</p>
74  
-</dd>
75  
-<dt class="hdlist1">
76  
-<tt>node.compile(source, scriptOrigin)</tt>
77  
-</dt>
78  
-<dd>
79  
-<p>
80  
-Just like <tt>eval()</tt> except that you can specify a <tt>scriptOrigin</tt> for better
81  
-error reporting.
82  
-</p>
83  
-</dd>
84  
-<dt class="hdlist1">
85  
-<tt>__filename</tt> 
86  
-</dt>
87  
-<dd>
88  
-<p>
89  
-The filename of the script being executed.
90  
-</p>
91  
-</dd>
92  
-<dt class="hdlist1">
93  
-<tt>require(path)</tt> 
94  
-</dt>
95  
-<dt class="hdlist1">
96  
-<tt>include(path)</tt> 
97  
-</dt>
98  
-<dd>
99  
-<p>
100  
-See the modules section.
101  
-</p>
102  
-</dd>
103  
-<dt class="hdlist1">
104  
-<tt>node.libraryPaths</tt> 
105  
-</dt>
106  
-<dd>
107  
-<p>
108  
-The search path for absolute path arguments to <tt>require()</tt> and <tt>include()</tt>.
109  
-</p>
110  
-</dd>
111  
-</dl></div>
112  
-<h3 id="_the_tt_process_tt_object">The <tt>process</tt> Object</h3><div style="clear:left"></div>
113  
-<div class="paragraph"><p><tt>process</tt> is the equivalent of <tt>window</tt> in browser-side javascript. It is
114  
-the global scope. <tt>process</tt> is an instance of <tt>node.EventEmitter</tt>.</p></div>
115  
-<div class="tableblock">
116  
-<table rules="all"
117  
-width="100%"
118  
-frame="border"
119  
-cellspacing="0" cellpadding="4">
120  
-<col width="7%" />
121  
-<col width="15%" />
122  
-<col width="76%" />
123  
-<thead>
124  
-<tr>
125  
-<th align="left" valign="top"> Event    </th>
126  
-<th align="left" valign="top"> Parameters </th>
127  
-<th align="left" valign="top"> Notes</th>
128  
-</tr>
129  
-</thead>
130  
-<tbody>
131  
-<tr>
132  
-<td align="left" valign="top"><p class="table"><tt>"exit"</tt></p></td>
133  
-<td align="left" valign="top"><p class="table"><tt>code</tt></p></td>
134  
-<td align="left" valign="top"><p class="table">Made when the process exits.
135  
-                          A listener on this event should not try to perform
136  
-                          I/O since the process will forcibly exit in less
137  
-                          than microsecond. However, it is a good hook to
138  
-                          perform constant time checks of the module&#8217;s
139  
-                          state (like for unit tests).
140  
-                         <br />
141  
-                          The parameter <tt>code</tt> is the integer exit code
142  
-                          passed to <tt>process.exit()</tt>.</p></td>
143  
-</tr>
144  
-</tbody>
145  
-</table>
146  
-</div>
147  
-<div class="dlist"><dl>
148  
-<dt class="hdlist1">
149  
-<tt>process.exit(code=0)</tt>
150  
-</dt>
151  
-<dd>
152  
-<p>
153  
-Ends the process with the specified code. By default it exits with the
154  
-success code 0.
155  
-</p>
156  
-</dd>
157  
-<dt class="hdlist1">
158  
-<tt>process.ARGV</tt> 
159  
-</dt>
160  
-<dd>
161  
-<p>
162  
-An array containing the command line arguments.
163  
-</p>
164  
-</dd>
165  
-<dt class="hdlist1">
166  
-<tt>process.ENV</tt> 
167  
-</dt>
168  
-<dd>
169  
-<p>
170  
-An object containing the user environment. See environ(7).
171  
-</p>
172  
-</dd>
173  
-</dl></div>
174  
-<h3 id="_utilities">Utilities</h3><div style="clear:left"></div>
175  
-<div class="paragraph"><p>These function are in <tt>"/utils.js"</tt>. Use <tt>require("/utils.js")</tt> to access them.</p></div>
176  
-<div class="dlist"><dl>
177  
-<dt class="hdlist1">
178  
-<tt>puts(string)</tt>
179  
-</dt>
180  
-<dd>
181  
-<p>
182  
-Outputs the <tt>string</tt> and a trailing new-line to <tt>stdout</tt>.
183  
-</p>
184  
-</dd>
185  
-<dt class="hdlist1">
186  
-<tt>print(string)</tt>
187  
-</dt>
188  
-<dd>
189  
-<p>
190  
-Like <tt>puts()</tt> but without the trailing new-line.
191  
-</p>
192  
-</dd>
193  
-<dt class="hdlist1">
194  
-<tt>debug(string)</tt>
195  
-</dt>
196  
-<dd>
197  
-<p>
198  
-A synchronous output function. Will block the process and
199  
-output the string immediately to stdout.
200  
-</p>
201  
-</dd>
202  
-<dt class="hdlist1">
203  
-<tt>inspect(object)</tt> 
204  
-</dt>
205  
-<dd>
206  
-<p>
207  
-Return a string representation of the <tt>object</tt>. (For debugging.)
208  
-</p>
209  
-</dd>
210  
-<dt class="hdlist1">
211  
-<tt>exec(command)</tt>
212  
-</dt>
213  
-<dd>
214  
-<p>
215  
-Executes the command as a child process, buffers the output and returns it
216  
-in a promise callback.
217  
-</p>
218  
-<div class="listingblock">
219  
-<div class="content">
220  
-<pre><tt>include("/utils.js");
221  
-exec("ls /").addCallback(function (stdout, stderr) {
222  
-  puts(stdout);
223  
-});</tt></pre>
224  
-</div></div>
225  
-<div class="ulist"><ul>
226  
-<li>
227  
-<p>
228  
-on success: stdout buffer, stderr buffer
229  
-</p>
230  
-</li>
231  
-<li>
232  
-<p>
233  
-on error: exit code, stdout buffer, stderr buffer
234  
-</p>
235  
-</li>
236  
-</ul></div>
237  
-</dd>
238  
-</dl></div>
239  
-<h3 id="_events">Events</h3><div style="clear:left"></div>
240  
-<div class="paragraph"><p>Many objects in Node emit events: a TCP server emits an event each time
241  
-there is a connection, a child process emits an event when it exits. All
242  
-objects which emit events are are instances of <tt>node.EventEmitter</tt>.</p></div>
243  
-<div class="paragraph"><p>Events are represented by a camel-cased string. Here are some examples:
244  
-<tt>"connection"</tt>, <tt>"receive"</tt>, <tt>"messageBegin"</tt>.</p></div>
245  
-<div class="paragraph"><p>Functions can be then be attached to objects, to be executed when an event
246  
-is emitted. These functions are called <em>listeners</em>.</p></div>
247  
-<div class="paragraph"><p>Some asynchronous file operations return an <tt>EventEmitter</tt> called a
248  
-<em>promise</em>.  A promise emits just a single event when the operation is
249  
-complete.</p></div>
250  
-<h4 id="_tt_node_eventemitter_tt"><tt>node.EventEmitter</tt></h4>
251  
-<div class="paragraph"><p>All EventEmitters emit the event <tt>"newListener"</tt> when new listeners are
252  
-added.</p></div>
253  
-<div class="tableblock">
254  
-<table rules="all"
255  
-width="100%"
256  
-frame="border"
257  
-cellspacing="0" cellpadding="4">
258  
-<col width="7%" />
259  
-<col width="15%" />
260  
-<col width="76%" />
261  
-<thead>
262  
-<tr>
263  
-<th align="left" valign="top"> Event           </th>
264  
-<th align="left" valign="top"> Parameters       </th>
265  
-<th align="left" valign="top"> Notes</th>
266  
-</tr>
267  
-</thead>
268  
-<tbody>
269  
-<tr>
270  
-<td align="left" valign="top"><p class="table"><tt>"newListener"</tt></p></td>
271  
-<td align="left" valign="top"><p class="table"><tt>event, listener</tt></p></td>
272  
-<td align="left" valign="top"><p class="table">This event is made
273  
-                                       any time someone adds
274  
-                                       a new listener.</p></td>
275  
-</tr>
276  
-</tbody>
277  
-</table>
278  
-</div>
279  
-<div class="dlist"><dl>
280  
-<dt class="hdlist1">
281  
-<tt>emitter.addListener(event, listener)</tt> 
282  
-</dt>
283  
-<dd>
284  
-<p>
285  
-Adds a listener to the end of the listeners array for the specified event.
286  
-</p>
287  
-<div class="listingblock">
288  
-<div class="content">
289  
-<pre><tt>server.addListener("connection", function (socket) {
290  
-  puts("someone connected!");
291  
-});</tt></pre>
292  
-</div></div>
293  
-</dd>
294  
-<dt class="hdlist1">
295  
-<tt>emitter.listeners(event)</tt> 
296  
-</dt>
297  
-<dd>
298  
-<p>
299  
-Returns an array of listeners for the specified event. This array can be
300  
-manipulated, e.g. to remove listeners.
301  
-</p>
302  
-</dd>
303  
-<dt class="hdlist1">
304  
-<tt>emitter.emit(event, arg1, arg2, &#8230;)</tt> 
305  
-</dt>
306  
-<dd>
307  
-<p>
308  
-Execute each of the listeners in order with the supplied arguments.
309  
-</p>
310  
-</dd>
311  
-</dl></div>
312  
-<h4 id="_tt_node_promise_tt"><tt>node.Promise</tt></h4>
313  
-<div class="paragraph"><p><tt>node.Promise</tt> inherits from <tt>node.eventEmitter</tt>. A promise emits one of two
314  
-events: <tt>"success"</tt> or <tt>"error"</tt>.  After emitting its event, it will not
315  
-emit anymore events.</p></div>
316  
-<div class="tableblock">
317  
-<table rules="all"
318  
-width="100%"
319  
-frame="border"
320  
-cellspacing="0" cellpadding="4">
321  
-<col width="7%" />
322  
-<col width="15%" />
323  
-<col width="76%" />
324  
-<thead>
325  
-<tr>
326  
-<th align="left" valign="top"> Event       </th>
327  
-<th align="left" valign="top"> Parameters       </th>
328  
-<th align="left" valign="top"> Notes</th>
329  
-</tr>
330  
-</thead>
331  
-<tbody>
332  
-<tr>
333  
-<td align="left" valign="top"><p class="table"><tt>"success"</tt></p></td>
334  
-<td align="left" valign="top"><p class="table">(depends)</p></td>
335  
-<td align="left" valign="top"><p class="table"></p></td>
336  
-</tr>
337  
-<tr>
338  
-<td align="left" valign="top"><p class="table"><tt>"error"</tt></p></td>
339  
-<td align="left" valign="top"><p class="table">(depends)</p></td>
340  
-<td align="left" valign="top"><p class="table"></p></td>
341  
-</tr>
342  
-</tbody>
343  
-</table>
344  
-</div>
345  
-<div class="dlist"><dl>
346  
-<dt class="hdlist1">
347  
-<tt>promise.addCallback(listener)</tt> 
348  
-</dt>
349  
-<dd>
350  
-<p>
351  
-Adds a listener for the <tt>"success"</tt> event. Returns the same promise object.
352  
-</p>
353  
-</dd>
354  
-<dt class="hdlist1">
355  
-<tt>promise.addErrback(listener)</tt> 
356  
-</dt>
357  
-<dd>
358  
-<p>
359  
-Adds a listener for the <tt>"error"</tt> event. Returns the same promise object.
360  
-</p>
361  
-</dd>
362  
-<dt class="hdlist1">
363  
-<tt>promise.emitSuccess(arg1, arg2, &#8230;)</tt> 
364  
-</dt>
365  
-<dd>
366  
-<p>
367  
-If you created the promise (by doing <tt>new node.Promise()</tt>) then call
368  
-<tt>emitSuccess</tt> to emit the <tt>"success"</tt> event with the given arguments.
369  
-</p>
370  
-<div class="paragraph"><p>(<tt>promise.emit("success", arg1, arg2, &#8230;)</tt> should also work, but doesn&#8217;t at
371  
-the moment due to a bug; use <tt>emitSuccess</tt> instead.)</p></div>
372  
-</dd>
373  
-<dt class="hdlist1">
374  
-<tt>promise.emitError(arg1, arg2, &#8230;)</tt> 
375  
-</dt>
376  
-<dd>
377  
-<p>
378  
-Emits the <tt>"error"</tt> event.
379  
-</p>
380  
-</dd>
381  
-<dt class="hdlist1">
382  
-<tt>promise.wait()</tt> 
383  
-</dt>
384  
-<dd>
385  
-<p>
386  
-Blocks futher execution until the promise emits a success or error event.
387  
-Events setup before the call to <tt>promise.wait()</tt> was made may still be
388  
-emitted and executed while <tt>promise.wait()</tt> is blocking.
389  
-</p>
390  
-<div class="paragraph"><p>If there was a single argument to the <tt>"success"</tt> event then it is returned.
391  
-If there were multiple arguments to <tt>"success"</tt> then they are returned as an
392  
-array.</p></div>
393  
-<div class="paragraph"><p>If <tt>"error"</tt> was emitted instead, <tt>wait()</tt> throws an error.</p></div>
394  
-<div class="paragraph"><p><strong>IMPORTANT</strong> <tt>promise.wait()</tt> is not a true fiber/coroutine. If any other
395  
-promises are created and made to wait while the first promise waits, the
396  
-first promise&#8217;s wait will not return until all others return. The benefit of
397  
-this is a simple implementation and the event loop does not get blocked.
398  
-Disadvantage is the possibility of situations where the promise stack grows
399  
-infinitely large because promises keep getting created and keep being told
400  
-to wait(). Use <tt>promise.wait()</tt> sparingly&#8212;probably best used only during
401  
-program setup, not during busy server activity.</p></div>
402  
-</dd>
403  
-</dl></div>
404  
-<h3 id="_standard_i_o">Standard I/O</h3><div style="clear:left"></div>
405  
-<div class="paragraph"><p>Standard I/O is handled through a special object <tt>node.stdio</tt>. stdout and
406  
-stdin are fully non-blocking (even when piping to files). stderr is
407  
-synchronous.</p></div>
408  
-<div class="tableblock">
409  
-<table rules="all"
410  
-width="100%"
411  
-frame="border"
412  
-cellspacing="0" cellpadding="4">
413  
-<col width="7%" />
414  
-<col width="15%" />
415  
-<col width="76%" />
416  
-<thead>
417  
-<tr>
418  
-<th align="left" valign="top"> Event      </th>
419  
-<th align="left" valign="top"> Parameters </th>
420  
-<th align="left" valign="top"> Notes</th>
421  
-</tr>
422  
-</thead>
423  
-<tbody>
424  
-<tr>
425  
-<td align="left" valign="top"><p class="table"><tt>"data"</tt></p></td>
426  
-<td align="left" valign="top"><p class="table"><tt>data</tt></p></td>
427  
-<td align="left" valign="top"><p class="table">Made when stdin has received a chunk of data.
428  
-                            Depending on the encoding that stdin was opened
429  
-                            with, <tt>data</tt> will be  a string. This event will
430  
-                            only be emited after <tt>node.stdio.open()</tt> has
431  
-                            been called.</p></td>
432  
-</tr>
433  
-<tr>
434  
-<td align="left" valign="top"><p class="table"><tt>"close"</tt></p></td>
435  
-<td align="left" valign="top"><p class="table"></p></td>
436  
-<td align="left" valign="top"><p class="table">Made when stdin has been closed.</p></td>
437  
-</tr>
438  
-</tbody>
439  
-</table>
440  
-</div>
441  
-<div class="dlist"><dl>
442  
-<dt class="hdlist1">
443  
-<tt>node.stdio.open(encoding="utf8")</tt>
444  
-</dt>
445  
-<dd>
446  
-<p>
447  
-Open stdin. The program will not exit until <tt>node.stdio.close()</tt> has been
448  
-called or the <tt>"close"</tt> event has been emitted.
449  
-</p>
450  
-</dd>
451  
-<dt class="hdlist1">
452  
-<tt>node.stdio.write(data)</tt>
453  
-</dt>
454  
-<dd>
455  
-<p>
456  
-Write data to stdout.
457  
-</p>
458  
-</dd>
459  
-<dt class="hdlist1">
460  
-<tt>node.stdio.writeError(data)</tt>
461  
-</dt>
462  
-<dd>
463  
-<p>
464  
-Write data to stderr. Synchronous.
465  
-</p>
466  
-</dd>
467  
-<dt class="hdlist1">
468  
-<tt>node.stdio.close()</tt>
469  
-</dt>
470  
-<dd>
471  
-<p>
472  
-Close stdin.
473  
-</p>
474  
-</dd>
475  
-</dl></div>
476  
-<h3 id="_modules">Modules</h3><div style="clear:left"></div>
477  
-<div class="paragraph"><p>Node has a simple module loading system.  In Node, files and modules are in
478  
-one-to-one correspondence.  As an example, <tt>foo.js</tt> loads the module
479  
-<tt>circle.js</tt>.</p></div>
480  
-<div class="paragraph"><p>The contents of <tt>foo.js</tt>:</p></div>
481  
-<div class="listingblock">
482  
-<div class="content">
483  
-<pre><tt>var circle = require("circle.js");
484  
-include("/utils.js");
485  
-puts("The area of a circle of radius 4 is " + circle.area(4));</tt></pre>
486  
-</div></div>
487  
-<div class="paragraph"><p>The contents of <tt>circle.js</tt>:</p></div>
488  
-<div class="listingblock">
489  
-<div class="content">
490  
-<pre><tt>var PI = 3.14;
491  
-
492  
-exports.area = function (r) {
493  
-  return PI * r * r;
494  
-};
495  
-
496  
-exports.circumference = function (r) {
497  
-  return 2 * PI * r;
498  
-};</tt></pre>
499  
-</div></div>
500  
-<div class="paragraph"><p>The module <tt>circle.js</tt> has exported the functions <tt>area()</tt> and
501  
-<tt>circumference()</tt>.  To export an object, add to the special <tt>exports</tt>
502  
-object.  (Alternatively, one can use <tt>this</tt> instead of <tt>exports</tt>.) Variables
503  
-local to the module will be private. In this example the variable <tt>PI</tt> is
504  
-private to <tt>circle.js</tt>. The function <tt>puts()</tt> comes from the module
505  
-<tt>"/utils.js"</tt>. Because <tt>include("/utils.js")</tt> was called, <tt>puts()</tt> is in the
506  
-global namespace.</p></div>
507  
-<div class="paragraph"><p>The module path is relative to the file calling <tt>require()</tt>.  That is,
508  
-<tt>circle.js</tt> must be in the same directory as <tt>foo.js</tt> for <tt>require()</tt> to
509  
-find it.</p></div>
510  
-<div class="paragraph"><p>Like <tt>require()</tt> the function <tt>include()</tt> also loads a module. Instead of
511  
-returning a namespace object, <tt>include()</tt> will add the module&#8217;s exports into
512  
-the global namespace. For example:</p></div>
513  
-<div class="listingblock">
514  
-<div class="content">
515  
-<pre><tt>include("circle.js");
516  
-include("/utils.js");
517  
-puts("The area of a cirlce of radius 4 is " + area(4));</tt></pre>
518  
-</div></div>
519  
-<div class="paragraph"><p>When an absolute path is given to <tt>require()</tt> or <tt>include()</tt>, like
520  
-<tt>require("/mjsunit.js")</tt> the module is searched for in the
521  
-<tt>node.libraryPaths</tt> array. <tt>node.libraryPaths</tt> on my system looks like this:</p></div>
522  
-<div class="listingblock">
523  
-<div class="content">
524  
-<pre><tt>[ "/home/ryan/.node_libraries"
525  
-, "/home/ryan/local/node/lib/node_libraries"
526  
-, "/"
527  
-]</tt></pre>
528  
-</div></div>
529  
-<div class="paragraph"><p>That is, first Node looks for <tt>"/home/ryan/.node_libraries/mjsunit.js"</tt> and
530  
-then for <tt>"/home/ryan/local/node/lib/node_libraries/mjsunit.js"</tt>. If not
531  
-found, it finally looks for <tt>"/mjsunit.js"</tt> (in the root directory).</p></div>
532  
-<div class="paragraph"><p><tt>node.libraryPaths</tt> can be modified at runtime by simply unshifting new
533  
-paths on to it and at startup with the <tt>NODE_LIBRARY_PATHS</tt> environmental
534  
-variable (which should be a list of paths, colon separated).</p></div>
535  
-<div class="paragraph"><p>Node comes with several libraries which are installed when <tt>"make install"</tt>
536  
-is run. These are currently undocumented, but do look them up in your
537  
-system.</p></div>
538  
-<h3 id="_timers">Timers</h3><div style="clear:left"></div>
539  
-<div class="dlist"><dl>
540  
-<dt class="hdlist1">
541  
-<tt>setTimeout(callback, delay)</tt>
542  
-</dt>
543  
-<dd>
544  
-<p>
545  
-To schedule execution of callback after delay milliseconds. Returns a
546  
-<tt>timeoutId</tt> for possible use with <tt>clearTimeout()</tt>.
547  
-</p>
548  
-</dd>
549  
-<dt class="hdlist1">
550  
-<tt>clearTimeout(timeoutId)</tt>
551  
-</dt>
552  
-<dd>
553  
-<p>
554  
-Prevents said timeout from triggering.
555  
-</p>
556  
-</dd>
557  
-<dt class="hdlist1">
558  
-<tt>setInterval(callback, delay)</tt>
559  
-</dt>
560  
-<dd>
561  
-<p>
562  
-To schedule the repeated execution of callback every <tt>delay</tt> milliseconds. Returns
563  
-a <tt>intervalId</tt> for possible use with <tt>clearInterval()</tt>.
564  
-</p>
565  
-</dd>
566  
-<dt class="hdlist1">
567  
-<tt>clearInterval(intervalId)</tt>
568  
-</dt>
569  
-<dd>
570  
-<p>
571  
-Stops a interval from triggering.
572  
-</p>
573  
-</dd>
574  
-</dl></div>
575  
-<h3 id="_child_processes">Child Processes</h3><div style="clear:left"></div>
576  
-<div class="paragraph"><p>Node provides a tridirectional <tt>popen(3)</tt> facility through the class
577  
-<tt>node.ChildProcess</tt>. It is possible to stream data through the child&#8217;s <tt>stdin</tt>,
578  
-<tt>stdout</tt>, and <tt>stderr</tt> in a fully non-blocking way.</p></div>
579  
-<h4 id="_tt_node_childprocess_tt"><tt>node.ChildProcess</tt></h4>
580  
-<div class="tableblock">
581  
-<table rules="all"
582  
-width="100%"
583  
-frame="border"
584  
-cellspacing="0" cellpadding="4">
585  
-<col width="7%" />
586  
-<col width="15%" />
587  
-<col width="76%" />
588  
-<thead>
589  
-<tr>
590  
-<th align="left" valign="top"> Event      </th>
591  
-<th align="left" valign="top"> Parameters </th>
592  
-<th align="left" valign="top">Notes</th>
593  
-</tr>
594  
-</thead>
595  
-<tbody>
596  
-<tr>
597  
-<td align="left" valign="top"><p class="table"><tt>"output"</tt></p></td>
598  
-<td align="left" valign="top"><p class="table"><tt>data</tt></p></td>
599  
-<td align="left" valign="top"><p class="table">Each time the child process
600  
-                            sends data to its <tt>stdout</tt>, this event is
601  
-                            emitted. <tt>data</tt> is a string.  + If the child
602  
-                            process closes its <tt>stdout</tt> stream (a common
603  
-                            thing to do on exit), this event will be emitted
604  
-                            with <tt>data === null</tt>.</p></td>
605  
-</tr>
606  
-<tr>
607  
-<td align="left" valign="top"><p class="table"><tt>"error"</tt></p></td>
608  
-<td align="left" valign="top"><p class="table"><tt>data</tt></p></td>
609  
-<td align="left" valign="top"><p class="table">Identical to the <tt>"output"</tt> event except for
610  
-                            <tt>stderr</tt> instead of <tt>stdout</tt>.</p></td>
611  
-</tr>
612  
-<tr>
613  
-<td align="left" valign="top"><p class="table"><tt>"exit"</tt></p></td>
614  
-<td align="left" valign="top"><p class="table"><tt>code</tt></p></td>
615  
-<td align="left" valign="top"><p class="table">This event is emitted after the child process
616  
-                            ends. <tt>code</tt> is the final exit code of the
617  
-                            process. One can be assured that after this
618  
-                            event is emitted that the <tt>"output"</tt> and
619  
-                            <tt>"error"</tt> callbacks will no longer be made.</p></td>
620  
-</tr>
621  
-</tbody>
622  
-</table>
623  
-</div>
624  
-<div class="dlist"><dl>
625  
-<dt class="hdlist1">
626  
-<tt>node.createChildProcess(command)</tt>
627  
-</dt>
628  
-<dd>
629  
-<p>
630  
-Launches a new process with the given <tt>command</tt>. For example:
631  
-</p>
632  
-<div class="listingblock">
633  
-<div class="content">
634  
-<pre><tt>var ls = node.createChildProcess("ls -lh /usr");
635  
-ls.addListener("output", function (data) {
636  
-  puts(data);
637  
-});</tt></pre>
638  
-</div></div>
639  
-</dd>
640  
-<dt class="hdlist1">
641  
-<tt>child.pid</tt> 
642  
-</dt>
643  
-<dd>
644  
-<p>
645  
-The PID of the child process.
646  
-</p>
647  
-</dd>
648  
-<dt class="hdlist1">
649  
-<tt>child.write(data, encoding="ascii")</tt> 
650  
-</dt>
651  
-<dd>
652  
-<p>
653  
-Write data to the child process&#8217;s <tt>stdin</tt>. The second argument is optional and
654  
-specifies the encoding: possible values are <tt>"utf8"</tt>, <tt>"ascii"</tt>, and
655  
-<tt>"binary"</tt>.
656  
-</p>
657  
-</dd>
658  
-<dt class="hdlist1">
659  
-<tt>child.close()</tt> 
660  
-</dt>
661  
-<dd>
662  
-<p>
663  
-Closes the process&#8217;s <tt>stdin</tt> stream.
664  
-</p>
665  
-</dd>
666  
-<dt class="hdlist1">
667  
-<tt>child.kill(signal=node.SIGTERM)</tt> 
668  
-</dt>
669  
-<dd>
670  
-<p>
671  
-Send a single to the child process.  If no argument is given, the process
672  
-will be sent <tt>node.SIGTERM</tt>.  The standard POSIX signals are defined under
673  
-the <tt>node</tt> namespace (<tt>node.SIGINT</tt>, <tt>node.SIGUSR1</tt>, &#8230;).
674  
-</p>
675  
-</dd>
676  
-</dl></div>
677  
-<h3 id="_file_i_o">File I/O</h3><div style="clear:left"></div>
678  
-<div class="paragraph"><p>File I/O is provided by simple wrappers around standard POSIX functions.
679  
-All POSIX wrappers have a similar form.
680  
-They return a promise (<tt>node.Promise</tt>). Example:</p></div>
681  
-<div class="listingblock">
682  
-<div class="content">
683  
-<pre><tt>var promise = node.fs.unlink("/tmp/hello");
684  
-promise.addCallback(function () {
685  
-  puts("successfully deleted /tmp/hello");
686  
-});</tt></pre>
687  
-</div></div>
688  
-<div class="paragraph"><p>There is no guaranteed ordering to the POSIX wrappers. The
689  
-following is very much prone to error</p></div>
690  
-<div class="listingblock">
691  
-<div class="content">
692  
-<pre><tt>node.fs.rename("/tmp/hello", "/tmp/world");
693  
-node.fs.stat("/tmp/world").addCallback(function (stats) {
694  
-  puts("stats: " + JSON.stringify(stats));
695  
-});</tt></pre>
696  
-</div></div>
697  
-<div class="paragraph"><p>It could be that <tt>stat()</tt> is executed before the <tt>rename()</tt>.
698  
-The correct way to do this is to chain the promises.</p></div>
699  
-<div class="listingblock">
700  
-<div class="content">
701  
-<pre><tt>node.fs.rename("/tmp/hello", "/tmp/world").addCallback(function () {
702  
-  node.fs.stat("/tmp/world").addCallback(function (stats) {
703  
-    puts("stats: " + JSON.stringify(stats));
704  
-  });
705  
-});</tt></pre>
706  
-</div></div>
707  
-<div class="paragraph"><p>Or use the <tt>promise.wait()</tt> functionality:</p></div>
708  
-<div class="listingblock">
709  
-<div class="content">
710  
-<pre><tt>node.fs.rename("/tmp/hello", "/tmp/world").wait();
711  
-node.fs.stat("/tmp/world").addCallback(function (stats) {
712  
-  puts("stats: " + JSON.stringify(stats));
713  
-});</tt></pre>
714  
-</div></div>
715  
-<div class="dlist"><dl>
716  
-<dt class="hdlist1">
717  
-<tt>node.fs.rename(path1, path2)</tt> 
718  
-</dt>
719  
-<dd>
720  
-<p>
721  
-  See rename(2).
722  
-</p>
723  
-<div class="ulist"><ul>
724  
-<li>
725  
-<p>
726  
-on success: no parameters.
727  
-</p>
728  
-</li>
729  
-<li>
730  
-<p>
731  
-on error: no parameters.
732  
-</p>
733  
-</li>
734  
-</ul></div>
735  
-</dd>
736  
-<dt class="hdlist1">
737  
-<tt>node.fs.stat(path)</tt> 
738  
-</dt>
739  
-<dd>
740  
-<p>
741  
-  See stat(2).
742  
-</p>
743  
-<div class="ulist"><ul>
744  
-<li>
745  
-<p>
746  
-on success: Returns <tt>node.fs.Stats</tt> object. It looks like this:
747  
-    <tt>{ dev: 2049, ino: 305352, mode: 16877, nlink: 12, uid: 1000, gid: 1000,
748  
-    rdev: 0, size: 4096, blksize: 4096, blocks: 8, atime:
749  
-    "2009-06-29T11:11:55Z", mtime: "2009-06-29T11:11:40Z", ctime:
750  
-    "2009-06-29T11:11:40Z" }</tt>
751  
-    See the <tt>node.fs.Stats</tt> section below for more information.
752  
-</p>
753  
-</li>
754  
-<li>
755  
-<p>
756  
-on error: no parameters.
757  
-</p>
758  
-</li>
759  
-</ul></div>
760  
-</dd>
761  
-<dt class="hdlist1">
762  
-<tt>node.fs.unlink(path)</tt> 
763  
-</dt>
764  
-<dd>
765  
-<p>
766  
-  See unlink(2)
767  
-</p>
768  
-<div class="ulist"><ul>
769  
-<li>
770  
-<p>
771  
-on success: no parameters.
772  
-</p>
773  
-</li>
774  
-<li>
775  
-<p>
776  
-on error: no parameters.
777  
-</p>
778  
-</li>
779  
-</ul></div>
780  
-</dd>
781  
-<dt class="hdlist1">
782  
-<tt>node.fs.rmdir(path)</tt> 
783  
-</dt>
784  
-<dd>
785  
-<p>
786  
-  See rmdir(2)
787  
-</p>
788  
-<div class="ulist"><ul>
789  
-<li>
790  
-<p>
791  
-on success: no parameters.
792  
-</p>
793  
-</li>
794  
-<li>
795  
-<p>
796  
-on error: no parameters.
797  
-</p>
798  
-</li>
799  
-</ul></div>
800  
-</dd>
801  
-<dt class="hdlist1">
802  
-<tt>node.fs.mkdir(path, mode)</tt> 
803  
-</dt>
804  
-<dd>
805  
-<p>
806  
-  See mkdir(2)
807  
-</p>
808  
-<div class="ulist"><ul>
809  
-<li>
810  
-<p>
811  
-on success: no parameters.
812  
-</p>
813  
-</li>
814  
-<li>
815  
-<p>
816  
-on error: no parameters.
817  
-</p>
818  
-</li>
819  
-</ul></div>
820  
-</dd>
821  
-<dt class="hdlist1">
822  
-<tt>node.fs.readdir(path)</tt> 
823  
-</dt>
824  
-<dd>
825  
-<p>
826  
-  Reads the contents of a directory.
827  
-</p>
828  
-<div class="ulist"><ul>
829  
-<li>
830  
-<p>
831  
-on success: One argument, an array containing the names (strings) of the
832  
-    files in the directory (excluding "." and "..").
833  
-</p>
834  
-</li>
835  
-<li>
836  
-<p>
837  
-on error: no parameters.
838  
-</p>
839  
-</li>
840  
-</ul></div>
841  
-</dd>
842  
-<dt class="hdlist1">
843  
-<tt>node.fs.close(fd)</tt> 
844  
-</dt>
845  
-<dd>
846  
-<p>
847  
-  See close(2)
848  
-</p>
849  
-<div class="ulist"><ul>
850  
-<li>
851  
-<p>
852  
-on success: no parameters.
853  
-</p>
854  
-</li>
855  
-<li>
856  
-<p>
857  
-on error: no parameters.
858  
-</p>
859  
-</li>
860  
-</ul></div>
861  
-</dd>
862  
-<dt class="hdlist1">
863  
-<tt>node.fs.open(path, flags, mode)</tt>
864  
-</dt>
865  
-<dd>
866  
-<p>
867  
-  See open(2). The constants like <tt>O_CREAT</tt> are defined at <tt>node.O_CREAT</tt>.
868  
-</p>
869  
-<div class="ulist"><ul>
870  
-<li>
871  
-<p>
872  
-on success: <tt>fd</tt> is given as the parameter.
873  
-</p>
874  
-</li>
875  
-<li>
876  
-<p>
877  
-on error: no parameters.
878  
-</p>
879  
-</li>
880  
-</ul></div>
881  
-</dd>
882  
-<dt class="hdlist1">
883  
-<tt>node.fs.write(fd, data, position, encoding)</tt>
884  
-</dt>
885  
-<dd>
886  
-<p>
887  
-  Write data to the file specified by <tt>fd</tt>.  <tt>position</tt> refers to the offset
888  
-  from the beginning of the file where this data should be written. If
889  
-  <tt>position</tt> is <tt>null</tt>, the data will be written at the current position.
890  
-  See pwrite(2).
891  
-</p>
892  
-<div class="ulist"><ul>
893  
-<li>
894  
-<p>
895  
-on success: returns an integer <tt>written</tt> which specifies how many <em>bytes</em> were written.
896  
-</p>
897  
-</li>
898  
-<li>
899  
-<p>
900  
-on error: no parameters.
901  
-</p>
902  
-</li>
903  
-</ul></div>
904  
-</dd>
905  
-<dt class="hdlist1">
906  
-<tt>node.fs.read(fd, length, position, encoding)</tt>
907  
-</dt>
908  
-<dd>
909  
-<p>
910  
-Read data from the file specified by <tt>fd</tt>.
911  
-</p>
912  
-<div class="paragraph"><p><tt>length</tt> is an integer specifying the number of
913  
-bytes to read.</p></div>
914  
-<div class="paragraph"><p><tt>position</tt> is an integer specifying where to begin
915  
-reading from in the file.</p></div>
916  
-<div class="ulist"><ul>
917  
-<li>
918  
-<p>
919  
-on success: returns <tt>data, bytes_read</tt>, what was read from the file.
920  
-</p>
921  
-</li>
922  
-<li>
923  
-<p>
924  
-on error: no parameters.
925  
-</p>
926  
-</li>
927  
-</ul></div>
928  
-</dd>
929  
-<dt class="hdlist1">
930  
-<tt>node.fs.cat(filename, encoding="utf8")</tt>
931  
-</dt>
932  
-<dd>
933  
-<p>
934  
-Outputs the entire contents of a file. Example:
935  
-</p>
936  
-<div class="listingblock">
937  
-<div class="content">
938  
-<pre><tt>node.fs.cat("/etc/passwd").addCallback(function (content) {
939  
-  puts(content);
940  
-});</tt></pre>
941  
-</div></div>
942  
-<div class="ulist"><ul>
943  
-<li>
944  
-<p>
945  
-on success: returns <tt>data</tt>, what was read from the file.
946  
-</p>
947  
-</li>
948  
-<li>
949  
-<p>
950  
-on error: no parameters.
951  
-</p>
952  
-</li>
953  
-</ul></div>
954  
-</dd>
955  
-</dl></div>
956  
-<h4 id="_tt_node_fs_stats_tt"><tt>node.fs.Stats</tt></h4>
957  
-<div class="paragraph"><p>Objects returned from <tt>node.fs.stat()</tt> are of this type.</p></div>
958  
-<div class="dlist"><dl>
959  
-<dt class="hdlist1">
960  
-<tt>stats.isFile()</tt>
961  
-</dt>
962  
-<dt class="hdlist1">
963  
-<tt>stats.isDirectory()</tt>
964  
-</dt>
965  
-<dt class="hdlist1">
966  
-<tt>stats.isBlockDevice()</tt>
967  
-</dt>
968  
-<dt class="hdlist1">
969  
-<tt>stats.isCharacterDevice()</tt>
970  
-</dt>
971  
-<dt class="hdlist1">
972  
-<tt>stats.isSymbolicLink()</tt>
973  
-</dt>
974  
-<dt class="hdlist1">
975  
-<tt>stats.isFIFO()</tt>
976  
-</dt>
977  
-<dt class="hdlist1">
978  
-<tt>stats.isSocket()</tt>
979  
-</dt>
980  
-<dd>
981  
-<p>
982  
-&#8230;
983  
-</p>
984  
-</dd>
985  
-</dl></div>
986  
-<h3 id="_http">HTTP</h3><div style="clear:left"></div>
987  
-<div class="paragraph"><p>To use the HTTP server and client one must <tt>require("/http.js")</tt> or
988  
-<tt>include("/http.js")</tt>.</p></div>
989  
-<div class="paragraph"><p>The HTTP interfaces in Node are designed to support many features
990  
-of the protocol which have been traditionally difficult to use.
991  
-In particular, large, possibly chunk-encoded, messages. The interface is
992  
-careful to never buffer entire requests or responses&#8212;the
993  
-user is able to stream data.</p></div>
994  
-<div class="paragraph"><p>HTTP message headers are represented by an object like this</p></div>
995  
-<div class="listingblock">
996  
-<div class="content">
997  
-<pre><tt>{ "Content-Length": "123"
998  
-, "Content-Type": "text/plain"
999  
-, "Connection": "keep-alive"
1000  
-, "Accept": "*/*"
1001  
-}</tt></pre>
1002  
-</div></div>
1003  
-<div class="paragraph"><p>In order to support the full spectrum of possible HTTP applications, Node&#8217;s
1004  
-HTTP API is very low-level. It deals with connection handling and message
1005  
-parsing only. It parses a message into headers and body but it does not
1006  
-parse the actual headers or the body.</p></div>
1007  
-<h4 id="_tt_http_server_tt"><tt>http.Server</tt></h4>
1008  
-<div class="tableblock">
1009  
-<table rules="all"
1010  
-width="100%"
1011  
-frame="border"
1012  
-cellspacing="0" cellpadding="4">
1013  
-<col width="7%" />
1014  
-<col width="15%" />
1015  
-<col width="76%" />
1016  
-<thead>
1017  
-<tr>
1018  
-<th align="left" valign="top">Event           </th>
1019  
-<th align="left" valign="top"> Parameters          </th>
1020  
-<th align="left" valign="top"> Notes</th>
1021  
-</tr>
1022  
-</thead>
1023  
-<tbody>
1024  
-<tr>
1025  
-<td align="left" valign="top"><p class="table"><tt>"request"</tt></p></td>
1026  
-<td align="left" valign="top"><p class="table"><tt>request, response</tt></p></td>
1027  
-<td align="left" valign="top"><p class="table"><tt>request</tt> is an instance of <tt>http.ServerRequest</tt>
1028  
-                                        <br />
1029  
-                                         <tt>response</tt> is an instance of <tt>http.ServerResponse</tt></p></td>
1030  
-</tr>
1031  
-<tr>
1032  
-<td align="left" valign="top"><p class="table"><tt>"connection"</tt></p></td>
1033  
-<td align="left" valign="top"><p class="table"><tt>connection</tt></p></td>
1034  
-<td align="left" valign="top"><p class="table">When a new TCP connection is established.
1035  
-                                         <tt>connection</tt> is an object of type
1036  
-                                         <tt>http.Connection</tt>. Usually users
1037  
-                                         will not want to access this event.
1038  
-                                         The <tt>connection</tt> can also be
1039  
-                                         accessed at <tt>request.connection</tt>.</p></td>
1040  
-</tr>
1041  
-<tr>
1042  
-<td align="left" valign="top"><p class="table"><tt>"close"</tt></p></td>
1043  
-<td align="left" valign="top"><p class="table"><tt>errorno</tt></p></td>
1044  
-<td align="left" valign="top"><p class="table">Emitted when the server closes. <tt>errorno</tt>
1045  
-                                         is an integer which indicates what, if any,
1046  
-                                         error caused the server to close. If no
1047  
-                                         error occured <tt>errorno</tt> will be 0.</p></td>
1048  
-</tr>
1049  
-</tbody>
1050  
-</table>
1051  
-</div>
1052  
-<div class="dlist"><dl>
1053  
-<dt class="hdlist1">
1054  
-<tt>http.createServer(request_listener, options);</tt> 
1055  
-</dt>
1056  
-<dd>
1057  
-<p>
1058  
-Returns a new web server object.
1059  
-</p>
1060  
-<div class="paragraph"><p>The <tt>options</tt> argument is optional. The
1061  
-<tt>options</tt> argument accepts the same values as the
1062  
-options argument for <tt>tcp.Server</tt> does.</p></div>
1063  
-<div class="paragraph"><p>The <tt>request_listener</tt> is a function which is automatically
1064  
-added to the <tt>"request"</tt> event.</p></div>
1065  
-</dd>
1066  
-<dt class="hdlist1">
1067  
-<tt>server.listen(port, hostname)</tt> 
1068  
-</dt>
1069  
-<dd>
1070  
-<p>
1071  
-Begin accepting connections on the specified port and hostname.
1072  
-If the hostname is omitted, the server will accept connections
1073  
-directed to any address. This function is synchronous.
1074  
-</p>
1075  
-</dd>
1076  
-<dt class="hdlist1">
1077  
-<tt>server.close()</tt> 
1078  
-</dt>
1079  
-<dd>
1080  
-<p>
1081  
-Stops the server from accepting new connections.
1082  
-</p>
1083  
-</dd>
1084  
-</dl></div>
1085  
-<h4 id="_tt_http_serverrequest_tt"><tt>http.ServerRequest</tt></h4>
1086  
-<div class="paragraph"><p>This object is created internally by a HTTP server&#8212;not by
1087  
-the user&#8212;and passed as the first argument to a <tt>"request"</tt> listener.</p></div>
1088  
-<div class="tableblock">
1089  
-<table rules="all"
1090  
-width="100%"
1091  
-frame="border"
1092  
-cellspacing="0" cellpadding="4">
1093  
-<col width="7%" />
1094  
-<col width="15%" />
1095  
-<col width="76%" />
1096  
-<thead>
1097  
-<tr>
1098  
-<th align="left" valign="top">Event           </th>
1099  
-<th align="left" valign="top"> Parameters   </th>
1100  
-<th align="left" valign="top"> Notes</th>
1101  
-</tr>
1102  
-</thead>
1103  
-<tbody>
1104  
-<tr>
1105  
-<td align="left" valign="top"><p class="table"><tt>"body"</tt></p></td>
1106  
-<td align="left" valign="top"><p class="table"><tt>chunk</tt></p></td>
1107  
-<td align="left" valign="top"><p class="table">Emitted when a piece of the
1108  
-                                  message body is received. Example: A chunk
1109  
-                                  of the body is given as the single
1110  
-                                  argument. The transfer-encoding has been
1111  
-                                  decoded.  The body chunk is a String.  The
1112  
-                                  body encoding is set with
1113  
-                                  <tt>request.setBodyEncoding()</tt>.</p></td>
1114  
-</tr>
1115  
-<tr>
1116  
-<td align="left" valign="top"><p class="table"><tt>"complete"</tt></p></td>
1117  
-<td align="left" valign="top"><p class="table">(none)</p></td>
1118  
-<td align="left" valign="top"><p class="table">Emitted exactly once for each message.
1119  
-                                  No arguments.  After emitted no other
1120  
-                                  events will be emitted on the request.</p></td>
1121  
-</tr>
1122  
-</tbody>
1123  
-</table>
1124  
-</div>
1125  
-<div class="dlist"><dl>
1126  
-<dt class="hdlist1">
1127  
-<tt>request.method</tt> 
1128  
-</dt>
1129  
-<dd>
1130  
-<p>
1131  
-The request method as a string. Read only. Example:
1132  
-<tt>"GET"</tt>, <tt>"DELETE"</tt>.
1133  
-</p>
1134  
-</dd>
1135  
-<dt class="hdlist1">
1136  
-<tt>request.uri</tt> 
1137  
-</dt>
1138  
-<dd>
1139  
-<p>
1140  
-Request URI Object. This contains only the parameters that are
1141  
-present in the actual HTTP request. That is, if the request is
1142  
-</p>
1143  
-<div class="listingblock">
1144  
-<div class="content">
1145  
-<pre><tt>GET /status?name=ryan HTTP/1.1\r\n
1146  
-Accept: text/plain\r\n
1147  
-\r\n</tt></pre>
1148  
-</div></div>
1149  
-<div class="paragraph"><p>Then <tt>request.uri</tt> will be</p></div>
1150  
-<div class="listingblock">
1151  
-<div class="content">
1152