1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #pragma once
- #include <string>
- #include <curl/curl.h>
- #include "BBS2chProxyConnection.h"
- #include "BBS2chProxyHttpHeaders.h"
- #include "BBS2chProxyFormData.h"
- #include "BBS2chProxyURL.h"
- class IBBS2chProxyPoster {
- protected:
- std::string _url;
- BBS2chProxyHttpHeaders &_requestHeaders;
- BBS2chProxyFormData &_requestBody;
- std::string _host;
- std::string _board;
- std::string _thread;
- std::string _nic;
- std::string _forceProxy;
- long _verbose;
- void prepareHeadersAndBody();
- curl_slist* prepareCurlHandle(BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body, curl_slist* headersForCurl);
- void runLuaScript(BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body);
- public:
- BBS2chProxyConnection *connectionDelegate;
- std::string _userAgentForRequest;
- std::string _monaKeyForRequest;
- IBBS2chProxyPoster(BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body, BBS2chProxyConnection *delegate);
- virtual ~IBBS2chProxyPoster() {};
- virtual long post() = 0;
- };
- class BBS2chProxy5chPoster : public IBBS2chProxyPoster {
- protected:
- void makeSignature(BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body);
- public:
- bool _isFirstRun;
- int _status;
- bool _isResponseChunked;
- std::string _responseHeaders;
- BBS2chProxy5chPoster(BBS2chProxyURL &url, BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body, BBS2chProxyConnection *delegate);
- virtual ~BBS2chProxy5chPoster() {};
- virtual long post();
- };
- class BBS2chProxyTalkPoster : public IBBS2chProxyPoster {
- void makeSignature(BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body);
- public:
- BBS2chProxyTalkPoster(BBS2chProxyURL &url, BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body, BBS2chProxyConnection *delegate);
- virtual ~BBS2chProxyTalkPoster() {};
- virtual long post();
- };
- class BBS2chProxyTalkTo5chPoster : public BBS2chProxy5chPoster {
- public:
- BBS2chProxyTalkTo5chPoster(BBS2chProxyURL &url, BBS2chProxyHttpHeaders &headers, BBS2chProxyFormData &body, BBS2chProxyConnection *delegate);
- virtual ~BBS2chProxyTalkTo5chPoster() {};
- virtual long post();
- };
|