Commit 1b9dcc31 authored by jan.koester's avatar jan.koester
Browse files

test

parent f36d84b4
Loading
Loading
Loading
Loading

.vscode/launch.json

0 → 100644
+19 −0
Changes for .vscode/launch.json: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
        "name": "(Windows) Launch",
        "type": "cppvsdbg",
        "request": "launch",
        "program": "${workspaceFolder}/build/examples/Debug/httpsysinfo.exe",
        "args": ["-a","0.0.0.0.","-p","8080"],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "console": "externalTerminal"
    }
    ]
}
 No newline at end of file

.vscode/tasks.json

0 → 100644
+28 −0
Changes for .vscode/tasks.json: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: cl.exe build active file",
            "command": "cl.exe",
            "args": [
                "/Zi",
                "/EHsc",
                "/nologo",
                "/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
                "${file}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$msCompile"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
 No newline at end of file
+2 −0
Changes for examples/httpsysinfo.cpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -222,6 +222,7 @@ public:
    }
    /*virtual method from event will call for every incomming Request*/
    void RequestEvent(libhttppp::HttpRequest& curreq, const int tid,ULONG_PTR args){
		std::cout << "url: " << curreq.getRequestURL() << std::endl;
        try{
            /*self implemented controller see above*/
            IndexController(curreq);
@@ -234,6 +235,7 @@ public:
    }

    void ResponseEvent(libhttppp::HttpRequest& curreq, const int tid,ULONG_PTR args){
		std::cout << "url: " << curreq.getRequestURL() << std::endl;
        if(curreq.getRequestURL()=="/images/header.png"){
            if(curreq.SendData.pos < header_png_size){
                size_t si = BLOCKSIZE < (header_png_size-curreq.SendData.pos) ? BLOCKSIZE : (header_png_size-curreq.SendData.pos);
+2 −0
Changes for src/http.cpp: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1159,6 +1159,8 @@ size_t libhttppp::HttpRequest::parse(){
      size_t last =_Request.rfind('?');
      if(last==std::string::npos)
          last=_Request.length();
      if (_Request[last] == '/')
          --last;
      _RequestURL=_Request.substr(0,last);
    }

+8 −9
Changes for src/httpd.cpp: 8 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -29,9 +29,6 @@
#include <fstream>
#include <iostream>

#include <memory>
#include <memory_resource>

#include <netplus/socket.h>
#include <netplus/exception.h>

@@ -213,11 +210,11 @@ libhttppp::HttpD::HttpD(int argc, char** argv) {
        }else{
            #ifndef Windows
            if (portset == true)
                _ServerSocket = std::make_shared<netplus::tcp>(httpaddr, port, maxconnections,-1);
                _ServerSocket = new netplus::tcp(httpaddr, port, maxconnections,-1);
            else
                _ServerSocket = std::make_shared<netplus::tcp>(httpaddr, maxconnections,-1);
                _ServerSocket = new netplus::tcp(httpaddr, maxconnections,-1);
            #else
            _ServerSocket = std::make_shared<netplus::tcp>(httpaddr, port, maxconnections,-1);
            _ServerSocket = new netplus::tcp(httpaddr, port, maxconnections,-1);
            #endif 
        }

@@ -231,6 +228,7 @@ libhttppp::HttpD::HttpD(int argc, char** argv) {

libhttppp::HttpD::HttpD(const char *httpaddr, int port,int maxconnections,const char *sslcertpath,const char *sslkeypath) {
    try {
		_ServerSocket = nullptr;

		_fileServer = false;

@@ -265,11 +263,11 @@ libhttppp::HttpD::HttpD(const char *httpaddr, int port,int maxconnections,const
        }else{
            #ifndef Windows
            if (port != -1)
                _ServerSocket = std::make_shared<netplus::tcp>(httpaddr, port, maxconnections,-1);
                _ServerSocket = new netplus::tcp(httpaddr, port, maxconnections,-1);
            else
                _ServerSocket = std::make_shared<netplus::tcp>(httpaddr, maxconnections,-1);
                _ServerSocket = new netplus::tcp(httpaddr, maxconnections,-1);
            #else
                _ServerSocket = std::make_shared<netplus::tcp>(httpaddr, port, maxconnections);
                _ServerSocket = new netplus::tcp(httpaddr, port, maxconnections);
            #endif
        }
    }catch (netplus::NetException &e) {
@@ -284,4 +282,5 @@ netplus::socket &libhttppp::HttpD::getServerSocket(){
}

libhttppp::HttpD::~HttpD(){
    delete _ServerSocket;
}
Loading