diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-08-31 01:00:15 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-08-31 01:00:15 +0000 |
| commit | 982781f1464c9b7a8133130433f83dbf1f59a2c0 (patch) | |
| tree | 8f96f9e9fa1e6bef8b8356037986ddc18673cade /doc/code.html | |
| parent | 6789b83ff5c15296267f880d3b98cf8a1800c30a (diff) | |
| download | luasocket-982781f1464c9b7a8133130433f83dbf1f59a2c0.tar.gz luasocket-982781f1464c9b7a8133130433f83dbf1f59a2c0.tar.bz2 luasocket-982781f1464c9b7a8133130433f83dbf1f59a2c0.zip | |
LuaSocket 2.0 User's Manual.
Diffstat (limited to 'doc/code.html')
| -rw-r--r-- | doc/code.html | 202 |
1 files changed, 202 insertions, 0 deletions
diff --git a/doc/code.html b/doc/code.html new file mode 100644 index 0000000..45fd21a --- /dev/null +++ b/doc/code.html | |||
| @@ -0,0 +1,202 @@ | |||
| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | ||
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> | ||
| 3 | <html> | ||
| 4 | |||
| 5 | <head> | ||
| 6 | <title>LuaSocket: Network support for the Lua language</title> | ||
| 7 | <link rel="stylesheet" href="reference.css" type="text/css"> | ||
| 8 | </head> | ||
| 9 | |||
| 10 | <body> | ||
| 11 | |||
| 12 | <!-- header +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 13 | |||
| 14 | <div class=header> | ||
| 15 | <hr> | ||
| 16 | <center> | ||
| 17 | <table summary="LuaSocket logo"> | ||
| 18 | <tr><td align=center><a href="http://www.lua.org"> | ||
| 19 | <img border=0 alt="LuaSocket" src="luasocket.png"> | ||
| 20 | </a></td></tr> | ||
| 21 | <tr><td align=center valign=top>Network support for the Lua language | ||
| 22 | </td></tr> | ||
| 23 | </table> | ||
| 24 | <p class=bar> | ||
| 25 | <a href="home.html">home</a> · | ||
| 26 | <a href="home.html#download">download</a> · | ||
| 27 | <a href="introduction.html">introduction</a> · | ||
| 28 | <a href="reference.html">reference</a> | ||
| 29 | </p> | ||
| 30 | </center> | ||
| 31 | <hr> | ||
| 32 | </div> | ||
| 33 | |||
| 34 | <!-- code +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 35 | |||
| 36 | <h2 id=code>Code</h2> | ||
| 37 | |||
| 38 | <p> | ||
| 39 | The <tt>code.lua</tt> module offers routines to convert back and forth | ||
| 40 | some common types of content encoding, including Base 64 and URL | ||
| 41 | escaping. Base 64 is described in | ||
| 42 | <a href="http://www.cs.princeton.edu/~diego/rfc/rfc2045.txt">RFC | ||
| 43 | 2045</a>, | ||
| 44 | URL escaping is described in | ||
| 45 | <a href="http://www.cs.princeton.edu/~diego/rfc/rfc2396.txt">RFC | ||
| 46 | 2396</a>. | ||
| 47 | </p> | ||
| 48 | |||
| 49 | <!-- base64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 50 | |||
| 51 | <p class=name id="base64"> | ||
| 52 | socket.code.<b>base64(</b>content, single<b>)</b> | ||
| 53 | </p> | ||
| 54 | |||
| 55 | <p class=description> | ||
| 56 | Applies the Base 64 content coding to a string. | ||
| 57 | </p> | ||
| 58 | |||
| 59 | <p class=parameters> | ||
| 60 | <tt>Content</tt> is the string to be encoded. | ||
| 61 | If <tt>single</tt> is set to anything | ||
| 62 | but <tt>nil</tt>, the output is returned as a single | ||
| 63 | line, otherwise the function splits the content into 76 character long | ||
| 64 | lines after encoding. | ||
| 65 | </p> | ||
| 66 | |||
| 67 | <p class=result> | ||
| 68 | The function returns the encoded string. | ||
| 69 | </p> | ||
| 70 | |||
| 71 | <pre class=example> | ||
| 72 | code = socket.code.base64("diego:password") | ||
| 73 | -- code = "ZGllZ286cGFzc3dvcmQ=" | ||
| 74 | </pre> | ||
| 75 | |||
| 76 | <!-- unbase64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 77 | |||
| 78 | <p class=name id="unbase64"> | ||
| 79 | socket.code.<b>unbase64(</b>content<b>)</b> | ||
| 80 | </p> | ||
| 81 | |||
| 82 | <p class=description> | ||
| 83 | Removes the Base 64 content coding from a string. | ||
| 84 | </p> | ||
| 85 | |||
| 86 | <p class=parameters> | ||
| 87 | <tt>Content</tt> is the string to be decoded. | ||
| 88 | </p> | ||
| 89 | |||
| 90 | <p class=result> | ||
| 91 | The function returns the decoded string. | ||
| 92 | </p> | ||
| 93 | |||
| 94 | <!-- escape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 95 | |||
| 96 | <p class=name id="escape"> | ||
| 97 | socket.code.<b>escape(</b>content<b>)</b> | ||
| 98 | </p> | ||
| 99 | |||
| 100 | <p class=description> | ||
| 101 | Applies the URL escaping content coding to a string | ||
| 102 | Each byte is encoded as a percent character followed | ||
| 103 | by the two byte hexadecimal representation of its integer | ||
| 104 | value. | ||
| 105 | </p> | ||
| 106 | |||
| 107 | <p class=parameters> | ||
| 108 | <tt>Content</tt> is the string to be encoded. | ||
| 109 | </p> | ||
| 110 | |||
| 111 | <p class=result> | ||
| 112 | The function returns the encoded string. | ||
| 113 | </p> | ||
| 114 | |||
| 115 | <pre class=example> | ||
| 116 | code = socket.code.escape("/#?;") | ||
| 117 | -- code = "%2f%23%3f%3b" | ||
| 118 | </pre> | ||
| 119 | |||
| 120 | <!-- unescape +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 121 | |||
| 122 | <p class=name id="unescape"> | ||
| 123 | socket.code.<b>unescape(</b>content<b>)</b> | ||
| 124 | </p> | ||
| 125 | |||
| 126 | <p class=description> | ||
| 127 | Removes the URL escaping content coding from a string. | ||
| 128 | </p> | ||
| 129 | |||
| 130 | <p class=parameters> | ||
| 131 | <tt>Content</tt> is the string to be decoded. | ||
| 132 | </p> | ||
| 133 | |||
| 134 | <p class=return> | ||
| 135 | The function returns the decoded string. | ||
| 136 | </p> | ||
| 137 | |||
| 138 | <!-- hexa +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 139 | |||
| 140 | <p class=name id="hexa"> | ||
| 141 | socket.code.<b>hexa(</b>content<b>)</b> | ||
| 142 | </p> | ||
| 143 | |||
| 144 | <p class=description> | ||
| 145 | Applies the hexadecimal content coding to a string. | ||
| 146 | Each byte is encoded as the byte hexadecimal | ||
| 147 | representation of its integer value. <p> | ||
| 148 | </p> | ||
| 149 | |||
| 150 | <p class=parameters> | ||
| 151 | <tt>Content</tt> is the string to be encoded. | ||
| 152 | </p> | ||
| 153 | |||
| 154 | <p class=return> | ||
| 155 | The function returns the encoded string. | ||
| 156 | </p> | ||
| 157 | |||
| 158 | <pre class=example> | ||
| 159 | code = socket.code.hexa("\16\32\255") | ||
| 160 | -- code = "1020ff" | ||
| 161 | </pre> | ||
| 162 | |||
| 163 | <!-- unhexa +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 164 | |||
| 165 | <p class=name id="unhexa"> | ||
| 166 | socket.code.<b>unhexa(</b>content<b>)</b> | ||
| 167 | </p> | ||
| 168 | |||
| 169 | <p class=description> | ||
| 170 | Removes the hexadecimal content coding from a string. | ||
| 171 | </p> | ||
| 172 | |||
| 173 | <p class=parameters> | ||
| 174 | <tt>Content</tt> is the string to be decoded. | ||
| 175 | </p> | ||
| 176 | |||
| 177 | <p class=return> | ||
| 178 | The function returns the decoded string. | ||
| 179 | </p> | ||
| 180 | |||
| 181 | <!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> | ||
| 182 | |||
| 183 | <div class=footer> | ||
| 184 | <hr> | ||
| 185 | <center> | ||
| 186 | <p class=bar> | ||
| 187 | <a href="home.html">home</a> · | ||
| 188 | <a href="home.html#down">download</a> · | ||
| 189 | <a href="introduction.html">introduction</a> · | ||
| 190 | <a href="reference.html">reference</a> | ||
| 191 | </p> | ||
| 192 | <p> | ||
| 193 | <small> | ||
| 194 | Last modified by Diego Nehab on <br> | ||
| 195 | Sat Aug 9 01:00:41 PDT 2003 | ||
| 196 | </small> | ||
| 197 | </p> | ||
| 198 | </center> | ||
| 199 | </div> | ||
| 200 | |||
| 201 | </body> | ||
| 202 | </html> | ||
