-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
124 changed files
with
53,093 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
</Project> |
23 changes: 23 additions & 0 deletions
23
external_imported/UniversalStacktrace/external/Catch2/misc/SelfTest.vcxproj.user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<UseFullPaths>false</UseFullPaths> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
BasedOnStyle: LLVM | ||
AllowShortBlocksOnASingleLine: true | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortIfStatementsOnASingleLine: true | ||
Cpp11BracedListStyle: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [macOS-latest, ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- name: prepare git for checkout on windows | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
- name: install brotli library on ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
run: sudo apt update && sudo apt-get install -y libbrotli-dev | ||
- name: install brotli library on macOS | ||
if: matrix.os == 'macOS-latest' | ||
run: brew install brotli | ||
- name: make | ||
if: matrix.os != 'windows-latest' | ||
run: cd test && make | ||
- name: check fuzz test target | ||
if: matrix.os == 'ubuntu-latest' | ||
run: cd test && make -f Makefile.fuzz_test | ||
- name: setup msbuild on windows | ||
if: matrix.os == 'windows-latest' | ||
uses: microsoft/[email protected] | ||
- name: make-windows | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
cd test | ||
msbuild.exe test.sln /verbosity:minimal /t:Build "/p:Configuration=Release;Platform=x64" | ||
x64\Release\test.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
tags | ||
|
||
example/server | ||
example/client | ||
example/hello | ||
example/simplecli | ||
example/simplesvr | ||
example/benchmark | ||
example/redirect | ||
example/sse* | ||
example/upload | ||
example/*.pem | ||
test/test | ||
test/test_proxy | ||
test/test.xcodeproj/xcuser* | ||
test/test.xcodeproj/*/xcuser* | ||
test/*.pem | ||
test/*.srl | ||
|
||
*.swp | ||
|
||
Debug | ||
Release | ||
*.vcxproj.user | ||
*.sdf | ||
*.suo | ||
*.opensdf | ||
*.db | ||
ipch | ||
*.dSYM | ||
.* | ||
!/.travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
#CXX = clang++ | ||
CXXFLAGS = -std=c++11 -I.. -Wall -Wextra -pthread | ||
|
||
OPENSSL_DIR = /usr/local/opt/openssl | ||
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto | ||
|
||
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz | ||
|
||
BROTLI_DIR = /usr/local/opt/brotli | ||
# BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon-static -lbrotlienc-static -lbrotlidec-static | ||
|
||
all: server client hello simplecli simplesvr upload redirect ssesvr ssecli benchmark | ||
|
||
server : server.cc ../httplib.h Makefile | ||
$(CXX) -o server $(CXXFLAGS) server.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
client : client.cc ../httplib.h Makefile | ||
$(CXX) -o client $(CXXFLAGS) client.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
hello : hello.cc ../httplib.h Makefile | ||
$(CXX) -o hello $(CXXFLAGS) hello.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
simplecli : simplecli.cc ../httplib.h Makefile | ||
$(CXX) -o simplecli $(CXXFLAGS) simplecli.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
simplesvr : simplesvr.cc ../httplib.h Makefile | ||
$(CXX) -o simplesvr $(CXXFLAGS) simplesvr.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
upload : upload.cc ../httplib.h Makefile | ||
$(CXX) -o upload $(CXXFLAGS) upload.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
redirect : redirect.cc ../httplib.h Makefile | ||
$(CXX) -o redirect $(CXXFLAGS) redirect.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
ssesvr : ssesvr.cc ../httplib.h Makefile | ||
$(CXX) -o ssesvr $(CXXFLAGS) ssesvr.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
ssecli : ssecli.cc ../httplib.h Makefile | ||
$(CXX) -o ssecli $(CXXFLAGS) ssecli.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
benchmark : benchmark.cc ../httplib.h Makefile | ||
$(CXX) -o benchmark $(CXXFLAGS) benchmark.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) | ||
|
||
pem: | ||
openssl genrsa 2048 > key.pem | ||
openssl req -new -key key.pem | openssl x509 -days 3650 -req -signkey key.pem > cert.pem | ||
|
||
clean: | ||
rm server client hello simplecli simplesvr upload redirect ssesvr sselci benchmark *.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// ssecli.cc | ||
// | ||
// Copyright (c) 2019 Yuji Hirose. All rights reserved. | ||
// MIT License | ||
// | ||
|
||
#include <httplib.h> | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main(void) { | ||
httplib::Client("http://localhost:1234") | ||
.Get("/event1", [&](const char *data, size_t data_length) { | ||
std::cout << string(data, data_length); | ||
return true; | ||
}); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// | ||
// sse.cc | ||
// | ||
// Copyright (c) 2020 Yuji Hirose. All rights reserved. | ||
// MIT License | ||
// | ||
|
||
#include <atomic> | ||
#include <chrono> | ||
#include <condition_variable> | ||
#include <httplib.h> | ||
#include <iostream> | ||
#include <mutex> | ||
#include <sstream> | ||
#include <thread> | ||
|
||
using namespace httplib; | ||
using namespace std; | ||
|
||
class EventDispatcher { | ||
public: | ||
EventDispatcher() { | ||
id_ = 0; | ||
cid_ = -1; | ||
} | ||
|
||
void wait_event(DataSink *sink) { | ||
unique_lock<mutex> lk(m_); | ||
int id = id_; | ||
cv_.wait(lk, [&] { return cid_ == id; }); | ||
if (sink->is_writable()) { sink->write(message_.data(), message_.size()); } | ||
} | ||
|
||
void send_event(const string &message) { | ||
lock_guard<mutex> lk(m_); | ||
cid_ = id_++; | ||
message_ = message; | ||
cv_.notify_all(); | ||
} | ||
|
||
private: | ||
mutex m_; | ||
condition_variable cv_; | ||
atomic_int id_; | ||
atomic_int cid_; | ||
string message_; | ||
}; | ||
|
||
const auto html = R"( | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>SSE demo</title> | ||
</head> | ||
<body> | ||
<script> | ||
const ev1 = new EventSource("event1"); | ||
ev1.onmessage = function(e) { | ||
console.log('ev1', e.data); | ||
} | ||
const ev2 = new EventSource("event2"); | ||
ev2.onmessage = function(e) { | ||
console.log('ev2', e.data); | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
)"; | ||
|
||
int main(void) { | ||
EventDispatcher ed; | ||
|
||
Server svr; | ||
|
||
svr.Get("/", [&](const Request & /*req*/, Response &res) { | ||
res.set_content(html, "text/html"); | ||
}); | ||
|
||
svr.Get("/event1", [&](const Request & /*req*/, Response &res) { | ||
cout << "connected to event1..." << endl; | ||
res.set_chunked_content_provider("text/event-stream", | ||
[&](size_t /*offset*/, DataSink &sink) { | ||
ed.wait_event(&sink); | ||
return true; | ||
}); | ||
}); | ||
|
||
svr.Get("/event2", [&](const Request & /*req*/, Response &res) { | ||
cout << "connected to event2..." << endl; | ||
res.set_chunked_content_provider("text/event-stream", | ||
[&](size_t /*offset*/, DataSink &sink) { | ||
ed.wait_event(&sink); | ||
return true; | ||
}); | ||
}); | ||
|
||
thread t([&] { | ||
int id = 0; | ||
while (true) { | ||
this_thread::sleep_for(chrono::seconds(1)); | ||
cout << "send event: " << id << std::endl; | ||
std::stringstream ss; | ||
ss << "data: " << id << "\n\n"; | ||
ed.send_event(ss.str()); | ||
id++; | ||
} | ||
}); | ||
|
||
svr.listen("localhost", 1234); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#CXX = clang++ | ||
CXXFLAGS = -g -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I.. -I. -Wall -Wextra -Wtype-limits -Wconversion #-fsanitize=address | ||
|
||
OPENSSL_DIR = /usr/local/opt/[email protected] | ||
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib -lssl -lcrypto | ||
|
||
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz | ||
|
||
BROTLI_DIR = /usr/local/opt/brotli | ||
BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon -lbrotlienc -lbrotlidec | ||
|
||
all : test | ||
./test | ||
|
||
proxy : test_proxy | ||
./test_proxy | ||
|
||
test : test.cc ../httplib.h Makefile cert.pem | ||
$(CXX) -o test $(CXXFLAGS) test.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) -pthread | ||
|
||
test_proxy : test_proxy.cc ../httplib.h Makefile cert.pem | ||
$(CXX) -o test_proxy $(CXXFLAGS) test_proxy.cc gtest/gtest-all.cc gtest/gtest_main.cc $(OPENSSL_SUPPORT) $(ZLIB_SUPPORT) $(BROTLI_SUPPORT) -pthread | ||
|
||
cert.pem: | ||
openssl genrsa 2048 > key.pem | ||
openssl req -new -batch -config test.conf -key key.pem | openssl x509 -days 3650 -req -signkey key.pem > cert.pem | ||
openssl req -x509 -config test.conf -key key.pem -sha256 -days 3650 -nodes -out cert2.pem -extensions SAN | ||
openssl genrsa 2048 > rootCA.key.pem | ||
openssl req -x509 -new -batch -config test.rootCA.conf -key rootCA.key.pem -days 1024 > rootCA.cert.pem | ||
openssl genrsa 2048 > client.key.pem | ||
openssl req -new -batch -config test.conf -key client.key.pem | openssl x509 -days 370 -req -CA rootCA.cert.pem -CAkey rootCA.key.pem -CAcreateserial > client.cert.pem | ||
#c_rehash . | ||
|
||
clean: | ||
rm -f test test_proxy pem *.0 *.1 *.srl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
#CXX = clang++ | ||
# Do not add default sanitizer flags here as OSS-fuzz adds its own sanitizer flags. | ||
CXXFLAGS += -ggdb -O0 -std=c++11 -DGTEST_USE_OWN_TR1_TUPLE -I../.. -I. -Wall -Wextra -Wtype-limits -Wconversion | ||
|
||
OPENSSL_DIR = /usr/local/opt/[email protected] | ||
|
||
# Using full path to libssl and libcrypto to avoid accidentally picking openssl libs brought in by msan. | ||
OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I$(OPENSSL_DIR)/include -I$(OPENSSL_DIR)/lib /usr/local/lib/libssl.a /usr/local/lib/libcrypto.a | ||
|
||
ZLIB_SUPPORT = -DCPPHTTPLIB_ZLIB_SUPPORT -lz | ||
|
||
BROTLI_DIR = /usr/local/opt/brotli | ||
# BROTLI_SUPPORT = -DCPPHTTPLIB_BROTLI_SUPPORT -I$(BROTLI_DIR)/include -L$(BROTLI_DIR)/lib -lbrotlicommon -lbrotlienc -lbrotlidec | ||
|
||
# Runs all the tests and also fuzz tests against seed corpus. | ||
all : server_fuzzer | ||
./server_fuzzer corpus/* | ||
|
||
# Fuzz target, so that you can choose which $(LIB_FUZZING_ENGINE) to use. | ||
server_fuzzer : server_fuzzer.cc ../../httplib.h | ||
# $(CXX) $(CXXFLAGS) -o $@ $< -Wl,-Bstatic $(OPENSSL_SUPPORT) -Wl,-Bdynamic -ldl $(ZLIB_SUPPORT) $(LIB_FUZZING_ENGINE) -pthread | ||
$(CXX) $(CXXFLAGS) -o $@ $< $(ZLIB_SUPPORT) $(LIB_FUZZING_ENGINE) -pthread | ||
zip -q -r server_fuzzer_seed_corpus.zip corpus | ||
|
||
clean: | ||
rm -f server_fuzzer pem *.0 *.o *.1 *.srl *.zip |
19 changes: 19 additions & 0 deletions
19
external_imported/easyloggingpp/samples/OpenGL/Cube/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CC = g++ | ||
CFLAGS = -Wall -std=c++11 | ||
PROG = cube | ||
|
||
SRCS = main.cpp imageloader.cpp | ||
|
||
ifeq ($(shell uname),Darwin) | ||
LIBS = -framework OpenGL -framework GLUT | ||
else | ||
LIBS = -lglut -lGLU -lGL | ||
endif | ||
|
||
all: $(PROG) | ||
|
||
$(PROG): $(SRCS) | ||
$(CC) $(CFLAGS) -o bin/$(PROG) $(SRCS) $(LIBS) | ||
|
||
clean: | ||
rm -f $(PROG) |
Oops, something went wrong.