-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
I'm going to try to keep this as concise as possible.
What's happening is I have an SSLServer that's running, but when I setup the mount point to get files automatically, it just won't send the entire html file over. It sends almost all of it, then just stops and eventually times out. It's almost like it's trying to send the entire file in one TCP packet. That just can't happen, yet it's trying to or something. I can't determine what's causing this to happen.
I didn't want to open this as an issue, but after re-programming a tiny class to reproduce my issue, I determined it wasn't in my code.
Below is my minimal code that reproduces the error. I can connect on my PC which works fine on https://localhost, however it barely works when I connect over the WiFi on my Mobile device, or even other computers in the network. Sometimes (once every 15 - 20 tried) it might load the whole html page. The index.html is 578KB, and includes 39.6KB of javascript files. The problem is definitely with the large file size not being able to be sent by the mount point system somehow. I really need this to work, as this is an important project I'm working on. TIA
test.h
#pragma once
#include <iostream>
#define CPPHTTPLIB_OPENSSL_SUPPORT
#include "httplib.h"
class TestServer {
public:
httplib::SSLServer server;
TestServer();
};
test.cpp
#include "test.h"
/*
Test Server Class Implementation
*/
TestServer::TestServer(): server("certs\\server.pem", "certs\\server.key") {
server.set_pre_routing_handler([&](const httplib::Request &req, httplib::Response &res) -> httplib::SSLServer::HandlerResponse {
std::cout << "from -> " << req.remote_addr << ":" << req.remote_port << "\n";
return httplib::SSLServer::HandlerResponse::Unhandled;
});
server.set_mount_point("/", ".\\html");
server.listen("0.0.0.0", 443);
}EDIT:
I've been doing a lot of testing and have also uncovered the following:

The return value of SSL_write(...) is -1 when using the debugger
This results in an SSL_ERROR_SYSCALL error from SSL_get_error(rval);