Initial commit
This commit is contained in:
commit
425e89e326
26 changed files with 1039 additions and 0 deletions
BIN
Release/CL.read.1.tlog
Normal file
BIN
Release/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
Release/CL.write.1.tlog
Normal file
BIN
Release/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
Release/cl.command.1.tlog
Normal file
BIN
Release/cl.command.1.tlog
Normal file
Binary file not shown.
BIN
Release/http.obj
Normal file
BIN
Release/http.obj
Normal file
Binary file not shown.
BIN
Release/json.obj
Normal file
BIN
Release/json.obj
Normal file
Binary file not shown.
BIN
Release/link.command.1.tlog
Normal file
BIN
Release/link.command.1.tlog
Normal file
Binary file not shown.
BIN
Release/link.read.1.tlog
Normal file
BIN
Release/link.read.1.tlog
Normal file
Binary file not shown.
BIN
Release/link.write.1.tlog
Normal file
BIN
Release/link.write.1.tlog
Normal file
Binary file not shown.
BIN
Release/main.obj
Normal file
BIN
Release/main.obj
Normal file
Binary file not shown.
BIN
Release/mt.command.1.tlog
Normal file
BIN
Release/mt.command.1.tlog
Normal file
Binary file not shown.
BIN
Release/mt.read.1.tlog
Normal file
BIN
Release/mt.read.1.tlog
Normal file
Binary file not shown.
BIN
Release/mt.write.1.tlog
Normal file
BIN
Release/mt.write.1.tlog
Normal file
Binary file not shown.
18
Release/sdk_http.Build.CppClean.log
Normal file
18
Release/sdk_http.Build.CppClean.log
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
D:\LUA502\LUA\RELEASE\SDK_HTTP.DLL
|
||||
D:\lua502\lua\Release\sdk_http.exp
|
||||
D:\lua502\lua\Release\sdk_http.lib
|
||||
D:\LUA502\LUA\RELEASE\SDK_HTTP.PDB
|
||||
D:\lua502\lua\sdk_http\Release\cl.command.1.tlog
|
||||
D:\lua502\lua\sdk_http\Release\CL.read.1.tlog
|
||||
D:\lua502\lua\sdk_http\Release\CL.write.1.tlog
|
||||
D:\LUA502\LUA\SDK_HTTP\RELEASE\HTTP.OBJ
|
||||
D:\lua502\lua\sdk_http\Release\link.command.1.tlog
|
||||
D:\lua502\lua\sdk_http\Release\link.read.1.tlog
|
||||
D:\lua502\lua\sdk_http\Release\link.write.1.tlog
|
||||
D:\LUA502\LUA\SDK_HTTP\RELEASE\MAIN.OBJ
|
||||
D:\lua502\lua\sdk_http\Release\mt.command.1.tlog
|
||||
D:\lua502\lua\sdk_http\Release\mt.read.1.tlog
|
||||
D:\lua502\lua\sdk_http\Release\mt.write.1.tlog
|
||||
D:\LUA502\LUA\SDK_HTTP\RELEASE\SDK_HTTP.DLL.INTERMEDIATE.MANIFEST
|
||||
D:\lua502\lua\sdk_http\Release\sdk_http.write.1.tlog
|
||||
D:\LUA502\LUA\SDK_HTTP\RELEASE\VC100.PDB
|
||||
10
Release/sdk_http.dll.intermediate.manifest
Normal file
10
Release/sdk_http.dll.intermediate.manifest
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
|
||||
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
2
Release/sdk_http.lastbuildstate
Normal file
2
Release/sdk_http.lastbuildstate
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#v4.0:v100:false
|
||||
Release|Win32|D:\lua502\lua\|
|
||||
27
Release/sdk_http.log
Normal file
27
Release/sdk_http.log
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Build started 19.06.2018 5:05:02.
|
||||
1>Project "D:\lua502\lua\sdk_http\sdk_http.vcxproj" on node 2 (build target(s)).
|
||||
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(299,5): warning MSB8004: каталог Output заканчивается не косой чертой. Этот экземпляр построения добавит косую черту, поскольку она необходима для правильного определения каталога Output.
|
||||
1>InitializeBuildStatus:
|
||||
Creating "Release\sdk_http.unsuccessfulbuild" because "AlwaysCreate" was specified.
|
||||
ClCompile:
|
||||
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ID:\source2006\public\dlls /ID:\source2006\dlls\hl2_dll /ID:\source2006\game_shared\hl2 /ID:\source2006\game_shared\hl2mp /ID:\source2006\game_shared /ID:\source2006\dlls /ID:\source2006\public\tier1 /ID:\source2006\public\tier0 /ID:\source2006\public /ID:\source2006\common /ID:\lua502\lua\lua502_sdk /I"D:\libcurl\builds\libcurl-vc10-x86-release-dll-ipv6-sspi-winssl\include" /ID:\crusader\platform /I"D:\json-parser" /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D _SSDK /D _WINDLL /D _MBCS /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt json.cpp
|
||||
json.cpp
|
||||
1>D:\json-parser\json.h(259): warning C4244: return: преобразование "double" в "int", возможна потеря данных
|
||||
Link:
|
||||
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"..\..\..\GMod9Dev_Server\gmod9\lua\bin\sdk_http.dll" /NOLOGO /LIBPATH:D:\source2006\lib\public /LIBPATH:D:\lua502\lua\Release /LIBPATH:"D:\libcurl\builds\libcurl-vc10-x86-release-dll-ipv6-sspi-winssl\lib" /LIBPATH:D:\crusader\Release /LIBPATH:"D:\json-parser\Release" lua502_sdk.lib vstdlib.lib tier0.lib tier1.lib platform.lib jsonlib.lib libcurl.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NODEFAULTLIB:LIBCMT.lib /MANIFEST /ManifestFile:"Release\sdk_http.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.pdb" /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"..\..\..\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib" /MACHINE:X86 /DLL Release\http.obj
|
||||
Release\json.obj
|
||||
Release\main.obj
|
||||
Создается библиотека ..\..\..\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib и объект ..\..\..\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
Создание кода
|
||||
Создание кода завершено
|
||||
sdk_http.vcxproj -> D:\lua502\lua\sdk_http\..\..\..\GMod9Dev_Server\gmod9\lua\bin\sdk_http.dll
|
||||
Manifest:
|
||||
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:"..\..\..\GMod9Dev_Server\gmod9\lua\bin\sdk_http.dll;#2" /manifest Release\sdk_http.dll.intermediate.manifest
|
||||
FinalizeBuildStatus:
|
||||
Deleting file "Release\sdk_http.unsuccessfulbuild".
|
||||
Touching "Release\sdk_http.lastbuildstate".
|
||||
1>Done Building Project "D:\lua502\lua\sdk_http\sdk_http.vcxproj" (build target(s)).
|
||||
|
||||
Построение успешно завершено.
|
||||
|
||||
Time Elapsed 00:00:01.12
|
||||
BIN
Release/sdk_http.vcxprojResolveAssemblyReference.cache
Normal file
BIN
Release/sdk_http.vcxprojResolveAssemblyReference.cache
Normal file
Binary file not shown.
235
Release/sdk_http.write.1.tlog
Normal file
235
Release/sdk_http.write.1.tlog
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
^D:\lua502\lua\sdk_http\sdk_http.vcxproj
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.lib
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
D:\GMod9Dev_Server\gmod9\lua\bin\sdk_http.exp
|
||||
BIN
Release/vc100.pdb
Normal file
BIN
Release/vc100.pdb
Normal file
Binary file not shown.
358
http.cpp
Normal file
358
http.cpp
Normal file
|
|
@ -0,0 +1,358 @@
|
|||
#include "threadtools.h"
|
||||
#include "http.h"
|
||||
#include "baselib.h"
|
||||
#include "tier1.h"
|
||||
|
||||
//class CHTTPAsyncQueue : public CWorkerThread
|
||||
//{
|
||||
//public:
|
||||
// CHTTPAsyncQueue() : CWorkerThread()
|
||||
// {
|
||||
// SetName("HTTPAsyncQueue");
|
||||
// }
|
||||
//
|
||||
// enum {
|
||||
// CALL_FUNC,
|
||||
// EXIT
|
||||
// };
|
||||
//
|
||||
// void AddRequest(CHTTPAsyncQuery* query)
|
||||
// {
|
||||
// m_pQuery = query;
|
||||
// CallWorker(CALL_FUNC);
|
||||
// }
|
||||
//
|
||||
// int Run()
|
||||
// {
|
||||
// unsigned nCall;
|
||||
// while(WaitForCall(&nCall))
|
||||
// {
|
||||
// if(nCall == EXIT)
|
||||
// {
|
||||
// Reply(1);
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// CHTTPAsyncQuery* query = m_pQuery;
|
||||
// m_pQuery = NULL;
|
||||
// Reply(1);
|
||||
// DoHTTPAsyncQuery(query);
|
||||
// }
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// static void DoHTTPAsyncQuery(CHTTPAsyncQuery*);
|
||||
//
|
||||
// CHTTPAsyncQuery* m_pQuery;
|
||||
//} g_HTTPAsyncQueue;
|
||||
|
||||
class CHTTPAsyncQueue : public CThread
|
||||
{
|
||||
public:
|
||||
CHTTPAsyncQueue() : CThread()
|
||||
{
|
||||
SetName("HTTPAsyncQueue");
|
||||
}
|
||||
|
||||
void AddRequest(CHTTPAsyncQuery* query)
|
||||
{
|
||||
m_Lock.Lock();
|
||||
m_Queue.AddToTail(query);
|
||||
m_Lock.Unlock();
|
||||
m_Event.Set();
|
||||
}
|
||||
|
||||
int Run()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
m_Event.Wait();
|
||||
m_Lock.Lock();
|
||||
while(m_Queue.Count())
|
||||
{
|
||||
m_Lock.Unlock();
|
||||
DoHTTPAsyncQuery(m_Queue[0]);
|
||||
m_Lock.Lock();
|
||||
m_Queue.Remove(0);
|
||||
}
|
||||
m_Lock.Unlock();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoHTTPAsyncQuery(CHTTPAsyncQuery*);
|
||||
|
||||
CThreadEvent m_Event;
|
||||
CThreadFastMutex m_Lock;
|
||||
CUtlVector<CHTTPAsyncQuery*> m_Queue;
|
||||
} g_HTTPAsyncQueue;
|
||||
|
||||
void CHTTPAsyncQueue::DoHTTPAsyncQuery(CHTTPAsyncQuery* query)
|
||||
{
|
||||
CCURL curl;
|
||||
if(!curl.Open())
|
||||
{
|
||||
query->m_iCurlCode = -1;
|
||||
FinishQuery(query);
|
||||
return;
|
||||
}
|
||||
|
||||
if(query->m_iType == CHTTPAsyncQuery::HTTP_GET)
|
||||
curl.SetOpt(CURLOPT_URL,query->m_Url.Get());
|
||||
else if(query->m_iType == CHTTPAsyncQuery::HTTP_POST)
|
||||
{
|
||||
curl.SetOpt(CURLOPT_URL,query->m_Url.Get());
|
||||
curl.SetOpt(CURLOPT_POSTFIELDS,query->m_Args.Get());
|
||||
}
|
||||
else if(query->m_iType == CHTTPAsyncQuery::HTTP_POSTMULTIPART)
|
||||
{
|
||||
curl.SetOpt(CURLOPT_URL,query->m_Url.Get());
|
||||
curl_httppost* form = NULL,*last = NULL;
|
||||
for(int i = 0; i < query->m_PostForms.Count(); i++)
|
||||
{
|
||||
CHTTPAsyncQuery::formdata_t& data = query->m_PostForms[i];
|
||||
curl_formadd(&form,&last,CURLFORM_COPYNAME,data.m_Name.Get(),
|
||||
CURLFORM_COPYCONTENTS,data.m_pData,CURLFORM_CONTENTSLENGTH,
|
||||
data.m_uSize,CURLFORM_END);
|
||||
}
|
||||
for(int i = 0; i < query->m_PostFiles.Count(); i++)
|
||||
{
|
||||
CHTTPAsyncQuery::filedata_t& data = query->m_PostFiles[i];
|
||||
/*curl_formadd(&form,&last,CURLFORM_COPYNAME,data.m_Name.Get(),
|
||||
CURLFORM_COPYCONTENTS,data.m_pData,CURLFORM_CONTENTSLENGTH,
|
||||
data.m_uSize,CURLFORM_END);*/
|
||||
curl_formadd(&form,&last,CURLFORM_COPYNAME,data.m_Name.Get(),
|
||||
CURLFORM_BUFFER,data.m_FileName.Get(),
|
||||
CURLFORM_BUFFERPTR,data.m_pData,CURLFORM_BUFFERLENGTH,
|
||||
data.m_uSize,CURLFORM_END);
|
||||
}
|
||||
curl.SetOpt(CURLOPT_HTTPPOST,form);
|
||||
}
|
||||
|
||||
if(!query->m_UserAgent.IsEmpty())
|
||||
curl.SetOpt(CURLOPT_USERAGENT,query->m_UserAgent.Get());
|
||||
if(!query->m_Proxy.IsEmpty())
|
||||
curl.SetOpt(CURLOPT_PROXY,query->m_Proxy.Get());
|
||||
|
||||
if((query->m_iCurlCode=curl.Perform(&query->m_Mem))==CURLE_OK)
|
||||
query->m_iHttpCode = curl.GetInfo(CURLINFO_RESPONSE_CODE);
|
||||
curl.Close();
|
||||
if(query->m_iType == CHTTPAsyncQuery::HTTP_POSTMULTIPART)
|
||||
{
|
||||
for(int i = 0; i < query->m_PostForms.Count(); i++)
|
||||
delete[] (char*)(query->m_PostForms[i].m_pData);
|
||||
for(int i = 0; i < query->m_PostFiles.Count(); i++)
|
||||
delete[] (char*)(query->m_PostFiles[i].m_pData);
|
||||
}
|
||||
FinishQuery(query);
|
||||
}
|
||||
|
||||
void AddQuery(CHTTPAsyncQuery* query)
|
||||
{
|
||||
if(!g_HTTPAsyncQueue.IsAlive())
|
||||
{
|
||||
g_HTTPAsyncQueue.Start();
|
||||
//g_HTTPAsyncQueue.SetPriority(THREAD_MODE_BACKGROUND_BEGIN);
|
||||
}
|
||||
if(!g_HTTPAsyncQueue.IsAlive())
|
||||
{
|
||||
Warning("[sdk_http] FATAL ERROR - g_HTTPAsyncQueue is dead\n");
|
||||
return;
|
||||
}
|
||||
|
||||
g_HTTPAsyncQueue.AddRequest(query);
|
||||
DevMsg("Added query %p to %d worker thread\n",query,
|
||||
g_HTTPAsyncQueue.GetThreadId());
|
||||
}
|
||||
|
||||
DECLARE_LIBRARY("http")
|
||||
DECLARE_TABLE(http);
|
||||
|
||||
DECLARE_FUNCTION(http,Get)
|
||||
{
|
||||
luaL_checktype(L,1,LUA_TTABLE);
|
||||
luaL_checktype(L,2,LUA_TFUNCTION);
|
||||
luaL_checktype(L,3,LUA_TFUNCTION);
|
||||
|
||||
CHTTPAsyncQuery* query = new CHTTPAsyncQuery;
|
||||
|
||||
lua_pushvalue(L,2);
|
||||
query->m_iLuaRefOk = lua_refobj(L);
|
||||
lua_pushvalue(L,3);
|
||||
query->m_iLuaRefFail = lua_refobj(L);
|
||||
|
||||
lua_pushstring(L,"url");
|
||||
lua_gettable(L,1);
|
||||
if(!lua_isstring(L,-1))
|
||||
{
|
||||
delete query;
|
||||
lua_pop(L,1);
|
||||
luaL_error(L,"url must be specifed in table!");
|
||||
return 0;
|
||||
}
|
||||
query->m_Url.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"useragent");
|
||||
lua_gettable(L,1);
|
||||
if(lua_isstring(L,-1))
|
||||
query->m_UserAgent.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"proxy");
|
||||
lua_gettable(L,1);
|
||||
if(lua_isstring(L,-1))
|
||||
query->m_Proxy.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
query->m_iType = CHTTPAsyncQuery::HTTP_GET;
|
||||
AddQuery(query);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_FUNCTION(http,Post)
|
||||
{
|
||||
luaL_checktype(L,1,LUA_TTABLE);
|
||||
luaL_checktype(L,2,LUA_TFUNCTION);
|
||||
luaL_checktype(L,3,LUA_TFUNCTION);
|
||||
|
||||
CHTTPAsyncQuery* query = new CHTTPAsyncQuery;
|
||||
|
||||
lua_pushvalue(L,2);
|
||||
query->m_iLuaRefOk = lua_refobj(L);
|
||||
lua_pushvalue(L,3);
|
||||
query->m_iLuaRefFail = lua_refobj(L);
|
||||
|
||||
lua_pushstring(L,"url");
|
||||
lua_gettable(L,1);
|
||||
if(!lua_isstring(L,-1))
|
||||
{
|
||||
delete query;
|
||||
lua_pop(L,1);
|
||||
luaL_error(L,"url must be specifed in table!");
|
||||
return 0;
|
||||
}
|
||||
query->m_Url.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"args");
|
||||
lua_gettable(L,1);
|
||||
if(!lua_isstring(L,-1))
|
||||
{
|
||||
delete query;
|
||||
lua_pop(L,1);
|
||||
luaL_error(L,"args must be specifed in table!");
|
||||
return 0;
|
||||
}
|
||||
query->m_Args.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"useragent");
|
||||
lua_gettable(L,1);
|
||||
if(lua_isstring(L,-1))
|
||||
query->m_UserAgent.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"proxy");
|
||||
lua_gettable(L,1);
|
||||
if(lua_isstring(L,-1))
|
||||
query->m_Proxy.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
query->m_iType = CHTTPAsyncQuery::HTTP_POST;
|
||||
AddQuery(query);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DECLARE_FUNCTION(http,PostMultipart)
|
||||
{
|
||||
luaL_checktype(L,1,LUA_TTABLE);
|
||||
luaL_checktype(L,2,LUA_TFUNCTION);
|
||||
luaL_checktype(L,3,LUA_TFUNCTION);
|
||||
|
||||
CHTTPAsyncQuery* query = new CHTTPAsyncQuery;
|
||||
|
||||
lua_pushvalue(L,2);
|
||||
query->m_iLuaRefOk = lua_refobj(L);
|
||||
lua_pushvalue(L,3);
|
||||
query->m_iLuaRefFail = lua_refobj(L);
|
||||
|
||||
lua_pushstring(L,"url");
|
||||
lua_gettable(L,1);
|
||||
if(!lua_isstring(L,-1))
|
||||
{
|
||||
delete query;
|
||||
lua_pop(L,1);
|
||||
luaL_error(L,"url must be specifed in table!");
|
||||
return 0;
|
||||
}
|
||||
query->m_Url.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"form");
|
||||
lua_gettable(L,1);
|
||||
if(lua_istable(L,-1))
|
||||
{
|
||||
lua_pushnil(L);
|
||||
while(lua_next(L,-2))
|
||||
{
|
||||
// value -1, key -2, table -3
|
||||
CHTTPAsyncQuery::formdata_t form;
|
||||
int iLen = lua_strlen(L,-1);
|
||||
|
||||
char* pBuf = new char[iLen];
|
||||
memcpy(pBuf,lua_tostring(L,-1),iLen);
|
||||
|
||||
form.m_pData = pBuf;
|
||||
form.m_uSize = iLen;
|
||||
form.m_Name.Set(lua_tostring(L,-2));
|
||||
query->m_PostForms.AddToTail(form);
|
||||
lua_pop(L,1);
|
||||
}
|
||||
}
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"file");
|
||||
lua_gettable(L,1);
|
||||
if(lua_istable(L,-1))
|
||||
{
|
||||
lua_pushnil(L);
|
||||
while(lua_next(L,-2))
|
||||
{
|
||||
// value -1, key -2, table -3
|
||||
//Value is a table {NAME,FILENAME,BUF}
|
||||
CHTTPAsyncQuery::filedata_t file;
|
||||
|
||||
lua_rawgeti(L,-1,1);
|
||||
file.m_Name.Set(lua_tostring(L,-1));
|
||||
lua_rawgeti(L,-2,2);
|
||||
file.m_FileName.Set(lua_tostring(L,-1));
|
||||
lua_rawgeti(L,-3,3);
|
||||
|
||||
int iLen = lua_strlen(L,-1);
|
||||
char* pBuf = new char[iLen];
|
||||
memcpy(pBuf,lua_tostring(L,-1),iLen);
|
||||
file.m_pData = pBuf;
|
||||
file.m_uSize = iLen;
|
||||
|
||||
query->m_PostFiles.AddToTail(file);
|
||||
lua_pop(L,4);
|
||||
}
|
||||
}
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"useragent");
|
||||
lua_gettable(L,1);
|
||||
if(lua_isstring(L,-1))
|
||||
query->m_UserAgent.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
lua_pushstring(L,"proxy");
|
||||
lua_gettable(L,1);
|
||||
if(lua_isstring(L,-1))
|
||||
query->m_Proxy.Set(lua_tostring(L,-1));
|
||||
lua_pop(L,1);
|
||||
|
||||
query->m_iType = CHTTPAsyncQuery::HTTP_POSTMULTIPART;
|
||||
AddQuery(query);
|
||||
return 0;
|
||||
}
|
||||
53
http.h
Normal file
53
http.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#ifndef __HTTP_H
|
||||
#define __HTTP_H
|
||||
#include "tier1.h"
|
||||
#include "utlstring.h"
|
||||
#include "utlvector.h"
|
||||
#include "threadtools.h"
|
||||
#include "platform.h"
|
||||
#include "lcurl.h"
|
||||
|
||||
class CHTTPAsyncQuery
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
HTTP_GET,
|
||||
HTTP_POST,
|
||||
HTTP_POSTMULTIPART
|
||||
};
|
||||
int m_iType;
|
||||
|
||||
CUtlString m_Url;
|
||||
CUtlString m_Args;
|
||||
|
||||
CUtlString m_UserAgent;
|
||||
CUtlString m_Proxy;
|
||||
|
||||
typedef struct {
|
||||
CUtlString m_Name;
|
||||
size_t m_uSize;
|
||||
void* m_pData;
|
||||
} formdata_t;
|
||||
|
||||
typedef struct {
|
||||
CUtlString m_Name;
|
||||
CUtlString m_FileName;
|
||||
size_t m_uSize;
|
||||
void* m_pData;
|
||||
} filedata_t;
|
||||
|
||||
CUtlVector<formdata_t> m_PostForms;
|
||||
CUtlVector<filedata_t> m_PostFiles;
|
||||
|
||||
CMemPool m_Mem;
|
||||
int m_iCurlCode;
|
||||
int m_iHttpCode;
|
||||
|
||||
int m_iLuaRefOk;
|
||||
int m_iLuaRefFail;
|
||||
};
|
||||
|
||||
void AddQuery(CHTTPAsyncQuery*);
|
||||
void FinishQuery(CHTTPAsyncQuery*);
|
||||
|
||||
#endif
|
||||
120
json.cpp
Normal file
120
json.cpp
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
#include "baselib.h"
|
||||
#include "json.h"
|
||||
|
||||
DECLARE_LIBRARY("json")
|
||||
DECLARE_TABLE(json)
|
||||
|
||||
#include "tier0/dbg.h"
|
||||
|
||||
void _CheckNull(void* pPtr,const char* pName,const char* pFile,int iLine)
|
||||
{
|
||||
if(!pPtr)
|
||||
{
|
||||
static char szBuf[256] = {0};
|
||||
sprintf(szBuf,"%s:%d - !%s",
|
||||
pFile,iLine,pName);
|
||||
Error(szBuf);
|
||||
}
|
||||
}
|
||||
|
||||
#define CheckNull(a) _CheckNull(a,#a,__FILE__,__LINE__)
|
||||
|
||||
void JsonToTable(lua_State* L,json_value* json);
|
||||
void PushJsonValue(lua_State* L,json_value* json);
|
||||
|
||||
void JsonArrayToTable(lua_State* L,json_value* json)
|
||||
{
|
||||
lua_newtable(L);
|
||||
CheckNull(json->u.array.values);
|
||||
for(unsigned int i = 0; i < json->u.array.length; i++)
|
||||
{
|
||||
json_value* val = json->u.array.values[i];
|
||||
CheckNull(val);
|
||||
PushJsonValue(L,val);
|
||||
lua_rawseti(L,-2,i+1);
|
||||
}
|
||||
}
|
||||
|
||||
inline void PushJsonValue(lua_State* L,json_value* json)
|
||||
{
|
||||
switch(json->type)
|
||||
{
|
||||
case json_integer:
|
||||
lua_pushnumber(L,json->u.integer);
|
||||
break;
|
||||
case json_double:
|
||||
lua_pushnumber(L,json->u.dbl);
|
||||
break;
|
||||
case json_boolean:
|
||||
lua_pushboolean(L,json->u.boolean);
|
||||
break;
|
||||
case json_string:
|
||||
lua_pushlstring(L,json->u.string.ptr,
|
||||
json->u.string.length);
|
||||
break;
|
||||
case json_object:
|
||||
JsonToTable(L,json);
|
||||
break;
|
||||
case json_array:
|
||||
JsonArrayToTable(L,json);
|
||||
break;
|
||||
default:
|
||||
lua_pushnil(L);
|
||||
}
|
||||
}
|
||||
|
||||
void JsonToTable(lua_State* L,json_value* json)
|
||||
{
|
||||
DevMsg("json %p json->type %d\n",json,json->type);
|
||||
lua_newtable(L);
|
||||
CheckNull(json->u.object.values);
|
||||
for(unsigned int i = 0; i < json->u.object.length; i++)
|
||||
{
|
||||
json_object_entry& obj = json->u.object.values[i];
|
||||
CheckNull(obj.name);
|
||||
lua_pushlstring(L,obj.name,obj.name_length);
|
||||
if(obj.value->type == json_object)
|
||||
{
|
||||
if(!obj.value)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
{
|
||||
CheckNull(obj.value);
|
||||
JsonToTable(L,obj.value);
|
||||
}
|
||||
}
|
||||
else if(obj.value->type == json_array)
|
||||
{
|
||||
if(!obj.value->u.array.values)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
{
|
||||
lua_newtable(L);
|
||||
//CheckNull(obj.value->u.array.values);
|
||||
for(unsigned int i = 0; i < obj.value->u.array.length; i++)
|
||||
{
|
||||
json_value* value = obj.value->u.array.values[i];
|
||||
PushJsonValue(L,value);
|
||||
lua_rawseti(L,-2,i+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckNull(obj.value);
|
||||
PushJsonValue(L,obj.value);
|
||||
}
|
||||
lua_settable(L,-3);
|
||||
}
|
||||
}
|
||||
|
||||
DECLARE_FUNCTION(json,ToTable)
|
||||
{
|
||||
luaL_checktype(L,1,LUA_TSTRING);
|
||||
json_value* json = json_parse(lua_tostring(L,1),
|
||||
lua_strlen(L,1));
|
||||
if(!json) return 0;
|
||||
JsonToTable(L,json);
|
||||
json_value_free(json);
|
||||
return 1;
|
||||
}
|
||||
100
main.cpp
Normal file
100
main.cpp
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
#define GAME_DLL
|
||||
#include "plugin.h"
|
||||
#include "baselib.h"
|
||||
#include "tier1.h"
|
||||
#include "threadtools.h"
|
||||
#include "http.h"
|
||||
#include "lua.h"
|
||||
|
||||
DECLARE_PLUGIN(CSDKHTTP)
|
||||
virtual bool Load(CreateInterfaceFn,CreateInterfaceFn);
|
||||
virtual void GameFrame(bool);
|
||||
virtual bool LuaInit(lua_State*);
|
||||
|
||||
void ProcessResponse(CHTTPAsyncQuery*);
|
||||
|
||||
lua_State* L;
|
||||
CThreadFastMutex m_Lock;
|
||||
CUtlVector<CHTTPAsyncQuery*> m_Responses;
|
||||
END_PLUGIN(CSDKHTTP,"GLua9 HTTP");
|
||||
|
||||
void FinishQuery(CHTTPAsyncQuery* query)
|
||||
{
|
||||
//s_CSDKHTTP.m_Lock.Lock();
|
||||
s_CSDKHTTP.m_Responses.AddToTail(query);
|
||||
//s_CSDKHTTP.m_Lock.Unlock();
|
||||
|
||||
DevMsg("Query %p finished\n",query);
|
||||
}
|
||||
|
||||
bool CSDKHTTP::Load(CreateInterfaceFn,CreateInterfaceFn)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CSDKHTTP::GameFrame(bool bSimulating)
|
||||
{
|
||||
//m_Lock.Lock();
|
||||
for(int i = 0; i < m_Responses.Count();)
|
||||
{
|
||||
CHTTPAsyncQuery* query = m_Responses[i];
|
||||
DevMsg("MainThrd catch query %p\n",query);
|
||||
ProcessResponse(query);
|
||||
delete query;
|
||||
m_Responses.Remove(i);
|
||||
}
|
||||
//m_Lock.Unlock();
|
||||
}
|
||||
|
||||
bool CSDKHTTP::LuaInit(lua_State* _L)
|
||||
{
|
||||
L = _L;
|
||||
CLuaLibrary::Init(L);
|
||||
return true;
|
||||
}
|
||||
|
||||
int _aterror(lua_State* L)
|
||||
{
|
||||
return g_pLua502->GetLuaCallbacks()->OnLuaError(L);
|
||||
}
|
||||
|
||||
void CSDKHTTP::ProcessResponse(CHTTPAsyncQuery* query)
|
||||
{
|
||||
lua_pushcfunction(L,_aterror);
|
||||
int iHandler = lua_gettop(L);
|
||||
|
||||
if(query->m_iCurlCode == CURLE_OK)
|
||||
{
|
||||
lua_pushref(L,query->m_iLuaRefOk);
|
||||
if(!lua_isfunction(L,-1))
|
||||
{
|
||||
lua_pop(L,2);
|
||||
lua_unrefobj(L,query->m_iLuaRefOk);
|
||||
lua_unrefobj(L,query->m_iLuaRefFail);
|
||||
return;
|
||||
}
|
||||
|
||||
lua_pushlstring(L,(const char*)query->m_Mem.m_pMem,
|
||||
query->m_Mem.m_uSize);
|
||||
lua_pushnumber(L,query->m_iHttpCode);
|
||||
lua_pcall(L,2,0,iHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushref(L,query->m_iLuaRefFail);
|
||||
if(!lua_isfunction(L,-1))
|
||||
{
|
||||
lua_pop(L,2);
|
||||
lua_unrefobj(L,query->m_iLuaRefOk);
|
||||
lua_unrefobj(L,query->m_iLuaRefFail);
|
||||
return;
|
||||
}
|
||||
|
||||
lua_pushnumber(L,query->m_iCurlCode);
|
||||
lua_pcall(L,1,0,iHandler);
|
||||
}
|
||||
|
||||
lua_unrefobj(L,query->m_iLuaRefOk);
|
||||
lua_unrefobj(L,query->m_iLuaRefFail);
|
||||
lua_pop(L,1); //Remove handler
|
||||
}
|
||||
80
sdk_http.vcxproj
Normal file
80
sdk_http.vcxproj
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{0590CDBB-7088-4957-8FD9-64F6473041A4}</ProjectGuid>
|
||||
<RootNamespace>sdk_http</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>..\..\..\GMod9Dev_Server\gmod9\lua\bin</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>D:\source2006\public\dlls;D:\source2006\dlls\hl2_dll;D:\source2006\game_shared\hl2;D:\source2006\game_shared\hl2mp;D:\source2006\game_shared;D:\source2006\dlls;D:\source2006\public\tier1;D:\source2006\public\tier0;D:\source2006\public;D:\source2006\common;D:\lua502\lua\lua502_sdk;D:\libcurl\builds\libcurl-vc10-x86-release-dll-ipv6-sspi-winssl\include;D:\crusader\platform;D:\json-parser;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_SSDK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>D:\source2006\lib\public;D:\lua502\lua\Release;D:\libcurl\builds\libcurl-vc10-x86-release-dll-ipv6-sspi-winssl\lib;D:\crusader\Release;D:\json-parser\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>lua502_sdk.lib;vstdlib.lib;tier0.lib;tier1.lib;platform.lib;jsonlib.lib;libcurl.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="http.cpp" />
|
||||
<ClCompile Include="json.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="http.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
33
sdk_http.vcxproj.filters
Normal file
33
sdk_http.vcxproj.filters
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Файлы исходного кода">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Заголовочные файлы">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Файлы исходного кода</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="http.cpp">
|
||||
<Filter>Файлы исходного кода</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="json.cpp">
|
||||
<Filter>Файлы исходного кода</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="http.h">
|
||||
<Filter>Заголовочные файлы</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
sdk_http.vcxproj.user
Normal file
3
sdk_http.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
Loading…
Add table
Reference in a new issue