aboutsummaryrefslogtreecommitdiff
path: root/doc/http.html
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-16 04:28:21 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-16 04:28:21 +0000
commit0a4c1534f39511894728da193ab8225ad6022de9 (patch)
tree683b711accf64eca486b138cbc034c609f93a53a /doc/http.html
parent8e80e38f2c3121242b3b2f7a45a960c9af4d1a68 (diff)
downloadluasocket-0a4c1534f39511894728da193ab8225ad6022de9.tar.gz
luasocket-0a4c1534f39511894728da193ab8225ad6022de9.tar.bz2
luasocket-0a4c1534f39511894728da193ab8225ad6022de9.zip
Still work to do in the manual...
Diffstat (limited to 'doc/http.html')
-rw-r--r--doc/http.html29
1 files changed, 19 insertions, 10 deletions
diff --git a/doc/http.html b/doc/http.html
index bda3088..0fc04cd 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -37,8 +37,9 @@
37 37
38<p> 38<p>
39HTTP (Hyper Text Transfer Protocol) is the protocol used to exchange 39HTTP (Hyper Text Transfer Protocol) is the protocol used to exchange
40information between web-browsers and servers. The <tt>http.lua</tt> 40information between web-browsers and servers. The <tt>http</tt>
41module offers support for the client side of the HTTP protocol (i.e., 41namespace offers full support for the client side of the HTTP
42protocol (i.e.,
42the facilities that would be used by a web-browser implementation). The 43the facilities that would be used by a web-browser implementation). The
43implementation conforms to the HTTP/1.1 standard, 44implementation conforms to the HTTP/1.1 standard,
44<a href="http://www.cs.princeton.edu/~diego/rfc/rfc2616.txt">RFC 45<a href="http://www.cs.princeton.edu/~diego/rfc/rfc2616.txt">RFC
@@ -47,11 +48,20 @@ implementation conforms to the HTTP/1.1 standard,
47 48
48<p> 49<p>
49The module exports functions that provide HTTP functionality in different 50The module exports functions that provide HTTP functionality in different
50levels of abstraction, from the simple <a 51levels of abstraction, from the simple
51href="#get"><tt>get</tt></a> function to the generic, LTN12 based <a 52<a href="#get"><tt>get</tt></a> function, through the generic
52href="#request"><tt>request</tt></a> function. 53LTN12 based <a href="#request"><tt>request</tt></a> function, down to
54even lower-level if you bother to look through the source code.
53</p> 55</p>
54 56
57<p class=description> To obtain the <tt>ftp</tt> namespace, run:
58</p>
59
60<pre class=example>
61-- loads the HTTP module and any libraries it requires
62local http = require("http")
63</pre>
64
55<p> 65<p>
56URLs must conform to 66URLs must conform to
57<a href="http://www.cs.princeton.edu/~diego/rfc/rfc1738.txt">RFC 67<a href="http://www.cs.princeton.edu/~diego/rfc/rfc1738.txt">RFC
@@ -189,12 +199,12 @@ http.<b>request{</b><br>
189</p> 199</p>
190 200
191<p class=description> 201<p class=description>
192Performs the generic HTTP request, controled by a request table. 202Performs the generic HTTP request, controlled by a request table.
193</p> 203</p>
194 204
195<p class=parameters> 205<p class=parameters>
196The most important parameters are the <tt>url</tt> and the <em>simple</em> LTN12 <tt>sink</tt> that will receive the downloaded content. 206The most important parameters are the <tt>url</tt> and the <em>simple</em> LTN12 <tt>sink</tt> that will receive the downloaded content.
197Any part of the <tt>url</tt> can be overriden by including 207Any part of the <tt>url</tt> can be overridden by including
198the appropriate field in the request table. 208the appropriate field in the request table.
199If authentication information is provided, the function 209If authentication information is provided, the function
200uses the Basic Authentication Scheme (see <a href="#authentication">note</a>) 210uses the Basic Authentication Scheme (see <a href="#authentication">note</a>)
@@ -231,8 +241,8 @@ respt = {<br>
231</tt></blockquote> 241</tt></blockquote>
232 242
233<p class=return> 243<p class=return>
234Even when there was failure (URL not found, for example), the 244Even when the server fails to provide the contents of the requested URL (URL not found, for example), the
235function usually succeeds retrieving a message body (a web page informing the 245it usually returns a message body (a web page informing the
236URL was not found or some other useless page). To make sure the 246URL was not found or some other useless page). To make sure the
237operation was successful, check the returned status <tt>code</tt>. For 247operation was successful, check the returned status <tt>code</tt>. For
238a list of the possible values and their meanings, refer to <a 248a list of the possible values and their meanings, refer to <a
@@ -261,7 +271,6 @@ respt = http.request {
261-- ["content-Type"] = "text/html" 271-- ["content-Type"] = "text/html"
262-- } 272-- }
263</pre> 273</pre>
264</blockquote>
265 274
266<p class=note id=authentication> 275<p class=note id=authentication>
267Note: Some URLs are protected by their 276Note: Some URLs are protected by their