It is working
This commit is contained in:
2
CppNet
2
CppNet
Submodule CppNet updated: e51933f03c...5a61a165c4
9
Makefile
9
Makefile
@ -5,11 +5,18 @@ packages:
|
|||||||
sudo apt-get install g++ libmagic-dev libssl-dev php-cgi
|
sudo apt-get install g++ libmagic-dev libssl-dev php-cgi
|
||||||
@echo "Finished downloading!"
|
@echo "Finished downloading!"
|
||||||
|
|
||||||
|
update:
|
||||||
|
@echo "Updating imported git repos..."
|
||||||
|
cd CppNet
|
||||||
|
git pull
|
||||||
|
cd ..
|
||||||
|
@echo "Finished updating!"
|
||||||
|
|
||||||
compile:
|
compile:
|
||||||
@echo "Compiling..."
|
@echo "Compiling..."
|
||||||
@mkdir -p bin
|
@mkdir -p bin
|
||||||
g++ src/necronda-server.cpp -o bin/necronda-server -std=c++17 -fPIC -pthread -lz -lmagic -lssl -ldl -lcrypto
|
g++ src/necronda-server.cpp -o bin/necronda-server -std=c++17 -fPIC -pthread -lz -lmagic -lssl -ldl -lcrypto
|
||||||
@echo "Finished compiling!"
|
@echo "Finished compiling!"
|
||||||
|
|
||||||
install: | packages compile
|
install: | packages update compile
|
||||||
@echo "Finished!"
|
@echo "Finished!"
|
||||||
|
2
run.sh
2
run.sh
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "-- Building and starting Necronda Server..."
|
echo "-- Building and starting Necronda Server..."
|
||||||
make compile && \
|
make update && make compile && \
|
||||||
echo -e "-- Successfully finished compiling!\n" && \
|
echo -e "-- Successfully finished compiling!\n" && \
|
||||||
sleep 0.0625 && \
|
sleep 0.0625 && \
|
||||||
echo -e "-- Starting Server...\n" && \
|
echo -e "-- Starting Server...\n" && \
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "network/Socket.h"
|
#include "../CppNet/src/network/Socket.h"
|
||||||
#include "network/http/HttpRequest.h"
|
#include "../CppNet/src/network/http/HttpRequest.h"
|
||||||
#include "network/http/HttpConnection.h"
|
#include "../CppNet/src/network/http/HttpConnection.h"
|
||||||
#include "necronda-server.h"
|
#include "necronda-server.h"
|
||||||
#include "network/http/HttpStatusCode.h"
|
#include "../CppNet/src/network/http/HttpStatusCode.h"
|
||||||
#include "URI.h"
|
#include "URI.h"
|
||||||
#include "procopen.h"
|
#include "procopen.h"
|
||||||
|
|
||||||
|
@ -20,18 +20,6 @@ using namespace std;
|
|||||||
const char* webroot = "/srv/necronda/";
|
const char* webroot = "/srv/necronda/";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns UNIX time in microseconds
|
|
||||||
* @return UNIX time [µs]
|
|
||||||
*/
|
|
||||||
unsigned long getMicros() {
|
|
||||||
struct timeval tv;
|
|
||||||
gettimeofday(&tv, nullptr);
|
|
||||||
return (unsigned long) (1000000 * tv.tv_sec + tv.tv_usec);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
string getMimeType(string path) {
|
string getMimeType(string path) {
|
||||||
|
|
||||||
unsigned long pos = path.find_last_of('.');
|
unsigned long pos = path.find_last_of('.');
|
||||||
@ -63,24 +51,6 @@ string getMimeType(string path) {
|
|||||||
* Sun, 06 Nov 1994 08:49:37 GMT
|
* Sun, 06 Nov 1994 08:49:37 GMT
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
string getHttpDate() {
|
|
||||||
time_t rawtime;
|
|
||||||
time(&rawtime);
|
|
||||||
return getHttpDate(rawtime);
|
|
||||||
}
|
|
||||||
|
|
||||||
string getHttpDate(string filename) {
|
|
||||||
struct stat attrib;
|
|
||||||
stat(filename.c_str(), &attrib);
|
|
||||||
return getHttpDate(attrib.st_ctime);
|
|
||||||
}
|
|
||||||
|
|
||||||
string getHttpDate(time_t time) {
|
|
||||||
char buffer[64];
|
|
||||||
struct tm *timeinfo = gmtime(&time);
|
|
||||||
strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S GMT", timeinfo);
|
|
||||||
return string(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getTimestamp(string path) {
|
std::string getTimestamp(string path) {
|
||||||
struct stat attrib;
|
struct stat attrib;
|
||||||
@ -210,14 +180,15 @@ string read_line(FILE* file) {
|
|||||||
|
|
||||||
|
|
||||||
#include "procopen.cpp"
|
#include "procopen.cpp"
|
||||||
#include "network/Address.cpp"
|
#include "../CppNet/src/network/Address.cpp"
|
||||||
#include "network/Socket.cpp"
|
#include "../CppNet/src/network/Socket.cpp"
|
||||||
#include "URI.cpp"
|
#include "URI.cpp"
|
||||||
#include "network/http/HttpStatusCode.cpp"
|
#include "../CppNet/src/network/http/Http.cpp"
|
||||||
#include "network/http/HttpHeader.cpp"
|
#include "../CppNet/src/network/http/HttpStatusCode.cpp"
|
||||||
#include "network/http/HttpRequest.cpp"
|
#include "../CppNet/src/network/http/HttpHeader.cpp"
|
||||||
#include "network/http/HttpResponse.cpp"
|
#include "../CppNet/src/network/http/HttpRequest.cpp"
|
||||||
#include "network/http/HttpConnection.cpp"
|
#include "../CppNet/src/network/http/HttpResponse.cpp"
|
||||||
|
#include "../CppNet/src/network/http/HttpConnection.cpp"
|
||||||
|
|
||||||
string getWebRoot(string host) {
|
string getWebRoot(string host) {
|
||||||
if (host == "www.necronda.net") {
|
if (host == "www.necronda.net") {
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#ifndef NECRONDA_SERVER
|
#ifndef NECRONDA_SERVER
|
||||||
#define NECRONDA_SERVER
|
#define NECRONDA_SERVER
|
||||||
|
|
||||||
#define CHUNK 16384
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
unsigned long getMicros();
|
unsigned long getMicros();
|
||||||
@ -21,12 +19,6 @@ string getWebRoot(string host);
|
|||||||
|
|
||||||
string getMimeType(string path);
|
string getMimeType(string path);
|
||||||
|
|
||||||
string getHttpDate(time_t time);
|
|
||||||
|
|
||||||
string getHttpDate();
|
|
||||||
|
|
||||||
string getHttpDate(string filename);
|
|
||||||
|
|
||||||
string getTimestamp(string path);
|
string getTimestamp(string path);
|
||||||
|
|
||||||
string getTimestamp(time_t time);
|
string getTimestamp(time_t time);
|
||||||
|
Reference in New Issue
Block a user