diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..49c2c73 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + +jobs: + build: + name: Test ${{ matrix.luaVersion }} on ${{ matrix.platform }} + strategy: + fail-fast: false + matrix: + luaVersion: [ "5.4", "5.3", "5.2", "5.1", "luajit", "luajit-openresty" ] + platform: [ "ubuntu-22.04", "macos-11", "windows-2022" ] + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup ’msvc’ + if: ${{ startsWith(matrix.platform, 'windows') && !startsWith(matrix.luaVersion, 'luajit') }} + uses: ilammy/msvc-dev-cmd@v1 + - name: Setup ‘lua’ + uses: leso-kn/gh-actions-lua@v11-staging + with: + luaVersion: ${{ matrix.luaVersion }} + - name: Setup ‘luarocks’ + uses: hishamhm/gh-actions-luarocks@master + - name: Make and install + run: | + luarocks make -- luasocket-scm-3.rockspec + env: + DEBUG: DEBUG + - name: Run regression tests + shell: bash + run: | + cd test + lua hello.lua + lua testsrvr.lua > /dev/null & + lua testclnt.lua + lua stufftest.lua + lua excepttest.lua + lua test_bind.lua + lua test_getaddrinfo.lua + lua ltn12test.lua + lua mimetest.lua + lua urltest.lua + lua test_socket_error.lua + kill %1 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..acd66ea --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy + +on: [ push, workflow_dispatch ] + +jobs: + + affected: + uses: lunarmodules/.github/.github/workflows/list_affected_rockspecs.yml@main + + build: + needs: affected + if: ${{ needs.affected.outputs.rockspecs }} + uses: lunarmodules/.github/.github/workflows/test_build_rock.yml@main + with: + rockspecs: ${{ needs.affected.outputs.rockspecs }} + + upload: + needs: [ affected, build ] + # Only run upload if: + # 1. We are on the canonical repository (no uploads from forks) + # 2. The current commit is either tagged or on the default branch (the workflow will upload dev/scm rockspecs any + # time they are touched, tagged ones whenever the edited rockspec and tag match) + # 3. Some rockspecs were changed — this implies the commit changing the rockspec is the same one that gets tagged + if: >- + ${{ + github.repository == 'lunarmodules/luasocket' && + ( github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/') ) && + needs.affected.outputs.rockspecs + }} + uses: lunarmodules/.github/.github/workflows/upload_to_luarocks.yml@main + with: + rockspecs: ${{ needs.affected.outputs.rockspecs }} + secrets: + apikey: ${{ secrets.LUAROCKS_APIKEY }} diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml index 597cd64..9cb784c 100644 --- a/.github/workflows/luacheck.yml +++ b/.github/workflows/luacheck.yml @@ -5,15 +5,9 @@ on: [push, pull_request] jobs: luacheck: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup ‘lua’ - uses: leafo/gh-actions-lua@v9 - - name: Setup ‘luarocks’ - uses: leafo/gh-actions-luarocks@v4 - - name: Setup ‘luacheck’ - run: luarocks install luacheck - - name: Run ‘luacheck’ linter - run: luacheck . + - name: Checkout + uses: actions/checkout@v4 + - name: Luacheck + uses: lunarmodules/luacheck@v1 diff --git a/.luacheckrc b/.luacheckrc index 8b25dd7..a3b4f63 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -15,8 +15,6 @@ include_files = { } exclude_files = { - "etc/*.lua", - "etc/**/*.lua", "test/*.lua", "test/**/*.lua", "samples/*.lua", diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fce8a96..0000000 --- a/.travis.yml +++ /dev/null @@ -1,54 +0,0 @@ -language: erlang - -env: - global: - - LUAROCKS_BASE=luarocks-2.0.13 - matrix: - - LUA=lua5.1 LUA_DEV=liblua5.1-dev LUA_VER=5.1 LUA_SFX=5.1 LUA_INCDIR=/usr/include/lua5.1 - - LUA=lua5.2 LUA_DEV=liblua5.2-dev LUA_VER=5.2 LUA_SFX=5.2 LUA_INCDIR=/usr/include/lua5.2 - - LUA=luajit LUA_DEV=libluajit-5.1-dev LUA_VER=5.1 LUA_SFX=jit LUA_INCDIR=/usr/include/luajit-2.0 - -branches: - only: - - master - -before_install: - - if [ $LUA = "luajit" ]; then - sudo add-apt-repository ppa:mwild1/ppa -y && sudo apt-get update -y; - fi - - sudo apt-get install $LUA - - sudo apt-get install $LUA_DEV - - lua$LUA_SFX -v - # Install a recent luarocks release - - wget http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz - - tar zxvpf $LUAROCKS_BASE.tar.gz - - cd $LUAROCKS_BASE - - ./configure - --lua-version=$LUA_VER --lua-suffix=$LUA_SFX --with-lua-include="$LUA_INCDIR" - - sudo make - - sudo make install - - cd $TRAVIS_BUILD_DIR - - -install: - - export DEBUG=DEBUG - - sudo -E luarocks make luasocket-scm-0.rockspec - -script: - - cd test - - lua$LUA_SFX hello.lua - - lua$LUA_SFX testsrvr.lua > /dev/null & - - lua$LUA_SFX testclnt.lua - - lua$LUA_SFX stufftest.lua - - lua$LUA_SFX excepttest.lua - - lua$LUA_SFX test_bind.lua - - lua$LUA_SFX test_getaddrinfo.lua - - lua$LUA_SFX ltn12test.lua - - lua$LUA_SFX mimetest.lua - - lua$LUA_SFX urltest.lua - - lua$LUA_SFX test_socket_error.lua - -notifications: - email: - on_success: change - on_failure: always diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3a25186 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,65 @@ +# Changelog + +## [v3.1.0](https://github.com/lunarmodules/luasocket/releases/v3.1.0) — 2022-07-27 + +* Add support for TCP Defer Accept – @Zash +* Add support for TCP Fast Open – @Zash +* Fix Windows (mingw32) builds – @goldenstein64 +* Avoid build warnings on 64-bit Windows – @rpatters1 + +## [v3.0.0](https://github.com/lunarmodules/luasocket/releases/v3.0.0) — 2022-03-25 + +The last time LuaSocket had a stable release tag was 14 years ago when 2.0.2 was tagged. +A v3 release candidate was tagged 9 years ago. +Since then it has been downloaded over 3 million times. +Additionally the Git repository regularly gets several hundred clones a day. +But 9 years is a long time and even the release candidate has grown a bit long in the tooth. +Many Linux distros have packaged the current Git HEAD or some specific tested point as dated or otherwise labeled releases. +256 commits later and having been migrated to the @lunarmodules org namespace on GitHub, please welcome v3. + +This release is a "safe-harbor" tag that represents a minimal amount of changes to get a release tagged. +Beyond some CI tooling, very little code has changed since migration to @lunarmodules ([5b18e47..e47d98f](https://github.com/lunarmodules/luasocket/compare/5b18e47..e47d98f?w=1)): + +* Lua 5.4.3+ support – @pkulchenko, @Zash +* Cleanup minor issues to get a code linter to pass – @Tieske, @jyoui, @alerque +* Update Visual Studio build rules for Lua 5.1 – @ewestbrook +* Set http transfer-encoding even without content-length – @tokenrove + +Prior to migration to @lunarmodules ([v3.0-rc1..5b18e47](https://github.com/lunarmodules/luasocket/compare/v3.0-rc1..5b18e47?w=1)) many things happened of which the author of this changelog is not fully apprised. +Your best bet if it affects your project somehow is to read the commit log & diffs yourself. + +## [v3.0-rc1](https://github.com/lunarmodules/luasocket/releases/v3.0-rc1) — 2013-06-14 + +Main changes for LuaSocket 3.0-rc1 are IPv6 support and Lua 5.2 compatibility. + +* Added: Compatible with Lua 5.2 + - Note that unless you define LUA_COMPAT_MODULE, package tables will not be exported as globals! +* Added: IPv6 support; + - Socket.connect and socket.bind support IPv6 addresses; + - Getpeername and getsockname support IPv6 addresses, and return the socket family as a third value; + - URL module updated to support IPv6 host names; + - New socket.tcp6 and socket.udp6 functions; + - New socket.dns.getaddrinfo and socket.dns.getnameinfo functions; +* Added: getoption method; +* Fixed: url.unescape was returning additional values; +* Fixed: mime.qp, mime.unqp, mime.b64, and mime.unb64 could mistaking their own stack slots for functions arguments; +* Fixed: Receiving zero-length datagram is now possible; +* Improved: Hidden all internal library symbols; +* Improved: Better error messages; +* Improved: Better documentation of socket options. +* Fixed: manual sample of HTTP authentication now uses correct "authorization" header (Alexandre Ittner); +* Fixed: failure on bind() was destroying the socket (Sam Roberts); +* Fixed: receive() returns immediatelly if prefix can satisfy bytes requested (M Joonas Pihlaja); +* Fixed: multicast didn't work on Windows, or anywhere else for that matter (Herbert Leuwer, Adrian Sietsma); +* Fixed: select() now reports an error when called with more sockets than FD_SETSIZE (Lorenzo Leonini); +* Fixed: manual links to home.html changed to index.html (Robert Hahn); +* Fixed: mime.unb64() would return an empty string on results that started with a null character (Robert Raschke); +* Fixed: HTTP now automatically redirects on 303 and 307 (Jonathan Gray); +* Fixed: calling sleep() with negative numbers could block forever, wasting CPU. Now it returns immediately (MPB); +* Improved: FTP commands are now sent in upper case to help buggy servers (Anders Eurenius); +* Improved: known headers now sent in canonic capitalization to help buggy servers (Joseph Stewart); +* Improved: Clarified tcp:receive() in the manual (MPB); +* Improved: Decent makefiles (LHF). +* Fixed: RFC links in documentation now point to IETF (Cosmin Apreutesei). + +## [v2.0.2](https://github.com/lunarmodules/luasocket/releases/v2.0.2) — 2007-09-11 diff --git a/FIX b/FIX deleted file mode 100644 index 40f30a1..0000000 --- a/FIX +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - -http was preserving old host header during redirects -fix smtp.send hang on source error -add create field to FTP and SMTP and fix HTTP ugliness -clean timeout argument to open functions in SMTP, HTTP and FTP -eliminate globals from namespaces created by module(). -url.absolute was not working when base_url was already parsed -http.request was redirecting even when the location header was empty -tcp{client}:shutdown() was checking for group instead of class. -tcp{client}:send() now returns i+sent-1... -get rid of a = socket.try() in the manual, except for protected cases. replace it with assert. -get rid of "base." kludge in package.loaded -check all "require("http")" etc in the manual. -make sure sock_gethostname.* only return success if the hp is not null! -change 'l' prefix in C libraries to 'c' to avoid clash with LHF libraries - don't forget the declarations in luasocket.h and mime.h!!! -setpeername was using udp{unconnected} -fixed a bug in http.lua that caused some requests to fail (Florian Berger) -fixed a bug in select.c that prevented sockets with descriptor 0 from working (Renato Maia) -fixed a "bug" that caused dns.toip to crash under uLinux -fixed a "bug" that caused a crash in gethostbyname under VMS -DEBUG and VERSION became _DEBUG and _VERSION -send returns the right value if input is "". Alexander Marinov diff --git a/LICENSE b/LICENSE index b635451..a8ed03e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,4 @@ -LuaSocket 3.0 license -Copyright © 2004-2013 Diego Nehab +Copyright (C) 2004-2022 Diego Nehab Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/NEW b/NEW deleted file mode 100644 index 0bff64c..0000000 --- a/NEW +++ /dev/null @@ -1,44 +0,0 @@ -What's New - -Main changes for LuaSocket 3.0-rc1 are IPv6 support and Lua 5.2 compatibility. - - * Added: Compatible with Lua 5.2 - - Note that unless you define LUA_COMPAT_MODULE, package - tables will not be exported as globals! - * Added: IPv6 support; - - Socket.connect and socket.bind support IPv6 addresses; - - Getpeername and getsockname support IPv6 addresses, and - return the socket family as a third value; - - URL module updated to support IPv6 host names; - - New socket.tcp6 and socket.udp6 functions; - - New socket.dns.getaddrinfo and socket.dns.getnameinfo functions; - * Added: getoption method; - * Fixed: url.unescape was returning additional values; - * Fixed: mime.qp, mime.unqp, mime.b64, and mime.unb64 could - mistaking their own stack slots for functions arguments; - * Fixed: Receiving zero-length datagram is now possible; - * Improved: Hidden all internal library symbols; - * Improved: Better error messages; - * Improved: Better documentation of socket options. - * Fixed: manual sample of HTTP authentication now uses correct - "authorization" header (Alexandre Ittner); - * Fixed: failure on bind() was destroying the socket (Sam Roberts); - * Fixed: receive() returns immediatelly if prefix can satisfy - bytes requested (M Joonas Pihlaja); - * Fixed: multicast didn't work on Windows, or anywhere - else for that matter (Herbert Leuwer, Adrian Sietsma); - * Fixed: select() now reports an error when called with more - sockets than FD_SETSIZE (Lorenzo Leonini); - * Fixed: manual links to home.html changed to index.html (Robert Hahn); - * Fixed: mime.unb64() would return an empty string on results that started - with a null character (Robert Raschke); - * Fixed: HTTP now automatically redirects on 303 and 307 (Jonathan Gray); - * Fixed: calling sleep() with negative numbers could - block forever, wasting CPU. Now it returns immediately (MPB); - * Improved: FTP commands are now sent in upper case to - help buggy servers (Anders Eurenius); - * Improved: known headers now sent in canonic - capitalization to help buggy servers (Joseph Stewart); - * Improved: Clarified tcp:receive() in the manual (MPB); - * Improved: Decent makefiles (LHF). - * Fixed: RFC links in documentation now point to IETF (Cosmin Apreutesei). diff --git a/README b/README deleted file mode 100644 index cd8ee59..0000000 --- a/README +++ /dev/null @@ -1,11 +0,0 @@ -This is the LuaSocket 3.0-rc1. It has been tested on Windows 7, Mac OS X, -and Linux. - -Please use the project page at GitHub - - https://github.com/diegonehab/luasocket - -to file bug reports or propose changes. - -Have fun, -Diego Nehab. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f5657c --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# LuaSocket + + +[![Build](https://img.shields.io/github/actions/workflow/status/lunarmodules/luasocket/build.yml?branch=master&label=Build&logo=Lua)](https://github.com/lunarmodules/luasocket/actions?workflow=Build) +[![Luacheck](https://img.shields.io/github/actions/workflow/status/lunarmodules/luasocket/luacheck.yml?branch=master&label=Luacheck&logo=Lua)](https://github.com/lunarmodules/luasocket/actions?workflow=Luacheck) +[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/lunarmodules/luasocket?label=Tag&logo=GitHub)](https://github.com/lunarmodules/luasocket/releases) +[![Luarocks](https://img.shields.io/luarocks/v/lunarmodules/luasocket?label=Luarocks&logo=Lua)](https://luarocks.org/modules/lunarmodules/luasocket) + +LuaSocket is a Lua extension library composed of two parts: + +1. a set of C modules that provide support for the TCP and UDP transport layers, and +2. a set of Lua modules that provide functions commonly needed by applications that deal with the Internet. diff --git a/TODO b/TODO deleted file mode 100644 index a838fc0..0000000 --- a/TODO +++ /dev/null @@ -1,81 +0,0 @@ -- bizarre default values for getnameinfo should throw error instead! - -> It's just too bad it can't talk to gmail - -> reason 1: they absolutely want TLS -> reason 2: unlike all the other SMTP implementations, they -> don't -> tolerate missing < > around adresses - -- document the new bind and connect behavior. -- shouldn't we instead make the code compatible to Lua 5.2 - without any compat stuff, and use a compatibility layer to - make it work on 5.1? -- add what's new to manual -- should there be an equivalent to tohostname for IPv6? -- should we add service name resolution as well to getaddrinfo? -- Maybe the sockaddr to presentation conversion should be done with getnameinfo()? - -- add http POST sample to manual - people keep asking stupid questions -- documentation of dirty/getfd/setfd is problematic because of portability - same for unix and serial. - what to do about this? add a stronger disclaimer? -- fix makefile with decent defaults? - -Done: - -- added IPv6 support to getsockname -- simplified getpeername implementation -- added family to return of getsockname and getpeername - and added modification to the manual to describe - -- connect and bind try all adresses returned by getaddrinfo -- document headers.lua? -- update copyright date everywhere? -- remove RCSID from files? -- move version to 2.1 rather than 2.1.1? -- fixed url package to support ipv6 hosts -- changed domain to family -- implement getfamily methods. - -- remove references to Lua 5.0 from documentation, add 5.2? -- update lua and luasocket version in samples in documentation -- document ipv5_v6only default option being set? -- document tcp6 and udp6 -- document dns.getaddrinfo -- documented zero-sized datagram change? - no. -- document unix socket and serial socket? add raw support? - no. -- document getoption -- merge luaL_typeerror into auxiliar to avoid using luaL prefix? - - - - - - - - - - -replace \r\n with \0xD\0xA in everything -New mime support - -ftp send should return server replies? -make sure there are no object files in the distribution tarball -http handling of 100-continue, see DB patch -DB ftp.lua bug. -test unix.c to return just a function and works with require"unix" -get rid of setmetatable(, nil) since packages don't need this anymore in 5.1 -compat-5.1 novo -ajeitar pra lua-5.1 - -adicionar exemplos de expansão: pipe, local, named pipe -testar os options! - - -- Thread-unsafe functions to protect - gethostbyname(), gethostbyaddr(), gethostent(), -inet_ntoa(), strerror(), - diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..d265694 --- /dev/null +++ b/TODO.md @@ -0,0 +1,135 @@ +## FIX + +http was preserving old host header during redirects +fix smtp.send hang on source error +add create field to FTP and SMTP and fix HTTP ugliness +clean timeout argument to open functions in SMTP, HTTP and FTP +eliminate globals from namespaces created by module(). +url.absolute was not working when base_url was already parsed +http.request was redirecting even when the location header was empty +tcp{client}:shutdown() was checking for group instead of class. +tcp{client}:send() now returns i+sent-1... +get rid of a = socket.try() in the manual, except for protected cases. replace it with assert. +get rid of "base." kludge in package.loaded +check all "require("http")" etc in the manual. +make sure sock_gethostname.* only return success if the hp is not null! +change 'l' prefix in C libraries to 'c' to avoid clash with LHF libraries + don't forget the declarations in luasocket.h and mime.h!!! +setpeername was using udp{unconnected} +fixed a bug in http.lua that caused some requests to fail (Florian Berger) +fixed a bug in select.c that prevented sockets with descriptor 0 from working (Renato Maia) +fixed a "bug" that caused dns.toip to crash under uLinux +fixed a "bug" that caused a crash in gethostbyname under VMS +DEBUG and VERSION became _DEBUG and _VERSION +send returns the right value if input is "". Alexander Marinov + + +## WISH + +... as an l-value to get all results of a function call? +at least ...[i] and #... +extend to full tuples? + +__and __or __not metamethods + +lua_tostring, lua_tonumber, lua_touseradta etc push values in stack +__tostring,__tonumber, __touserdata metamethods are checked +and expected to push an object of correct type on stack + +lua_rawtostring, lua_rawtonumber, lua_rawtouserdata don't +push anything on stack, return data of appropriate type, +skip metamethods and throw error if object not of exact type + +package.findfile exported +module not polluting the global namespace + +coxpcall with a coroutine pool for efficiency (reusing coroutines) + +exception mechanism formalized? just like the package system was. + +a nice bitlib in the core + + +## TODO + +- bizarre default values for getnameinfo should throw error instead! + +> It's just too bad it can't talk to gmail - +> reason 1: they absolutely want TLS +> reason 2: unlike all the other SMTP implementations, they +> don't +> tolerate missing < > around adresses + +- document the new bind and connect behavior. +- shouldn't we instead make the code compatible to Lua 5.2 + without any compat stuff, and use a compatibility layer to + make it work on 5.1? +- add what's new to manual +- should there be an equivalent to tohostname for IPv6? +- should we add service name resolution as well to getaddrinfo? +- Maybe the sockaddr to presentation conversion should be done with getnameinfo()? + +- add http POST sample to manual + people keep asking stupid questions +- documentation of dirty/getfd/setfd is problematic because of portability + same for unix and serial. + what to do about this? add a stronger disclaimer? +- fix makefile with decent defaults? + +## Done: + +- added IPv6 support to getsockname +- simplified getpeername implementation +- added family to return of getsockname and getpeername + and added modification to the manual to describe + +- connect and bind try all adresses returned by getaddrinfo +- document headers.lua? +- update copyright date everywhere? +- remove RCSID from files? +- move version to 2.1 rather than 2.1.1? +- fixed url package to support ipv6 hosts +- changed domain to family +- implement getfamily methods. + +- remove references to Lua 5.0 from documentation, add 5.2? +- update lua and luasocket version in samples in documentation +- document ipv5_v6only default option being set? +- document tcp6 and udp6 +- document dns.getaddrinfo +- documented zero-sized datagram change? + no. +- document unix socket and serial socket? add raw support? + no. +- document getoption +- merge luaL_typeerror into auxiliar to avoid using luaL prefix? + + + + + + + + + + +replace \r\n with \0xD\0xA in everything +New mime support + +ftp send should return server replies? +make sure there are no object files in the distribution tarball +http handling of 100-continue, see DB patch +DB ftp.lua bug. +test unix.c to return just a function and works with require"unix" +get rid of setmetatable(, nil) since packages don't need this anymore in 5.1 +compat-5.1 novo +ajeitar pra lua-5.1 + +adicionar exemplos de expans�o: pipe, local, named pipe +testar os options! + + +- Thread-unsafe functions to protect + gethostbyname(), gethostbyaddr(), gethostent(), +inet_ntoa(), strerror(), + diff --git a/WISH b/WISH deleted file mode 100644 index e7e9c07..0000000 --- a/WISH +++ /dev/null @@ -1,22 +0,0 @@ -... as an l-value to get all results of a function call? -at least ...[i] and #... -extend to full tuples? - -__and __or __not metamethods - -lua_tostring, lua_tonumber, lua_touseradta etc push values in stack -__tostring,__tonumber, __touserdata metamethods are checked -and expected to push an object of correct type on stack - -lua_rawtostring, lua_rawtonumber, lua_rawtouserdata don't -push anything on stack, return data of appropriate type, -skip metamethods and throw error if object not of exact type - -package.findfile exported -module not polluting the global namespace - -coxpcall with a coroutine pool for efficiency (reusing coroutines) - -exception mechanism formalized? just like the package system was. - -a nice bitlib in the core diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index 7d81b41..0000000 --- a/doc/index.html +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - -LuaSocket: Network support for the Lua language - - - - - - - -
-
-
- - - -
-LuaSocket -
Network support for the Lua language -
-

-home · -download · -installation · -introduction · -reference -

-
-
-
- - - -

What is LuaSocket?

- -

-LuaSocket is a Lua extension library -that is composed by two parts: a C core that provides support for the TCP -and UDP transport layers, and a set of Lua modules that add support for -functionality commonly needed by applications that deal with the Internet. -

- -

-The core support has been implemented so that it is both efficient and -simple to use. It is available to any Lua application once it has been -properly initialized by the interpreter in use. The code has been tested -and runs well on several Windows and UNIX platforms.

- -

-Among the support modules, the most commonly used implement the -SMTP -(sending e-mails), -HTTP -(WWW access) and -FTP -(uploading and downloading files) client -protocols. These provide a very natural and generic interface to the -functionality defined by each protocol. -In addition, you will find that the -MIME (common encodings), -URL -(anything you could possible want to do with one) and -LTN12 -(filters, sinks, sources and pumps) modules can be very handy. -

- -

-The library is available under the same - -terms and conditions as the Lua language, the MIT license. The idea is -that if you can use Lua in a project, you should also be able to use -LuaSocket. -

- -

-Copyright © 1999-2013 Diego Nehab. All rights reserved.
-Author: Diego Nehab -

- - - -

Download

- -

-LuaSocket version 3.0-rc1 is now available for download! -It is compatible with Lua 5.1 and 5.2, and has -been tested on Windows XP, Linux, and Mac OS X. Chances -are it works well on most UNIX distributions and Windows flavors. -

- -

-The current version of the library can be found at -the LuaSocket -project page on GitHub. Besides the full C and Lua source code -for the library, the distribution contains several examples, -this user's manual and basic test procedures. -

- -

Take a look at the installation section of the -manual to find out how to properly install the library. -

- - - -

Special thanks

- -

-This marks the first release of LuaSocket that -wholeheartedly embraces the open-source development -philosophy. After a long hiatus, Matthew Wild finally -convinced me it was time for a release including IPv6 and -Lua 5.2 support. It was more work than we anticipated. -Special thanks to Sam Roberts, Florian Zeitz, and Paul -Aurich, Liam Devine, Alexey Melnichuk, and everybody else -that has helped bring this library back to life. -

- - - -

What's New

- -

-Main changes for LuaSocket 3.0-rc1 are IPv6 support -and Lua 5.2 compatibility. -

- - - - - -

Old Versions

- -

-All previous versions of the LuaSocket library can be downloaded -here. Although these versions are no longer supported, they are -still available for those that have compatibility issues. -

- - - - - - - diff --git a/doc/lua05.ppt b/doc/lua05.ppt deleted file mode 100644 index e2b7ab4..0000000 Binary files a/doc/lua05.ppt and /dev/null differ diff --git a/doc/dns.html b/docs/dns.html similarity index 70% rename from doc/dns.html rename to docs/dns.html index c4a0472..56ce3ba 100644 --- a/doc/dns.html +++ b/docs/dns.html @@ -1,4 +1,4 @@ - @@ -13,22 +13,22 @@ -
+

- -
-LuaSocket +
+LuaSocket
Network support for the Lua language +
Network support for the Lua language
-

+

home · download · installation · introduction · -reference +reference


@@ -36,14 +36,14 @@ -

DNS

+

DNS

-IPv4 name resolution functions -dns.toip +IPv4 name resolution functions +dns.toip and -dns.tohostname -return all information obtained from +dns.tohostname +return all information obtained from the resolver in a table of the form:

@@ -60,10 +60,10 @@ Note that the alias list can be empty.

-The more general name resolution function -dns.getaddrinfo, which +The more general name resolution function +dns.getaddrinfo, which supports both IPv6 and IPv4, -returns all information obtained from +returns all information obtained from the resolver in a table of the form:

@@ -88,82 +88,82 @@ addresses, and "inet6" for IPv6 addresses. -

+

socket.dns.getaddrinfo(address)

-

-Converts from host name to address. +

+Converts from host name to address.

-

-Address can be an IPv4 or IPv6 address or host name. +

+Address can be an IPv4 or IPv6 address or host name.

-

+

The function returns a table with all information returned by the resolver. In case of error, the function returns nil -followed by an error message. +followed by an error message.

-

+

socket.dns.gethostname()

-

-Returns the standard host name for the machine as a string. +

+Returns the standard host name for the machine as a string.

-

+

socket.dns.tohostname(address)

-

+

Converts from IPv4 address to host name.

-

-Address can be an IP address or host name. +

+Address can be an IP address or host name.

-

+

The function returns a string with the canonic host name of the given address, followed by a table with all information returned by the resolver. In case of error, the function returns nil -followed by an error message. +followed by an error message.

-

+

socket.dns.toip(address)

-

+

Converts from host name to IPv4 address.

-

-Address can be an IP address or host name. +

+Address can be an IP address or host name.

-

+

Returns a string with the first IP address found for address, followed by a table with all information returned by the resolver. In case of error, the function returns nil followed by an error -message. +message.

-