mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 08:54:12 +08:00
33 lines
799 B
C++
33 lines
799 B
C++
#pragma once
|
|
|
|
#include "common.h"
|
|
#include <winhttp.h>
|
|
|
|
using InternetHandle = AutoHandle<Functor<WinHttpCloseHandle>>;
|
|
|
|
struct HttpRequest
|
|
{
|
|
HttpRequest(
|
|
const wchar_t* agentName,
|
|
const wchar_t* serverName,
|
|
const wchar_t* action,
|
|
const wchar_t* objectName,
|
|
DWORD requestFlags = WINHTTP_FLAG_SECURE | WINHTTP_FLAG_ESCAPE_DISABLE,
|
|
const wchar_t* httpVersion = NULL,
|
|
const wchar_t* referrer = NULL,
|
|
const wchar_t** acceptTypes = NULL,
|
|
const wchar_t* headers = NULL,
|
|
void* body = NULL,
|
|
DWORD bodyLength = 0
|
|
);
|
|
operator bool() { return errorCode == ERROR_SUCCESS; }
|
|
|
|
std::wstring response;
|
|
InternetHandle connection = NULL;
|
|
InternetHandle request = NULL;
|
|
DWORD errorCode = ERROR_SUCCESS;
|
|
};
|
|
|
|
std::wstring Escape(const std::wstring& text);
|
|
void Unescape(std::wstring& text);
|