mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-06-17 22:23:03 +00:00
Http: Use ipv4
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
std::string Http::GET(const std::string& host, int port, const std::string& target, unsigned int* status) {
|
std::string Http::GET(const std::string& host, int port, const std::string& target, unsigned int* status) {
|
||||||
httplib::SSLClient client(host, port);
|
httplib::SSLClient client(host, port);
|
||||||
client.enable_server_certificate_verification(false);
|
client.enable_server_certificate_verification(false);
|
||||||
|
client.set_address_family(AF_INET);
|
||||||
auto res = client.Get(target.c_str());
|
auto res = client.Get(target.c_str());
|
||||||
if (res) {
|
if (res) {
|
||||||
if (status) {
|
if (status) {
|
||||||
@@ -25,6 +26,7 @@ std::string Http::GET(const std::string& host, int port, const std::string& targ
|
|||||||
std::string Http::POST(const std::string& host, int port, const std::string& target, const std::string& body, const std::string& ContentType, unsigned int* status) {
|
std::string Http::POST(const std::string& host, int port, const std::string& target, const std::string& body, const std::string& ContentType, unsigned int* status) {
|
||||||
httplib::SSLClient client(host, port);
|
httplib::SSLClient client(host, port);
|
||||||
client.enable_server_certificate_verification(false);
|
client.enable_server_certificate_verification(false);
|
||||||
|
client.set_address_family(AF_INET);
|
||||||
auto res = client.Post(target.c_str(), body.c_str(), body.size(), ContentType.c_str());
|
auto res = client.Post(target.c_str(), body.c_str(), body.size(), ContentType.c_str());
|
||||||
if (res) {
|
if (res) {
|
||||||
if (status) {
|
if (status) {
|
||||||
|
|||||||
+2
-1
@@ -207,7 +207,8 @@ void TNetwork::Authentication(const TConnection& ClientConnection) {
|
|||||||
auto Client = CreateClient(ClientConnection.Socket);
|
auto Client = CreateClient(ClientConnection.Socket);
|
||||||
char AddrBuf[64];
|
char AddrBuf[64];
|
||||||
// TODO: IPv6 would need this to be changed
|
// TODO: IPv6 would need this to be changed
|
||||||
auto str = inet_ntop(AF_INET, static_cast<const void*>(reinterpret_cast<const struct sockaddr_in*>(&ClientConnection.SockAddr)), AddrBuf, sizeof(ClientConnection.SockAddr));
|
auto str = inet_ntop(AF_INET, reinterpret_cast<const void*>(&ClientConnection.SockAddr), AddrBuf, sizeof(ClientConnection.SockAddr));
|
||||||
|
beammp_trace("This thread is ip " + std::string(str));
|
||||||
Client->SetIdentifier("ip", str);
|
Client->SetIdentifier("ip", str);
|
||||||
|
|
||||||
std::string Rc;
|
std::string Rc;
|
||||||
|
|||||||
Reference in New Issue
Block a user