aboutsummaryrefslogtreecommitdiff
path: root/doc/url.html
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-15 06:24:00 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-06-15 06:24:00 +0000
commit58096449c6044b7aade5cd41cfd71c6bec1d273d (patch)
tree1814ffebe89c4c2556d84f97f66db37a7e8b4554 /doc/url.html
parent9ed7f955e5fc69af9bf1794fa2c8cd227981ba24 (diff)
downloadluasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.tar.gz
luasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.tar.bz2
luasocket-58096449c6044b7aade5cd41cfd71c6bec1d273d.zip
Manual is almost done. HTTP is missing.
Implemented new distribution scheme. Select is now purely C. HTTP reimplemented seems faster dunno why. LTN12 functions that coroutines fail gracefully.
Diffstat (limited to 'doc/url.html')
-rw-r--r--doc/url.html76
1 files changed, 41 insertions, 35 deletions
diff --git a/doc/url.html b/doc/url.html
index f3a7cb7..cd699a2 100644
--- a/doc/url.html
+++ b/doc/url.html
@@ -59,7 +59,7 @@ An URL is defined by the following grammar:
59<!-- absolute +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 59<!-- absolute +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
60 60
61<p class=name id=absolute> 61<p class=name id=absolute>
62socket.url.<b>absolute(</b>base, relative<b>)</b> 62url.<b>absolute(</b>base, relative<b>)</b>
63</p> 63</p>
64 64
65<p class=description> 65<p class=description>
@@ -79,7 +79,7 @@ The function returns a string with the absolute URL.
79Note: The rules that 79Note: The rules that
80govern the composition are fairly complex, and are described in detail in 80govern the composition are fairly complex, and are described in detail in
81<a href="http://www.cs.princeton.edu/~diego/rfc/rfc2396.txt">RFC 2396</a>. 81<a href="http://www.cs.princeton.edu/~diego/rfc/rfc2396.txt">RFC 2396</a>.
82The example bellow should give an idea of what are the rules. 82The example bellow should give an idea of what the rules are.
83</p> 83</p>
84 84
85<pre class=example> 85<pre class=example>
@@ -114,7 +114,7 @@ g;x?y#s = http://a/b/c/g;x?y#s
114<!-- build ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 114<!-- build ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
115 115
116<p class=name id=build> 116<p class=name id=build>
117socket.url.<b>build(</b>parsed_url<b>)</b> 117url.<b>build(</b>parsed_url<b>)</b>
118</p> 118</p>
119 119
120<p class=description> 120<p class=description>
@@ -135,7 +135,7 @@ The function returns a string with the built URL.
135<!-- build_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 135<!-- build_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
136 136
137<p class=name id=build_path> 137<p class=name id=build_path>
138socket.url.<b>build_path(</b>segments, unsafe<b>)</b> 138url.<b>build_path(</b>segments, unsafe<b>)</b>
139</p> 139</p>
140 140
141<p class=description> 141<p class=description>
@@ -157,10 +157,39 @@ The function returns a string with the
157built <tt>&lt;path&gt;</tt> component. 157built <tt>&lt;path&gt;</tt> component.
158</p> 158</p>
159 159
160<!-- escape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
161
162<p class=name id="escape">
163url.<b>escape(</b>content<b>)</b>
164</p>
165
166<p class=description>
167Applies the URL escaping content coding to a string
168Each byte is encoded as a percent character followed
169by the two byte hexadecimal representation of its integer
170value.
171</p>
172
173<p class=parameters>
174<tt>Content</tt> is the string to be encoded.
175</p>
176
177<p class=result>
178The function returns the encoded string.
179</p>
180
181<pre class=example>
182-- load url module
183url = require("url")
184
185code = url.escape("/#?;")
186-- code = "%2f%23%3f%3b"
187</pre>
188
160<!-- parse ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 189<!-- parse ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
161 190
162<p class=name id=parse> 191<p class=name id=parse>
163socket.url.<b>parse(</b>url, default<b>)</b> 192url.<b>parse(</b>url, default<b>)</b>
164</p> 193</p>
165 194
166<p class=description> 195<p class=description>
@@ -196,7 +225,10 @@ parsed_url = {<br>
196</tt></blockquote> 225</tt></blockquote>
197 226
198<pre class=example> 227<pre class=example>
199parsed_url = socket.url.parse("http://www.puc-rio.br/~diego/index.lua?a=2#there") 228-- load url module
229url = require("url")
230
231parsed_url = url.parse("http://www.puc-rio.br/~diego/index.lua?a=2#there")
200-- parsed_url = { 232-- parsed_url = {
201-- scheme = "http", 233-- scheme = "http",
202-- authority = "www.puc-rio.br", 234-- authority = "www.puc-rio.br",
@@ -206,7 +238,7 @@ parsed_url = socket.url.parse("http://www.puc-rio.br/~diego/index.lua?a=2#there"
206-- host = "www.puc-rio.br", 238-- host = "www.puc-rio.br",
207-- } 239-- }
208 240
209parsed_url = socket.url.parse("ftp://root:passwd@unsafe.org/pub/virus.exe;type=i") 241parsed_url = url.parse("ftp://root:passwd@unsafe.org/pub/virus.exe;type=i")
210-- parsed_url = { 242-- parsed_url = {
211-- scheme = "ftp", 243-- scheme = "ftp",
212-- authority = "root:passwd@unsafe.org", 244-- authority = "root:passwd@unsafe.org",
@@ -222,7 +254,7 @@ parsed_url = socket.url.parse("ftp://root:passwd@unsafe.org/pub/virus.exe;type=i
222<!-- parse_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 254<!-- parse_path +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
223 255
224<p class=name id=parse_path> 256<p class=name id=parse_path>
225socket.url.<b>parse_path(</b>path<b>)</b> 257url.<b>parse_path(</b>path<b>)</b>
226</p> 258</p>
227 259
228<p class=description> 260<p class=description>
@@ -241,36 +273,10 @@ returning a list with all the parsed segments, the function unescapes all
241of them. 273of them.
242</p> 274</p>
243 275
244<!-- escape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
245
246<p class=name id="escape">
247socket.url.<b>escape(</b>content<b>)</b>
248</p>
249
250<p class=description>
251Applies the URL escaping content coding to a string
252Each byte is encoded as a percent character followed
253by the two byte hexadecimal representation of its integer
254value.
255</p>
256
257<p class=parameters>
258<tt>Content</tt> is the string to be encoded.
259</p>
260
261<p class=result>
262The function returns the encoded string.
263</p>
264
265<pre class=example>
266code = socket.url.escape("/#?;")
267-- code = "%2f%23%3f%3b"
268</pre>
269
270<!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 276<!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
271 277
272<p class=name id="unescape"> 278<p class=name id="unescape">
273socket.url.<b>unescape(</b>content<b>)</b> 279url.<b>unescape(</b>content<b>)</b>
274</p> 280</p>
275 281
276<p class=description> 282<p class=description>