see #2: update exercises and maintains of content

This commit is contained in:
Changkun Ou
2019-07-10 11:35:36 +02:00
parent fb91f1584a
commit cc1d3d7cb9
24 changed files with 2562 additions and 2535 deletions

View File

@@ -2,7 +2,7 @@
# Makefile
# web_server
#
# created by changkun at labex.io
# created by changkun at changkun.de/modern-cpp
#
CXX = g++
@@ -15,15 +15,16 @@ SOURCE_HTTPS = main.https.cpp
OBJECTS_HTTP = main.http.o
OBJECTS_HTTPS = main.https.o
LDFLAGS_COMMON = -std=c++11 -O3 -pthread -lboost_system
LDFLAGS_COMMON = -std=c++2a -O3 -pthread -lboost_system
LDFLAGS_HTTP =
LDFLAGS_HTTPS = -lssl -lcrypto
LPATH_COMMON = -I/usr/include/boost
LPATH_HTTP =
LPATH_HTTPS = -I/usr/include/openssl
LPATH_HTTPS = -I/usr/local/opt/openssl/include
LLIB_COMMON = -L/usr/lib
LLIB_HTTPS = -L/usr/local/opt/openssl/lib
all:
make http

View File

@@ -8,7 +8,7 @@
#include <fstream>
using namespace std;
using namespace LabexWeb;
using namespace Web;
template<typename SERVER_TYPE>
void start_server(SERVER_TYPE &server) {

View File

@@ -8,7 +8,7 @@
#include "server.http.hpp"
#include "handler.hpp"
using namespace LabexWeb;
using namespace Web;
int main() {
// HTTP server runs in port 12345 HTTP, enable 4 threads

View File

@@ -6,7 +6,7 @@
#include <iostream>
#include "server.https.hpp"
#include "handler.hpp"
using namespace LabexWeb;
using namespace Web;
int main() {
// HTTPS server runs in port 12345, enable 4 threads

View File

@@ -13,7 +13,7 @@
#include <unordered_map>
#include <thread>
namespace LabexWeb {
namespace Web {
struct Request {
// request method, POST, GET; path; HTTP version
std::string method, path, http_version;

View File

@@ -9,7 +9,7 @@
#include "server.base.hpp"
namespace LabexWeb {
namespace Web {
typedef boost::asio::ip::tcp::socket HTTP;
template<>
class Server<HTTP> : public ServerBase<HTTP> {

View File

@@ -10,7 +10,7 @@
#include "server.http.hpp"
#include <boost/asio/ssl.hpp>
namespace LabexWeb {
namespace Web {
// define HTTPS type
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> HTTPS;

View File

@@ -1,6 +1,6 @@
<html>
<head>
<title>LabEx Web Server Test</title>
<title>Web Server Test</title>
</head>
<body>
Hello world in index.html.

View File

@@ -1,6 +1,6 @@
<html>
<head>
<title>LabEx Web Server Test</title>
<title>Web Server Test</title>
</head>
<body>
Hello world in test.html.