diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-16 04:28:21 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-16 04:28:21 +0000 |
| commit | 0a4c1534f39511894728da193ab8225ad6022de9 (patch) | |
| tree | 683b711accf64eca486b138cbc034c609f93a53a /doc/http.html | |
| parent | 8e80e38f2c3121242b3b2f7a45a960c9af4d1a68 (diff) | |
| download | luasocket-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.html | 29 |
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> |
| 39 | HTTP (Hyper Text Transfer Protocol) is the protocol used to exchange | 39 | HTTP (Hyper Text Transfer Protocol) is the protocol used to exchange |
| 40 | information between web-browsers and servers. The <tt>http.lua</tt> | 40 | information between web-browsers and servers. The <tt>http</tt> |
| 41 | module offers support for the client side of the HTTP protocol (i.e., | 41 | namespace offers full support for the client side of the HTTP |
| 42 | protocol (i.e., | ||
| 42 | the facilities that would be used by a web-browser implementation). The | 43 | the facilities that would be used by a web-browser implementation). The |
| 43 | implementation conforms to the HTTP/1.1 standard, | 44 | implementation 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> |
| 49 | The module exports functions that provide HTTP functionality in different | 50 | The module exports functions that provide HTTP functionality in different |
| 50 | levels of abstraction, from the simple <a | 51 | levels of abstraction, from the simple |
| 51 | href="#get"><tt>get</tt></a> function to the generic, LTN12 based <a | 52 | <a href="#get"><tt>get</tt></a> function, through the generic |
| 52 | href="#request"><tt>request</tt></a> function. | 53 | LTN12 based <a href="#request"><tt>request</tt></a> function, down to |
| 54 | even 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 | ||
| 62 | local http = require("http") | ||
| 63 | </pre> | ||
| 64 | |||
| 55 | <p> | 65 | <p> |
| 56 | URLs must conform to | 66 | URLs 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> |
| 192 | Performs the generic HTTP request, controled by a request table. | 202 | Performs the generic HTTP request, controlled by a request table. |
| 193 | </p> | 203 | </p> |
| 194 | 204 | ||
| 195 | <p class=parameters> | 205 | <p class=parameters> |
| 196 | The most important parameters are the <tt>url</tt> and the <em>simple</em> LTN12 <tt>sink</tt> that will receive the downloaded content. | 206 | The most important parameters are the <tt>url</tt> and the <em>simple</em> LTN12 <tt>sink</tt> that will receive the downloaded content. |
| 197 | Any part of the <tt>url</tt> can be overriden by including | 207 | Any part of the <tt>url</tt> can be overridden by including |
| 198 | the appropriate field in the request table. | 208 | the appropriate field in the request table. |
| 199 | If authentication information is provided, the function | 209 | If authentication information is provided, the function |
| 200 | uses the Basic Authentication Scheme (see <a href="#authentication">note</a>) | 210 | uses 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> |
| 234 | Even when there was failure (URL not found, for example), the | 244 | Even when the server fails to provide the contents of the requested URL (URL not found, for example), the |
| 235 | function usually succeeds retrieving a message body (a web page informing the | 245 | it usually returns a message body (a web page informing the |
| 236 | URL was not found or some other useless page). To make sure the | 246 | URL was not found or some other useless page). To make sure the |
| 237 | operation was successful, check the returned status <tt>code</tt>. For | 247 | operation was successful, check the returned status <tt>code</tt>. For |
| 238 | a list of the possible values and their meanings, refer to <a | 248 | a 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> |
| 267 | Note: Some URLs are protected by their | 276 | Note: Some URLs are protected by their |
