added: logger, session destroy

This commit is contained in:
C
2022-11-29 13:59:44 +05:00
parent 67ee5974be
commit 12080c106a
14 changed files with 240 additions and 3746 deletions
+49 -55
View File
@@ -14,40 +14,12 @@ const crypto = require('crypto')
var querystring = require('querystring')
// write startup server history
var logs_dir = './logs'
if (!fs.existsSync(logs_dir))
fs.mkdirSync(logs_dir)
const http_client = require('../lib/http_client.js')
const logger = require('../lib/logger')
fs.appendFileSync(`./${logs_dir}/launch_history.log`, (node_time.create().format('Y-m-d H:M:S')).toString() + '\n')
async function PostSessionServer(data, ip, port, callback) {
// Build the post string from an object
// An object of options to indicate where to post to
var post_options = {
host: ip,
port: port,
method: 'POST',
headers: {
'Content-Type': 'applicaiton/json',
'Content-Length': Buffer.byteLength(data)
}
}
// Set up the request
var request = http.request(post_options, function(res) {
res.setEncoding('utf8')
res.on('data', async function (answer) {
callback(answer)
})
})
request.on('error', function(e) {
console.error(e)
callback('{"msg":"SESSION_SERVER_DISABLED"}')
})
// post the data
request.write(data)
request.end()
}
// logger
const logger_init = new logger('./logs/init.log')
const logger_runtime = new logger('./logs/runtime.log')
// response function
async function create_response(request, callback) {
@@ -59,7 +31,6 @@ async function create_response(request, callback) {
if (request.verb == 'GET_TITLES') {
var title = database.collection('title')
response = await title.find().skip(request.start).limit(request.count).toArray()
response = JSON.stringify(response)
callback(response)
} else if (request.verb == 'PLAN_SESSION') {
@@ -72,7 +43,7 @@ async function create_response(request, callback) {
var servers = await session_server.find({'title':request.title}).toArray()
if (!servers.length) {
response = '{"msg":"SERVERS_NOT_FOUND"}'
response = {msg:'SERVERS_NOT_FOUND'}
callback(response)
return
}
@@ -90,35 +61,58 @@ async function create_response(request, callback) {
}
}
if (free_server == null) {
response = '{"msg":"SESSION_LIMIT_REACHED"}'
response = {msg:'SESSION_LIMIT_REACHED'}
callback(response)
return
}
PostSessionServer(`{"verb":"CREATE_SESSION", "title":"${request.title}"}`, free_server.ip, free_server.port, async function(answer) {
var session_id = crypto.randomBytes(16).toString('base64')
// create session on session server
new http_client(free_server.ip, free_server.port).post(
`{"verb":"CREATE_SESSION", "title":"${request.title}", "session_id":"${session_id}"}`, async function(answer) {
var json_answer = await JSON.parse(answer)
if (json_answer.link == null) {
response = '{"msg":"SESSION_SERVER_NOT_WORKING"}'
response = {msg:'SESSION_SERVER_NOT_WORKING'}
callback(response)
return
}
// generate random code for session access
var code = Math.floor(1000 + Math.random() * 9000)
while ((await session_active.find({'code':code}).toArray()).length) {
code = Math.floor(1000 + Math.random() * 9000)
}
// add session to database
await session_active.insertOne({
server_id:free_server.server_id,
link:json_answer.link
session_id:session_id,
link:json_answer.link,
connection_code:code
})
response = `{"msg":"SESSION_CREATED", "link":"${json_answer.link}"}`
response = {msg:'SESSION_CREATED', link:json_answer.link}
callback(response)
return
},
function(error) {
logger_runtime.error(error)
callback({msg:'SESSION_SERVER_DISABLED'})
return
})
} else if (request.verb == 'CONNECT_SESSION') {
callback(response)
return
} else {
response = '{"msg":"UNKNOWN_VERB"}'
response = {msg:'UNKNOWN_VERB'}
callback(response)
return
}
} catch(e) {
console.error(e)
logger_runtime.error(e)
}
}
@@ -127,32 +121,32 @@ async function create_response(request, callback) {
const server = http.createServer(function(request, response) {
if (request.method == 'POST') {
var body = ''
request.on('data', function(data) {
body += data
})
request.on('end', function() {
console.log('received: "', body, '"')
response.writeHead(200, {'Content-Type': 'message'})
logger_runtime.log('received: ', body)
response.writeHead(200, {'Content-Type': 'application/json'})
try {
create_response(JSON.parse(body), function(message) {
response.end(message)
console.log('response:', message)
response.end(JSON.stringify(message))
logger_runtime.log('response:', message)
})
}
catch(e) {
console.error(e)
logger_runtime.error(e)
}
})
}
else {
var message = 'UNDEFINED_REQUEST' + ': ' + request.method.toString()
response.writeHead(200, {'Content-Type': 'message'})
response.end(message)
console.log(message)
response.writeHead(501, {'Content-Type': 'application/json'})
response.end(JSON.stringify({msg:'UNKNOWN_METHOD'}))
}
})
server.listen(config.port, config.ip)
console.log(`Listening at http://${config.ip}:${config.port}`)
try {
server.listen(config.port, config.ip)
logger_init.log(`Listening at http://${config.ip}:${config.port}`)
} catch (e) {
logger_init.error(e)
}
View File
File diff suppressed because it is too large Load Diff
-18
View File
@@ -1,18 +0,0 @@
{
"name": "coordinator",
"version": "1.0.0",
"description": "",
"main": "coordinator.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"dependencies": {
"express": "^4.18.2",
"mongodb": "^4.12.0",
"node-datetime": "^2.1.2"
}
}
+36
View File
@@ -0,0 +1,36 @@
const http = require('http')
module.exports = class http_client {
constructor(ip, port) {
this.#ip = ip
this.#port = port
}
async post(data, callback_answer, callback_error) {
// Build the post string from an object
// An object of options to indicate where to post to
var post_options = {
host: this.#ip,
port: this.#port,
method: 'POST',
headers: {
'Content-Type': 'applicaiton/json',
'Content-Length': Buffer.byteLength(data)
}
}
// Set up the request
var request = http.request(post_options, function(res) {
res.setEncoding('utf8')
res.on('data', async function (answer) {
callback_answer(answer)
})
})
request.on('error', function(e) {
callback_error(e)
})
// post the data
request.write(data)
request.end()
}
#ip
#port
}
+34
View File
@@ -0,0 +1,34 @@
const fs = require('fs')
const path = require('path')
const node_time = require('node-datetime')
const util = require('util')
module.exports = class logger {
constructor(filepath) {
this.#filepath = filepath
this.#filename = path.basename(filepath)
var dirname = path.dirname(filepath)
if (!fs.existsSync(dirname))
fs.mkdirSync(dirname, {recursive:true})
}
error(...arg) {
this.#log('error', arg)
}
log(...arg) {
this.#log('', arg)
}
#log(message = '', ...arg) {
var args = ''
arg.forEach(value => {
args += util.format(value) + ' '
})
args = (node_time.create().format('Y-m-d H:M:S')).toString() + ((message != '') ? ': ' + message : '') + ': ' + args
console.log(this.#filename + ': ' + args)
fs.appendFileSync(this.#filepath, args + '\n')
}
#filepath
#filename
}
@@ -1,4 +1,3 @@
class port {
constructor(value) {
this.#value = value
+28 -1
View File
@@ -11,7 +11,8 @@
"dependencies": {
"express": "^4.18.2",
"mongodb": "^4.12.0",
"node-datetime": "^2.1.2"
"node-datetime": "^2.1.2",
"signal": "^7.0.6"
}
},
"node_modules/@aws-crypto/ie11-detection": {
@@ -1592,6 +1593,11 @@
"node": ">= 0.8"
}
},
"node_modules/operation": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/operation/-/operation-5.0.2.tgz",
"integrity": "sha512-tFuFcNZMND6vA40IX+faGKE4xrsM9IIqgHf4peTqB1aMLIB0RwjFMzMq5DP0SgWuUEcKGWJFqOCh7xlH2lP50A=="
},
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -1757,6 +1763,14 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/signal": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/signal/-/signal-7.0.6.tgz",
"integrity": "sha512-9SnDOIATtoRktT5ePD68F+B5i3ZugSBHB1HrBhaI/kkhaMBaMMatoDn+ajdgnFE5Xz1hWliLkpwVEnj3+S+ntg==",
"dependencies": {
"operation": "5.0.x"
}
},
"node_modules/smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
@@ -3163,6 +3177,11 @@
"ee-first": "1.1.1"
}
},
"operation": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/operation/-/operation-5.0.2.tgz",
"integrity": "sha512-tFuFcNZMND6vA40IX+faGKE4xrsM9IIqgHf4peTqB1aMLIB0RwjFMzMq5DP0SgWuUEcKGWJFqOCh7xlH2lP50A=="
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
@@ -3283,6 +3302,14 @@
"object-inspect": "^1.9.0"
}
},
"signal": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/signal/-/signal-7.0.6.tgz",
"integrity": "sha512-9SnDOIATtoRktT5ePD68F+B5i3ZugSBHB1HrBhaI/kkhaMBaMMatoDn+ajdgnFE5Xz1hWliLkpwVEnj3+S+ntg==",
"requires": {
"operation": "5.0.x"
}
},
"smart-buffer": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
+2 -1
View File
@@ -13,6 +13,7 @@
"dependencies": {
"express": "^4.18.2",
"mongodb": "^4.12.0",
"node-datetime": "^2.1.2"
"node-datetime": "^2.1.2",
"signal": "^7.0.6"
}
}
+91 -81
View File
@@ -4,7 +4,7 @@ const http = require('http')
// filesystem
const fs = require('fs')
// server config
const config = require('./config.json');
const config = require('./config.json')
// node date time
const node_time = require('node-datetime')
// titles for process creation
@@ -12,16 +12,15 @@ const titles = require('./titles.json')
const { spawn } = require('node:child_process')
const port_alloc = require('./port_alloc.js')
const child_process = require('child_process')
// write startup server history
var logs_dir = './logs'
if (!fs.existsSync(logs_dir))
fs.mkdirSync(logs_dir)
const port_alloc = require('../lib/port_alloc.js')
const http_client = require('../lib/http_client.js')
const logger = require('../lib/logger')
fs.appendFileSync(`./${logs_dir}/launch_history.log`, (node_time.create().format('Y-m-d H:M:S')).toString() + '\n')
// logger
const logger_init = new logger('./logs/init.log')
const logger_runtime = new logger('./logs/runtime.log')
var app_port_alloc = new port_alloc(config.session_ports.app_begin, config.session_ports.count)
var http_port_alloc = new port_alloc(config.session_ports.http_begin, config.session_ports.count)
@@ -30,73 +29,83 @@ var http_port_alloc = new port_alloc(config.session_ports.http_begin, config.ses
async function create_response(request, callback) {
var response = ''
try {
switch(request.verb) {
case 'CREATE_SESSION':
var app_info
titles.forEach((title) => {
if (title.title == request.title) {
app_info = title
}
})
if (app_info == null) {
response = '{"msg":"TITLE_NOT_EXISTS"}'
break
if (request.verb == 'CREATE_SESSION') {
var app_info
titles.forEach((title) => {
if (title.title == request.title) {
app_info = title
}
})
if (app_info == null) {
response = {msg:'TITLE_NOT_EXISTS'}
callback(response)
return
}
var app_port
var http_port
try {
app_port = app_port_alloc.get()
http_port = http_port_alloc.get()
} catch(e) {
console.error(e)
response = '{"msg":"PORT_BUSY"}'
break
var app_port
var http_port
try {
app_port = app_port_alloc.get()
http_port = http_port_alloc.get()
} catch(e) {
logger_runtime.error(e)
response = {msg:'PORT_BUSY'}
callback(response)
return
}
// start app_proc
const app_proc = spawn(app_info.path, [].concat(config.app_args_static,
[config.app_args_runtime.ip + config.ip, config.app_args_runtime.port + app_port.toString()]), {
detached: true
})
app_proc.on('error', function(err) {
logger_runtime.error(err)
response = {msg:'APP_PROC_ERROR'}
callback(response)
return
})
app_proc.on('close', (code) => {
app_port_alloc.free(app_port)
})
// start webrtc server
const webrtc_proc = child_process.fork(config.webrtc_args_static.cirrus_path, [http_port.toString(), app_port.toString()], {
detached: true
})
webrtc_proc.on('error', function(err) {
logger_runtime.error(err)
response = {msg:'WEBRTC_PROC_ERROR'}
callback(response)
return
})
webrtc_proc.on('close', (code) => {
http_port_alloc.free(http_port)
// if webrtc server closed, kill app proc and send session end message to server
if (process.platform === 'win32') {
spawn('taskkill', ['/pid', app_proc.pid, '/f', '/t'])
}
// start app_proc
const app_proc = spawn(app_info.path, [].concat(config.app_args_static,
[config.app_args_runtime.ip + config.ip, config.app_args_runtime.port + app_port.toString()]), {
detached: true
})
app_proc.on('error', function(err) {
console.error(err)
response = '{"msg":"APP_PROC_ERROR"}'
callback(response)
return
})
app_proc.on('close', (code) => {
app_port_alloc.free(app_port)
})
else {
app_proc.kill('SIGINT')
}
//new http_client(ip, port).post()
})
// start webrtc server
//console.log('http_port: ', http_port, ' app_port: ', app_port)
const webrtc_proc = child_process.fork(config.webrtc_args_static.cirrus_path, [http_port.toString(), app_port.toString()], {
detached: true
})
webrtc_proc.on('error', function(err) {
console.error(err)
response = '{"msg":"WEBRTC_PROC_ERROR"}'
callback(response)
return
})
webrtc_proc.on('close', (code) => {
http_port_alloc.free(http_port)
})
response = `{"msg":"SESSION_CREATED", "link":"http://${config.ip+':'+http_port}"}`
break
case 'CONNECT_SESSION':
break
default:
response = '{"msg":"UNKNOWN_VERB"}'
response = {msg:'SESSION_CREATED', link:`http://${config.ip+':'+http_port}`}
callback(response)
return
} else if(request.verb == 'CONNECT_SESSION') {
response = ''
callback(response)
return
} else {
response = {msg:'UNKNOWN_VERB'}
callback(response)
return
}
callback(response)
}
catch(e) {
console.error(e)
logger_runtime.error(e)
}
}
@@ -105,32 +114,33 @@ async function create_response(request, callback) {
const server = http.createServer(function(request, response) {
if (request.method == 'POST') {
var body = ''
request.on('data', function(data) {
body += data
})
request.on('end', function() {
console.log('received: "', body, '"')
response.writeHead(200, {'Content-Type': 'message'})
logger_runtime.log('received: ', body)
response.writeHead(200, {'Content-Type': 'application/json'})
try {
create_response(JSON.parse(body), function(message) {
response.end(message)
console.log('response:', message)
response.end(JSON.stringify(message))
logger_runtime.log('response:', message)
})
}
catch(e) {
console.error(e)
logger_runtime.error(e)
}
})
}
else {
var message = 'UNDEFINED_REQUEST' + ': ' + request.method.toString()
response.writeHead(200, {'Content-Type': 'message'})
response.end(message)
console.log(message)
response.writeHead(501, {'Content-Type': 'application/json'})
response.end(JSON.stringify({msg:'UNKNOWN_METHOD'}))
}
})
server.listen(config.port, config.ip)
console.log(`Listening at http://${config.ip}:${config.port}`)
try {
server.listen(config.port, config.ip)
logger_init.log(`Listening at http://${config.ip}:${config.port}`)
} catch (e) {
logger_init.error(e)
}
-31
View File
@@ -1,31 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33103.184
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coordinator", "coordinator\coordinator.vcxproj", "{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Debug|x64.ActiveCfg = Debug|x64
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Debug|x64.Build.0 = Debug|x64
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Debug|x86.ActiveCfg = Debug|Win32
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Debug|x86.Build.0 = Debug|Win32
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Release|x64.ActiveCfg = Release|x64
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Release|x64.Build.0 = Release|x64
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Release|x86.ActiveCfg = Release|Win32
{A7EC1E63-3BDD-4683-969F-73CE46B8A8EE}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A9F48303-1B3C-4F1A-A5B7-E2C5A8888060}
EndGlobalSection
EndGlobal
@@ -1,140 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" 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>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{a7ec1e63-3bdd-4683-969f-73ce46b8a8ee}</ProjectGuid>
<RootNamespace>coordinator</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<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|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<VcpkgUseStatic>false</VcpkgUseStatic>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>C:\PixelStreamingLibraries\curlpp_cpr\x64-windows\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<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>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
-12
View File
@@ -1,12 +0,0 @@
//http request lib
#include <cpr/cpr.h>
#include <iostream>
#include <string>
int main(int argc, char** argv) {
//std::string url = "http://httpbin.org/get";
std::string url = "https://estate.graff.tech";
auto response = cpr::Get(cpr::Url{url});
std::cout << response.text << std::endl;
}