mirror of
https://github.com/lunarmodules/luasocket.git
synced 2025-07-13 14:14:30 +02:00
Compare commits
1 Commits
issue297
...
revert-256
Author | SHA1 | Date | |
---|---|---|---|
a24294d331 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@
|
||||
*.dll*
|
||||
*.user
|
||||
*.sdf
|
||||
Lua.props
|
||||
Debug
|
||||
Release
|
||||
*.manifest
|
||||
|
49
Lua.props
49
Lua.props
@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Condition="'$(Platform)'=='x64'" Label="LuaPlat">
|
||||
<LUAPLAT>$(Platform)/$(Configuration)</LUAPLAT>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Platform)'=='Win32'" Label="LuaPlat">
|
||||
<LUAPLAT>$(Configuration)</LUAPLAT>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<LUAV>5.3</LUAV>
|
||||
<LUAPREFIX>z:\data\build\vc14\</LUAPREFIX>
|
||||
<LUALIB>$(LUAPREFIX)\lib\lua\$(LUAV)\$(LUAPLAT)</LUALIB>
|
||||
<LUACDIR>$(LUAPREFIX)\bin\lua\$(LUAV)\$(LUAPLAT)</LUACDIR>
|
||||
<LUALDIR>$(LUAPREFIX)\bin\lua\$(LUAV)\$(LUAPLAT)\lua</LUALDIR>
|
||||
<LUAINC>$(LUAPREFIX)\include\lua\$(LUAV);$(LUAPREFIX)\include\lua$(LUAV)</LUAINC>
|
||||
<LUALIBNAME>lua$(LUAV.Replace('.', '')).lib</LUALIBNAME>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<_PropertySheetDisplayName>Lua</_PropertySheetDisplayName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup />
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="LUAPLAT">
|
||||
<Value>$(LUAPLAT)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUAPREFIX">
|
||||
<Value>$(LUAPREFIX)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUAV">
|
||||
<Value>$(LUAV)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUALIB">
|
||||
<Value>$(LUALIB)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUAINC">
|
||||
<Value>$(LUAINC)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUACDIR">
|
||||
<Value>$(LUACDIR)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUALDIR">
|
||||
<Value>$(LUALDIR)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUALIBNAME">
|
||||
<Value>$(LUALIBNAME)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
28
Lua51.props
Normal file
28
Lua51.props
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<LUABIN_PATH>..\build\vc12\bin\lua\5.1\</LUABIN_PATH>
|
||||
<LUALIB_PATH>..\build\vc12\bin\lua\5.1\</LUALIB_PATH>
|
||||
<LUAINC_PATH>..\build\vc12\include\lua\5.1\</LUAINC_PATH>
|
||||
<LUALIB>lua51.lib</LUALIB>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<_PropertySheetDisplayName>Lua51</_PropertySheetDisplayName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup />
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="LUALIB_PATH">
|
||||
<Value>$(LUALIB_PATH)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUABIN_PATH">
|
||||
<Value>$(LUABIN_PATH)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUAINC_PATH">
|
||||
<Value>$(LUAINC_PATH)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUALIB">
|
||||
<Value>$(LUALIB)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
28
Lua52.props
Normal file
28
Lua52.props
Normal file
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ImportGroup Label="PropertySheets" />
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<LUABIN_PATH>..\build\vc12\bin\lua\5.2\</LUABIN_PATH>
|
||||
<LUALIB_PATH>..\build\vc12\bin\lua\5.2\</LUALIB_PATH>
|
||||
<LUAINC_PATH>..\build\vc12\include\lua\5.2\</LUAINC_PATH>
|
||||
<LUALIB>lua52.lib</LUALIB>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<_PropertySheetDisplayName>Lua52</_PropertySheetDisplayName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup />
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="LUALIB_PATH">
|
||||
<Value>$(LUALIB_PATH)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUABIN_PATH">
|
||||
<Value>$(LUABIN_PATH)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUAINC_PATH">
|
||||
<Value>$(LUAINC_PATH)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="LUALIB">
|
||||
<Value>$(LUALIB)</Value>
|
||||
</BuildMacro>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -135,8 +135,7 @@ http.<b>request{</b><br>
|
||||
[step = <i>LTN12 pump step</i>,]<br>
|
||||
[proxy = <i>string</i>,]<br>
|
||||
[redirect = <i>boolean</i>,]<br>
|
||||
[create = <i>function</i>,]<br>
|
||||
[maxredirects = <i>number</i>]<br>
|
||||
[create = <i>function</i>]<br>
|
||||
<b>}</b>
|
||||
</p>
|
||||
|
||||
@ -186,7 +185,6 @@ Defaults to the LTN12 <tt>pump.step</tt> function.
|
||||
function from automatically following 301 or 302 server redirect messages;
|
||||
<li><tt>create</tt>: An optional function to be used instead of
|
||||
<a href=tcp.html#socket.tcp><tt>socket.tcp</tt></a> when the communications socket is created.
|
||||
<li><tt>maxredirects</tt>: An optional number specifying the maximum number of redirects to follow. Defaults to <tt>5</tt> if not specified. A boolean <tt>false</tt> value means no maximum (unlimited).
|
||||
</ul>
|
||||
|
||||
<p class=return>
|
||||
@ -326,8 +324,8 @@ r, c = http.request {
|
||||
</p>
|
||||
<p>
|
||||
<small>
|
||||
Last modified by Eric Westbrook on <br>
|
||||
Sat Feb 23 19:09:42 UTC 2019
|
||||
Last modified by Diego Nehab on <br>
|
||||
Thu Apr 20 00:25:26 EDT 2006
|
||||
</small>
|
||||
</p>
|
||||
</center>
|
||||
|
@ -477,12 +477,6 @@ used in validating addresses supplied in a call to
|
||||
<li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt>
|
||||
disables the Nagle's algorithm for the connection;
|
||||
|
||||
<li> '<tt>tcp-keepidle</tt>': value in seconds for <tt>TCP_KEEPIDLE</tt> Linux only!!
|
||||
|
||||
<li> '<tt>tcp-keepcnt</tt>': value for <tt>TCP_KEEPCNT</tt> Linux only!!
|
||||
|
||||
<li> '<tt>tcp-keepintvl</tt>': value for <tt>TCP_KEEPINTVL</tt> Linux only!!
|
||||
|
||||
<li> '<tt>ipv6-v6only</tt>':
|
||||
Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to
|
||||
sending and receiving only IPv6 packets.
|
||||
|
105
luasocket-scm-0.rockspec
Normal file
105
luasocket-scm-0.rockspec
Normal file
@ -0,0 +1,105 @@
|
||||
package = "LuaSocket"
|
||||
version = "scm-0"
|
||||
source = {
|
||||
url = "https://github.com/diegonehab/luasocket/archive/master.zip",
|
||||
dir = "luasocket-master",
|
||||
}
|
||||
description = {
|
||||
summary = "Network support for the Lua language",
|
||||
detailed = [[
|
||||
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.
|
||||
]],
|
||||
homepage = "http://luaforge.net/projects/luasocket/",
|
||||
license = "MIT"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
}
|
||||
|
||||
local function make_plat(plat)
|
||||
local defines = {
|
||||
unix = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"LUASOCKET_API=__attribute__((visibility(\"default\")))",
|
||||
"UNIX_API=__attribute__((visibility(\"default\")))",
|
||||
"MIME_API=__attribute__((visibility(\"default\")))"
|
||||
},
|
||||
macosx = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"UNIX_HAS_SUN_LEN",
|
||||
"LUASOCKET_API=__attribute__((visibility(\"default\")))",
|
||||
"UNIX_API=__attribute__((visibility(\"default\")))",
|
||||
"MIME_API=__attribute__((visibility(\"default\")))"
|
||||
},
|
||||
win32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"NDEBUG",
|
||||
"LUASOCKET_API=__declspec(dllexport)",
|
||||
"MIME_API=__declspec(dllexport)"
|
||||
},
|
||||
mingw32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"LUASOCKET_INET_PTON",
|
||||
"WINVER=0x0501",
|
||||
"LUASOCKET_API=__declspec(dllexport)",
|
||||
"MIME_API=__declspec(dllexport)"
|
||||
}
|
||||
}
|
||||
local modules = {
|
||||
["socket.core"] = {
|
||||
sources = { "src/luasocket.c", "src/timeout.c", "src/buffer.c", "src/io.c", "src/auxiliar.c", "src/options.c", "src/inet.c", "src/except.c", "src/select.c", "src/tcp.c", "src/udp.c", "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["mime.core"] = {
|
||||
sources = { "src/mime.c", "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["socket.http"] = "src/http.lua",
|
||||
["socket.url"] = "src/url.lua",
|
||||
["socket.tp"] = "src/tp.lua",
|
||||
["socket.ftp"] = "src/ftp.lua",
|
||||
["socket.headers"] = "src/headers.lua",
|
||||
["socket.smtp"] = "src/smtp.lua",
|
||||
ltn12 = "src/ltn12.lua",
|
||||
socket = "src/socket.lua",
|
||||
mime = "src/mime.lua"
|
||||
}
|
||||
if plat == "unix" or plat == "macosx" or plat == "haiku" then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
|
||||
if plat == "haiku" then
|
||||
modules["socket.core"].libraries = {"network"}
|
||||
end
|
||||
modules["socket.unix"] = {
|
||||
sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
modules["socket.serial"] = {
|
||||
sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/serial.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
end
|
||||
if plat == "win32" or plat == "mingw32" then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
|
||||
modules["socket.core"].libraries = { "ws2_32" }
|
||||
end
|
||||
return { modules = modules }
|
||||
end
|
||||
|
||||
build = {
|
||||
type = "builtin",
|
||||
platforms = {
|
||||
unix = make_plat("unix"),
|
||||
macosx = make_plat("macosx"),
|
||||
haiku = make_plat("haiku"),
|
||||
win32 = make_plat("win32"),
|
||||
mingw32 = make_plat("mingw32")
|
||||
},
|
||||
copy_directories = { "doc", "samples", "etc", "test" }
|
||||
}
|
@ -1 +1 @@
|
||||
make DEBUG=DEBUG PLAT=macosx LUAINC_macosx_base=/Users/$USER/build/macosx/include LUAPREFIX_macosx=/Users/$USER/build/macosx install-both
|
||||
make DEBUG=DEBUG PLAT=macosx LUAINC_macosx_base=/Users/diego/build/macosx/include LUAPREFIX_macosx=/Users/diego/build/macosx install-both
|
||||
|
2
makefile
Executable file → Normal file
2
makefile
Executable file → Normal file
@ -10,7 +10,7 @@
|
||||
# print print the build settings
|
||||
|
||||
PLAT?= linux
|
||||
PLATS= macosx linux win32 win64 mingw freebsd solaris
|
||||
PLATS= macosx linux win32 mingw freebsd solaris
|
||||
|
||||
all: $(PLAT)
|
||||
|
||||
|
55
mime.vcxproj
55
mime.vcxproj
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@ -21,6 +21,19 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\mime.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\mime.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUALIB_PATH)$(Platform)\$(Configuration)</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUALIB_PATH)$(Platform)\$(Configuration)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{128E8BD0-174A-48F0-8771-92B1E8D18713}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
@ -28,22 +41,22 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -74,7 +87,7 @@
|
||||
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(Configuration)\mime\</OutDir>
|
||||
<OutDir>$(LUABIN_PATH)$(Configuration)\mime\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>core</TargetName>
|
||||
@ -82,23 +95,23 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>core</TargetName>
|
||||
<OutDir>$(Platform)\$(Configuration)\mime\</OutDir>
|
||||
<OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\mime\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(Configuration)\mime\</OutDir>
|
||||
<OutDir>$(LUABIN_PATH)$(Configuration)\mime\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>core</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(Platform)\$(Configuration)\mime\</OutDir>
|
||||
<OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\mime\</OutDir>
|
||||
<TargetName>core</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -109,9 +122,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -125,7 +138,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
@ -136,9 +149,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -150,7 +163,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
@ -159,9 +172,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
@ -174,7 +187,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -185,9 +198,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
16
mime.vcxproj.filters
Normal file
16
mime.vcxproj.filters
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\mime.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="cdir">
|
||||
<UniqueIdentifier>{fad87a86-297c-4881-a114-73b967bb3c92}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\mime.lua">
|
||||
<Filter>cdir</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,134 +1,105 @@
|
||||
package = "LuaSocket"
|
||||
version = "3.0rc2-1"
|
||||
source = {
|
||||
url = "git://github.com/diegonehab/luasocket.git",
|
||||
tag = "v3.0-rc2",
|
||||
url = "git://github.com/diegonehab/luasocket.git",
|
||||
tag = "v3.0-rc2",
|
||||
}
|
||||
description = {
|
||||
summary = "Network support for the Lua language",
|
||||
detailed = [[
|
||||
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.
|
||||
]],
|
||||
homepage = "http://luaforge.net/projects/luasocket/",
|
||||
license = "MIT"
|
||||
summary = "Network support for the Lua language",
|
||||
detailed = [[
|
||||
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.
|
||||
]],
|
||||
homepage = "http://luaforge.net/projects/luasocket/",
|
||||
license = "MIT"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
"lua >= 5.1"
|
||||
}
|
||||
|
||||
local function make_plat(plat)
|
||||
local defines = {
|
||||
unix = {
|
||||
"LUASOCKET_DEBUG"
|
||||
},
|
||||
macosx = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"UNIX_HAS_SUN_LEN"
|
||||
},
|
||||
win32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"NDEBUG"
|
||||
},
|
||||
mingw32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"LUASOCKET_INET_PTON",
|
||||
"WINVER=0x0501"
|
||||
}
|
||||
}
|
||||
local modules = {
|
||||
["socket.core"] = {
|
||||
sources = {
|
||||
"src/luasocket.c"
|
||||
, "src/timeout.c"
|
||||
, "src/buffer.c"
|
||||
, "src/io.c"
|
||||
, "src/auxiliar.c"
|
||||
, "src/options.c"
|
||||
, "src/inet.c"
|
||||
, "src/except.c"
|
||||
, "src/select.c"
|
||||
, "src/tcp.c"
|
||||
, "src/udp.c"
|
||||
, "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["mime.core"] = {
|
||||
sources = { "src/mime.c", "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["socket.http"] = "src/http.lua",
|
||||
["socket.url"] = "src/url.lua",
|
||||
["socket.tp"] = "src/tp.lua",
|
||||
["socket.ftp"] = "src/ftp.lua",
|
||||
["socket.headers"] = "src/headers.lua",
|
||||
["socket.smtp"] = "src/smtp.lua",
|
||||
ltn12 = "src/ltn12.lua",
|
||||
socket = "src/socket.lua",
|
||||
mime = "src/mime.lua"
|
||||
}
|
||||
if plat == "unix"
|
||||
or plat == "macosx"
|
||||
or plat == "haiku"
|
||||
then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
|
||||
if plat == "haiku" then
|
||||
modules["socket.core"].libraries = {"network"}
|
||||
end
|
||||
modules["socket.unix"] = {
|
||||
sources = {
|
||||
"src/buffer.c"
|
||||
, "src/compat.c"
|
||||
, "src/auxiliar.c"
|
||||
, "src/options.c"
|
||||
, "src/timeout.c"
|
||||
, "src/io.c"
|
||||
, "src/usocket.c"
|
||||
, "src/unix.c"
|
||||
, "src/unixdgram.c"
|
||||
, "src/unixstream.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
modules["socket.serial"] = {
|
||||
sources = {
|
||||
"src/buffer.c"
|
||||
, "src/compat.c"
|
||||
, "src/auxiliar.c"
|
||||
, "src/options.c"
|
||||
, "src/timeout.c"
|
||||
, "src/io.c"
|
||||
, "src/usocket.c"
|
||||
, "src/serial.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
end
|
||||
if plat == "win32"
|
||||
or plat == "mingw32"
|
||||
then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
|
||||
modules["socket.core"].libraries = { "ws2_32" }
|
||||
end
|
||||
return { modules = modules }
|
||||
local defines = {
|
||||
unix = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"LUASOCKET_API=__attribute__((visibility(\"default\")))",
|
||||
"UNIX_API=__attribute__((visibility(\"default\")))",
|
||||
"MIME_API=__attribute__((visibility(\"default\")))"
|
||||
},
|
||||
macosx = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"UNIX_HAS_SUN_LEN",
|
||||
"LUASOCKET_API=__attribute__((visibility(\"default\")))",
|
||||
"UNIX_API=__attribute__((visibility(\"default\")))",
|
||||
"MIME_API=__attribute__((visibility(\"default\")))"
|
||||
},
|
||||
win32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"NDEBUG",
|
||||
"LUASOCKET_API=__declspec(dllexport)",
|
||||
"MIME_API=__declspec(dllexport)"
|
||||
},
|
||||
mingw32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"LUASOCKET_INET_PTON",
|
||||
"WINVER=0x0501",
|
||||
"LUASOCKET_API=__declspec(dllexport)",
|
||||
"MIME_API=__declspec(dllexport)"
|
||||
}
|
||||
}
|
||||
local modules = {
|
||||
["socket.core"] = {
|
||||
sources = { "src/luasocket.c", "src/timeout.c", "src/buffer.c", "src/io.c", "src/auxiliar.c", "src/options.c", "src/inet.c", "src/except.c", "src/select.c", "src/tcp.c", "src/udp.c", "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["mime.core"] = {
|
||||
sources = { "src/mime.c", "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["socket.http"] = "src/http.lua",
|
||||
["socket.url"] = "src/url.lua",
|
||||
["socket.tp"] = "src/tp.lua",
|
||||
["socket.ftp"] = "src/ftp.lua",
|
||||
["socket.headers"] = "src/headers.lua",
|
||||
["socket.smtp"] = "src/smtp.lua",
|
||||
ltn12 = "src/ltn12.lua",
|
||||
socket = "src/socket.lua",
|
||||
mime = "src/mime.lua"
|
||||
}
|
||||
if plat == "unix" or plat == "macosx" or plat == "haiku" then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
|
||||
if plat == "haiku" then
|
||||
modules["socket.core"].libraries = {"network"}
|
||||
end
|
||||
modules["socket.unix"] = {
|
||||
sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
modules["socket.serial"] = {
|
||||
sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/serial.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
end
|
||||
if plat == "win32" or plat == "mingw32" then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
|
||||
modules["socket.core"].libraries = { "ws2_32" }
|
||||
end
|
||||
return { modules = modules }
|
||||
end
|
||||
|
||||
build = {
|
||||
type = "builtin",
|
||||
platforms = {
|
||||
unix = make_plat("unix"),
|
||||
macosx = make_plat("macosx"),
|
||||
haiku = make_plat("haiku"),
|
||||
win32 = make_plat("win32"),
|
||||
mingw32 = make_plat("mingw32")
|
||||
},
|
||||
copy_directories = {
|
||||
"doc"
|
||||
, "samples"
|
||||
, "etc"
|
||||
, "test" }
|
||||
type = "builtin",
|
||||
platforms = {
|
||||
unix = make_plat("unix"),
|
||||
macosx = make_plat("macosx"),
|
||||
haiku = make_plat("haiku"),
|
||||
win32 = make_plat("win32"),
|
||||
mingw32 = make_plat("mingw32")
|
||||
},
|
||||
copy_directories = { "doc", "samples", "etc", "test" }
|
||||
}
|
||||
|
@ -1,134 +0,0 @@
|
||||
package = "LuaSocket"
|
||||
version = "scm-2"
|
||||
source = {
|
||||
url = "git://github.com/diegonehab/luasocket.git"
|
||||
, branch="master"
|
||||
}
|
||||
description = {
|
||||
summary = "Network support for the Lua language",
|
||||
detailed = [[
|
||||
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.
|
||||
]],
|
||||
homepage = "http://luaforge.net/projects/luasocket/",
|
||||
license = "MIT"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1"
|
||||
}
|
||||
|
||||
local function make_plat(plat)
|
||||
local defines = {
|
||||
unix = {
|
||||
"LUASOCKET_DEBUG"
|
||||
},
|
||||
macosx = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"UNIX_HAS_SUN_LEN"
|
||||
},
|
||||
win32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"NDEBUG"
|
||||
},
|
||||
mingw32 = {
|
||||
"LUASOCKET_DEBUG",
|
||||
"LUASOCKET_INET_PTON",
|
||||
"WINVER=0x0501"
|
||||
}
|
||||
}
|
||||
local modules = {
|
||||
["socket.core"] = {
|
||||
sources = {
|
||||
"src/luasocket.c"
|
||||
, "src/timeout.c"
|
||||
, "src/buffer.c"
|
||||
, "src/io.c"
|
||||
, "src/auxiliar.c"
|
||||
, "src/options.c"
|
||||
, "src/inet.c"
|
||||
, "src/except.c"
|
||||
, "src/select.c"
|
||||
, "src/tcp.c"
|
||||
, "src/udp.c"
|
||||
, "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["mime.core"] = {
|
||||
sources = { "src/mime.c", "src/compat.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
},
|
||||
["socket.http"] = "src/http.lua",
|
||||
["socket.url"] = "src/url.lua",
|
||||
["socket.tp"] = "src/tp.lua",
|
||||
["socket.ftp"] = "src/ftp.lua",
|
||||
["socket.headers"] = "src/headers.lua",
|
||||
["socket.smtp"] = "src/smtp.lua",
|
||||
ltn12 = "src/ltn12.lua",
|
||||
socket = "src/socket.lua",
|
||||
mime = "src/mime.lua"
|
||||
}
|
||||
if plat == "unix"
|
||||
or plat == "macosx"
|
||||
or plat == "haiku"
|
||||
then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/usocket.c"
|
||||
if plat == "haiku" then
|
||||
modules["socket.core"].libraries = {"network"}
|
||||
end
|
||||
modules["socket.unix"] = {
|
||||
sources = {
|
||||
"src/buffer.c"
|
||||
, "src/compat.c"
|
||||
, "src/auxiliar.c"
|
||||
, "src/options.c"
|
||||
, "src/timeout.c"
|
||||
, "src/io.c"
|
||||
, "src/usocket.c"
|
||||
, "src/unix.c"
|
||||
, "src/unixdgram.c"
|
||||
, "src/unixstream.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
modules["socket.serial"] = {
|
||||
sources = {
|
||||
"src/buffer.c"
|
||||
, "src/compat.c"
|
||||
, "src/auxiliar.c"
|
||||
, "src/options.c"
|
||||
, "src/timeout.c"
|
||||
, "src/io.c"
|
||||
, "src/usocket.c"
|
||||
, "src/serial.c" },
|
||||
defines = defines[plat],
|
||||
incdir = "/src"
|
||||
}
|
||||
end
|
||||
if plat == "win32"
|
||||
or plat == "mingw32"
|
||||
then
|
||||
modules["socket.core"].sources[#modules["socket.core"].sources+1] = "src/wsocket.c"
|
||||
modules["socket.core"].libraries = { "ws2_32" }
|
||||
end
|
||||
return { modules = modules }
|
||||
end
|
||||
|
||||
build = {
|
||||
type = "builtin",
|
||||
platforms = {
|
||||
unix = make_plat("unix"),
|
||||
macosx = make_plat("macosx"),
|
||||
haiku = make_plat("haiku"),
|
||||
win32 = make_plat("win32"),
|
||||
mingw32 = make_plat("mingw32")
|
||||
},
|
||||
copy_directories = {
|
||||
"doc"
|
||||
, "samples"
|
||||
, "etc"
|
||||
, "test" }
|
||||
}
|
134
socket.vcxproj
134
socket.vcxproj
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@ -32,6 +32,98 @@
|
||||
<ClCompile Include="src\udp.c" />
|
||||
<ClCompile Include="src\wsocket.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\ltn12.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\socket.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\ftp.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\headers.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\http.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\smtp.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\tp.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\url.lua">
|
||||
<FileType>Document</FileType>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{66E3CE14-884D-4AEA-9F20-15A0BEAF8C5A}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
@ -39,22 +131,22 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -85,7 +177,7 @@
|
||||
<_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(Configuration)\socket\</OutDir>
|
||||
<OutDir>$(LUALIB_PATH)$(Configuration)\socket\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>core</TargetName>
|
||||
@ -93,23 +185,23 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>core</TargetName>
|
||||
<OutDir>$(Platform)\$(Configuration)\socket\</OutDir>
|
||||
<OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(Configuration)\socket\</OutDir>
|
||||
<OutDir>$(LUALIB_PATH)$(Configuration)\socket\</OutDir>
|
||||
<IntDir>$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<TargetName>core</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(Platform)\$(Configuration)\socket\</OutDir>
|
||||
<OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\</OutDir>
|
||||
<TargetName>core</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@ -120,9 +212,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -136,7 +228,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
@ -147,9 +239,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -161,7 +253,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
@ -170,9 +262,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
@ -185,7 +277,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@ -196,9 +288,9 @@
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(LUALIBNAME);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(LUALIB);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
51
socket.vcxproj.filters
Normal file
51
socket.vcxproj.filters
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\auxiliar.c" />
|
||||
<ClCompile Include="src\buffer.c" />
|
||||
<ClCompile Include="src\except.c" />
|
||||
<ClCompile Include="src\inet.c" />
|
||||
<ClCompile Include="src\io.c" />
|
||||
<ClCompile Include="src\luasocket.c" />
|
||||
<ClCompile Include="src\options.c" />
|
||||
<ClCompile Include="src\select.c" />
|
||||
<ClCompile Include="src\tcp.c" />
|
||||
<ClCompile Include="src\timeout.c" />
|
||||
<ClCompile Include="src\udp.c" />
|
||||
<ClCompile Include="src\wsocket.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="src\ltn12.lua">
|
||||
<Filter>cdir</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\socket.lua">
|
||||
<Filter>cdir</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\ftp.lua">
|
||||
<Filter>ldir</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\headers.lua">
|
||||
<Filter>ldir</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\http.lua">
|
||||
<Filter>ldir</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\smtp.lua">
|
||||
<Filter>ldir</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\tp.lua">
|
||||
<Filter>ldir</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\url.lua">
|
||||
<Filter>ldir</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="cdir">
|
||||
<UniqueIdentifier>{b053460d-5439-4e3a-a2eb-c31a95b5691f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ldir">
|
||||
<UniqueIdentifier>{b301b82c-37cb-4e05-9333-194e92ed7a62}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -2,11 +2,14 @@
|
||||
* Auxiliar routines for class hierarchy manipulation
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "auxiliar.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "auxiliar.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
* Exported functions
|
||||
\*=========================================================================*/
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes the module
|
||||
\*-------------------------------------------------------------------------*/
|
||||
@ -152,3 +155,4 @@ int auxiliar_typeerror (lua_State *L, int narg, const char *tname) {
|
||||
luaL_typename(L, narg));
|
||||
return luaL_argerror(L, narg, msg);
|
||||
}
|
||||
|
||||
|
@ -29,26 +29,20 @@
|
||||
* reverse mapping are done using lauxlib.
|
||||
\*=========================================================================*/
|
||||
|
||||
#include "luasocket.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
int auxiliar_open(lua_State *L);
|
||||
void auxiliar_newclass(lua_State *L, const char *classname, luaL_Reg *func);
|
||||
int auxiliar_tostring(lua_State *L);
|
||||
void auxiliar_add2group(lua_State *L, const char *classname, const char *group);
|
||||
int auxiliar_checkboolean(lua_State *L, int objidx);
|
||||
void auxiliar_setclass(lua_State *L, const char *classname, int objidx);
|
||||
void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx);
|
||||
void *auxiliar_checkgroup(lua_State *L, const char *groupname, int objidx);
|
||||
void auxiliar_setclass(lua_State *L, const char *classname, int objidx);
|
||||
void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx);
|
||||
void *auxiliar_getclassudata(lua_State *L, const char *groupname, int objidx);
|
||||
void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx);
|
||||
int auxiliar_checkboolean(lua_State *L, int objidx);
|
||||
int auxiliar_tostring(lua_State *L);
|
||||
int auxiliar_typeerror(lua_State *L, int narg, const char *tname);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* AUXILIAR_H */
|
||||
|
@ -2,7 +2,10 @@
|
||||
* Input/Output interface for Lua programs
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "buffer.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
|
15
src/buffer.h
15
src/buffer.h
@ -15,7 +15,8 @@
|
||||
* The module is built on top of the I/O abstraction defined in io.h and the
|
||||
* timeout management is done with the timeout.h interface.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
|
||||
#include "io.h"
|
||||
#include "timeout.h"
|
||||
|
||||
@ -33,20 +34,12 @@ typedef struct t_buffer_ {
|
||||
} t_buffer;
|
||||
typedef t_buffer *p_buffer;
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int buffer_open(lua_State *L);
|
||||
void buffer_init(p_buffer buf, p_io io, p_timeout tm);
|
||||
int buffer_meth_getstats(lua_State *L, p_buffer buf);
|
||||
int buffer_meth_setstats(lua_State *L, p_buffer buf);
|
||||
int buffer_meth_send(lua_State *L, p_buffer buf);
|
||||
int buffer_meth_receive(lua_State *L, p_buffer buf);
|
||||
int buffer_meth_getstats(lua_State *L, p_buffer buf);
|
||||
int buffer_meth_setstats(lua_State *L, p_buffer buf);
|
||||
int buffer_isempty(p_buffer buf);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* BUF_H */
|
||||
|
@ -1,12 +1,10 @@
|
||||
#include "luasocket.h"
|
||||
#include "compat.h"
|
||||
|
||||
#if LUA_VERSION_NUM==501
|
||||
|
||||
/*
|
||||
** Adapted from Lua 5.2
|
||||
*/
|
||||
void luasocket_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
|
||||
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
|
||||
luaL_checkstack(L, nup+1, "too many upvalues");
|
||||
for (; l->name != NULL; l++) { /* fill the table with given functions */
|
||||
int i;
|
||||
@ -22,7 +20,7 @@ void luasocket_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
|
||||
/*
|
||||
** Duplicated from Lua 5.2
|
||||
*/
|
||||
void *luasocket_testudata (lua_State *L, int ud, const char *tname) {
|
||||
void *luaL_testudata (lua_State *L, int ud, const char *tname) {
|
||||
void *p = lua_touserdata(L, ud);
|
||||
if (p != NULL) { /* value is a userdata? */
|
||||
if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
|
||||
|
20
src/compat.h
20
src/compat.h
@ -1,22 +1,12 @@
|
||||
#ifndef COMPAT_H
|
||||
#define COMPAT_H
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#if LUA_VERSION_NUM==501
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
void luasocket_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
|
||||
void *luasocket_testudata ( lua_State *L, int arg, const char *tname);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#define luaL_setfuncs luasocket_setfuncs
|
||||
#define luaL_testudata luasocket_testudata
|
||||
|
||||
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
|
||||
void *luaL_testudata ( lua_State *L, int arg, const char *tname);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -2,10 +2,14 @@
|
||||
* Simple exception support
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "except.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "except.h"
|
||||
|
||||
#if LUA_VERSION_NUM < 502
|
||||
#define lua_pcallk(L, na, nr, err, ctx, cont) \
|
||||
(((void)ctx),((void)cont),lua_pcall(L, na, nr, err))
|
||||
|
10
src/except.h
10
src/except.h
@ -31,16 +31,8 @@
|
||||
* exceptions on error, but that don't interrupt the user script.
|
||||
\*=========================================================================*/
|
||||
|
||||
#include "luasocket.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
#include "lua.h"
|
||||
|
||||
int except_open(lua_State *L);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
80
src/http.lua
80
src/http.lua
@ -26,24 +26,11 @@ _M.TIMEOUT = 60
|
||||
-- user agent field sent in request
|
||||
_M.USERAGENT = socket._VERSION
|
||||
|
||||
-- supported schemes and their particulars
|
||||
local SCHEMES = {
|
||||
http = {
|
||||
port = 80
|
||||
, create = function(t)
|
||||
return socket.tcp end }
|
||||
, https = {
|
||||
port = 443
|
||||
, create = function(t)
|
||||
local https = assert(
|
||||
require("ssl.https"), 'LuaSocket: LuaSec not found')
|
||||
local tcp = assert(
|
||||
https.tcp, 'LuaSocket: Function tcp() not available from LuaSec')
|
||||
return tcp(t) end }}
|
||||
-- supported schemes
|
||||
local SCHEMES = { ["http"] = true }
|
||||
-- default port for document retrieval
|
||||
local PORT = 80
|
||||
|
||||
-- default scheme and port for document retrieval
|
||||
local SCHEME = 'http'
|
||||
local PORT = SCHEMES[SCHEME].port
|
||||
-----------------------------------------------------------------------------
|
||||
-- Reads MIME headers from a connection, unfolding where needed
|
||||
-----------------------------------------------------------------------------
|
||||
@ -124,13 +111,13 @@ local metat = { __index = {} }
|
||||
|
||||
function _M.open(host, port, create)
|
||||
-- create socket with user connect function, or with default
|
||||
local c = socket.try(create())
|
||||
local c = socket.try((create or socket.tcp)())
|
||||
local h = base.setmetatable({ c = c }, metat)
|
||||
-- create finalized try
|
||||
h.try = socket.newtry(function() h:close() end)
|
||||
-- set timeout before connecting
|
||||
h.try(c:settimeout(_M.TIMEOUT))
|
||||
h.try(c:connect(host, port))
|
||||
h.try(c:connect(host, port or PORT))
|
||||
-- here everything worked
|
||||
return h
|
||||
end
|
||||
@ -160,15 +147,10 @@ function metat.__index:sendbody(headers, source, step)
|
||||
end
|
||||
|
||||
function metat.__index:receivestatusline()
|
||||
local status,ec = self.try(self.c:receive(5))
|
||||
local status = self.try(self.c:receive(5))
|
||||
-- identify HTTP/0.9 responses, which do not contain a status line
|
||||
-- this is just a heuristic, but is what the RFC recommends
|
||||
if status ~= "HTTP/" then
|
||||
if ec == "timeout" then
|
||||
return 408
|
||||
end
|
||||
return nil, status
|
||||
end
|
||||
if status ~= "HTTP/" then return nil, status end
|
||||
-- otherwise proceed reading a status line
|
||||
status = self.try(self.c:receive("*l", status))
|
||||
local code = socket.skip(2, string.find(status, "HTTP/%d*%.%d* (%d%d%d)"))
|
||||
@ -230,10 +212,7 @@ end
|
||||
|
||||
local function adjustheaders(reqt)
|
||||
-- default headers
|
||||
local host = reqt.host
|
||||
local port = tostring(reqt.port)
|
||||
if port ~= tostring(SCHEMES[reqt.scheme].port) then
|
||||
host = host .. ':' .. port end
|
||||
local host = string.gsub(reqt.authority, "^.-@", "")
|
||||
local lower = {
|
||||
["user-agent"] = _M.USERAGENT,
|
||||
["host"] = host,
|
||||
@ -264,8 +243,10 @@ end
|
||||
|
||||
-- default url parts
|
||||
local default = {
|
||||
path ="/"
|
||||
, scheme = "http"
|
||||
host = "",
|
||||
port = PORT,
|
||||
path ="/",
|
||||
scheme = "http"
|
||||
}
|
||||
|
||||
local function adjustrequest(reqt)
|
||||
@ -273,13 +254,8 @@ local function adjustrequest(reqt)
|
||||
local nreqt = reqt.url and url.parse(reqt.url, default) or {}
|
||||
-- explicit components override url
|
||||
for i,v in base.pairs(reqt) do nreqt[i] = v end
|
||||
-- default to scheme particulars
|
||||
local schemedefs, host, port, method
|
||||
= SCHEMES[nreqt.scheme], nreqt.host, nreqt.port, nreqt.method
|
||||
if not nreqt.create then nreqt.create = schemedefs.create(nreqt) end
|
||||
if not (port and port ~= '') then nreqt.port = schemedefs.port end
|
||||
if not (method and method ~= '') then nreqt.method = 'GET' end
|
||||
if not (host and host ~= "") then
|
||||
if nreqt.port == "" then nreqt.port = PORT end
|
||||
if not (nreqt.host and nreqt.host ~= "") then
|
||||
socket.try(nil, "invalid host '" .. base.tostring(nreqt.host) .. "'")
|
||||
end
|
||||
-- compute uri if user hasn't overriden
|
||||
@ -296,16 +272,12 @@ local function shouldredirect(reqt, code, headers)
|
||||
if not location then return false end
|
||||
location = string.gsub(location, "%s", "")
|
||||
if location == "" then return false end
|
||||
local scheme = url.parse(location).scheme
|
||||
if scheme and (not SCHEMES[scheme]) then return false end
|
||||
-- avoid https downgrades
|
||||
if ('https' == reqt.scheme) and ('https' ~= scheme) then return false end
|
||||
local scheme = string.match(location, "^([%w][%w%+%-%.]*)%:")
|
||||
if scheme and not SCHEMES[scheme] then return false end
|
||||
return (reqt.redirect ~= false) and
|
||||
(code == 301 or code == 302 or code == 303 or code == 307) and
|
||||
(not reqt.method or reqt.method == "GET" or reqt.method == "HEAD")
|
||||
and ((false == reqt.maxredirects)
|
||||
or ((reqt.nredirects or 0)
|
||||
< (reqt.maxredirects or 5)))
|
||||
and (not reqt.nredirects or reqt.nredirects < 5)
|
||||
end
|
||||
|
||||
local function shouldreceivebody(reqt, code)
|
||||
@ -319,21 +291,14 @@ end
|
||||
local trequest, tredirect
|
||||
|
||||
--[[local]] function tredirect(reqt, location)
|
||||
-- the RFC says the redirect URL has to be absolute, but some
|
||||
-- servers do not respect that
|
||||
local newurl = url.absolute(reqt.url, location)
|
||||
-- if switching schemes, reset port and create function
|
||||
if url.parse(newurl).scheme ~= reqt.scheme then
|
||||
reqt.port = nil
|
||||
reqt.create = nil end
|
||||
-- make new request
|
||||
local result, code, headers, status = trequest {
|
||||
url = newurl,
|
||||
-- the RFC says the redirect URL has to be absolute, but some
|
||||
-- servers do not respect that
|
||||
url = url.absolute(reqt.url, location),
|
||||
source = reqt.source,
|
||||
sink = reqt.sink,
|
||||
headers = reqt.headers,
|
||||
proxy = reqt.proxy,
|
||||
maxredirects = reqt.maxredirects,
|
||||
nredirects = (reqt.nredirects or 0) + 1,
|
||||
create = reqt.create
|
||||
}
|
||||
@ -360,8 +325,6 @@ end
|
||||
if not code then
|
||||
h:receive09body(status, nreqt.sink, nreqt.step)
|
||||
return 1, 200
|
||||
elseif code == 408 then
|
||||
return 1, code
|
||||
end
|
||||
local headers
|
||||
-- ignore any 100-continue messages
|
||||
@ -416,5 +379,4 @@ _M.request = socket.protect(function(reqt, body)
|
||||
else return trequest(reqt) end
|
||||
end)
|
||||
|
||||
_M.schemes = SCHEMES
|
||||
return _M
|
||||
|
12
src/inet.c
12
src/inet.c
@ -2,13 +2,16 @@
|
||||
* Internet domain functions
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "inet.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "inet.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
* Internal function prototypes.
|
||||
\*=========================================================================*/
|
||||
@ -29,6 +32,9 @@ static luaL_Reg func[] = {
|
||||
{ NULL, NULL}
|
||||
};
|
||||
|
||||
/*=========================================================================*\
|
||||
* Exported functions
|
||||
\*=========================================================================*/
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes module
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
26
src/inet.h
26
src/inet.h
@ -14,7 +14,7 @@
|
||||
*
|
||||
* The Lua functions toip and tohostname are also implemented here.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
#include "socket.h"
|
||||
#include "timeout.h"
|
||||
|
||||
@ -22,23 +22,21 @@
|
||||
#define LUASOCKET_INET_ATON
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int inet_open(lua_State *L);
|
||||
|
||||
int inet_optfamily(lua_State* L, int narg, const char* def);
|
||||
int inet_optsocktype(lua_State* L, int narg, const char* def);
|
||||
const char *inet_trycreate(p_socket ps, int family, int type, int protocol);
|
||||
const char *inet_tryconnect(p_socket ps, int *family, const char *address,
|
||||
const char *serv, p_timeout tm, struct addrinfo *connecthints);
|
||||
const char *inet_trybind(p_socket ps, int *family, const char *address,
|
||||
const char *serv, struct addrinfo *bindhints);
|
||||
const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm);
|
||||
const char *inet_tryaccept(p_socket server, int family, p_socket client, p_timeout tm);
|
||||
|
||||
int inet_meth_getpeername(lua_State *L, p_socket ps, int family);
|
||||
int inet_meth_getsockname(lua_State *L, p_socket ps, int family);
|
||||
|
||||
const char *inet_trycreate(p_socket ps, int family, int type, int protocol);
|
||||
const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm);
|
||||
const char *inet_tryconnect(p_socket ps, int *family, const char *address, const char *serv, p_timeout tm, struct addrinfo *connecthints);
|
||||
const char *inet_tryaccept(p_socket server, int family, p_socket client, p_timeout tm);
|
||||
const char *inet_trybind(p_socket ps, int *family, const char *address, const char *serv, struct addrinfo *bindhints);
|
||||
int inet_optfamily(lua_State* L, int narg, const char* def);
|
||||
int inet_optsocktype(lua_State* L, int narg, const char* def);
|
||||
|
||||
#ifdef LUASOCKET_INET_ATON
|
||||
int inet_aton(const char *cp, struct in_addr *inp);
|
||||
@ -49,8 +47,4 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt);
|
||||
int inet_pton(int af, const char *src, void *dst);
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* INET_H */
|
||||
|
4
src/io.c
4
src/io.c
@ -2,9 +2,11 @@
|
||||
* Input/Output abstraction
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "io.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
* Exported functions
|
||||
\*=========================================================================*/
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes C structure
|
||||
\*-------------------------------------------------------------------------*/
|
||||
|
13
src/io.h
13
src/io.h
@ -12,7 +12,9 @@
|
||||
* The module socket.h implements this interface, and thus the module tcp.h
|
||||
* is very simple.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <stdio.h>
|
||||
#include "lua.h"
|
||||
|
||||
#include "timeout.h"
|
||||
|
||||
/* IO error codes */
|
||||
@ -56,15 +58,8 @@ typedef struct t_io_ {
|
||||
} t_io;
|
||||
typedef t_io *p_io;
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx);
|
||||
const char *io_strerror(int err);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* IO_H */
|
||||
|
||||
|
12
src/luasocket.c
Executable file → Normal file
12
src/luasocket.c
Executable file → Normal file
@ -12,6 +12,16 @@
|
||||
* standard Lua read and write functions.
|
||||
\*=========================================================================*/
|
||||
|
||||
/*=========================================================================*\
|
||||
* Standard include files
|
||||
\*=========================================================================*/
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
* LuaSocket includes
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "auxiliar.h"
|
||||
#include "except.h"
|
||||
@ -54,7 +64,7 @@ static luaL_Reg func[] = {
|
||||
* Skip a few arguments
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int global_skip(lua_State *L) {
|
||||
int amount = (int) luaL_checkinteger(L, 1);
|
||||
int amount = luaL_checkinteger(L, 1);
|
||||
int ret = lua_gettop(L) - amount - 1;
|
||||
return ret >= 0 ? ret : 0;
|
||||
}
|
||||
|
@ -6,8 +6,9 @@
|
||||
* Diego Nehab
|
||||
* 9/11/1999
|
||||
\*=========================================================================*/
|
||||
#include "lua.h"
|
||||
|
||||
/*-------------------------------------------------------------------------* \
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Current socket library version
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#define LUASOCKET_VERSION "LuaSocket 3.0-rc1"
|
||||
@ -17,16 +18,8 @@
|
||||
* This macro prefixes all exported API functions
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#ifndef LUASOCKET_API
|
||||
#ifdef _WIN32
|
||||
#define LUASOCKET_API __declspec(dllexport)
|
||||
#else
|
||||
#define LUASOCKET_API __attribute__ ((visibility ("default")))
|
||||
#define LUASOCKET_API extern
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes the library.
|
||||
|
115
src/makefile
Executable file → Normal file
115
src/makefile
Executable file → Normal file
@ -12,7 +12,7 @@
|
||||
#
|
||||
# make PLAT=linux DEBUG=DEBUG LUAV=5.2 prefix=/sw
|
||||
|
||||
# PLAT: linux macosx win32 win64 mingw
|
||||
# PLAT: linux macosx win32 mingw
|
||||
# platform to build for
|
||||
PLAT?=linux
|
||||
|
||||
@ -35,8 +35,7 @@ DEBUG?=NODEBUG
|
||||
# LUAINC_macosx:
|
||||
# /opt/local/include
|
||||
LUAINC_macosx_base?=/opt/local/include
|
||||
LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV) $(LUAINC_macosx_base)/lua$(LUAV) $(LUAINC_macosx_base)/lua-$(LUAV)
|
||||
|
||||
LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV)
|
||||
# FIXME default should this default to fink or to macports?
|
||||
# What happens when more than one Lua version is installed?
|
||||
LUAPREFIX_macosx?=/opt/local
|
||||
@ -49,7 +48,7 @@ LDIR_macosx?=share/lua/$(LUAV)
|
||||
# /usr/local/include/lua$(LUAV)
|
||||
# where lua headers are found for linux builds
|
||||
LUAINC_linux_base?=/usr/include
|
||||
LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV) $(LUAINC_linux_base)/lua$(LUAV)
|
||||
LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV)
|
||||
LUAPREFIX_linux?=/usr/local
|
||||
CDIR_linux?=lib/lua/$(LUAV)
|
||||
LDIR_linux?=share/lua/$(LUAV)
|
||||
@ -58,7 +57,7 @@ LDIR_linux?=share/lua/$(LUAV)
|
||||
# /usr/local/include/lua$(LUAV)
|
||||
# where lua headers are found for freebsd builds
|
||||
LUAINC_freebsd_base?=/usr/local/include/
|
||||
LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua/$(LUAV) $(LUAINC_freebsd_base)/lua$(LUAV)
|
||||
LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua$(LUAV)
|
||||
LUAPREFIX_freebsd?=/usr/local/
|
||||
CDIR_freebsd?=lib/lua/$(LUAV)
|
||||
LDIR_freebsd?=share/lua/$(LUAV)
|
||||
@ -67,7 +66,7 @@ LDIR_freebsd?=share/lua/$(LUAV)
|
||||
# LUAINC_mingw:
|
||||
# /opt/local/include
|
||||
LUAINC_mingw_base?=/usr/include
|
||||
LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV) $(LUAINC_mingw_base)/lua$(LUAV)
|
||||
LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV)
|
||||
LUALIB_mingw_base?=/usr/bin
|
||||
LUALIB_mingw?=$(LUALIB_mingw_base)/lua/$(LUAV)/lua$(subst .,,$(LUAV)).dll
|
||||
LUAPREFIX_mingw?=/usr
|
||||
@ -79,28 +78,17 @@ LDIR_mingw?=lua/$(LUAV)/lua
|
||||
# LUALIB_win32:
|
||||
# where lua headers and libraries are found for win32 builds
|
||||
LUAPREFIX_win32?=
|
||||
LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV) $(LUAPREFIX_win32)/include/lua$(LUAV)
|
||||
LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV)
|
||||
PLATFORM_win32?=Release
|
||||
CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)
|
||||
LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua
|
||||
LUALIB_win32?=$(LUAPREFIX_win32)/lib/lua/$(LUAV)/$(PLATFORM_win32)
|
||||
LUALIBNAME_win32?=lua$(subst .,,$(LUAV)).lib
|
||||
|
||||
# LUAINC_win64:
|
||||
# LUALIB_win64:
|
||||
# where lua headers and libraries are found for win64 builds
|
||||
LUAPREFIX_win64?=
|
||||
LUAINC_win64?=$(LUAPREFIX_win64)/include/lua/$(LUAV) $(LUAPREFIX_win64)/include/lua$(LUAV)
|
||||
PLATFORM_win64?=x64/Release
|
||||
CDIR_win64?=bin/lua/$(LUAV)/$(PLATFORM_win64)
|
||||
LDIR_win64?=bin/lua/$(LUAV)/$(PLATFORM_win64)/lua
|
||||
LUALIB_win64?=$(LUAPREFIX_win64)/lib/lua/$(LUAV)/$(PLATFORM_win64)
|
||||
LUALIBNAME_win64?=lua$(subst .,,$(LUAV)).lib
|
||||
LUALIBNAME_win32?=lua$(subst .,,$(LUAV)).lib
|
||||
|
||||
|
||||
# LUAINC_solaris:
|
||||
LUAINC_solaris_base?=/usr/include
|
||||
LUAINC_solaris?=$(LUAINC_solaris_base)/lua/$(LUAV) $(LUAINC_solaris_base)/lua$(LUAV)
|
||||
LUAINC_solaris?=$(LUAINC_solaris_base)/lua/$(LUAV)
|
||||
LUAPREFIX_solaris?=/usr/local
|
||||
CDIR_solaris?=lib/lua/$(LUAV)
|
||||
LDIR_solaris?=share/lua/$(LUAV)
|
||||
@ -153,7 +141,7 @@ print:
|
||||
#------
|
||||
# Supported platforms
|
||||
#
|
||||
PLATS= macosx linux win32 win64 mingw solaris
|
||||
PLATS= macosx linux win32 mingw solaris
|
||||
|
||||
#------
|
||||
# Compiler and linker settings
|
||||
@ -161,10 +149,14 @@ PLATS= macosx linux win32 win64 mingw solaris
|
||||
SO_macosx=so
|
||||
O_macosx=o
|
||||
CC_macosx=gcc
|
||||
DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN
|
||||
CFLAGS_macosx=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common
|
||||
DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \
|
||||
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||
-DMIME_API='__attribute__((visibility("default")))'
|
||||
CFLAGS_macosx= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \
|
||||
-fvisibility=hidden
|
||||
LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o
|
||||
LD_macosx=gcc
|
||||
LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
|
||||
SOCKET_macosx=usocket.o
|
||||
|
||||
#------
|
||||
@ -173,9 +165,12 @@ SOCKET_macosx=usocket.o
|
||||
SO_linux=so
|
||||
O_linux=o
|
||||
CC_linux=gcc
|
||||
DEF_linux=-DLUASOCKET_$(DEBUG)
|
||||
CFLAGS_linux=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
|
||||
-Wimplicit -O2 -ggdb3 -fpic
|
||||
DEF_linux=-DLUASOCKET_$(DEBUG) \
|
||||
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||
-DMIME_API='__attribute__((visibility("default")))'
|
||||
CFLAGS_linux= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \
|
||||
-Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
|
||||
LDFLAGS_linux=-O -shared -fpic -o
|
||||
LD_linux=gcc
|
||||
SOCKET_linux=usocket.o
|
||||
@ -186,9 +181,12 @@ SOCKET_linux=usocket.o
|
||||
SO_freebsd=so
|
||||
O_freebsd=o
|
||||
CC_freebsd=gcc
|
||||
DEF_freebsd=-DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN
|
||||
CFLAGS_freebsd=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
|
||||
-Wimplicit -O2 -ggdb3 -fpic
|
||||
DEF_freebsd=-DLUASOCKET_$(DEBUG) \
|
||||
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||
-DMIME_API='__attribute__((visibility("default")))'
|
||||
CFLAGS_freebsd= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \
|
||||
-Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
|
||||
LDFLAGS_freebsd=-O -shared -fpic -o
|
||||
LD_freebsd=gcc
|
||||
SOCKET_freebsd=usocket.o
|
||||
@ -199,9 +197,12 @@ SOCKET_freebsd=usocket.o
|
||||
SO_solaris=so
|
||||
O_solaris=o
|
||||
CC_solaris=gcc
|
||||
DEF_solaris=-DLUASOCKET_$(DEBUG)
|
||||
CFLAGS_solaris=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
|
||||
-Wimplicit -O2 -ggdb3 -fpic
|
||||
DEF_solaris=-DLUASOCKET_$(DEBUG) \
|
||||
-DLUASOCKET_API='__attribute__((visibility("default")))' \
|
||||
-DUNIX_API='__attribute__((visibility("default")))' \
|
||||
-DMIME_API='__attribute__((visibility("default")))'
|
||||
CFLAGS_solaris=-I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \
|
||||
-Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
|
||||
LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o
|
||||
LD_solaris=gcc
|
||||
SOCKET_solaris=usocket.o
|
||||
@ -213,8 +214,10 @@ SO_mingw=dll
|
||||
O_mingw=o
|
||||
CC_mingw=gcc
|
||||
DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \
|
||||
-DWINVER=0x0501
|
||||
CFLAGS_mingw=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common
|
||||
-DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \
|
||||
-DMIME_API='__declspec(dllexport)'
|
||||
CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \
|
||||
-fvisibility=hidden
|
||||
LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
|
||||
LD_mingw=gcc
|
||||
SOCKET_mingw=wsocket.o
|
||||
@ -227,41 +230,19 @@ SO_win32=dll
|
||||
O_win32=obj
|
||||
CC_win32=cl
|
||||
DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
|
||||
//D "_CRT_SECURE_NO_WARNINGS" \
|
||||
//D "_WINDLL" \
|
||||
//D "LUASOCKET_$(DEBUG)"
|
||||
CFLAGS_win32=$(LUAINC:%=//I "%") $(DEF) //O2 //Ot //MD //W3 //nologo
|
||||
//D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
|
||||
//D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \
|
||||
//D "LUASOCKET_$(DEBUG)"
|
||||
CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo
|
||||
LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
|
||||
//MANIFEST //MANIFESTFILE:"intermediate.manifest" \
|
||||
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
|
||||
//MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
|
||||
//SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \
|
||||
//MACHINE:X86 /LIBPATH:"$(LUALIB)" \
|
||||
//MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" \
|
||||
$(LUALIBNAME_win32) ws2_32.lib //OUT:
|
||||
|
||||
LD_win32=cl
|
||||
SOCKET_win32=wsocket.obj
|
||||
|
||||
#------
|
||||
# Compiler and linker settings
|
||||
# for Win64
|
||||
SO_win64=dll
|
||||
O_win64=obj
|
||||
CC_win64=cl
|
||||
DEF_win64= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
|
||||
//D "_CRT_SECURE_NO_WARNINGS" \
|
||||
//D "_WINDLL" \
|
||||
//D "LUASOCKET_$(DEBUG)"
|
||||
CFLAGS_win64=$(LUAINC:%=//I "%") $(DEF) //O2 //Ot //MD //W3 //nologo
|
||||
LDFLAGS_win64= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
|
||||
//MANIFEST //MANIFESTFILE:"intermediate.manifest" \
|
||||
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
|
||||
//SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \
|
||||
/LIBPATH:"$(LUALIB)" \
|
||||
$(LUALIBNAME_win64) ws2_32.lib //OUT:
|
||||
|
||||
LD_win64=cl
|
||||
SOCKET_win64=wsocket.obj
|
||||
|
||||
.SUFFIXES: .obj
|
||||
|
||||
.c.obj:
|
||||
@ -336,7 +317,6 @@ UNIX_OBJS=\
|
||||
#
|
||||
SERIAL_OBJS=\
|
||||
buffer.$(O) \
|
||||
compat.$(O) \
|
||||
auxiliar.$(O) \
|
||||
options.$(O) \
|
||||
timeout.$(O) \
|
||||
@ -375,15 +355,12 @@ macosx:
|
||||
win32:
|
||||
$(MAKE) all PLAT=win32
|
||||
|
||||
win64:
|
||||
$(MAKE) all PLAT=win64
|
||||
|
||||
linux:
|
||||
$(MAKE) all-unix PLAT=linux
|
||||
|
||||
mingw:
|
||||
$(MAKE) all PLAT=mingw
|
||||
|
||||
|
||||
solaris:
|
||||
$(MAKE) all-unix PLAT=solaris
|
||||
|
||||
@ -409,7 +386,7 @@ $(UNIX_SO): $(UNIX_OBJS)
|
||||
$(SERIAL_SO): $(SERIAL_OBJS)
|
||||
$(LD) $(SERIAL_OBJS) $(LDFLAGS)$@
|
||||
|
||||
install:
|
||||
install:
|
||||
$(INSTALL_DIR) $(INSTALL_TOP_LDIR)
|
||||
$(INSTALL_DATA) $(TO_TOP_LDIR) $(INSTALL_TOP_LDIR)
|
||||
$(INSTALL_DIR) $(INSTALL_SOCKET_LDIR)
|
||||
|
164
src/mime.c
Executable file → Normal file
164
src/mime.c
Executable file → Normal file
@ -2,10 +2,13 @@
|
||||
* MIME support functions
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "mime.h"
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "mime.h"
|
||||
|
||||
/*=========================================================================*\
|
||||
* Don't want to trust escape character constants
|
||||
@ -27,12 +30,12 @@ static int mime_global_eol(lua_State *L);
|
||||
static int mime_global_dot(lua_State *L);
|
||||
|
||||
static size_t dot(int c, size_t state, luaL_Buffer *buffer);
|
||||
//static void b64setup(UC *base);
|
||||
static void b64setup(UC *base);
|
||||
static size_t b64encode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
|
||||
static size_t b64pad(const UC *input, size_t size, luaL_Buffer *buffer);
|
||||
static size_t b64decode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
|
||||
|
||||
//static void qpsetup(UC *class, UC *unbase);
|
||||
static void qpsetup(UC *class, UC *unbase);
|
||||
static void qpquote(UC c, luaL_Buffer *buffer);
|
||||
static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer);
|
||||
static size_t qpencode(UC c, UC *input, size_t size,
|
||||
@ -55,111 +58,17 @@ static luaL_Reg func[] = {
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Quoted-printable globals
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static UC qpclass[256];
|
||||
static UC qpbase[] = "0123456789ABCDEF";
|
||||
static UC qpunbase[256];
|
||||
enum {QP_PLAIN, QP_QUOTED, QP_CR, QP_IF_LAST};
|
||||
|
||||
static const UC qpclass[] = {
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_IF_LAST, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_CR, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_IF_LAST, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_QUOTED, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN, QP_PLAIN,
|
||||
QP_PLAIN, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED,
|
||||
QP_QUOTED, QP_QUOTED, QP_QUOTED, QP_QUOTED
|
||||
};
|
||||
|
||||
static const UC qpbase[] = "0123456789ABCDEF";
|
||||
|
||||
static const UC qpunbase[] = {
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255,
|
||||
255, 255, 255, 255, 255, 255, 10, 11, 12, 13, 14, 15,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 10, 11, 12, 13, 14, 15, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Base64 globals
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static const UC b64base[] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
static const UC b64unbase[] = {
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 62, 255, 255, 255, 63,
|
||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 255, 0,
|
||||
255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 255, 255,
|
||||
255, 255, 255, 255, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
||||
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
|
||||
51, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
|
||||
255, 255
|
||||
};
|
||||
static UC b64unbase[256];
|
||||
|
||||
/*=========================================================================*\
|
||||
* Exported functions
|
||||
@ -167,7 +76,7 @@ static const UC b64unbase[] = {
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes module
|
||||
\*-------------------------------------------------------------------------*/
|
||||
LUASOCKET_API int luaopen_mime_core(lua_State *L)
|
||||
MIME_API int luaopen_mime_core(lua_State *L)
|
||||
{
|
||||
lua_newtable(L);
|
||||
luaL_setfuncs(L, func, 0);
|
||||
@ -176,8 +85,8 @@ LUASOCKET_API int luaopen_mime_core(lua_State *L)
|
||||
lua_pushstring(L, MIME_VERSION);
|
||||
lua_rawset(L, -3);
|
||||
/* initialize lookup tables */
|
||||
// qpsetup(qpclass, qpunbase);
|
||||
// b64setup(b64unbase);
|
||||
qpsetup(qpclass, qpunbase);
|
||||
b64setup(b64unbase);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -233,7 +142,6 @@ static int mime_global_wrp(lua_State *L)
|
||||
return 2;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Fill base64 decode map.
|
||||
\*-------------------------------------------------------------------------*/
|
||||
@ -243,14 +151,7 @@ static void b64setup(UC *unbase)
|
||||
for (i = 0; i <= 255; i++) unbase[i] = (UC) 255;
|
||||
for (i = 0; i < 64; i++) unbase[b64base[i]] = (UC) i;
|
||||
unbase['='] = 0;
|
||||
|
||||
printf("static const UC b64unbase[] = {\n");
|
||||
for (int i = 0; i < 256; i++) {
|
||||
printf("%d, ", unbase[i]);
|
||||
}
|
||||
printf("\n}\n;");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Acumulates bytes in input buffer until 3 bytes are available.
|
||||
@ -444,14 +345,12 @@ static int mime_global_unb64(lua_State *L)
|
||||
* To encode one byte, we need to see the next two.
|
||||
* Worst case is when we see a space, and wonder if a CRLF is comming
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#if 0
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Split quoted-printable characters into classes
|
||||
* Precompute reverse map for encoding
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static void qpsetup(UC *cl, UC *unbase)
|
||||
{
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 256; i++) cl[i] = QP_QUOTED;
|
||||
for (i = 33; i <= 60; i++) cl[i] = QP_PLAIN;
|
||||
@ -468,37 +367,7 @@ static void qpsetup(UC *cl, UC *unbase)
|
||||
unbase['c'] = 12; unbase['D'] = 13; unbase['d'] = 13;
|
||||
unbase['E'] = 14; unbase['e'] = 14; unbase['F'] = 15;
|
||||
unbase['f'] = 15;
|
||||
|
||||
printf("static UC qpclass[] = {");
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (i % 6 == 0) {
|
||||
printf("\n ");
|
||||
}
|
||||
switch(cl[i]) {
|
||||
case QP_QUOTED:
|
||||
printf("QP_QUOTED, ");
|
||||
break;
|
||||
case QP_PLAIN:
|
||||
printf("QP_PLAIN, ");
|
||||
break;
|
||||
case QP_CR:
|
||||
printf("QP_CR, ");
|
||||
break;
|
||||
case QP_IF_LAST:
|
||||
printf("QP_IF_LAST, ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("\n};\n");
|
||||
|
||||
printf("static const UC qpunbase[] = {");
|
||||
for (int i = 0; i < 256; i++) {
|
||||
int c = qpunbase[i];
|
||||
printf("%d, ", c);
|
||||
}
|
||||
printf("\";\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Output one character in form =XX
|
||||
@ -578,6 +447,7 @@ static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer)
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int mime_global_qp(lua_State *L)
|
||||
{
|
||||
|
||||
size_t asize = 0, isize = 0;
|
||||
UC atom[3];
|
||||
const UC *input = (const UC *) luaL_optlstring(L, 1, NULL, &isize);
|
||||
@ -784,7 +654,7 @@ static int eolprocess(int c, int last, const char *marker,
|
||||
\*-------------------------------------------------------------------------*/
|
||||
static int mime_global_eol(lua_State *L)
|
||||
{
|
||||
int ctx = (int) luaL_checkinteger(L, 1);
|
||||
int ctx = luaL_checkinteger(L, 1);
|
||||
size_t isize = 0;
|
||||
const char *input = luaL_optlstring(L, 2, NULL, &isize);
|
||||
const char *last = input + isize;
|
||||
|
11
src/mime.h
11
src/mime.h
@ -8,7 +8,7 @@
|
||||
* and formatting conforming to RFC 2045. It is used by mime.lua, which
|
||||
* provide a higher level interface to this functionality.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Current MIME library version
|
||||
@ -17,6 +17,13 @@
|
||||
#define MIME_COPYRIGHT "Copyright (C) 2004-2013 Diego Nehab"
|
||||
#define MIME_AUTHORS "Diego Nehab"
|
||||
|
||||
LUASOCKET_API int luaopen_mime_core(lua_State *L);
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* This macro prefixes all exported API functions
|
||||
\*-------------------------------------------------------------------------*/
|
||||
#ifndef MIME_API
|
||||
#define MIME_API extern
|
||||
#endif
|
||||
|
||||
MIME_API int luaopen_mime_core(lua_State *L);
|
||||
|
||||
#endif /* MIME_H */
|
||||
|
@ -10,6 +10,7 @@
|
||||
local base = _G
|
||||
local ltn12 = require("ltn12")
|
||||
local mime = require("mime.core")
|
||||
local io = require("io")
|
||||
local string = require("string")
|
||||
local _M = mime
|
||||
|
||||
@ -86,4 +87,4 @@ function _M.stuff()
|
||||
return ltn12.filter.cycle(_M.dot, 2)
|
||||
end
|
||||
|
||||
return _M
|
||||
return _M
|
120
src/options.c
120
src/options.c
@ -2,11 +2,14 @@
|
||||
* Common option interface
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "lauxlib.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "options.h"
|
||||
#include "inet.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
/*=========================================================================*\
|
||||
* Internal functions prototypes
|
||||
@ -54,7 +57,6 @@ int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps)
|
||||
return opt->func(L, ps);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/* enables reuse of local address */
|
||||
int opt_set_reuseaddr(lua_State *L, p_socket ps)
|
||||
{
|
||||
@ -66,7 +68,6 @@ int opt_get_reuseaddr(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEADDR);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/* enables reuse of local port */
|
||||
int opt_set_reuseport(lua_State *L, p_socket ps)
|
||||
{
|
||||
@ -78,8 +79,7 @@ int opt_get_reuseport(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_REUSEPORT);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
/* disables the Nagle algorithm */
|
||||
/* disables the Naggle algorithm */
|
||||
int opt_set_tcp_nodelay(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, IPPROTO_TCP, TCP_NODELAY);
|
||||
@ -90,52 +90,6 @@ int opt_get_tcp_nodelay(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, IPPROTO_TCP, TCP_NODELAY);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
#ifdef TCP_KEEPIDLE
|
||||
|
||||
int opt_get_tcp_keepidle(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, IPPROTO_TCP, TCP_KEEPIDLE);
|
||||
}
|
||||
|
||||
int opt_set_tcp_keepidle(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_TCP, TCP_KEEPIDLE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------
|
||||
#ifdef TCP_KEEPCNT
|
||||
|
||||
int opt_get_tcp_keepcnt(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, IPPROTO_TCP, TCP_KEEPCNT);
|
||||
}
|
||||
|
||||
int opt_set_tcp_keepcnt(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_TCP, TCP_KEEPCNT);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------
|
||||
#ifdef TCP_KEEPINTVL
|
||||
|
||||
int opt_get_tcp_keepintvl(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, IPPROTO_TCP, TCP_KEEPINTVL);
|
||||
}
|
||||
|
||||
int opt_set_tcp_keepintvl(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_TCP, TCP_KEEPINTVL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_keepalive(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE);
|
||||
@ -146,7 +100,6 @@ int opt_get_keepalive(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_dontroute(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, SOL_SOCKET, SO_DONTROUTE);
|
||||
@ -157,7 +110,6 @@ int opt_get_dontroute(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_DONTROUTE);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_broadcast(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
|
||||
@ -168,29 +120,6 @@ int opt_get_broadcast(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, SOL_SOCKET, SO_BROADCAST);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_recv_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, SOL_SOCKET, SO_RCVBUF);
|
||||
}
|
||||
|
||||
int opt_get_recv_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, SOL_SOCKET, SO_RCVBUF);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_get_send_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||
}
|
||||
|
||||
int opt_set_send_buf_size(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, SOL_SOCKET, SO_SNDBUF);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS);
|
||||
@ -201,7 +130,6 @@ int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps)
|
||||
return opt_getint(L, ps, IPPROTO_IPV6, IPV6_UNICAST_HOPS);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
|
||||
@ -212,7 +140,6 @@ int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps)
|
||||
return opt_getint(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_HOPS);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip_multicast_loop(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP);
|
||||
@ -223,7 +150,6 @@ int opt_get_ip_multicast_loop(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, IPPROTO_IP, IP_MULTICAST_LOOP);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP);
|
||||
@ -234,7 +160,6 @@ int opt_get_ip6_multicast_loop(lua_State *L, p_socket ps)
|
||||
return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_MULTICAST_LOOP);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_linger(lua_State *L, p_socket ps)
|
||||
{
|
||||
struct linger li; /* obj, name, table */
|
||||
@ -267,13 +192,11 @@ int opt_get_linger(lua_State *L, p_socket ps)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setint(L, ps, IPPROTO_IP, IP_MULTICAST_TTL);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip_multicast_if(lua_State *L, p_socket ps)
|
||||
{
|
||||
const char *address = luaL_checkstring(L, 3); /* obj, name, ip */
|
||||
@ -298,7 +221,6 @@ int opt_get_ip_multicast_if(lua_State *L, p_socket ps)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip_add_membership(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_setmembership(L, ps, IPPROTO_IP, IP_ADD_MEMBERSHIP);
|
||||
@ -309,7 +231,6 @@ int opt_set_ip_drop_membersip(lua_State *L, p_socket ps)
|
||||
return opt_setmembership(L, ps, IPPROTO_IP, IP_DROP_MEMBERSHIP);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_set_ip6_add_membership(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP);
|
||||
@ -319,7 +240,7 @@ int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_ip6_setmembership(L, ps, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP);
|
||||
}
|
||||
// -------------------------------------------------------
|
||||
|
||||
int opt_get_ip6_v6only(lua_State *L, p_socket ps)
|
||||
{
|
||||
return opt_getboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY);
|
||||
@ -330,20 +251,6 @@ int opt_set_ip6_v6only(lua_State *L, p_socket ps)
|
||||
return opt_setboolean(L, ps, IPPROTO_IPV6, IPV6_V6ONLY);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
int opt_get_error(lua_State *L, p_socket ps)
|
||||
{
|
||||
int val = 0;
|
||||
socklen_t len = sizeof(val);
|
||||
if (getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *) &val, &len) < 0) {
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, "getsockopt failed");
|
||||
return 2;
|
||||
}
|
||||
lua_pushstring(L, socket_strerror(val));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*=========================================================================*\
|
||||
* Auxiliar functions
|
||||
\*=========================================================================*/
|
||||
@ -430,6 +337,19 @@ static int opt_getboolean(lua_State *L, p_socket ps, int level, int name)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int opt_get_error(lua_State *L, p_socket ps)
|
||||
{
|
||||
int val = 0;
|
||||
socklen_t len = sizeof(val);
|
||||
if (getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *) &val, &len) < 0) {
|
||||
lua_pushnil(L);
|
||||
lua_pushstring(L, "getsockopt failed");
|
||||
return 2;
|
||||
}
|
||||
lua_pushstring(L, socket_strerror(val));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int opt_setboolean(lua_State *L, p_socket ps, int level, int name)
|
||||
{
|
||||
int val = auxiliar_checkboolean(L, 3); /* obj, name, bool */
|
||||
|
116
src/options.h
116
src/options.h
@ -8,7 +8,7 @@
|
||||
* modules UDP and TCP.
|
||||
\*=========================================================================*/
|
||||
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
#include "socket.h"
|
||||
|
||||
/* option registry */
|
||||
@ -18,85 +18,45 @@ typedef struct t_opt {
|
||||
} t_opt;
|
||||
typedef t_opt *p_opt;
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
/* supported options for setoption */
|
||||
int opt_set_dontroute(lua_State *L, p_socket ps);
|
||||
int opt_set_broadcast(lua_State *L, p_socket ps);
|
||||
int opt_set_tcp_nodelay(lua_State *L, p_socket ps);
|
||||
int opt_set_keepalive(lua_State *L, p_socket ps);
|
||||
int opt_set_linger(lua_State *L, p_socket ps);
|
||||
int opt_set_reuseaddr(lua_State *L, p_socket ps);
|
||||
int opt_set_reuseport(lua_State *L, p_socket ps);
|
||||
int opt_set_ip_multicast_if(lua_State *L, p_socket ps);
|
||||
int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps);
|
||||
int opt_set_ip_multicast_loop(lua_State *L, p_socket ps);
|
||||
int opt_set_ip_add_membership(lua_State *L, p_socket ps);
|
||||
int opt_set_ip_drop_membersip(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_add_membership(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_v6only(lua_State *L, p_socket ps);
|
||||
|
||||
/* supported options for getoption */
|
||||
int opt_get_dontroute(lua_State *L, p_socket ps);
|
||||
int opt_get_broadcast(lua_State *L, p_socket ps);
|
||||
int opt_get_reuseaddr(lua_State *L, p_socket ps);
|
||||
int opt_get_reuseport(lua_State *L, p_socket ps);
|
||||
int opt_get_tcp_nodelay(lua_State *L, p_socket ps);
|
||||
int opt_get_keepalive(lua_State *L, p_socket ps);
|
||||
int opt_get_linger(lua_State *L, p_socket ps);
|
||||
int opt_get_ip_multicast_loop(lua_State *L, p_socket ps);
|
||||
int opt_get_ip_multicast_if(lua_State *L, p_socket ps);
|
||||
int opt_get_error(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_multicast_loop(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_v6only(lua_State *L, p_socket ps);
|
||||
int opt_get_reuseport(lua_State *L, p_socket ps);
|
||||
|
||||
/* invokes the appropriate option handler */
|
||||
int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps);
|
||||
int opt_meth_getoption(lua_State *L, p_opt opt, p_socket ps);
|
||||
|
||||
int opt_set_reuseaddr(lua_State *L, p_socket ps);
|
||||
int opt_get_reuseaddr(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_reuseport(lua_State *L, p_socket ps);
|
||||
int opt_get_reuseport(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_tcp_nodelay(lua_State *L, p_socket ps);
|
||||
int opt_get_tcp_nodelay(lua_State *L, p_socket ps);
|
||||
|
||||
#ifdef TCP_KEEPIDLE
|
||||
int opt_set_tcp_keepidle(lua_State *L, p_socket ps);
|
||||
int opt_get_tcp_keepidle(lua_State *L, p_socket ps);
|
||||
#endif
|
||||
|
||||
#ifdef TCP_KEEPCNT
|
||||
int opt_set_tcp_keepcnt(lua_State *L, p_socket ps);
|
||||
int opt_get_tcp_keepcnt(lua_State *L, p_socket ps);
|
||||
#endif
|
||||
|
||||
#ifdef TCP_KEEPINTVL
|
||||
int opt_set_tcp_keepintvl(lua_State *L, p_socket ps);
|
||||
int opt_get_tcp_keepintvl(lua_State *L, p_socket ps);
|
||||
#endif
|
||||
|
||||
int opt_set_keepalive(lua_State *L, p_socket ps);
|
||||
int opt_get_keepalive(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_dontroute(lua_State *L, p_socket ps);
|
||||
int opt_get_dontroute(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_broadcast(lua_State *L, p_socket ps);
|
||||
int opt_get_broadcast(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_recv_buf_size(lua_State *L, p_socket ps);
|
||||
int opt_get_recv_buf_size(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_send_buf_size(lua_State *L, p_socket ps);
|
||||
int opt_get_send_buf_size(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip6_unicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_unicast_hops(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip6_multicast_hops(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_multicast_hops(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip_multicast_loop(lua_State *L, p_socket ps);
|
||||
int opt_get_ip_multicast_loop(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip6_multicast_loop(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_multicast_loop(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_linger(lua_State *L, p_socket ps);
|
||||
int opt_get_linger(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip_multicast_ttl(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip_multicast_if(lua_State *L, p_socket ps);
|
||||
int opt_get_ip_multicast_if(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip_add_membership(lua_State *L, p_socket ps);
|
||||
int opt_set_ip_drop_membersip(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip6_add_membership(lua_State *L, p_socket ps);
|
||||
int opt_set_ip6_drop_membersip(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_set_ip6_v6only(lua_State *L, p_socket ps);
|
||||
int opt_get_ip6_v6only(lua_State *L, p_socket ps);
|
||||
|
||||
int opt_get_error(lua_State *L, p_socket ps);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
12
src/select.c
12
src/select.c
@ -2,14 +2,16 @@
|
||||
* Select implementation
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "socket.h"
|
||||
#include "timeout.h"
|
||||
#include "select.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*=========================================================================*\
|
||||
* Internal function prototypes.
|
||||
\*=========================================================================*/
|
||||
@ -29,6 +31,9 @@ static luaL_Reg func[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
/*=========================================================================*\
|
||||
* Exported functions
|
||||
\*=========================================================================*/
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes module
|
||||
\*-------------------------------------------------------------------------*/
|
||||
@ -212,3 +217,4 @@ static void make_assoc(lua_State *L, int tab) {
|
||||
i = i+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,14 +10,6 @@
|
||||
* true if there is data ready for reading (required for buffered input).
|
||||
\*=========================================================================*/
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int select_open(lua_State *L);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* SELECT_H */
|
||||
|
@ -2,14 +2,15 @@
|
||||
* Serial stream
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "socket.h"
|
||||
#include "options.h"
|
||||
#include "unix.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
/*
|
||||
|
55
src/socket.h
55
src/socket.h
@ -28,46 +28,51 @@
|
||||
\*=========================================================================*/
|
||||
#include "timeout.h"
|
||||
|
||||
/* convenient shorthand */
|
||||
/* we are lazy... */
|
||||
typedef struct sockaddr SA;
|
||||
|
||||
/*=========================================================================*\
|
||||
* Functions bellow implement a comfortable platform independent
|
||||
* interface to sockets
|
||||
\*=========================================================================*/
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int socket_waitfd(p_socket ps, int sw, p_timeout tm);
|
||||
int socket_open(void);
|
||||
int socket_close(void);
|
||||
void socket_destroy(p_socket ps);
|
||||
int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, p_timeout tm);
|
||||
void socket_shutdown(p_socket ps, int how);
|
||||
int socket_sendto(p_socket ps, const char *data, size_t count,
|
||||
size_t *sent, SA *addr, socklen_t addr_len, p_timeout tm);
|
||||
int socket_recvfrom(p_socket ps, char *data, size_t count,
|
||||
size_t *got, SA *addr, socklen_t *addr_len, p_timeout tm);
|
||||
|
||||
void socket_setnonblocking(p_socket ps);
|
||||
void socket_setblocking(p_socket ps);
|
||||
|
||||
int socket_waitfd(p_socket ps, int sw, p_timeout tm);
|
||||
int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds,
|
||||
p_timeout tm);
|
||||
|
||||
int socket_connect(p_socket ps, SA *addr, socklen_t addr_len, p_timeout tm);
|
||||
int socket_create(p_socket ps, int domain, int type, int protocol);
|
||||
int socket_bind(p_socket ps, SA *addr, socklen_t addr_len);
|
||||
int socket_listen(p_socket ps, int backlog);
|
||||
void socket_shutdown(p_socket ps, int how);
|
||||
int socket_connect(p_socket ps, SA *addr, socklen_t addr_len, p_timeout tm);
|
||||
int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *addr_len, p_timeout tm);
|
||||
int socket_send(p_socket ps, const char *data, size_t count, size_t *sent, p_timeout tm);
|
||||
int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, SA *addr, socklen_t addr_len, p_timeout tm);
|
||||
int socket_accept(p_socket ps, p_socket pa, SA *addr,
|
||||
socklen_t *addr_len, p_timeout tm);
|
||||
|
||||
const char *socket_hoststrerror(int err);
|
||||
const char *socket_gaistrerror(int err);
|
||||
const char *socket_strerror(int err);
|
||||
|
||||
/* these are perfect to use with the io abstraction module
|
||||
and the buffered input module */
|
||||
int socket_send(p_socket ps, const char *data, size_t count,
|
||||
size_t *sent, p_timeout tm);
|
||||
int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm);
|
||||
int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, SA *addr, socklen_t *addr_len, p_timeout tm);
|
||||
int socket_write(p_socket ps, const char *data, size_t count, size_t *sent, p_timeout tm);
|
||||
int socket_write(p_socket ps, const char *data, size_t count,
|
||||
size_t *sent, p_timeout tm);
|
||||
int socket_read(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm);
|
||||
void socket_setblocking(p_socket ps);
|
||||
void socket_setnonblocking(p_socket ps);
|
||||
const char *socket_ioerror(p_socket ps, int err);
|
||||
|
||||
int socket_gethostbyaddr(const char *addr, socklen_t len, struct hostent **hp);
|
||||
int socket_gethostbyname(const char *addr, struct hostent **hp);
|
||||
const char *socket_hoststrerror(int err);
|
||||
const char *socket_strerror(int err);
|
||||
const char *socket_ioerror(p_socket ps, int err);
|
||||
const char *socket_gaistrerror(int err);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* SOCKET_H */
|
||||
|
30
src/tcp.c
30
src/tcp.c
@ -2,7 +2,11 @@
|
||||
* TCP object
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "socket.h"
|
||||
@ -10,8 +14,6 @@
|
||||
#include "options.h"
|
||||
#include "tcp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/*=========================================================================*\
|
||||
* Internal function prototypes
|
||||
\*=========================================================================*/
|
||||
@ -75,19 +77,8 @@ static t_opt optget[] = {
|
||||
{"reuseaddr", opt_get_reuseaddr},
|
||||
{"reuseport", opt_get_reuseport},
|
||||
{"tcp-nodelay", opt_get_tcp_nodelay},
|
||||
#ifdef TCP_KEEPIDLE
|
||||
{"tcp-keepidle", opt_get_tcp_keepidle},
|
||||
#endif
|
||||
#ifdef TCP_KEEPCNT
|
||||
{"tcp-keepcnt", opt_get_tcp_keepcnt},
|
||||
#endif
|
||||
#ifdef TCP_KEEPINTVL
|
||||
{"tcp-keepintvl", opt_get_tcp_keepintvl},
|
||||
#endif
|
||||
{"linger", opt_get_linger},
|
||||
{"error", opt_get_error},
|
||||
{"recv-buffer-size", opt_get_recv_buf_size},
|
||||
{"send-buffer-size", opt_get_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -96,19 +87,8 @@ static t_opt optset[] = {
|
||||
{"reuseaddr", opt_set_reuseaddr},
|
||||
{"reuseport", opt_set_reuseport},
|
||||
{"tcp-nodelay", opt_set_tcp_nodelay},
|
||||
#ifdef TCP_KEEPIDLE
|
||||
{"tcp-keepidle", opt_set_tcp_keepidle},
|
||||
#endif
|
||||
#ifdef TCP_KEEPCNT
|
||||
{"tcp-keepcnt", opt_set_tcp_keepcnt},
|
||||
#endif
|
||||
#ifdef TCP_KEEPINTVL
|
||||
{"tcp-keepintvl", opt_set_tcp_keepintvl},
|
||||
#endif
|
||||
{"ipv6-v6only", opt_set_ip6_v6only},
|
||||
{"linger", opt_set_linger},
|
||||
{"recv-buffer-size", opt_set_recv_buf_size},
|
||||
{"send-buffer-size", opt_set_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
10
src/tcp.h
10
src/tcp.h
@ -14,7 +14,7 @@
|
||||
* tcp objects either connected to some address or returned by the accept
|
||||
* method of a server object.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "timeout.h"
|
||||
@ -30,14 +30,6 @@ typedef struct t_tcp_ {
|
||||
|
||||
typedef t_tcp *p_tcp;
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int tcp_open(lua_State *L);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* TCP_H */
|
||||
|
@ -2,15 +2,17 @@
|
||||
* Timeout management functions
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Timeout management functions
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
|
||||
/* timeout control structure */
|
||||
typedef struct t_timeout_ {
|
||||
@ -14,27 +14,16 @@ typedef struct t_timeout_ {
|
||||
} t_timeout;
|
||||
typedef t_timeout *p_timeout;
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int timeout_open(lua_State *L);
|
||||
void timeout_init(p_timeout tm, double block, double total);
|
||||
double timeout_get(p_timeout tm);
|
||||
double timeout_getstart(p_timeout tm);
|
||||
double timeout_getretry(p_timeout tm);
|
||||
p_timeout timeout_markstart(p_timeout tm);
|
||||
|
||||
double timeout_getstart(p_timeout tm);
|
||||
double timeout_gettime(void);
|
||||
|
||||
int timeout_open(lua_State *L);
|
||||
|
||||
int timeout_meth_settimeout(lua_State *L, p_timeout tm);
|
||||
int timeout_meth_gettimeout(lua_State *L, p_timeout tm);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#define timeout_iszero(tm) ((tm)->block == 0.0)
|
||||
|
||||
#endif /* TIMEOUT_H */
|
||||
|
19
src/udp.c
19
src/udp.c
@ -2,7 +2,12 @@
|
||||
* UDP object
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "socket.h"
|
||||
@ -10,9 +15,6 @@
|
||||
#include "options.h"
|
||||
#include "udp.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* min and max macros */
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) ((x) < (y) ? x : y)
|
||||
@ -86,8 +88,6 @@ static t_opt optset[] = {
|
||||
{"ipv6-add-membership", opt_set_ip6_add_membership},
|
||||
{"ipv6-drop-membership", opt_set_ip6_drop_membersip},
|
||||
{"ipv6-v6only", opt_set_ip6_v6only},
|
||||
{"recv-buffer-size", opt_set_recv_buf_size},
|
||||
{"send-buffer-size", opt_set_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -104,8 +104,6 @@ static t_opt optget[] = {
|
||||
{"ipv6-multicast-hops", opt_get_ip6_unicast_hops},
|
||||
{"ipv6-multicast-loop", opt_get_ip6_multicast_loop},
|
||||
{"ipv6-v6only", opt_get_ip6_v6only},
|
||||
{"recv-buffer-size", opt_get_recv_buf_size},
|
||||
{"send-buffer-size", opt_get_send_buf_size},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@ -184,10 +182,7 @@ static int meth_sendto(lua_State *L) {
|
||||
memset(&aihint, 0, sizeof(aihint));
|
||||
aihint.ai_family = udp->family;
|
||||
aihint.ai_socktype = SOCK_DGRAM;
|
||||
aihint.ai_flags = AI_NUMERICHOST;
|
||||
#ifdef AI_NUMERICSERV
|
||||
aihint.ai_flags |= AI_NUMERICSERV;
|
||||
#endif
|
||||
aihint.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
|
||||
err = getaddrinfo(ip, port, &aihint, &ai);
|
||||
if (err) {
|
||||
lua_pushnil(L);
|
||||
|
10
src/udp.h
10
src/udp.h
@ -12,7 +12,7 @@
|
||||
* with a call to the setpeername function. The same function can be used to
|
||||
* break the connection.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
|
||||
#include "timeout.h"
|
||||
#include "socket.h"
|
||||
@ -26,14 +26,6 @@ typedef struct t_udp_ {
|
||||
} t_udp;
|
||||
typedef t_udp *p_udp;
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int udp_open(lua_State *L);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* UDP_H */
|
||||
|
@ -2,7 +2,8 @@
|
||||
* Unix domain socket
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#include "unixstream.h"
|
||||
#include "unixdgram.h"
|
||||
@ -44,7 +45,7 @@ static int compat_socket_unix_call(lua_State *L)
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Initializes module
|
||||
\*-------------------------------------------------------------------------*/
|
||||
LUASOCKET_API int luaopen_socket_unix(lua_State *L)
|
||||
int luaopen_socket_unix(lua_State *L)
|
||||
{
|
||||
int i;
|
||||
lua_newtable(L);
|
||||
|
@ -7,12 +7,16 @@
|
||||
* This module is just an example of how to extend LuaSocket with a new
|
||||
* domain.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include "lua.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "timeout.h"
|
||||
#include "socket.h"
|
||||
|
||||
#ifndef UNIX_API
|
||||
#define UNIX_API extern
|
||||
#endif
|
||||
|
||||
typedef struct t_unix_ {
|
||||
t_socket sock;
|
||||
t_io io;
|
||||
@ -21,6 +25,6 @@ typedef struct t_unix_ {
|
||||
} t_unix;
|
||||
typedef t_unix *p_unix;
|
||||
|
||||
LUASOCKET_API int luaopen_socket_unix(lua_State *L);
|
||||
UNIX_API int luaopen_socket_unix(lua_State *L);
|
||||
|
||||
#endif /* UNIX_H */
|
||||
|
@ -2,27 +2,21 @@
|
||||
* Unix domain socket dgram submodule
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "socket.h"
|
||||
#include "options.h"
|
||||
#include "unix.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/un.h>
|
||||
|
||||
#define UNIXDGRAM_DATAGRAMSIZE 8192
|
||||
|
||||
// provide a SUN_LEN macro if sys/un.h doesn't (e.g. Android)
|
||||
#ifndef SUN_LEN
|
||||
#define SUN_LEN(ptr) \
|
||||
((size_t) (((struct sockaddr_un *) 0)->sun_path) \
|
||||
+ strlen ((ptr)->sun_path))
|
||||
#endif
|
||||
|
||||
/*=========================================================================*\
|
||||
* Internal function prototypes
|
||||
\*=========================================================================*/
|
||||
@ -267,15 +261,20 @@ static int meth_dirty(lua_State *L) {
|
||||
static const char *unixdgram_trybind(p_unix un, const char *path) {
|
||||
struct sockaddr_un local;
|
||||
size_t len = strlen(path);
|
||||
int err;
|
||||
if (len >= sizeof(local.sun_path)) return "path too long";
|
||||
memset(&local, 0, sizeof(local));
|
||||
strcpy(local.sun_path, path);
|
||||
local.sun_family = AF_UNIX;
|
||||
size_t addrlen = SUN_LEN(&local);
|
||||
#ifdef UNIX_HAS_SUN_LEN
|
||||
local.sun_len = addrlen + 1;
|
||||
local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len)
|
||||
+ len + 1;
|
||||
err = socket_bind(&un->sock, (SA *) &local, local.sun_len);
|
||||
|
||||
#else
|
||||
err = socket_bind(&un->sock, (SA *) &local,
|
||||
sizeof(local.sun_family) + len);
|
||||
#endif
|
||||
int err = socket_bind(&un->sock, (SA *) &local, addrlen);
|
||||
if (err != IO_DONE) socket_destroy(&un->sock);
|
||||
return socket_strerror(err);
|
||||
}
|
||||
@ -316,17 +315,21 @@ static int meth_getsockname(lua_State *L)
|
||||
static const char *unixdgram_tryconnect(p_unix un, const char *path)
|
||||
{
|
||||
struct sockaddr_un remote;
|
||||
int err;
|
||||
size_t len = strlen(path);
|
||||
if (len >= sizeof(remote.sun_path)) return "path too long";
|
||||
memset(&remote, 0, sizeof(remote));
|
||||
strcpy(remote.sun_path, path);
|
||||
remote.sun_family = AF_UNIX;
|
||||
timeout_markstart(&un->tm);
|
||||
size_t addrlen = SUN_LEN(&remote);
|
||||
#ifdef UNIX_HAS_SUN_LEN
|
||||
remote.sun_len = addrlen + 1;
|
||||
remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len)
|
||||
+ len + 1;
|
||||
err = socket_connect(&un->sock, (SA *) &remote, remote.sun_len, &un->tm);
|
||||
#else
|
||||
err = socket_connect(&un->sock, (SA *) &remote,
|
||||
sizeof(remote.sun_family) + len, &un->tm);
|
||||
#endif
|
||||
int err = socket_connect(&un->sock, (SA *) &remote, addrlen, &un->tm);
|
||||
if (err != IO_DONE) socket_destroy(&un->sock);
|
||||
return socket_strerror(err);
|
||||
}
|
||||
|
@ -15,14 +15,6 @@
|
||||
|
||||
#include "unix.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int unixdgram_open(lua_State *L);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* UNIXDGRAM_H */
|
||||
|
@ -2,14 +2,16 @@
|
||||
* Unix domain socket stream sub module
|
||||
* LuaSocket toolkit
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include "auxiliar.h"
|
||||
#include "socket.h"
|
||||
#include "options.h"
|
||||
#include "unixstream.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
/*=========================================================================*\
|
||||
|
@ -16,14 +16,6 @@
|
||||
\*=========================================================================*/
|
||||
#include "unix.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility push(hidden)
|
||||
#endif
|
||||
|
||||
int unixstream_open(lua_State *L);
|
||||
|
||||
#ifndef _WIN32
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
#endif /* UNIXSTREAM_H */
|
||||
|
64
src/url.lua
64
src/url.lua
@ -76,34 +76,6 @@ function _M.unescape(s)
|
||||
end))
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Removes '..' and '.' components appropriately from a path.
|
||||
-- Input
|
||||
-- path
|
||||
-- Returns
|
||||
-- dot-normalized path
|
||||
local function remove_dot_components(path)
|
||||
local marker = string.char(1)
|
||||
repeat
|
||||
local was = path
|
||||
path = path:gsub('//', '/'..marker..'/', 1)
|
||||
until path == was
|
||||
repeat
|
||||
local was = path
|
||||
path = path:gsub('/%./', '/', 1)
|
||||
until path == was
|
||||
repeat
|
||||
local was = path
|
||||
path = path:gsub('[^/]+/%.%./([^/]+)', '%1', 1)
|
||||
until path == was
|
||||
path = path:gsub('[^/]+/%.%./*$', '')
|
||||
path = path:gsub('/%.%.$', '/')
|
||||
path = path:gsub('/%.$', '/')
|
||||
path = path:gsub('^/%.%./', '/')
|
||||
path = path:gsub(marker, '')
|
||||
return path
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- Builds a path from a base path and a relative path
|
||||
-- Input
|
||||
@ -113,12 +85,23 @@ end
|
||||
-- corresponding absolute path
|
||||
-----------------------------------------------------------------------------
|
||||
local function absolute_path(base_path, relative_path)
|
||||
if string.sub(relative_path, 1, 1) == "/" then
|
||||
return remove_dot_components(relative_path) end
|
||||
base_path = base_path:gsub("[^/]*$", "")
|
||||
if not base_path:find'/$' then base_path = base_path .. '/' end
|
||||
local path = base_path .. relative_path
|
||||
path = remove_dot_components(path)
|
||||
if string.sub(relative_path, 1, 1) == "/" then return relative_path end
|
||||
local path = string.gsub(base_path, "[^/]*$", "")
|
||||
path = path .. relative_path
|
||||
path = string.gsub(path, "([^/]*%./)", function (s)
|
||||
if s ~= "./" then return s else return "" end
|
||||
end)
|
||||
path = string.gsub(path, "/%.$", "/")
|
||||
local reduced
|
||||
while reduced ~= path do
|
||||
reduced = path
|
||||
path = string.gsub(reduced, "([^/]*/%.%./)", function (s)
|
||||
if s ~= "../../" then return "" else return s end
|
||||
end)
|
||||
end
|
||||
path = string.gsub(reduced, "([^/]*/%.%.)$", function (s)
|
||||
if s ~= "../.." then return "" else return s end
|
||||
end)
|
||||
return path
|
||||
end
|
||||
|
||||
@ -244,14 +227,10 @@ function _M.absolute(base_url, relative_url)
|
||||
else
|
||||
base_parsed = _M.parse(base_url)
|
||||
end
|
||||
local result
|
||||
local relative_parsed = _M.parse(relative_url)
|
||||
if not base_parsed then
|
||||
result = relative_url
|
||||
elseif not relative_parsed then
|
||||
result = base_url
|
||||
elseif relative_parsed.scheme then
|
||||
result = relative_url
|
||||
if not base_parsed then return relative_url
|
||||
elseif not relative_parsed then return base_url
|
||||
elseif relative_parsed.scheme then return relative_url
|
||||
else
|
||||
relative_parsed.scheme = base_parsed.scheme
|
||||
if not relative_parsed.authority then
|
||||
@ -269,9 +248,8 @@ function _M.absolute(base_url, relative_url)
|
||||
relative_parsed.path)
|
||||
end
|
||||
end
|
||||
result = _M.build(relative_parsed)
|
||||
return _M.build(relative_parsed)
|
||||
end
|
||||
return remove_dot_components(result)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
|
@ -6,14 +6,12 @@
|
||||
* The penalty of calling select to avoid busy-wait is only paid when
|
||||
* the I/O call fail in the first place.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "socket.h"
|
||||
#include "pierror.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
* Wait for readable/writable/connected socket with timeout
|
||||
\*-------------------------------------------------------------------------*/
|
||||
@ -440,9 +438,7 @@ const char *socket_gaistrerror(int err) {
|
||||
case EAI_FAMILY: return PIE_FAMILY;
|
||||
case EAI_MEMORY: return PIE_MEMORY;
|
||||
case EAI_NONAME: return PIE_NONAME;
|
||||
#ifdef EAI_OVERFLOW
|
||||
case EAI_OVERFLOW: return PIE_OVERFLOW;
|
||||
#endif
|
||||
#ifdef EAI_PROTOCOL
|
||||
case EAI_PROTOCOL: return PIE_PROTOCOL;
|
||||
#endif
|
||||
@ -452,3 +448,4 @@ const char *socket_gaistrerror(int err) {
|
||||
default: return gai_strerror(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
7
src/wsocket.c
Executable file → Normal file
7
src/wsocket.c
Executable file → Normal file
@ -5,8 +5,6 @@
|
||||
* The penalty of calling select to avoid busy-wait is only paid when
|
||||
* the I/O call fail in the first place.
|
||||
\*=========================================================================*/
|
||||
#include "luasocket.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "socket.h"
|
||||
@ -133,11 +131,11 @@ int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) {
|
||||
/* we wait until something happens */
|
||||
err = socket_waitfd(ps, WAITFD_C, tm);
|
||||
if (err == IO_CLOSED) {
|
||||
int elen = sizeof(err);
|
||||
int len = sizeof(err);
|
||||
/* give windows time to set the error (yes, disgusting) */
|
||||
Sleep(10);
|
||||
/* find out why we failed */
|
||||
getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &elen);
|
||||
getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &len);
|
||||
/* we KNOW there was an error. if 'why' is 0, we will return
|
||||
* "unknown error", but it's not really our fault */
|
||||
return err > 0? err: IO_UNKNOWN;
|
||||
@ -432,3 +430,4 @@ const char *socket_gaistrerror(int err) {
|
||||
default: return gai_strerror(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ ulimit -n
|
||||
You'll probably need to be root to do this.
|
||||
]]
|
||||
|
||||
socket = require "socket"
|
||||
require "socket"
|
||||
|
||||
host = arg[1] or "google.com"
|
||||
port = arg[2] or 80
|
||||
|
@ -1,35 +1,19 @@
|
||||
#!/usr/bin/env lua
|
||||
|
||||
local socket = require"socket"
|
||||
require"socket"
|
||||
|
||||
port = 8765
|
||||
|
||||
function pcalltest(msg, o, opt)
|
||||
local a = { pcall(o.getoption, o, opt) }
|
||||
if a[1] then
|
||||
print(msg, opt, unpack(a))
|
||||
else
|
||||
print(msg, opt, 'fail: ' .. a[2])
|
||||
end
|
||||
end
|
||||
|
||||
function options(o)
|
||||
print("options for", o)
|
||||
|
||||
for _, opt in ipairs{
|
||||
"keepalive", "reuseaddr",
|
||||
"tcp-nodelay", "tcp-keepidle", "tcp-keepcnt", "tcp-keepintvl"} do
|
||||
pcalltest("getoption", o, opt)
|
||||
for _, opt in ipairs{"keepalive", "reuseaddr", "tcp-nodelay"} do
|
||||
print("getoption", opt, o:getoption(opt))
|
||||
end
|
||||
|
||||
r = o:getoption'linger'
|
||||
if r then
|
||||
print("getoption", "linger",
|
||||
"on", r.on,
|
||||
"timeout", r.timeout)
|
||||
else
|
||||
print("getoption", "linger", "no result")
|
||||
end
|
||||
print("getoption", "linger",
|
||||
"on", o:getoption("linger").on,
|
||||
"timeout", o:getoption("linger").timeout)
|
||||
end
|
||||
|
||||
local m = socket.tcp()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env lua
|
||||
#!/usr/bin/lua
|
||||
|
||||
--[[
|
||||
Show that luasocket returns an error message on zero-length UDP sends,
|
||||
@ -12,7 +12,7 @@ listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
|
||||
|
||||
]]
|
||||
|
||||
socket = require"socket"
|
||||
require"socket"
|
||||
|
||||
s = assert(socket.udp())
|
||||
r = assert(socket.udp())
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env lua
|
||||
#!/usr/bin/lua
|
||||
|
||||
--[[
|
||||
Show that luasocket returns an error message on zero-length UDP sends,
|
||||
@ -12,7 +12,7 @@ listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
|
||||
|
||||
]]
|
||||
|
||||
socket = require"socket"
|
||||
require"socket"
|
||||
|
||||
s = assert(socket.udp())
|
||||
r = assert(socket.udp())
|
||||
|
@ -61,7 +61,7 @@ end
|
||||
local check_absolute_url = function(base, relative, absolute)
|
||||
local res = socket.url.absolute(base, relative)
|
||||
if res ~= absolute then
|
||||
io.write("absolute: In test for base='", base, "', rel='", relative, "' expected '",
|
||||
io.write("absolute: In test for '", relative, "' expected '",
|
||||
absolute, "' but got '", res, "'\n")
|
||||
os.exit()
|
||||
end
|
||||
@ -627,37 +627,25 @@ check_absolute_url("http://a/b/c/d;p?q#f", "/g", "http://a/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "//g", "http://g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "?y", "http://a/b/c/d;p?y")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g?y", "http://a/b/c/g?y")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g?y/./x", "http://a/b/c/g?y/x")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g?y/./x", "http://a/b/c/g?y/./x")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "#s", "http://a/b/c/d;p?q#s")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g#s", "http://a/b/c/g#s")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g#s/./x", "http://a/b/c/g#s/x")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g#s/./x", "http://a/b/c/g#s/./x")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g?y#s", "http://a/b/c/g?y#s")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", ";x", "http://a/b/c/d;x")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g;x", "http://a/b/c/g;x")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g;x?y#s", "http://a/b/c/g;x?y#s")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", ".", "http://a/b/c/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "./", "http://a/b/c/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "./g", "http://a/b/c/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "./g/", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "././g", "http://a/b/c/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "././g/", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g/.", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g/./", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g/./.", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g/././", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "./.", "http://a/b/c/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "././.", "http://a/b/c/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "././g/./.", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "..", "http://a/b/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "../", "http://a/b/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "../g", "http://a/b/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "../..", "http://a/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "../../", "http://a/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "../../g", "http://a/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "../../../g", "http://a/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "", "http://a/b/c/d;p?q#f")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "/./g", "http://a/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "/../g", "http://a/g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "/./g", "http://a/./g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "/../g", "http://a/../g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g.", "http://a/b/c/g.")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", ".g", "http://a/b/c/.g")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g..", "http://a/b/c/g..")
|
||||
@ -667,17 +655,6 @@ check_absolute_url("http://a/b/c/d;p?q#f", "./g/.", "http://a/b/c/g/")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g/./h", "http://a/b/c/g/h")
|
||||
check_absolute_url("http://a/b/c/d;p?q#f", "g/../h", "http://a/b/c/h")
|
||||
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "../g/", "http://a/b/g/")
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "../g", "http://a/b/g")
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "../.g/", "http://a/b/.g/")
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "../.g", "http://a/b/.g")
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "../.g.h/", "http://a/b/.g.h/")
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "../.g.h", "http://a/b/.g.h")
|
||||
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "g.h/", "http://a/b/c/g.h/")
|
||||
check_absolute_url("http://a/b/c/d:p?q#f/", "../g.h/", "http://a/b/g.h/")
|
||||
check_absolute_url("http://a/", "../g.h/", "http://a/g.h/")
|
||||
|
||||
-- extra tests
|
||||
check_absolute_url("//a/b/c/d;p?q#f", "d/e/f", "//a/b/c/d/e/f")
|
||||
check_absolute_url("/a/b/c/d;p?q#f", "d/e/f", "/a/b/c/d/e/f")
|
||||
@ -685,17 +662,6 @@ check_absolute_url("a/b/c/d", "d/e/f", "a/b/c/d/e/f")
|
||||
check_absolute_url("a/b/c/d/../", "d/e/f", "a/b/c/d/e/f")
|
||||
check_absolute_url("http://velox.telemar.com.br", "/dashboard/index.html",
|
||||
"http://velox.telemar.com.br/dashboard/index.html")
|
||||
check_absolute_url("http://example.com/", "../.badhost.com/", "http://example.com/.badhost.com/")
|
||||
check_absolute_url("http://example.com/", "...badhost.com/", "http://example.com/...badhost.com/")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "../q", "http://example.com/a/b/c/q")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "../../q", "http://example.com/a/b/q")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "../../../q", "http://example.com/a/q")
|
||||
check_absolute_url("http://example.com", ".badhost.com", "http://example.com/.badhost.com")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "..//../../../q", "http://example.com/a/q")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "..//a/../../../../q", "http://example.com/a/q")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "..//a/..//../../../q", "http://example.com/a/b/q")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "..//a/..///../../../../q", "http://example.com/a/b/q")
|
||||
check_absolute_url("http://example.com/a/b/c/d/", "../x/a/../y/z/../../../../q", "http://example.com/a/b/q")
|
||||
|
||||
print("testing path parsing and composition")
|
||||
check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 })
|
||||
|
3
vc32.bat
3
vc32.bat
@ -1,3 +0,0 @@
|
||||
call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
|
||||
cls
|
||||
"c:\Program Files\Git\git-bash.exe" --cd-to-home
|
3
vc64.bat
3
vc64.bat
@ -1,3 +0,0 @@
|
||||
call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
|
||||
cls
|
||||
"c:\Program Files\Git\git-bash.exe" --cd-to-home
|
2
win32.cmd
Executable file → Normal file
2
win32.cmd
Executable file → Normal file
@ -1 +1 @@
|
||||
LUAV=5.3 PLAT=win32 LUAPREFIX_win32=/z/data/build/vc14 make
|
||||
make LUAPREFIX_win32='c:\cygwin\home\diego\vc12' LUAV=5.1 PLAT=win32 LUALIBNAME_win32=lualib.lib PLATFORM_win32=Debug install-both
|
||||
|
Reference in New Issue
Block a user