rodecomp/Source/Network/Http/CURLPostHander.cpp
ragnarok-clanker e168b4e4a6 Restore translation-unit ownership and publish verified source corrections
Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas.

449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
2026-10-25 15:42:21 +00:00

86 lines
2.4 KiB
C++

#include "Network/Http/CURLPostHander.h"
#include <utility>
// OFFSET: 0x005E9600
// FUNCTION: fn_03955
CCURLPostHander::CCURLPostHander(std::string url)
: m_enabled(false), m_url(std::move(url)), m_headers(nullptr), m_last(nullptr), m_form(nullptr), m_easy(nullptr) {
this->m_easy = g_curlMgr->easyInit();
if (this->m_easy) {
this->m_headers = g_curlMgr->slistAppend(this->m_headers, "Content-Type: multipart/form-data");
this->m_headers = g_curlMgr->slistAppend(this->m_headers, "Expect: 100-continue");
this->m_headers = g_curlMgr->slistAppend(this->m_headers, "Connection: keep-alive");
this->m_enabled = true;
}
}
// OFFSET: 0x005E9710
// OFFSET: 0x005E97D0
// FUNCTION: fn_03956
CCURLPostHander::~CCURLPostHander() {
if (this->m_easy) {
g_curlMgr->easyCleanup(this->m_easy);
this->m_easy = nullptr;
}
if (this->m_form) {
g_curlMgr->formFree(this->m_form);
this->m_form = nullptr;
}
if (this->m_headers) {
g_curlMgr->slistFreeAll(this->m_headers);
this->m_headers = nullptr;
}
}
// OFFSET: 0x005E9960
// FUNCTION: fn_03958
int CCURLPostHander::AddField(std::string name, std::string value, int type) {
return g_curlMgr->formAdd(&this->m_form, &this->m_last, 1, name.c_str(), type, value.c_str(), 17);
}
// OFFSET: 0x005E9AF0
// FUNCTION: fn_03961
std::size_t __cdecl CCURLPostHander::WriteResponse(char* data, std::size_t size, std::size_t count, std::string* response) {
if (!response) {
return 0;
}
response->append(data, size * count);
return size * count;
}
// OFFSET: 0x005E9A20
// FUNCTION: fn_03960
int CCURLPostHander::Perform() {
if (!this->m_easy) {
return 2;
}
g_curlMgr->easySetopt(this->m_easy, 10002, this->m_url.c_str());
g_curlMgr->easySetopt(this->m_easy, 10023, this->m_headers);
g_curlMgr->easySetopt(this->m_easy, 47, 1L);
g_curlMgr->easySetopt(this->m_easy, 10024, this->m_form);
g_curlMgr->easySetopt(this->m_easy, 20011, WriteResponse);
g_curlMgr->easySetopt(this->m_easy, 10001, &this->m_response);
g_curlMgr->easySetopt(this->m_easy, 13, 3L);
g_curlMgr->easySetopt(this->m_easy, 78, 3L);
return g_curlMgr->easyPerform(this->m_easy);
}
// OFFSET: 0x005E99F0
// FUNCTION: fn_03959
long CCURLPostHander::ResponseCode() {
long code;
g_curlMgr->easyGetinfo(this->m_easy, 2097154, &code);
return code;
}
// OFFSET: 0x005CDD40
// FUNCTION: fn_03679
std::string CCURLPostHander::Response() const {
return this->m_response;
}