Skip to content

Commit 684f956

Browse files
Merge pull request #198 from ladislav-zezula/Issue_196
* Removed using of Wininet (Windows only) * HTTP functions implemented via sockets (Platform independent)
2 parents a690a40 + 8cfa741 commit 684f956

36 files changed

+2120
-534
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
/*.cmake
2525
/Makefile
2626
/CMakeScripts/
27+
/build/
2728

2829
# Visual Studio related files
2930
*.opensdf

CMakeLists.txt

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.6)
1+
cmake_minimum_required(VERSION 3.2)
22
project(CascLib)
33

44
set(HEADER_FILES
@@ -13,8 +13,10 @@ set(HEADER_FILES
1313
src/common/FileTree.h
1414
src/common/ListFile.h
1515
src/common/Map.h
16+
src/common/Mime.h
1617
src/common/Path.h
1718
src/common/RootHandler.h
19+
src/common/Sockets.h
1820
src/jenkins/lookup.h
1921
)
2022

@@ -25,7 +27,9 @@ set(SRC_FILES
2527
src/common/FileStream.cpp
2628
src/common/FileTree.cpp
2729
src/common/ListFile.cpp
30+
src/common/Mime.cpp
2831
src/common/RootHandler.cpp
32+
src/common/Sockets.cpp
2933
src/jenkins/lookup3.c
3034
src/md5/md5.cpp
3135
src/CascDecompress.cpp
@@ -73,10 +77,10 @@ if(WIN32)
7377
set(SRC_ADDITIONAL_FILES ${ZLIB_FILES})
7478
set(LINK_LIBS wininet)
7579
if(CASC_UNICODE)
76-
message(STATUS "Build UNICODE version")
80+
message(STATUS "Build UNICODE version")
7781
add_definitions(-DUNICODE -D_UNICODE)
7882
else()
79-
message(STATUS "Build ANSI version")
83+
message(STATUS "Build ANSI version")
8084
endif()
8185
endif()
8286

@@ -93,57 +97,58 @@ endif()
9397

9498
option(CASC_BUILD_SHARED_LIB "Compile dynamically linked library" ON)
9599
if(CASC_BUILD_SHARED_LIB)
96-
message(STATUS "Build dynamically linked library")
97-
add_library(casc SHARED ${SRC_FILES} ${HEADER_FILES} ${SRC_ADDITIONAL_FILES})
98-
target_link_libraries(casc ${LINK_LIBS})
99-
install(TARGETS casc RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)
100-
target_include_directories(casc
101-
PUBLIC
102-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
103-
$<INSTALL_INTERFACE:include>
104-
)
105-
# On Win32, build CascLib.dll
106-
if(WIN32)
107-
set_target_properties(casc PROPERTIES OUTPUT_NAME CascLib)
108-
endif()
100+
message(STATUS "Build dynamically linked library")
101+
add_library(casc SHARED ${SRC_FILES} ${HEADER_FILES} ${SRC_ADDITIONAL_FILES})
109102

103+
if(APPLE)
104+
set_target_properties(casc PROPERTIES FRAMEWORK true)
105+
set_target_properties(casc PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
106+
set_target_properties(casc PROPERTIES LINK_FLAGS "-framework Carbon")
107+
endif()
110108

111-
if(APPLE)
112-
set_target_properties(casc PROPERTIES FRAMEWORK true)
113-
set_target_properties(casc PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
114-
set_target_properties(casc PROPERTIES LINK_FLAGS "-framework Carbon")
115-
endif()
116-
117-
if(UNIX)
118-
set_target_properties(casc PROPERTIES VERSION 1.0.0)
119-
set_target_properties(casc PROPERTIES SOVERSION 1)
120-
endif()
109+
if(UNIX)
110+
set_target_properties(casc PROPERTIES VERSION 1.0.0)
111+
set_target_properties(casc PROPERTIES SOVERSION 1)
112+
endif()
113+
114+
target_link_libraries(casc ${LINK_LIBS})
115+
install(TARGETS casc RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)
116+
target_include_directories(casc
117+
PUBLIC
118+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
119+
$<INSTALL_INTERFACE:include>
120+
)
121+
# On Win32, build CascLib.dll
122+
if(WIN32)
123+
set_target_properties(casc PROPERTIES OUTPUT_NAME CascLib)
124+
endif()
121125

122126
endif()
123127

124128
option(CASC_BUILD_TESTS "Build Test application" OFF)
125129
if(CASC_BUILD_TESTS)
126-
set(CASC_BUILD_STATIC_LIB ON CACHE BOOL "Force Static library building to link test app")
127-
message(STATUS "Build Test application")
130+
set(CASC_BUILD_STATIC_LIB ON CACHE BOOL "Force Static library building to link test app" FORCE)
131+
message(STATUS "Build Test application")
128132
add_executable(casc_test ${TEST_SRC_FILES})
133+
set_target_properties(casc_test PROPERTIES LINK_FLAGS "-pthread")
129134
target_link_libraries(casc_test casc_static)
130-
install(TARGETS casc_test RUNTIME DESTINATION bin)
135+
install(TARGETS casc_test RUNTIME DESTINATION bin)
131136
endif()
132137

133138
option(CASC_BUILD_STATIC_LIB "Build static linked library" OFF)
134139
if(CASC_BUILD_STATIC_LIB)
135-
message(STATUS "Build static linked library")
140+
message(STATUS "Build static linked library")
136141
add_library(casc_static STATIC ${SRC_FILES} ${HEADER_FILES} ${SRC_ADDITIONAL_FILES})
137142
target_link_libraries(casc_static ${LINK_LIBS})
138143
set_target_properties(casc_static PROPERTIES OUTPUT_NAME casc)
139-
target_include_directories(casc_static
140-
PUBLIC
141-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
142-
$<INSTALL_INTERFACE:include>
143-
)
144-
install(TARGETS casc_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)
145-
146-
if(APPLE)
144+
target_include_directories(casc_static
145+
PUBLIC
146+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
147+
$<INSTALL_INTERFACE:include>
148+
)
149+
install(TARGETS casc_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)
150+
151+
if(APPLE)
147152
set_target_properties(casc_static PROPERTIES FRAMEWORK false)
148153
set_target_properties(casc_static PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
149154
set_target_properties(casc_static PROPERTIES LINK_FLAGS "-framework Carbon")

CascLib_vs08.vcproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,22 @@
12131213
RelativePath=".\src\common\RootHandler.h"
12141214
>
12151215
</File>
1216+
<File
1217+
RelativePath=".\src\common\Mime.cpp"
1218+
>
1219+
</File>
1220+
<File
1221+
RelativePath=".\src\common\Mime.h"
1222+
>
1223+
</File>
1224+
<File
1225+
RelativePath=".\src\common\Sockets.cpp"
1226+
>
1227+
</File>
1228+
<File
1229+
RelativePath=".\src\common\Sockets.h"
1230+
>
1231+
</File>
12161232
</Filter>
12171233
<Filter
12181234
Name="jenkins"

CascLib_vs08_dll.vcproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,22 @@
473473
RelativePath=".\src\common\RootHandler.h"
474474
>
475475
</File>
476+
<File
477+
RelativePath=".\src\common\Mime.cpp"
478+
>
479+
</File>
480+
<File
481+
RelativePath=".\src\common\Mime.h"
482+
>
483+
</File>
484+
<File
485+
RelativePath=".\src\common\Sockets.cpp"
486+
>
487+
</File>
488+
<File
489+
RelativePath=".\src\common\Sockets.h"
490+
>
491+
</File>
476492
</Filter>
477493
<Filter
478494
Name="jenkins"

CascLib_vs08_test.vcproj

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
WarningLevel="4"
6969
SuppressStartupBanner="true"
7070
DebugInformationFormat="4"
71+
DisableSpecificWarnings="4127; 4131; 4244"
7172
/>
7273
<Tool
7374
Name="VCManagedResourceCompilerTool"
@@ -168,6 +169,7 @@
168169
WarningLevel="4"
169170
SuppressStartupBanner="true"
170171
DebugInformationFormat="3"
172+
DisableSpecificWarnings="4127; 4131; 4244"
171173
/>
172174
<Tool
173175
Name="VCManagedResourceCompilerTool"
@@ -268,6 +270,7 @@
268270
WarningLevel="4"
269271
SuppressStartupBanner="true"
270272
DebugInformationFormat="3"
273+
DisableSpecificWarnings="4127; 4131; 4244"
271274
/>
272275
<Tool
273276
Name="VCManagedResourceCompilerTool"
@@ -369,6 +372,7 @@
369372
WarningLevel="4"
370373
SuppressStartupBanner="true"
371374
DebugInformationFormat="3"
375+
DisableSpecificWarnings="4127; 4131; 4244"
372376
/>
373377
<Tool
374378
Name="VCManagedResourceCompilerTool"
@@ -619,6 +623,14 @@
619623
<File
620624
RelativePath=".\src\zlib\deflate.c"
621625
>
626+
<FileConfiguration
627+
Name="Debug|Win32"
628+
>
629+
<Tool
630+
Name="VCCLCompilerTool"
631+
DisableSpecificWarnings="4131"
632+
/>
633+
</FileConfiguration>
622634
</File>
623635
<File
624636
RelativePath=".\src\zlib\inffast.c"
@@ -836,6 +848,22 @@
836848
RelativePath=".\src\common\RootHandler.h"
837849
>
838850
</File>
851+
<File
852+
RelativePath=".\src\common\Mime.cpp"
853+
>
854+
</File>
855+
<File
856+
RelativePath=".\src\common\Mime.h"
857+
>
858+
</File>
859+
<File
860+
RelativePath=".\src\common\Sockets.cpp"
861+
>
862+
</File>
863+
<File
864+
RelativePath=".\src\common\Sockets.h"
865+
>
866+
</File>
839867
</Filter>
840868
</Filter>
841869
<Filter

CascLib_vs19.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,8 @@
579579
<ClInclude Include="src\common\ListFile.h" />
580580
<ClInclude Include="src\common\Map.h" />
581581
<ClInclude Include="src\common\RootHandler.h" />
582+
<ClInclude Include="src\common\Mime.h" />
583+
<ClInclude Include="src\common\Sockets.h" />
582584
<ClInclude Include="src\FileStream.h" />
583585
<ClInclude Include="src\md5\md5.h" />
584586
</ItemGroup>
@@ -606,6 +608,8 @@
606608
<ClCompile Include="src\common\FileTree.cpp" />
607609
<ClCompile Include="src\common\ListFile.cpp" />
608610
<ClCompile Include="src\common\RootHandler.cpp" />
611+
<ClCompile Include="src\common\Mime.cpp" />
612+
<ClCompile Include="src\common\Sockets.cpp" />
609613
<ClCompile Include="src\jenkins\lookup3.c" />
610614
<ClCompile Include="src\md5\md5.cpp" />
611615
<ClCompile Include="src\zlib\adler32.c" />

CascLib_vs19.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
<ClInclude Include="src\md5\md5.h">
7272
<Filter>Source Files\md5</Filter>
7373
</ClInclude>
74+
<ClInclude Include="src\common\Mime.h">
75+
<Filter>Source Files\common</Filter>
76+
</ClInclude>
77+
<ClInclude Include="src\common\Sockets.h">
78+
<Filter>Source Files\common</Filter>
79+
</ClInclude>
7480
</ItemGroup>
7581
<ItemGroup>
7682
<ClCompile Include="src\CascFiles.cpp">
@@ -172,5 +178,11 @@
172178
<ClCompile Include="src\zlib\trees.c">
173179
<Filter>Source Files\zlib</Filter>
174180
</ClCompile>
181+
<ClCompile Include="src\common\Mime.cpp">
182+
<Filter>Source Files\common</Filter>
183+
</ClCompile>
184+
<ClCompile Include="src\common\Sockets.cpp">
185+
<Filter>Source Files\common</Filter>
186+
</ClCompile>
175187
</ItemGroup>
176188
</Project>

CascLib_vs19_dll.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@
215215
<ClCompile Include="src\common\FileTree.cpp" />
216216
<ClCompile Include="src\common\ListFile.cpp" />
217217
<ClCompile Include="src\common\RootHandler.cpp" />
218+
<ClCompile Include="src\common\Mime.cpp" />
219+
<ClCompile Include="src\common\Sockets.cpp" />
218220
<ClCompile Include="src\DllMain.c" />
219221
<ClCompile Include="src\jenkins\lookup3.c" />
220222
<ClCompile Include="src\md5\md5.cpp" />
@@ -239,6 +241,8 @@
239241
<ClInclude Include="src\common\ListFile.h" />
240242
<ClInclude Include="src\common\Map.h" />
241243
<ClInclude Include="src\common\RootHandler.h" />
244+
<ClInclude Include="src\common\Mime.h" />
245+
<ClInclude Include="src\common\Sockets.h" />
242246
<ClInclude Include="src\FileStream.h" />
243247
<ClInclude Include="src\md5\md5.h" />
244248
<ClInclude Include="src\zlib\deflate.h" />

CascLib_vs19_dll.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
<ClCompile Include="src\zlib\trees.c">
121121
<Filter>Source Files\zlib</Filter>
122122
</ClCompile>
123+
<ClCompile Include="src\common\Mime.cpp">
124+
<Filter>Source Files\common</Filter>
125+
</ClCompile>
126+
<ClCompile Include="src\common\Sockets.cpp">
127+
<Filter>Source Files\common</Filter>
128+
</ClCompile>
123129
</ItemGroup>
124130
<ItemGroup>
125131
<ClInclude Include="src\common\Common.h">
@@ -167,6 +173,12 @@
167173
<ClInclude Include="src\zlib\deflate.h">
168174
<Filter>Source Files\zlib</Filter>
169175
</ClInclude>
176+
<ClInclude Include="src\common\Mime.h">
177+
<Filter>Source Files\common</Filter>
178+
</ClInclude>
179+
<ClInclude Include="src\common\Sockets.h">
180+
<Filter>Source Files\common</Filter>
181+
</ClInclude>
170182
</ItemGroup>
171183
<ItemGroup>
172184
<ResourceCompile Include="src\DllMain.rc">

CascLib_vs19_test.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@
308308
<ClCompile Include="src\common\FileTree.cpp" />
309309
<ClCompile Include="src\common\ListFile.cpp" />
310310
<ClCompile Include="src\common\RootHandler.cpp" />
311+
<ClCompile Include="src\common\Mime.cpp" />
312+
<ClCompile Include="src\common\Sockets.cpp" />
311313
<ClCompile Include="src\jenkins\lookup3.c">
312314
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Level1</WarningLevel>
313315
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Level1</WarningLevel>
@@ -368,6 +370,8 @@
368370
<ClInclude Include="src\common\ListFile.h" />
369371
<ClInclude Include="src\common\Map.h" />
370372
<ClInclude Include="src\common\RootHandler.h" />
373+
<ClInclude Include="src\common\Mime.h" />
374+
<ClInclude Include="src\common\Sockets.h" />
371375
<ClInclude Include="src\md5\md5.h" />
372376
</ItemGroup>
373377
<ItemGroup>

0 commit comments

Comments
 (0)