aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rwxr-xr-xLua.props28
-rw-r--r--Lua51.props28
-rw-r--r--Lua52.props28
-rw-r--r--doc/http.html8
-rw-r--r--doc/ltn12.html10
-rw-r--r--doc/reference.html3
-rw-r--r--doc/tcp.html6
-rw-r--r--luasocket-scm-0.rockspec2
-rw-r--r--macosx.cmd2
-rwxr-xr-xmime.vcxproj61
-rwxr-xr-xsocket.vcxproj173
-rw-r--r--src/auxiliar.c2
-rw-r--r--src/compat.c18
-rw-r--r--src/compat.h3
-rw-r--r--src/http.lua25
-rw-r--r--src/ltn12.lua10
-rwxr-xr-x[-rw-r--r--]src/luasocket.c2
-rw-r--r--src/makefile30
-rwxr-xr-x[-rw-r--r--]src/mime.c3
-rw-r--r--src/options.c36
-rw-r--r--src/options.h18
-rw-r--r--src/tcp.c18
-rw-r--r--src/unixdgram.c27
-rw-r--r--src/url.lua64
-rwxr-xr-x[-rw-r--r--]src/wsocket.c4
-rw-r--r--test/ltn12test.lua9
-rwxr-xr-xtest/tcp-getoptions4
-rw-r--r--test/urltest.lua44
29 files changed, 419 insertions, 248 deletions
diff --git a/.gitignore b/.gitignore
index 8307483..9ed661c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,7 +6,6 @@
6*.dll* 6*.dll*
7*.user 7*.user
8*.sdf 8*.sdf
9Lua.props
10Debug 9Debug
11Release 10Release
12*.manifest 11*.manifest
diff --git a/Lua.props b/Lua.props
new file mode 100755
index 0000000..bdfca40
--- /dev/null
+++ b/Lua.props
@@ -0,0 +1,28 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ImportGroup Label="PropertySheets" />
4 <PropertyGroup Label="UserMacros">
5 <BUILD>z:\data\build\vc14\</BUILD>
6 <LUABIN>$(BUILD)\bin\lua\5.3\</LUABIN>
7 <LUALIB>$(BUILD)\lib\lua\5.3\</LUALIB>
8 <LUAINC>$(BUILD)\include\lua\5.3\</LUAINC>
9 </PropertyGroup>
10 <PropertyGroup>
11 <_PropertySheetDisplayName>Lua53</_PropertySheetDisplayName>
12 </PropertyGroup>
13 <ItemDefinitionGroup />
14 <ItemGroup>
15 <BuildMacro Include="LUALIB">
16 <Value>$(LUALIB)</Value>
17 </BuildMacro>
18 <BuildMacro Include="LUAINC">
19 <Value>$(LUAINC)</Value>
20 </BuildMacro>
21 <BuildMacro Include="LUABIN">
22 <Value>$(LUABIN)</Value>
23 </BuildMacro>
24 <BuildMacro Include="BUILD">
25 <Value>$(BUILD)</Value>
26 </BuildMacro>
27 </ItemGroup>
28</Project>
diff --git a/Lua51.props b/Lua51.props
deleted file mode 100644
index 1bd6256..0000000
--- a/Lua51.props
+++ /dev/null
@@ -1,28 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ImportGroup Label="PropertySheets" />
4 <PropertyGroup Label="UserMacros">
5 <LUABIN_PATH>..\build\vc12\bin\lua\5.1\</LUABIN_PATH>
6 <LUALIB_PATH>..\build\vc12\bin\lua\5.1\</LUALIB_PATH>
7 <LUAINC_PATH>..\build\vc12\include\lua\5.1\</LUAINC_PATH>
8 <LUALIB>lua51.lib</LUALIB>
9 </PropertyGroup>
10 <PropertyGroup>
11 <_PropertySheetDisplayName>Lua51</_PropertySheetDisplayName>
12 </PropertyGroup>
13 <ItemDefinitionGroup />
14 <ItemGroup>
15 <BuildMacro Include="LUALIB_PATH">
16 <Value>$(LUALIB_PATH)</Value>
17 </BuildMacro>
18 <BuildMacro Include="LUABIN_PATH">
19 <Value>$(LUABIN_PATH)</Value>
20 </BuildMacro>
21 <BuildMacro Include="LUAINC_PATH">
22 <Value>$(LUAINC_PATH)</Value>
23 </BuildMacro>
24 <BuildMacro Include="LUALIB">
25 <Value>$(LUALIB)</Value>
26 </BuildMacro>
27 </ItemGroup>
28</Project>
diff --git a/Lua52.props b/Lua52.props
deleted file mode 100644
index 01afcfa..0000000
--- a/Lua52.props
+++ /dev/null
@@ -1,28 +0,0 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ImportGroup Label="PropertySheets" />
4 <PropertyGroup Label="UserMacros">
5 <LUABIN_PATH>..\build\vc12\bin\lua\5.2\</LUABIN_PATH>
6 <LUALIB_PATH>..\build\vc12\bin\lua\5.2\</LUALIB_PATH>
7 <LUAINC_PATH>..\build\vc12\include\lua\5.2\</LUAINC_PATH>
8 <LUALIB>lua52.lib</LUALIB>
9 </PropertyGroup>
10 <PropertyGroup>
11 <_PropertySheetDisplayName>Lua52</_PropertySheetDisplayName>
12 </PropertyGroup>
13 <ItemDefinitionGroup />
14 <ItemGroup>
15 <BuildMacro Include="LUALIB_PATH">
16 <Value>$(LUALIB_PATH)</Value>
17 </BuildMacro>
18 <BuildMacro Include="LUABIN_PATH">
19 <Value>$(LUABIN_PATH)</Value>
20 </BuildMacro>
21 <BuildMacro Include="LUAINC_PATH">
22 <Value>$(LUAINC_PATH)</Value>
23 </BuildMacro>
24 <BuildMacro Include="LUALIB">
25 <Value>$(LUALIB)</Value>
26 </BuildMacro>
27 </ItemGroup>
28</Project>
diff --git a/doc/http.html b/doc/http.html
index 3b7a8b1..78f785a 100644
--- a/doc/http.html
+++ b/doc/http.html
@@ -135,7 +135,8 @@ http.<b>request{</b><br>
135&nbsp;&nbsp;[step = <i>LTN12 pump step</i>,]<br> 135&nbsp;&nbsp;[step = <i>LTN12 pump step</i>,]<br>
136&nbsp;&nbsp;[proxy = <i>string</i>,]<br> 136&nbsp;&nbsp;[proxy = <i>string</i>,]<br>
137&nbsp;&nbsp;[redirect = <i>boolean</i>,]<br> 137&nbsp;&nbsp;[redirect = <i>boolean</i>,]<br>
138&nbsp;&nbsp;[create = <i>function</i>]<br> 138&nbsp;&nbsp;[create = <i>function</i>,]<br>
139&nbsp;&nbsp;[maxredirects = <i>number</i>]<br>
139<b>}</b> 140<b>}</b>
140</p> 141</p>
141 142
@@ -185,6 +186,7 @@ Defaults to the LTN12 <tt>pump.step</tt> function.
185function from automatically following 301 or 302 server redirect messages; 186function from automatically following 301 or 302 server redirect messages;
186<li><tt>create</tt>: An optional function to be used instead of 187<li><tt>create</tt>: An optional function to be used instead of
187<a href=tcp.html#socket.tcp><tt>socket.tcp</tt></a> when the communications socket is created. 188<a href=tcp.html#socket.tcp><tt>socket.tcp</tt></a> when the communications socket is created.
189<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).
188</ul> 190</ul>
189 191
190<p class=return> 192<p class=return>
@@ -324,8 +326,8 @@ r, c = http.request {
324</p> 326</p>
325<p> 327<p>
326<small> 328<small>
327Last modified by Diego Nehab on <br> 329Last modified by Eric Westbrook on <br>
328Thu Apr 20 00:25:26 EDT 2006 330Sat Feb 23 19:09:42 UTC 2019
329</small> 331</small>
330</p> 332</p>
331</center> 333</center>
diff --git a/doc/ltn12.html b/doc/ltn12.html
index 54e66fb..ee2502f 100644
--- a/doc/ltn12.html
+++ b/doc/ltn12.html
@@ -405,6 +405,16 @@ Creates and returns a source that produces the contents of a
405<tt>string</tt>, chunk by chunk. 405<tt>string</tt>, chunk by chunk.
406</p> 406</p>
407 407
408<!-- table +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
409
410<p class=name id="source.table">
411ltn12.source.<b>table(</b>table<b>)</b>
412</p>
413
414<p class=description>
415Creates and returns a source that produces the numerically-indexed values of a <tt>table</tt> successively beginning at 1. The source returns nil (end-of-stream) whenever a nil value is produced by the current index, which proceeds forward regardless.
416</p>
417
408<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 418<!-- footer +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
409 419
410<div class=footer> 420<div class=footer>
diff --git a/doc/reference.html b/doc/reference.html
index 287dc19..163a8a2 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -99,7 +99,8 @@ Support, Manual">
99<a href="ltn12.html#source.error">error</a>, 99<a href="ltn12.html#source.error">error</a>,
100<a href="ltn12.html#source.file">file</a>, 100<a href="ltn12.html#source.file">file</a>,
101<a href="ltn12.html#source.simplify">simplify</a>, 101<a href="ltn12.html#source.simplify">simplify</a>,
102<a href="ltn12.html#source.string">string</a>. 102<a href="ltn12.html#source.string">string</a>,
103<a href="ltn12.html#source.table">table</a>.
103</blockquote> 104</blockquote>
104</blockquote> 105</blockquote>
105 106
diff --git a/doc/tcp.html b/doc/tcp.html
index c6c6eb2..6050a5f 100644
--- a/doc/tcp.html
+++ b/doc/tcp.html
@@ -477,6 +477,12 @@ used in validating addresses supplied in a call to
477<li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt> 477<li> '<tt>tcp-nodelay</tt>': Setting this option to <tt>true</tt>
478disables the Nagle's algorithm for the connection; 478disables the Nagle's algorithm for the connection;
479 479
480<li> '<tt>tcp-keepidle</tt>': value in seconds for <tt>TCP_KEEPIDLE</tt> Linux only!!
481
482<li> '<tt>tcp-keepcnt</tt>': value for <tt>TCP_KEEPCNT</tt> Linux only!!
483
484<li> '<tt>tcp-keepintvl</tt>': value for <tt>TCP_KEEPINTVL</tt> Linux only!!
485
480<li> '<tt>ipv6-v6only</tt>': 486<li> '<tt>ipv6-v6only</tt>':
481Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to 487Setting this option to <tt>true</tt> restricts an <tt>inet6</tt> socket to
482sending and receiving only IPv6 packets. 488sending and receiving only IPv6 packets.
diff --git a/luasocket-scm-0.rockspec b/luasocket-scm-0.rockspec
index 61bd645..c827e46 100644
--- a/luasocket-scm-0.rockspec
+++ b/luasocket-scm-0.rockspec
@@ -75,7 +75,7 @@ local function make_plat(plat)
75 modules["socket.core"].libraries = {"network"} 75 modules["socket.core"].libraries = {"network"}
76 end 76 end
77 modules["socket.unix"] = { 77 modules["socket.unix"] = {
78 sources = { "src/buffer.c", "src/auxiliar.c", "src/options.c", "src/timeout.c", "src/io.c", "src/usocket.c", "src/unix.c" }, 78 sources = { "src/buffer.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" },
79 defines = defines[plat], 79 defines = defines[plat],
80 incdir = "/src" 80 incdir = "/src"
81 } 81 }
diff --git a/macosx.cmd b/macosx.cmd
index 46a0709..dd5d8cf 100644
--- a/macosx.cmd
+++ b/macosx.cmd
@@ -1 +1 @@
make DEBUG=DEBUG PLAT=macosx LUAINC_macosx_base=/Users/diego/build/macosx/include LUAPREFIX_macosx=/Users/diego/build/macosx install-both make DEBUG=DEBUG PLAT=macosx LUAINC_macosx_base=/Users/$USER/build/macosx/include LUAPREFIX_macosx=/Users/$USER/build/macosx install-both
diff --git a/mime.vcxproj b/mime.vcxproj
index c77d611..74bba0c 100755
--- a/mime.vcxproj
+++ b/mime.vcxproj
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 2<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup Label="ProjectConfigurations"> 3 <ItemGroup Label="ProjectConfigurations">
4 <ProjectConfiguration Include="Debug|Win32"> 4 <ProjectConfiguration Include="Debug|Win32">
5 <Configuration>Debug</Configuration> 5 <Configuration>Debug</Configuration>
@@ -24,39 +24,40 @@
24 <ItemGroup> 24 <ItemGroup>
25 <CustomBuild Include="src\mime.lua"> 25 <CustomBuild Include="src\mime.lua">
26 <FileType>Document</FileType> 26 <FileType>Document</FileType>
27 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> 27 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
28 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> 28 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
29 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> 29 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
30 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> 30 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
31 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUALIB_PATH)$(Platform)\$(Configuration)</Command> 31 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
32 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUALIB_PATH)$(Platform)\$(Configuration)</Command> 32 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
33 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> 33 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
34 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> 34 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
35 </CustomBuild> 35 </CustomBuild>
36 </ItemGroup> 36 </ItemGroup>
37 <PropertyGroup Label="Globals"> 37 <PropertyGroup Label="Globals">
38 <ProjectGuid>{128E8BD0-174A-48F0-8771-92B1E8D18713}</ProjectGuid> 38 <ProjectGuid>{128E8BD0-174A-48F0-8771-92B1E8D18713}</ProjectGuid>
39 <Keyword>Win32Proj</Keyword> 39 <Keyword>Win32Proj</Keyword>
40 <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
40 </PropertyGroup> 41 </PropertyGroup>
41 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> 42 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
42 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 43 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
43 <ConfigurationType>DynamicLibrary</ConfigurationType> 44 <ConfigurationType>DynamicLibrary</ConfigurationType>
44 <PlatformToolset>v110</PlatformToolset> 45 <PlatformToolset>v141</PlatformToolset>
45 <CharacterSet>MultiByte</CharacterSet> 46 <CharacterSet>MultiByte</CharacterSet>
46 </PropertyGroup> 47 </PropertyGroup>
47 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 48 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
48 <ConfigurationType>DynamicLibrary</ConfigurationType> 49 <ConfigurationType>DynamicLibrary</ConfigurationType>
49 <PlatformToolset>v110</PlatformToolset> 50 <PlatformToolset>v141</PlatformToolset>
50 <CharacterSet>MultiByte</CharacterSet> 51 <CharacterSet>MultiByte</CharacterSet>
51 </PropertyGroup> 52 </PropertyGroup>
52 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 53 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
53 <ConfigurationType>DynamicLibrary</ConfigurationType> 54 <ConfigurationType>DynamicLibrary</ConfigurationType>
54 <PlatformToolset>v110</PlatformToolset> 55 <PlatformToolset>v141</PlatformToolset>
55 <CharacterSet>MultiByte</CharacterSet> 56 <CharacterSet>MultiByte</CharacterSet>
56 </PropertyGroup> 57 </PropertyGroup>
57 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 58 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
58 <ConfigurationType>DynamicLibrary</ConfigurationType> 59 <ConfigurationType>DynamicLibrary</ConfigurationType>
59 <PlatformToolset>v110</PlatformToolset> 60 <PlatformToolset>v141</PlatformToolset>
60 <CharacterSet>MultiByte</CharacterSet> 61 <CharacterSet>MultiByte</CharacterSet>
61 </PropertyGroup> 62 </PropertyGroup>
62 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> 63 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -87,7 +88,7 @@
87 <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> 88 <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
88 </PropertyGroup> 89 </PropertyGroup>
89 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 90 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
90 <OutDir>$(LUABIN_PATH)$(Configuration)\mime\</OutDir> 91 <OutDir>$(LUABIN)$(Configuration)\mime\</OutDir>
91 <IntDir>$(Configuration)\</IntDir> 92 <IntDir>$(Configuration)\</IntDir>
92 <LinkIncremental>true</LinkIncremental> 93 <LinkIncremental>true</LinkIncremental>
93 <TargetName>core</TargetName> 94 <TargetName>core</TargetName>
@@ -95,23 +96,23 @@
95 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 96 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
96 <LinkIncremental>true</LinkIncremental> 97 <LinkIncremental>true</LinkIncremental>
97 <TargetName>core</TargetName> 98 <TargetName>core</TargetName>
98 <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\mime\</OutDir> 99 <OutDir>$(LUABIN)$(Platform)\$(Configuration)\mime\</OutDir>
99 </PropertyGroup> 100 </PropertyGroup>
100 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 101 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
101 <OutDir>$(LUABIN_PATH)$(Configuration)\mime\</OutDir> 102 <OutDir>$(LUABIN)$(Configuration)\mime\</OutDir>
102 <IntDir>$(Configuration)\</IntDir> 103 <IntDir>$(Configuration)\</IntDir>
103 <LinkIncremental>false</LinkIncremental> 104 <LinkIncremental>false</LinkIncremental>
104 <TargetName>core</TargetName> 105 <TargetName>core</TargetName>
105 </PropertyGroup> 106 </PropertyGroup>
106 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 107 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
107 <LinkIncremental>false</LinkIncremental> 108 <LinkIncremental>false</LinkIncremental>
108 <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\mime\</OutDir> 109 <OutDir>$(LUABIN)$(Platform)\$(Configuration)\mime\</OutDir>
109 <TargetName>core</TargetName> 110 <TargetName>core</TargetName>
110 </PropertyGroup> 111 </PropertyGroup>
111 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 112 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
112 <ClCompile> 113 <ClCompile>
113 <Optimization>Disabled</Optimization> 114 <Optimization>Disabled</Optimization>
114 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 115 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
115 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 116 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
116 <MinimalRebuild>true</MinimalRebuild> 117 <MinimalRebuild>true</MinimalRebuild>
117 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 118 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -122,9 +123,9 @@
122 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 123 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
123 </ClCompile> 124 </ClCompile>
124 <Link> 125 <Link>
125 <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> 126 <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies>
126 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 127 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
127 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 128 <AdditionalLibraryDirectories>$(LUALIB)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
128 <GenerateDebugInformation>true</GenerateDebugInformation> 129 <GenerateDebugInformation>true</GenerateDebugInformation>
129 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> 130 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
130 <SubSystem>Windows</SubSystem> 131 <SubSystem>Windows</SubSystem>
@@ -138,7 +139,7 @@
138 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 139 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
139 <ClCompile> 140 <ClCompile>
140 <Optimization>Disabled</Optimization> 141 <Optimization>Disabled</Optimization>
141 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 142 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
142 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 143 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
143 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 144 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
144 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> 145 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -149,9 +150,9 @@
149 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 150 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
150 </ClCompile> 151 </ClCompile>
151 <Link> 152 <Link>
152 <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> 153 <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies>
153 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 154 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
154 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 155 <AdditionalLibraryDirectories>$(LUALIB)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
155 <GenerateDebugInformation>true</GenerateDebugInformation> 156 <GenerateDebugInformation>true</GenerateDebugInformation>
156 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> 157 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
157 <SubSystem>Windows</SubSystem> 158 <SubSystem>Windows</SubSystem>
@@ -163,7 +164,7 @@
163 </ItemDefinitionGroup> 164 </ItemDefinitionGroup>
164 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 165 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
165 <ClCompile> 166 <ClCompile>
166 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 167 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
167 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 168 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
168 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> 169 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
169 <PrecompiledHeader /> 170 <PrecompiledHeader />
@@ -172,9 +173,9 @@
172 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 173 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
173 </ClCompile> 174 </ClCompile>
174 <Link> 175 <Link>
175 <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> 176 <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies>
176 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 177 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
177 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 178 <AdditionalLibraryDirectories>$(LUALIB)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
178 <GenerateDebugInformation>true</GenerateDebugInformation> 179 <GenerateDebugInformation>true</GenerateDebugInformation>
179 <SubSystem>Windows</SubSystem> 180 <SubSystem>Windows</SubSystem>
180 <OptimizeReferences>true</OptimizeReferences> 181 <OptimizeReferences>true</OptimizeReferences>
@@ -187,7 +188,7 @@
187 </ItemDefinitionGroup> 188 </ItemDefinitionGroup>
188 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 189 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
189 <ClCompile> 190 <ClCompile>
190 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 191 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
191 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 192 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
192 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> 193 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
193 <PrecompiledHeader> 194 <PrecompiledHeader>
@@ -198,9 +199,9 @@
198 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 199 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
199 </ClCompile> 200 </ClCompile>
200 <Link> 201 <Link>
201 <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> 202 <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies>
202 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 203 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
203 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 204 <AdditionalLibraryDirectories>$(LUALIB)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
204 <GenerateDebugInformation>true</GenerateDebugInformation> 205 <GenerateDebugInformation>true</GenerateDebugInformation>
205 <SubSystem>Windows</SubSystem> 206 <SubSystem>Windows</SubSystem>
206 <OptimizeReferences>true</OptimizeReferences> 207 <OptimizeReferences>true</OptimizeReferences>
@@ -214,4 +215,4 @@
214 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> 215 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
215 <ImportGroup Label="ExtensionTargets"> 216 <ImportGroup Label="ExtensionTargets">
216 </ImportGroup> 217 </ImportGroup>
217</Project> \ No newline at end of file 218</Project>
diff --git a/socket.vcxproj b/socket.vcxproj
index 16daeef..cfa32b3 100755
--- a/socket.vcxproj
+++ b/socket.vcxproj
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="utf-8"?> 1<?xml version="1.0" encoding="utf-8"?>
2<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 2<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <ItemGroup Label="ProjectConfigurations"> 3 <ItemGroup Label="ProjectConfigurations">
4 <ProjectConfiguration Include="Debug|Win32"> 4 <ProjectConfiguration Include="Debug|Win32">
5 <Configuration>Debug</Configuration> 5 <Configuration>Debug</Configuration>
@@ -35,118 +35,119 @@
35 <ItemGroup> 35 <ItemGroup>
36 <CustomBuild Include="src\ltn12.lua"> 36 <CustomBuild Include="src\ltn12.lua">
37 <FileType>Document</FileType> 37 <FileType>Document</FileType>
38 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> 38 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
39 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> 39 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
40 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> 40 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
41 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> 41 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
42 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> 42 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
43 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> 43 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
44 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> 44 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
45 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> 45 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
46 </CustomBuild> 46 </CustomBuild>
47 <CustomBuild Include="src\socket.lua"> 47 <CustomBuild Include="src\socket.lua">
48 <FileType>Document</FileType> 48 <FileType>Document</FileType>
49 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> 49 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
50 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> 50 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
51 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> 51 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
52 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> 52 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
53 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> 53 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
54 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> 54 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
55 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> 55 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
56 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> 56 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
57 </CustomBuild> 57 </CustomBuild>
58 </ItemGroup> 58 </ItemGroup>
59 <ItemGroup> 59 <ItemGroup>
60 <CustomBuild Include="src\ftp.lua"> 60 <CustomBuild Include="src\ftp.lua">
61 <FileType>Document</FileType> 61 <FileType>Document</FileType>
62 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 62 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
63 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 63 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
64 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 64 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
65 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 65 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
66 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 66 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
67 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 67 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
68 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 68 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
69 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 69 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
70 </CustomBuild> 70 </CustomBuild>
71 <CustomBuild Include="src\headers.lua"> 71 <CustomBuild Include="src\headers.lua">
72 <FileType>Document</FileType> 72 <FileType>Document</FileType>
73 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 73 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
74 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 74 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
75 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 75 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
76 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 76 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
77 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 77 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
78 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 78 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
79 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 79 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
80 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 80 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
81 </CustomBuild> 81 </CustomBuild>
82 <CustomBuild Include="src\http.lua"> 82 <CustomBuild Include="src\http.lua">
83 <FileType>Document</FileType> 83 <FileType>Document</FileType>
84 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 84 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
85 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 85 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
86 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 86 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
87 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 87 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
88 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 88 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
89 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 89 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
90 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 90 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
91 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 91 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
92 </CustomBuild> 92 </CustomBuild>
93 <CustomBuild Include="src\smtp.lua"> 93 <CustomBuild Include="src\smtp.lua">
94 <FileType>Document</FileType> 94 <FileType>Document</FileType>
95 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 95 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
96 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 96 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
97 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 97 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
98 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 98 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
99 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 99 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
100 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 100 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
101 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 101 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
102 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 102 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
103 </CustomBuild> 103 </CustomBuild>
104 <CustomBuild Include="src\tp.lua"> 104 <CustomBuild Include="src\tp.lua">
105 <FileType>Document</FileType> 105 <FileType>Document</FileType>
106 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 106 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
107 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 107 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
108 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 108 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
109 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 109 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
110 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 110 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
111 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 111 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
112 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 112 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
113 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 113 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
114 </CustomBuild> 114 </CustomBuild>
115 <CustomBuild Include="src\url.lua"> 115 <CustomBuild Include="src\url.lua">
116 <FileType>Document</FileType> 116 <FileType>Document</FileType>
117 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 117 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
118 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 118 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN)$(Configuration)</Command>
119 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 119 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
120 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> 120 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN)$(Platform)\$(Configuration)</Command>
121 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 121 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
122 <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> 122 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN)$(Configuration)\%(Filename)%(Extension)</Outputs>
123 <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 123 <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
124 <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> 124 <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs>
125 </CustomBuild> 125 </CustomBuild>
126 </ItemGroup> 126 </ItemGroup>
127 <PropertyGroup Label="Globals"> 127 <PropertyGroup Label="Globals">
128 <ProjectGuid>{66E3CE14-884D-4AEA-9F20-15A0BEAF8C5A}</ProjectGuid> 128 <ProjectGuid>{66E3CE14-884D-4AEA-9F20-15A0BEAF8C5A}</ProjectGuid>
129 <Keyword>Win32Proj</Keyword> 129 <Keyword>Win32Proj</Keyword>
130 <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
130 </PropertyGroup> 131 </PropertyGroup>
131 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> 132 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
132 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> 133 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
133 <ConfigurationType>DynamicLibrary</ConfigurationType> 134 <ConfigurationType>DynamicLibrary</ConfigurationType>
134 <PlatformToolset>v110</PlatformToolset> 135 <PlatformToolset>v141</PlatformToolset>
135 <CharacterSet>MultiByte</CharacterSet> 136 <CharacterSet>MultiByte</CharacterSet>
136 </PropertyGroup> 137 </PropertyGroup>
137 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> 138 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
138 <ConfigurationType>DynamicLibrary</ConfigurationType> 139 <ConfigurationType>DynamicLibrary</ConfigurationType>
139 <PlatformToolset>v110</PlatformToolset> 140 <PlatformToolset>v141</PlatformToolset>
140 <CharacterSet>MultiByte</CharacterSet> 141 <CharacterSet>MultiByte</CharacterSet>
141 </PropertyGroup> 142 </PropertyGroup>
142 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 143 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
143 <ConfigurationType>DynamicLibrary</ConfigurationType> 144 <ConfigurationType>DynamicLibrary</ConfigurationType>
144 <PlatformToolset>v110</PlatformToolset> 145 <PlatformToolset>v141</PlatformToolset>
145 <CharacterSet>MultiByte</CharacterSet> 146 <CharacterSet>MultiByte</CharacterSet>
146 </PropertyGroup> 147 </PropertyGroup>
147 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 148 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
148 <ConfigurationType>DynamicLibrary</ConfigurationType> 149 <ConfigurationType>DynamicLibrary</ConfigurationType>
149 <PlatformToolset>v110</PlatformToolset> 150 <PlatformToolset>v141</PlatformToolset>
150 <CharacterSet>MultiByte</CharacterSet> 151 <CharacterSet>MultiByte</CharacterSet>
151 </PropertyGroup> 152 </PropertyGroup>
152 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> 153 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
@@ -177,7 +178,7 @@
177 <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> 178 <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion>
178 </PropertyGroup> 179 </PropertyGroup>
179 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 180 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
180 <OutDir>$(LUALIB_PATH)$(Configuration)\socket\</OutDir> 181 <OutDir>$(LUABIN)$(Configuration)\socket\</OutDir>
181 <IntDir>$(Configuration)\</IntDir> 182 <IntDir>$(Configuration)\</IntDir>
182 <LinkIncremental>true</LinkIncremental> 183 <LinkIncremental>true</LinkIncremental>
183 <TargetName>core</TargetName> 184 <TargetName>core</TargetName>
@@ -185,23 +186,23 @@
185 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 186 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
186 <LinkIncremental>true</LinkIncremental> 187 <LinkIncremental>true</LinkIncremental>
187 <TargetName>core</TargetName> 188 <TargetName>core</TargetName>
188 <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\</OutDir> 189 <OutDir>$(LUABIN)$(Platform)\$(Configuration)\socket\</OutDir>
189 </PropertyGroup> 190 </PropertyGroup>
190 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 191 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
191 <OutDir>$(LUALIB_PATH)$(Configuration)\socket\</OutDir> 192 <OutDir>$(LUABIN)$(Configuration)\socket\</OutDir>
192 <IntDir>$(Configuration)\</IntDir> 193 <IntDir>$(Configuration)\</IntDir>
193 <LinkIncremental>false</LinkIncremental> 194 <LinkIncremental>false</LinkIncremental>
194 <TargetName>core</TargetName> 195 <TargetName>core</TargetName>
195 </PropertyGroup> 196 </PropertyGroup>
196 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 197 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
197 <LinkIncremental>false</LinkIncremental> 198 <LinkIncremental>false</LinkIncremental>
198 <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\</OutDir> 199 <OutDir>$(LUABIN)$(Platform)\$(Configuration)\socket\</OutDir>
199 <TargetName>core</TargetName> 200 <TargetName>core</TargetName>
200 </PropertyGroup> 201 </PropertyGroup>
201 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> 202 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
202 <ClCompile> 203 <ClCompile>
203 <Optimization>Disabled</Optimization> 204 <Optimization>Disabled</Optimization>
204 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 205 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
205 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 206 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
206 <MinimalRebuild>true</MinimalRebuild> 207 <MinimalRebuild>true</MinimalRebuild>
207 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 208 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -212,9 +213,9 @@
212 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 213 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
213 </ClCompile> 214 </ClCompile>
214 <Link> 215 <Link>
215 <AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> 216 <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
216 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 217 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
217 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 218 <AdditionalLibraryDirectories>$(LUALIB)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
218 <GenerateDebugInformation>true</GenerateDebugInformation> 219 <GenerateDebugInformation>true</GenerateDebugInformation>
219 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> 220 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
220 <SubSystem>Windows</SubSystem> 221 <SubSystem>Windows</SubSystem>
@@ -228,7 +229,7 @@
228 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> 229 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
229 <ClCompile> 230 <ClCompile>
230 <Optimization>Disabled</Optimization> 231 <Optimization>Disabled</Optimization>
231 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 232 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
232 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> 233 <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
233 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> 234 <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
234 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> 235 <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -239,9 +240,9 @@
239 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 240 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
240 </ClCompile> 241 </ClCompile>
241 <Link> 242 <Link>
242 <AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> 243 <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
243 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 244 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
244 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 245 <AdditionalLibraryDirectories>$(LUALIB)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
245 <GenerateDebugInformation>true</GenerateDebugInformation> 246 <GenerateDebugInformation>true</GenerateDebugInformation>
246 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> 247 <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile>
247 <SubSystem>Windows</SubSystem> 248 <SubSystem>Windows</SubSystem>
@@ -253,7 +254,7 @@
253 </ItemDefinitionGroup> 254 </ItemDefinitionGroup>
254 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> 255 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
255 <ClCompile> 256 <ClCompile>
256 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 257 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
257 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 258 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
258 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> 259 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
259 <PrecompiledHeader /> 260 <PrecompiledHeader />
@@ -262,9 +263,9 @@
262 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 263 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
263 </ClCompile> 264 </ClCompile>
264 <Link> 265 <Link>
265 <AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> 266 <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
266 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 267 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
267 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 268 <AdditionalLibraryDirectories>$(LUALIB)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
268 <GenerateDebugInformation>true</GenerateDebugInformation> 269 <GenerateDebugInformation>true</GenerateDebugInformation>
269 <SubSystem>Windows</SubSystem> 270 <SubSystem>Windows</SubSystem>
270 <OptimizeReferences>true</OptimizeReferences> 271 <OptimizeReferences>true</OptimizeReferences>
@@ -277,7 +278,7 @@
277 </ItemDefinitionGroup> 278 </ItemDefinitionGroup>
278 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> 279 <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
279 <ClCompile> 280 <ClCompile>
280 <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> 281 <AdditionalIncludeDirectories>$(LUAINC);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
281 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> 282 <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
282 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> 283 <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
283 <PrecompiledHeader> 284 <PrecompiledHeader>
@@ -288,9 +289,9 @@
288 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> 289 <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
289 </ClCompile> 290 </ClCompile>
290 <Link> 291 <Link>
291 <AdditionalDependencies>$(LUALIB);ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> 292 <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
292 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> 293 <OutputFile>$(OutDir)$(TargetName).dll</OutputFile>
293 <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> 294 <AdditionalLibraryDirectories>$(LUALIB)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
294 <GenerateDebugInformation>true</GenerateDebugInformation> 295 <GenerateDebugInformation>true</GenerateDebugInformation>
295 <SubSystem>Windows</SubSystem> 296 <SubSystem>Windows</SubSystem>
296 <OptimizeReferences>true</OptimizeReferences> 297 <OptimizeReferences>true</OptimizeReferences>
@@ -304,4 +305,4 @@
304 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> 305 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
305 <ImportGroup Label="ExtensionTargets"> 306 <ImportGroup Label="ExtensionTargets">
306 </ImportGroup> 307 </ImportGroup>
307</Project> \ No newline at end of file 308</Project>
diff --git a/src/auxiliar.c b/src/auxiliar.c
index 18fa8e4..5251549 100644
--- a/src/auxiliar.c
+++ b/src/auxiliar.c
@@ -143,7 +143,7 @@ void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx) {
143* otherwise 143* otherwise
144\*-------------------------------------------------------------------------*/ 144\*-------------------------------------------------------------------------*/
145void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) { 145void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) {
146 return luaL_checkudata(L, objidx, classname); 146 return luaL_testudata(L, objidx, classname);
147} 147}
148 148
149/*-------------------------------------------------------------------------*\ 149/*-------------------------------------------------------------------------*\
diff --git a/src/compat.c b/src/compat.c
index c2d99cb..988fa68 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -16,4 +16,22 @@ void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
16 } 16 }
17 lua_pop(L, nup); /* remove upvalues */ 17 lua_pop(L, nup); /* remove upvalues */
18} 18}
19
20/*
21** Duplicated from Lua 5.2
22*/
23void *luaL_testudata (lua_State *L, int ud, const char *tname) {
24 void *p = lua_touserdata(L, ud);
25 if (p != NULL) { /* value is a userdata? */
26 if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
27 luaL_getmetatable(L, tname); /* get correct metatable */
28 if (!lua_rawequal(L, -1, -2)) /* not the same? */
29 p = NULL; /* value is a userdata with wrong metatable */
30 lua_pop(L, 2); /* remove both metatables */
31 return p;
32 }
33 }
34 return NULL; /* value is not a userdata with a metatable */
35}
36
19#endif 37#endif
diff --git a/src/compat.h b/src/compat.h
index 7bf8010..49e83f9 100644
--- a/src/compat.h
+++ b/src/compat.h
@@ -5,7 +5,10 @@
5#include "lauxlib.h" 5#include "lauxlib.h"
6 6
7#if LUA_VERSION_NUM==501 7#if LUA_VERSION_NUM==501
8#define luaL_setfuncs socket_setfuncs
9#define luaL_testudata socket_testudata
8void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); 10void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
11void *luaL_testudata ( lua_State *L, int arg, const char *tname);
9#endif 12#endif
10 13
11#endif 14#endif
diff --git a/src/http.lua b/src/http.lua
index a386165..fb729b2 100644
--- a/src/http.lua
+++ b/src/http.lua
@@ -27,9 +27,13 @@ _M.TIMEOUT = 60
27_M.USERAGENT = socket._VERSION 27_M.USERAGENT = socket._VERSION
28 28
29-- supported schemes 29-- supported schemes
30local SCHEMES = { ["http"] = true } 30local SCHEMES = {
31-- default port for document retrieval 31 http = { port = 80 }
32local PORT = 80 32 , https = { port = 443 }}
33
34-- default scheme and port for document retrieval
35local SCHEME = 'http'
36local PORT = SCHEMES[SCHEME].port
33 37
34----------------------------------------------------------------------------- 38-----------------------------------------------------------------------------
35-- Reads MIME headers from a connection, unfolding where needed 39-- Reads MIME headers from a connection, unfolding where needed
@@ -212,10 +216,14 @@ end
212 216
213local function adjustheaders(reqt) 217local function adjustheaders(reqt)
214 -- default headers 218 -- default headers
215 local host = string.gsub(reqt.authority, "^.-@", "") 219 local headhost = reqt.host
220 local headport = tostring(reqt.port)
221 local schemeport = tostring(SCHEMES[reqt.scheme].port)
222 if headport ~= schemeport then
223 headhost = headhost .. ':' .. headport end
216 local lower = { 224 local lower = {
217 ["user-agent"] = _M.USERAGENT, 225 ["user-agent"] = _M.USERAGENT,
218 ["host"] = host, 226 ["host"] = headhost,
219 ["connection"] = "close, TE", 227 ["connection"] = "close, TE",
220 ["te"] = "trailers" 228 ["te"] = "trailers"
221 } 229 }
@@ -246,7 +254,7 @@ local default = {
246 host = "", 254 host = "",
247 port = PORT, 255 port = PORT,
248 path ="/", 256 path ="/",
249 scheme = "http" 257 scheme = SCHEME
250} 258}
251 259
252local function adjustrequest(reqt) 260local function adjustrequest(reqt)
@@ -277,7 +285,9 @@ local function shouldredirect(reqt, code, headers)
277 return (reqt.redirect ~= false) and 285 return (reqt.redirect ~= false) and
278 (code == 301 or code == 302 or code == 303 or code == 307) and 286 (code == 301 or code == 302 or code == 303 or code == 307) and
279 (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD") 287 (not reqt.method or reqt.method == "GET" or reqt.method == "HEAD")
280 and (not reqt.nredirects or reqt.nredirects < 5) 288 and ((false == reqt.maxredirects)
289 or ((reqt.nredirects or 0)
290 < (reqt.maxredirects or 5)))
281end 291end
282 292
283local function shouldreceivebody(reqt, code) 293local function shouldreceivebody(reqt, code)
@@ -299,6 +309,7 @@ local trequest, tredirect
299 sink = reqt.sink, 309 sink = reqt.sink,
300 headers = reqt.headers, 310 headers = reqt.headers,
301 proxy = reqt.proxy, 311 proxy = reqt.proxy,
312 maxredirects = reqt.maxredirects,
302 nredirects = (reqt.nredirects or 0) + 1, 313 nredirects = (reqt.nredirects or 0) + 1,
303 create = reqt.create 314 create = reqt.create
304 } 315 }
diff --git a/src/ltn12.lua b/src/ltn12.lua
index 575c5a7..afa735d 100644
--- a/src/ltn12.lua
+++ b/src/ltn12.lua
@@ -128,6 +128,16 @@ function source.string(s)
128 else return source.empty() end 128 else return source.empty() end
129end 129end
130 130
131-- creates table source
132function source.table(t)
133 base.assert('table' == type(t))
134 local i = 0
135 return function()
136 i = i + 1
137 return t[i]
138 end
139end
140
131-- creates rewindable source 141-- creates rewindable source
132function source.rewind(src) 142function source.rewind(src)
133 base.assert(src) 143 base.assert(src)
diff --git a/src/luasocket.c b/src/luasocket.c
index 7d9c802..d2752a7 100644..100755
--- a/src/luasocket.c
+++ b/src/luasocket.c
@@ -64,7 +64,7 @@ static luaL_Reg func[] = {
64* Skip a few arguments 64* Skip a few arguments
65\*-------------------------------------------------------------------------*/ 65\*-------------------------------------------------------------------------*/
66static int global_skip(lua_State *L) { 66static int global_skip(lua_State *L) {
67 int amount = luaL_checkinteger(L, 1); 67 int amount = (int) luaL_checkinteger(L, 1);
68 int ret = lua_gettop(L) - amount - 1; 68 int ret = lua_gettop(L) - amount - 1;
69 return ret >= 0 ? ret : 0; 69 return ret >= 0 ? ret : 0;
70} 70}
diff --git a/src/makefile b/src/makefile
index 494baab..cc1ec7e 100644
--- a/src/makefile
+++ b/src/makefile
@@ -35,7 +35,7 @@ DEBUG?=NODEBUG
35# LUAINC_macosx: 35# LUAINC_macosx:
36# /opt/local/include 36# /opt/local/include
37LUAINC_macosx_base?=/opt/local/include 37LUAINC_macosx_base?=/opt/local/include
38LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV) 38LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV) $(LUAINC_macosx_base)/lua$(LUAV)
39# FIXME default should this default to fink or to macports? 39# FIXME default should this default to fink or to macports?
40# What happens when more than one Lua version is installed? 40# What happens when more than one Lua version is installed?
41LUAPREFIX_macosx?=/opt/local 41LUAPREFIX_macosx?=/opt/local
@@ -48,7 +48,7 @@ LDIR_macosx?=share/lua/$(LUAV)
48# /usr/local/include/lua$(LUAV) 48# /usr/local/include/lua$(LUAV)
49# where lua headers are found for linux builds 49# where lua headers are found for linux builds
50LUAINC_linux_base?=/usr/include 50LUAINC_linux_base?=/usr/include
51LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV) 51LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV) $(LUAINC_linux_base)/lua$(LUAV)
52LUAPREFIX_linux?=/usr/local 52LUAPREFIX_linux?=/usr/local
53CDIR_linux?=lib/lua/$(LUAV) 53CDIR_linux?=lib/lua/$(LUAV)
54LDIR_linux?=share/lua/$(LUAV) 54LDIR_linux?=share/lua/$(LUAV)
@@ -57,7 +57,7 @@ LDIR_linux?=share/lua/$(LUAV)
57# /usr/local/include/lua$(LUAV) 57# /usr/local/include/lua$(LUAV)
58# where lua headers are found for freebsd builds 58# where lua headers are found for freebsd builds
59LUAINC_freebsd_base?=/usr/local/include/ 59LUAINC_freebsd_base?=/usr/local/include/
60LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua$(LUAV) 60LUAINC_freebsd?=$(LUAINC_freebsd_base)/lua/$(LUAV) $(LUAINC_freebsd_base)/lua$(LUAV)
61LUAPREFIX_freebsd?=/usr/local/ 61LUAPREFIX_freebsd?=/usr/local/
62CDIR_freebsd?=lib/lua/$(LUAV) 62CDIR_freebsd?=lib/lua/$(LUAV)
63LDIR_freebsd?=share/lua/$(LUAV) 63LDIR_freebsd?=share/lua/$(LUAV)
@@ -66,7 +66,7 @@ LDIR_freebsd?=share/lua/$(LUAV)
66# LUAINC_mingw: 66# LUAINC_mingw:
67# /opt/local/include 67# /opt/local/include
68LUAINC_mingw_base?=/usr/include 68LUAINC_mingw_base?=/usr/include
69LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV) 69LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV) $(LUAINC_mingw_base)/lua$(LUAV)
70LUALIB_mingw_base?=/usr/bin 70LUALIB_mingw_base?=/usr/bin
71LUALIB_mingw?=$(LUALIB_mingw_base)/lua/$(LUAV)/lua$(subst .,,$(LUAV)).dll 71LUALIB_mingw?=$(LUALIB_mingw_base)/lua/$(LUAV)/lua$(subst .,,$(LUAV)).dll
72LUAPREFIX_mingw?=/usr 72LUAPREFIX_mingw?=/usr
@@ -78,7 +78,7 @@ LDIR_mingw?=lua/$(LUAV)/lua
78# LUALIB_win32: 78# LUALIB_win32:
79# where lua headers and libraries are found for win32 builds 79# where lua headers and libraries are found for win32 builds
80LUAPREFIX_win32?= 80LUAPREFIX_win32?=
81LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV) 81LUAINC_win32?=$(LUAPREFIX_win32)/include/lua/$(LUAV) $(LUAPREFIX_win32)/include/lua$(LUAV)
82PLATFORM_win32?=Release 82PLATFORM_win32?=Release
83CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32) 83CDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)
84LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua 84LDIR_win32?=bin/lua/$(LUAV)/$(PLATFORM_win32)/lua
@@ -88,7 +88,7 @@ LUALIBNAME_win32?=lua$(subst .,,$(LUAV)).lib
88 88
89# LUAINC_solaris: 89# LUAINC_solaris:
90LUAINC_solaris_base?=/usr/include 90LUAINC_solaris_base?=/usr/include
91LUAINC_solaris?=$(LUAINC_solaris_base)/lua/$(LUAV) 91LUAINC_solaris?=$(LUAINC_solaris_base)/lua/$(LUAV) $(LUAINC_solaris_base)/lua$(LUAV)
92LUAPREFIX_solaris?=/usr/local 92LUAPREFIX_solaris?=/usr/local
93CDIR_solaris?=lib/lua/$(LUAV) 93CDIR_solaris?=lib/lua/$(LUAV)
94LDIR_solaris?=share/lua/$(LUAV) 94LDIR_solaris?=share/lua/$(LUAV)
@@ -153,7 +153,7 @@ DEF_macosx= -DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \
153 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 153 -DLUASOCKET_API='__attribute__((visibility("default")))' \
154 -DUNIX_API='__attribute__((visibility("default")))' \ 154 -DUNIX_API='__attribute__((visibility("default")))' \
155 -DMIME_API='__attribute__((visibility("default")))' 155 -DMIME_API='__attribute__((visibility("default")))'
156CFLAGS_macosx= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ 156CFLAGS_macosx=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common \
157 -fvisibility=hidden 157 -fvisibility=hidden
158LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o 158LDFLAGS_macosx= -bundle -undefined dynamic_lookup -o
159LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc 159LD_macosx= export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc
@@ -169,7 +169,7 @@ DEF_linux=-DLUASOCKET_$(DEBUG) \
169 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 169 -DLUASOCKET_API='__attribute__((visibility("default")))' \
170 -DUNIX_API='__attribute__((visibility("default")))' \ 170 -DUNIX_API='__attribute__((visibility("default")))' \
171 -DMIME_API='__attribute__((visibility("default")))' 171 -DMIME_API='__attribute__((visibility("default")))'
172CFLAGS_linux= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ 172CFLAGS_linux=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
173 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden 173 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
174LDFLAGS_linux=-O -shared -fpic -o 174LDFLAGS_linux=-O -shared -fpic -o
175LD_linux=gcc 175LD_linux=gcc
@@ -181,11 +181,11 @@ SOCKET_linux=usocket.o
181SO_freebsd=so 181SO_freebsd=so
182O_freebsd=o 182O_freebsd=o
183CC_freebsd=gcc 183CC_freebsd=gcc
184DEF_freebsd=-DLUASOCKET_$(DEBUG) \ 184DEF_freebsd=-DLUASOCKET_$(DEBUG) -DUNIX_HAS_SUN_LEN \
185 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 185 -DLUASOCKET_API='__attribute__((visibility("default")))' \
186 -DUNIX_API='__attribute__((visibility("default")))' \ 186 -DUNIX_API='__attribute__((visibility("default")))' \
187 -DMIME_API='__attribute__((visibility("default")))' 187 -DMIME_API='__attribute__((visibility("default")))'
188CFLAGS_freebsd= -I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ 188CFLAGS_freebsd=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
189 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden 189 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
190LDFLAGS_freebsd=-O -shared -fpic -o 190LDFLAGS_freebsd=-O -shared -fpic -o
191LD_freebsd=gcc 191LD_freebsd=gcc
@@ -201,7 +201,7 @@ DEF_solaris=-DLUASOCKET_$(DEBUG) \
201 -DLUASOCKET_API='__attribute__((visibility("default")))' \ 201 -DLUASOCKET_API='__attribute__((visibility("default")))' \
202 -DUNIX_API='__attribute__((visibility("default")))' \ 202 -DUNIX_API='__attribute__((visibility("default")))' \
203 -DMIME_API='__attribute__((visibility("default")))' 203 -DMIME_API='__attribute__((visibility("default")))'
204CFLAGS_solaris=-I$(LUAINC) $(DEF) -Wall -Wshadow -Wextra \ 204CFLAGS_solaris=$(LUAINC:%=-I%) $(DEF) -Wall -Wshadow -Wextra \
205 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden 205 -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden
206LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o 206LDFLAGS_solaris=-lnsl -lsocket -lresolv -O -shared -fpic -o
207LD_solaris=gcc 207LD_solaris=gcc
@@ -216,7 +216,7 @@ CC_mingw=gcc
216DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \ 216DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) \
217 -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \ 217 -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \
218 -DMIME_API='__declspec(dllexport)' 218 -DMIME_API='__declspec(dllexport)'
219CFLAGS_mingw= -I$(LUAINC) $(DEF) -Wall -O2 -fno-common \ 219CFLAGS_mingw=$(LUAINC:%=-I%) $(DEF) -Wall -O2 -fno-common \
220 -fvisibility=hidden 220 -fvisibility=hidden
221LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o 221LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lws2_32 -o
222LD_mingw=gcc 222LD_mingw=gcc
@@ -233,7 +233,7 @@ DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \
233 //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \ 233 //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \
234 //D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \ 234 //D "_WINDLL" //D "MIME_API=__declspec(dllexport)" \
235 //D "LUASOCKET_$(DEBUG)" 235 //D "LUASOCKET_$(DEBUG)"
236CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo 236CFLAGS_win32=$(LUAINC:%=//I "%") $(DEF) //O2 //Ot //MD //W3 //nologo
237LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \ 237LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \
238 //MANIFEST //MANIFESTFILE:"intermediate.manifest" \ 238 //MANIFEST //MANIFESTFILE:"intermediate.manifest" \
239 //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ 239 //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \
@@ -360,7 +360,7 @@ linux:
360 360
361mingw: 361mingw:
362 $(MAKE) all PLAT=mingw 362 $(MAKE) all PLAT=mingw
363 363
364solaris: 364solaris:
365 $(MAKE) all-unix PLAT=solaris 365 $(MAKE) all-unix PLAT=solaris
366 366
@@ -386,7 +386,7 @@ $(UNIX_SO): $(UNIX_OBJS)
386$(SERIAL_SO): $(SERIAL_OBJS) 386$(SERIAL_SO): $(SERIAL_OBJS)
387 $(LD) $(SERIAL_OBJS) $(LDFLAGS)$@ 387 $(LD) $(SERIAL_OBJS) $(LDFLAGS)$@
388 388
389install: 389install:
390 $(INSTALL_DIR) $(INSTALL_TOP_LDIR) 390 $(INSTALL_DIR) $(INSTALL_TOP_LDIR)
391 $(INSTALL_DATA) $(TO_TOP_LDIR) $(INSTALL_TOP_LDIR) 391 $(INSTALL_DATA) $(TO_TOP_LDIR) $(INSTALL_TOP_LDIR)
392 $(INSTALL_DIR) $(INSTALL_SOCKET_LDIR) 392 $(INSTALL_DIR) $(INSTALL_SOCKET_LDIR)
diff --git a/src/mime.c b/src/mime.c
index ed44104..338ecd4 100644..100755
--- a/src/mime.c
+++ b/src/mime.c
@@ -654,7 +654,7 @@ static int eolprocess(int c, int last, const char *marker,
654\*-------------------------------------------------------------------------*/ 654\*-------------------------------------------------------------------------*/
655static int mime_global_eol(lua_State *L) 655static int mime_global_eol(lua_State *L)
656{ 656{
657 int ctx = luaL_checkinteger(L, 1); 657 int ctx = (int) luaL_checkinteger(L, 1);
658 size_t isize = 0; 658 size_t isize = 0;
659 const char *input = luaL_optlstring(L, 2, NULL, &isize); 659 const char *input = luaL_optlstring(L, 2, NULL, &isize);
660 const char *last = input + isize; 660 const char *last = input + isize;
@@ -689,6 +689,7 @@ static size_t dot(int c, size_t state, luaL_Buffer *buffer)
689 case '.': 689 case '.':
690 if (state == 2) 690 if (state == 2)
691 luaL_addchar(buffer, '.'); 691 luaL_addchar(buffer, '.');
692 /* Falls through. */
692 default: 693 default:
693 return 0; 694 return 0;
694 } 695 }
diff --git a/src/options.c b/src/options.c
index fe4e9bb..bbadec3 100644
--- a/src/options.c
+++ b/src/options.c
@@ -90,6 +90,42 @@ int opt_get_tcp_nodelay(lua_State *L, p_socket ps)
90 return opt_getboolean(L, ps, IPPROTO_TCP, TCP_NODELAY); 90 return opt_getboolean(L, ps, IPPROTO_TCP, TCP_NODELAY);
91} 91}
92 92
93#ifdef TCP_KEEPIDLE
94int opt_get_tcp_keepidle(lua_State *L, p_socket ps)
95{
96 return opt_getint(L, ps, IPPROTO_TCP, TCP_KEEPIDLE);
97}
98
99int opt_set_tcp_keepidle(lua_State *L, p_socket ps)
100{
101 return opt_setint(L, ps, IPPROTO_TCP, TCP_KEEPIDLE);
102}
103#endif
104
105#ifdef TCP_KEEPCNT
106int opt_get_tcp_keepcnt(lua_State *L, p_socket ps)
107{
108 return opt_getint(L, ps, IPPROTO_TCP, TCP_KEEPCNT);
109}
110
111int opt_set_tcp_keepcnt(lua_State *L, p_socket ps)
112{
113 return opt_setint(L, ps, IPPROTO_TCP, TCP_KEEPCNT);
114}
115#endif
116
117#ifdef TCP_KEEPINTVL
118int opt_get_tcp_keepintvl(lua_State *L, p_socket ps)
119{
120 return opt_getint(L, ps, IPPROTO_TCP, TCP_KEEPINTVL);
121}
122
123int opt_set_tcp_keepintvl(lua_State *L, p_socket ps)
124{
125 return opt_setint(L, ps, IPPROTO_TCP, TCP_KEEPINTVL);
126}
127#endif
128
93int opt_set_keepalive(lua_State *L, p_socket ps) 129int opt_set_keepalive(lua_State *L, p_socket ps)
94{ 130{
95 return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE); 131 return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE);
diff --git a/src/options.h b/src/options.h
index 4530389..fb82c4d 100644
--- a/src/options.h
+++ b/src/options.h
@@ -22,6 +22,15 @@ typedef t_opt *p_opt;
22int opt_set_dontroute(lua_State *L, p_socket ps); 22int opt_set_dontroute(lua_State *L, p_socket ps);
23int opt_set_broadcast(lua_State *L, p_socket ps); 23int opt_set_broadcast(lua_State *L, p_socket ps);
24int opt_set_tcp_nodelay(lua_State *L, p_socket ps); 24int opt_set_tcp_nodelay(lua_State *L, p_socket ps);
25#ifdef TCP_KEEPIDLE
26int opt_set_tcp_keepidle(lua_State *L, p_socket ps);
27#endif
28#ifdef TCP_KEEPCNT
29int opt_set_tcp_keepcnt(lua_State *L, p_socket ps);
30#endif
31#ifdef TCP_KEEPINTVL
32int opt_set_tcp_keepintvl(lua_State *L, p_socket ps);
33#endif
25int opt_set_keepalive(lua_State *L, p_socket ps); 34int opt_set_keepalive(lua_State *L, p_socket ps);
26int opt_set_linger(lua_State *L, p_socket ps); 35int opt_set_linger(lua_State *L, p_socket ps);
27int opt_set_reuseaddr(lua_State *L, p_socket ps); 36int opt_set_reuseaddr(lua_State *L, p_socket ps);
@@ -46,6 +55,15 @@ int opt_get_broadcast(lua_State *L, p_socket ps);
46int opt_get_reuseaddr(lua_State *L, p_socket ps); 55int opt_get_reuseaddr(lua_State *L, p_socket ps);
47int opt_get_reuseport(lua_State *L, p_socket ps); 56int opt_get_reuseport(lua_State *L, p_socket ps);
48int opt_get_tcp_nodelay(lua_State *L, p_socket ps); 57int opt_get_tcp_nodelay(lua_State *L, p_socket ps);
58#ifdef TCP_KEEPIDLE
59int opt_get_tcp_keepidle(lua_State *L, p_socket ps);
60#endif
61#ifdef TCP_KEEPCNT
62int opt_get_tcp_keepcnt(lua_State *L, p_socket ps);
63#endif
64#ifdef TCP_KEEPINTVL
65int opt_get_tcp_keepintvl(lua_State *L, p_socket ps);
66#endif
49int opt_get_keepalive(lua_State *L, p_socket ps); 67int opt_get_keepalive(lua_State *L, p_socket ps);
50int opt_get_linger(lua_State *L, p_socket ps); 68int opt_get_linger(lua_State *L, p_socket ps);
51int opt_get_ip_multicast_loop(lua_State *L, p_socket ps); 69int opt_get_ip_multicast_loop(lua_State *L, p_socket ps);
diff --git a/src/tcp.c b/src/tcp.c
index f64cb10..c7384b4 100644
--- a/src/tcp.c
+++ b/src/tcp.c
@@ -77,6 +77,15 @@ static t_opt optget[] = {
77 {"reuseaddr", opt_get_reuseaddr}, 77 {"reuseaddr", opt_get_reuseaddr},
78 {"reuseport", opt_get_reuseport}, 78 {"reuseport", opt_get_reuseport},
79 {"tcp-nodelay", opt_get_tcp_nodelay}, 79 {"tcp-nodelay", opt_get_tcp_nodelay},
80#ifdef TCP_KEEPIDLE
81 {"tcp-keepidle", opt_get_tcp_keepidle},
82#endif
83#ifdef TCP_KEEPCNT
84 {"tcp-keepcnt", opt_get_tcp_keepcnt},
85#endif
86#ifdef TCP_KEEPINTVL
87 {"tcp-keepintvl", opt_get_tcp_keepintvl},
88#endif
80 {"linger", opt_get_linger}, 89 {"linger", opt_get_linger},
81 {"error", opt_get_error}, 90 {"error", opt_get_error},
82 {"recv-buffer-size", opt_get_recv_buf_size}, 91 {"recv-buffer-size", opt_get_recv_buf_size},
@@ -89,6 +98,15 @@ static t_opt optset[] = {
89 {"reuseaddr", opt_set_reuseaddr}, 98 {"reuseaddr", opt_set_reuseaddr},
90 {"reuseport", opt_set_reuseport}, 99 {"reuseport", opt_set_reuseport},
91 {"tcp-nodelay", opt_set_tcp_nodelay}, 100 {"tcp-nodelay", opt_set_tcp_nodelay},
101#ifdef TCP_KEEPIDLE
102 {"tcp-keepidle", opt_set_tcp_keepidle},
103#endif
104#ifdef TCP_KEEPCNT
105 {"tcp-keepcnt", opt_set_tcp_keepcnt},
106#endif
107#ifdef TCP_KEEPINTVL
108 {"tcp-keepintvl", opt_set_tcp_keepintvl},
109#endif
92 {"ipv6-v6only", opt_set_ip6_v6only}, 110 {"ipv6-v6only", opt_set_ip6_v6only},
93 {"linger", opt_set_linger}, 111 {"linger", opt_set_linger},
94 {"recv-buffer-size", opt_set_recv_buf_size}, 112 {"recv-buffer-size", opt_set_recv_buf_size},
diff --git a/src/unixdgram.c b/src/unixdgram.c
index 4645892..0d6f18c 100644
--- a/src/unixdgram.c
+++ b/src/unixdgram.c
@@ -17,6 +17,12 @@
17 17
18#define UNIXDGRAM_DATAGRAMSIZE 8192 18#define UNIXDGRAM_DATAGRAMSIZE 8192
19 19
20// provide a SUN_LEN macro if sys/un.h doesn't (e.g. Android)
21#ifndef SUN_LEN
22#define SUN_LEN(ptr) \
23 ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
24 + strlen ((ptr)->sun_path))
25#endif
20/*=========================================================================*\ 26/*=========================================================================*\
21* Internal function prototypes 27* Internal function prototypes
22\*=========================================================================*/ 28\*=========================================================================*/
@@ -261,20 +267,15 @@ static int meth_dirty(lua_State *L) {
261static const char *unixdgram_trybind(p_unix un, const char *path) { 267static const char *unixdgram_trybind(p_unix un, const char *path) {
262 struct sockaddr_un local; 268 struct sockaddr_un local;
263 size_t len = strlen(path); 269 size_t len = strlen(path);
264 int err;
265 if (len >= sizeof(local.sun_path)) return "path too long"; 270 if (len >= sizeof(local.sun_path)) return "path too long";
266 memset(&local, 0, sizeof(local)); 271 memset(&local, 0, sizeof(local));
267 strcpy(local.sun_path, path); 272 strcpy(local.sun_path, path);
268 local.sun_family = AF_UNIX; 273 local.sun_family = AF_UNIX;
274 size_t addrlen = SUN_LEN(&local);
269#ifdef UNIX_HAS_SUN_LEN 275#ifdef UNIX_HAS_SUN_LEN
270 local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len) 276 local.sun_len = addrlen + 1;
271 + len + 1;
272 err = socket_bind(&un->sock, (SA *) &local, local.sun_len);
273
274#else
275 err = socket_bind(&un->sock, (SA *) &local,
276 sizeof(local.sun_family) + len);
277#endif 277#endif
278 int err = socket_bind(&un->sock, (SA *) &local, addrlen);
278 if (err != IO_DONE) socket_destroy(&un->sock); 279 if (err != IO_DONE) socket_destroy(&un->sock);
279 return socket_strerror(err); 280 return socket_strerror(err);
280} 281}
@@ -315,21 +316,17 @@ static int meth_getsockname(lua_State *L)
315static const char *unixdgram_tryconnect(p_unix un, const char *path) 316static const char *unixdgram_tryconnect(p_unix un, const char *path)
316{ 317{
317 struct sockaddr_un remote; 318 struct sockaddr_un remote;
318 int err;
319 size_t len = strlen(path); 319 size_t len = strlen(path);
320 if (len >= sizeof(remote.sun_path)) return "path too long"; 320 if (len >= sizeof(remote.sun_path)) return "path too long";
321 memset(&remote, 0, sizeof(remote)); 321 memset(&remote, 0, sizeof(remote));
322 strcpy(remote.sun_path, path); 322 strcpy(remote.sun_path, path);
323 remote.sun_family = AF_UNIX; 323 remote.sun_family = AF_UNIX;
324 timeout_markstart(&un->tm); 324 timeout_markstart(&un->tm);
325 size_t addrlen = SUN_LEN(&remote);
325#ifdef UNIX_HAS_SUN_LEN 326#ifdef UNIX_HAS_SUN_LEN
326 remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len) 327 remote.sun_len = addrlen + 1;
327 + len + 1;
328 err = socket_connect(&un->sock, (SA *) &remote, remote.sun_len, &un->tm);
329#else
330 err = socket_connect(&un->sock, (SA *) &remote,
331 sizeof(remote.sun_family) + len, &un->tm);
332#endif 328#endif
329 int err = socket_connect(&un->sock, (SA *) &remote, addrlen, &un->tm);
333 if (err != IO_DONE) socket_destroy(&un->sock); 330 if (err != IO_DONE) socket_destroy(&un->sock);
334 return socket_strerror(err); 331 return socket_strerror(err);
335} 332}
diff --git a/src/url.lua b/src/url.lua
index 110ea94..0a3a80a 100644
--- a/src/url.lua
+++ b/src/url.lua
@@ -77,6 +77,34 @@ function _M.unescape(s)
77end 77end
78 78
79----------------------------------------------------------------------------- 79-----------------------------------------------------------------------------
80-- Removes '..' and '.' components appropriately from a path.
81-- Input
82-- path
83-- Returns
84-- dot-normalized path
85local function remove_dot_components(path)
86 local marker = string.char(1)
87 repeat
88 local was = path
89 path = path:gsub('//', '/'..marker..'/', 1)
90 until path == was
91 repeat
92 local was = path
93 path = path:gsub('/%./', '/', 1)
94 until path == was
95 repeat
96 local was = path
97 path = path:gsub('[^/]+/%.%./([^/]+)', '%1', 1)
98 until path == was
99 path = path:gsub('[^/]+/%.%./*$', '')
100 path = path:gsub('/%.%.$', '/')
101 path = path:gsub('/%.$', '/')
102 path = path:gsub('^/%.%./', '/')
103 path = path:gsub(marker, '')
104 return path
105end
106
107-----------------------------------------------------------------------------
80-- Builds a path from a base path and a relative path 108-- Builds a path from a base path and a relative path
81-- Input 109-- Input
82-- base_path 110-- base_path
@@ -85,23 +113,12 @@ end
85-- corresponding absolute path 113-- corresponding absolute path
86----------------------------------------------------------------------------- 114-----------------------------------------------------------------------------
87local function absolute_path(base_path, relative_path) 115local function absolute_path(base_path, relative_path)
88 if string.sub(relative_path, 1, 1) == "/" then return relative_path end 116 if string.sub(relative_path, 1, 1) == "/" then
89 local path = string.gsub(base_path, "[^/]*$", "") 117 return remove_dot_components(relative_path) end
90 path = path .. relative_path 118 base_path = base_path:gsub("[^/]*$", "")
91 path = string.gsub(path, "([^/]*%./)", function (s) 119 if not base_path:find'/$' then base_path = base_path .. '/' end
92 if s ~= "./" then return s else return "" end 120 local path = base_path .. relative_path
93 end) 121 path = remove_dot_components(path)
94 path = string.gsub(path, "/%.$", "/")
95 local reduced
96 while reduced ~= path do
97 reduced = path
98 path = string.gsub(reduced, "([^/]*/%.%./)", function (s)
99 if s ~= "../../" then return "" else return s end
100 end)
101 end
102 path = string.gsub(reduced, "([^/]*/%.%.)$", function (s)
103 if s ~= "../.." then return "" else return s end
104 end)
105 return path 122 return path
106end 123end
107 124
@@ -227,10 +244,14 @@ function _M.absolute(base_url, relative_url)
227 else 244 else
228 base_parsed = _M.parse(base_url) 245 base_parsed = _M.parse(base_url)
229 end 246 end
247 local result
230 local relative_parsed = _M.parse(relative_url) 248 local relative_parsed = _M.parse(relative_url)
231 if not base_parsed then return relative_url 249 if not base_parsed then
232 elseif not relative_parsed then return base_url 250 result = relative_url
233 elseif relative_parsed.scheme then return relative_url 251 elseif not relative_parsed then
252 result = base_url
253 elseif relative_parsed.scheme then
254 result = relative_url
234 else 255 else
235 relative_parsed.scheme = base_parsed.scheme 256 relative_parsed.scheme = base_parsed.scheme
236 if not relative_parsed.authority then 257 if not relative_parsed.authority then
@@ -248,8 +269,9 @@ function _M.absolute(base_url, relative_url)
248 relative_parsed.path) 269 relative_parsed.path)
249 end 270 end
250 end 271 end
251 return _M.build(relative_parsed) 272 result = _M.build(relative_parsed)
252 end 273 end
274 return remove_dot_components(result)
253end 275end
254 276
255----------------------------------------------------------------------------- 277-----------------------------------------------------------------------------
diff --git a/src/wsocket.c b/src/wsocket.c
index 8ecb0fc..ac8411f 100644..100755
--- a/src/wsocket.c
+++ b/src/wsocket.c
@@ -131,11 +131,11 @@ int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) {
131 /* we wait until something happens */ 131 /* we wait until something happens */
132 err = socket_waitfd(ps, WAITFD_C, tm); 132 err = socket_waitfd(ps, WAITFD_C, tm);
133 if (err == IO_CLOSED) { 133 if (err == IO_CLOSED) {
134 int len = sizeof(err); 134 int elen = sizeof(err);
135 /* give windows time to set the error (yes, disgusting) */ 135 /* give windows time to set the error (yes, disgusting) */
136 Sleep(10); 136 Sleep(10);
137 /* find out why we failed */ 137 /* find out why we failed */
138 getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &len); 138 getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &elen);
139 /* we KNOW there was an error. if 'why' is 0, we will return 139 /* we KNOW there was an error. if 'why' is 0, we will return
140 * "unknown error", but it's not really our fault */ 140 * "unknown error", but it's not really our fault */
141 return err > 0? err: IO_UNKNOWN; 141 return err > 0? err: IO_UNKNOWN;
diff --git a/test/ltn12test.lua b/test/ltn12test.lua
index e3f85fb..e7d368d 100644
--- a/test/ltn12test.lua
+++ b/test/ltn12test.lua
@@ -181,6 +181,15 @@ assert(table.concat(t) == s, "mismatch")
181print("ok") 181print("ok")
182 182
183-------------------------------- 183--------------------------------
184io.write("testing source.table: ")
185local inp = {'a','b','c','d','e'}
186local source = ltn12.source.table(inp)
187sink, t = ltn12.sink.table()
188assert(ltn12.pump.all(source, sink), "returned error")
189for i = 1, #inp do assert(t[i] == inp[i], "mismatch") end
190print("ok")
191
192--------------------------------
184io.write("testing source.chain (with split): ") 193io.write("testing source.chain (with split): ")
185source = ltn12.source.string(s) 194source = ltn12.source.string(s)
186filter = split(5) 195filter = split(5)
diff --git a/test/tcp-getoptions b/test/tcp-getoptions
index f9b3d1b..777ccc3 100755
--- a/test/tcp-getoptions
+++ b/test/tcp-getoptions
@@ -7,7 +7,9 @@ port = 8765
7function options(o) 7function options(o)
8 print("options for", o) 8 print("options for", o)
9 9
10 for _, opt in ipairs{"keepalive", "reuseaddr", "tcp-nodelay"} do 10 for _, opt in ipairs{
11 "keepalive", "reuseaddr",
12 "tcp-nodelay", "tcp-keepidle", "tcp-keepcnt", "tcp-keepintvl"} do
11 print("getoption", opt, o:getoption(opt)) 13 print("getoption", opt, o:getoption(opt))
12 end 14 end
13 15
diff --git a/test/urltest.lua b/test/urltest.lua
index 1090a7e..ae8ba75 100644
--- a/test/urltest.lua
+++ b/test/urltest.lua
@@ -61,7 +61,7 @@ end
61local check_absolute_url = function(base, relative, absolute) 61local check_absolute_url = function(base, relative, absolute)
62 local res = socket.url.absolute(base, relative) 62 local res = socket.url.absolute(base, relative)
63 if res ~= absolute then 63 if res ~= absolute then
64 io.write("absolute: In test for '", relative, "' expected '", 64 io.write("absolute: In test for base='", base, "', rel='", relative, "' expected '",
65 absolute, "' but got '", res, "'\n") 65 absolute, "' but got '", res, "'\n")
66 os.exit() 66 os.exit()
67 end 67 end
@@ -627,25 +627,37 @@ check_absolute_url("http://a/b/c/d;p?q#f", "/g", "http://a/g")
627check_absolute_url("http://a/b/c/d;p?q#f", "//g", "http://g") 627check_absolute_url("http://a/b/c/d;p?q#f", "//g", "http://g")
628check_absolute_url("http://a/b/c/d;p?q#f", "?y", "http://a/b/c/d;p?y") 628check_absolute_url("http://a/b/c/d;p?q#f", "?y", "http://a/b/c/d;p?y")
629check_absolute_url("http://a/b/c/d;p?q#f", "g?y", "http://a/b/c/g?y") 629check_absolute_url("http://a/b/c/d;p?q#f", "g?y", "http://a/b/c/g?y")
630check_absolute_url("http://a/b/c/d;p?q#f", "g?y/./x", "http://a/b/c/g?y/./x") 630check_absolute_url("http://a/b/c/d;p?q#f", "g?y/./x", "http://a/b/c/g?y/x")
631check_absolute_url("http://a/b/c/d;p?q#f", "#s", "http://a/b/c/d;p?q#s") 631check_absolute_url("http://a/b/c/d;p?q#f", "#s", "http://a/b/c/d;p?q#s")
632check_absolute_url("http://a/b/c/d;p?q#f", "g#s", "http://a/b/c/g#s") 632check_absolute_url("http://a/b/c/d;p?q#f", "g#s", "http://a/b/c/g#s")
633check_absolute_url("http://a/b/c/d;p?q#f", "g#s/./x", "http://a/b/c/g#s/./x") 633check_absolute_url("http://a/b/c/d;p?q#f", "g#s/./x", "http://a/b/c/g#s/x")
634check_absolute_url("http://a/b/c/d;p?q#f", "g?y#s", "http://a/b/c/g?y#s") 634check_absolute_url("http://a/b/c/d;p?q#f", "g?y#s", "http://a/b/c/g?y#s")
635check_absolute_url("http://a/b/c/d;p?q#f", ";x", "http://a/b/c/d;x") 635check_absolute_url("http://a/b/c/d;p?q#f", ";x", "http://a/b/c/d;x")
636check_absolute_url("http://a/b/c/d;p?q#f", "g;x", "http://a/b/c/g;x") 636check_absolute_url("http://a/b/c/d;p?q#f", "g;x", "http://a/b/c/g;x")
637check_absolute_url("http://a/b/c/d;p?q#f", "g;x?y#s", "http://a/b/c/g;x?y#s") 637check_absolute_url("http://a/b/c/d;p?q#f", "g;x?y#s", "http://a/b/c/g;x?y#s")
638check_absolute_url("http://a/b/c/d;p?q#f", ".", "http://a/b/c/") 638check_absolute_url("http://a/b/c/d;p?q#f", ".", "http://a/b/c/")
639check_absolute_url("http://a/b/c/d;p?q#f", "./", "http://a/b/c/") 639check_absolute_url("http://a/b/c/d;p?q#f", "./", "http://a/b/c/")
640check_absolute_url("http://a/b/c/d;p?q#f", "./g", "http://a/b/c/g")
641check_absolute_url("http://a/b/c/d;p?q#f", "./g/", "http://a/b/c/g/")
642check_absolute_url("http://a/b/c/d;p?q#f", "././g", "http://a/b/c/g")
643check_absolute_url("http://a/b/c/d;p?q#f", "././g/", "http://a/b/c/g/")
644check_absolute_url("http://a/b/c/d;p?q#f", "g/.", "http://a/b/c/g/")
645check_absolute_url("http://a/b/c/d;p?q#f", "g/./", "http://a/b/c/g/")
646check_absolute_url("http://a/b/c/d;p?q#f", "g/./.", "http://a/b/c/g/")
647check_absolute_url("http://a/b/c/d;p?q#f", "g/././", "http://a/b/c/g/")
648check_absolute_url("http://a/b/c/d;p?q#f", "./.", "http://a/b/c/")
649check_absolute_url("http://a/b/c/d;p?q#f", "././.", "http://a/b/c/")
650check_absolute_url("http://a/b/c/d;p?q#f", "././g/./.", "http://a/b/c/g/")
640check_absolute_url("http://a/b/c/d;p?q#f", "..", "http://a/b/") 651check_absolute_url("http://a/b/c/d;p?q#f", "..", "http://a/b/")
641check_absolute_url("http://a/b/c/d;p?q#f", "../", "http://a/b/") 652check_absolute_url("http://a/b/c/d;p?q#f", "../", "http://a/b/")
642check_absolute_url("http://a/b/c/d;p?q#f", "../g", "http://a/b/g") 653check_absolute_url("http://a/b/c/d;p?q#f", "../g", "http://a/b/g")
643check_absolute_url("http://a/b/c/d;p?q#f", "../..", "http://a/") 654check_absolute_url("http://a/b/c/d;p?q#f", "../..", "http://a/")
644check_absolute_url("http://a/b/c/d;p?q#f", "../../", "http://a/") 655check_absolute_url("http://a/b/c/d;p?q#f", "../../", "http://a/")
645check_absolute_url("http://a/b/c/d;p?q#f", "../../g", "http://a/g") 656check_absolute_url("http://a/b/c/d;p?q#f", "../../g", "http://a/g")
657check_absolute_url("http://a/b/c/d;p?q#f", "../../../g", "http://a/g")
646check_absolute_url("http://a/b/c/d;p?q#f", "", "http://a/b/c/d;p?q#f") 658check_absolute_url("http://a/b/c/d;p?q#f", "", "http://a/b/c/d;p?q#f")
647check_absolute_url("http://a/b/c/d;p?q#f", "/./g", "http://a/./g") 659check_absolute_url("http://a/b/c/d;p?q#f", "/./g", "http://a/g")
648check_absolute_url("http://a/b/c/d;p?q#f", "/../g", "http://a/../g") 660check_absolute_url("http://a/b/c/d;p?q#f", "/../g", "http://a/g")
649check_absolute_url("http://a/b/c/d;p?q#f", "g.", "http://a/b/c/g.") 661check_absolute_url("http://a/b/c/d;p?q#f", "g.", "http://a/b/c/g.")
650check_absolute_url("http://a/b/c/d;p?q#f", ".g", "http://a/b/c/.g") 662check_absolute_url("http://a/b/c/d;p?q#f", ".g", "http://a/b/c/.g")
651check_absolute_url("http://a/b/c/d;p?q#f", "g..", "http://a/b/c/g..") 663check_absolute_url("http://a/b/c/d;p?q#f", "g..", "http://a/b/c/g..")
@@ -655,6 +667,17 @@ check_absolute_url("http://a/b/c/d;p?q#f", "./g/.", "http://a/b/c/g/")
655check_absolute_url("http://a/b/c/d;p?q#f", "g/./h", "http://a/b/c/g/h") 667check_absolute_url("http://a/b/c/d;p?q#f", "g/./h", "http://a/b/c/g/h")
656check_absolute_url("http://a/b/c/d;p?q#f", "g/../h", "http://a/b/c/h") 668check_absolute_url("http://a/b/c/d;p?q#f", "g/../h", "http://a/b/c/h")
657 669
670check_absolute_url("http://a/b/c/d:p?q#f/", "../g/", "http://a/b/g/")
671check_absolute_url("http://a/b/c/d:p?q#f/", "../g", "http://a/b/g")
672check_absolute_url("http://a/b/c/d:p?q#f/", "../.g/", "http://a/b/.g/")
673check_absolute_url("http://a/b/c/d:p?q#f/", "../.g", "http://a/b/.g")
674check_absolute_url("http://a/b/c/d:p?q#f/", "../.g.h/", "http://a/b/.g.h/")
675check_absolute_url("http://a/b/c/d:p?q#f/", "../.g.h", "http://a/b/.g.h")
676
677check_absolute_url("http://a/b/c/d:p?q#f/", "g.h/", "http://a/b/c/g.h/")
678check_absolute_url("http://a/b/c/d:p?q#f/", "../g.h/", "http://a/b/g.h/")
679check_absolute_url("http://a/", "../g.h/", "http://a/g.h/")
680
658-- extra tests 681-- extra tests
659check_absolute_url("//a/b/c/d;p?q#f", "d/e/f", "//a/b/c/d/e/f") 682check_absolute_url("//a/b/c/d;p?q#f", "d/e/f", "//a/b/c/d/e/f")
660check_absolute_url("/a/b/c/d;p?q#f", "d/e/f", "/a/b/c/d/e/f") 683check_absolute_url("/a/b/c/d;p?q#f", "d/e/f", "/a/b/c/d/e/f")
@@ -662,6 +685,17 @@ check_absolute_url("a/b/c/d", "d/e/f", "a/b/c/d/e/f")
662check_absolute_url("a/b/c/d/../", "d/e/f", "a/b/c/d/e/f") 685check_absolute_url("a/b/c/d/../", "d/e/f", "a/b/c/d/e/f")
663check_absolute_url("http://velox.telemar.com.br", "/dashboard/index.html", 686check_absolute_url("http://velox.telemar.com.br", "/dashboard/index.html",
664 "http://velox.telemar.com.br/dashboard/index.html") 687 "http://velox.telemar.com.br/dashboard/index.html")
688check_absolute_url("http://example.com/", "../.badhost.com/", "http://example.com/.badhost.com/")
689check_absolute_url("http://example.com/", "...badhost.com/", "http://example.com/...badhost.com/")
690check_absolute_url("http://example.com/a/b/c/d/", "../q", "http://example.com/a/b/c/q")
691check_absolute_url("http://example.com/a/b/c/d/", "../../q", "http://example.com/a/b/q")
692check_absolute_url("http://example.com/a/b/c/d/", "../../../q", "http://example.com/a/q")
693check_absolute_url("http://example.com", ".badhost.com", "http://example.com/.badhost.com")
694check_absolute_url("http://example.com/a/b/c/d/", "..//../../../q", "http://example.com/a/q")
695check_absolute_url("http://example.com/a/b/c/d/", "..//a/../../../../q", "http://example.com/a/q")
696check_absolute_url("http://example.com/a/b/c/d/", "..//a/..//../../../q", "http://example.com/a/b/q")
697check_absolute_url("http://example.com/a/b/c/d/", "..//a/..///../../../../q", "http://example.com/a/b/q")
698check_absolute_url("http://example.com/a/b/c/d/", "../x/a/../y/z/../../../../q", "http://example.com/a/b/q")
665 699
666print("testing path parsing and composition") 700print("testing path parsing and composition")
667check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 }) 701check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 })