mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-19 03:57:14 +01:00
Implement user agent option in CPR.
This commit is contained in:
parent
1d6bca426b
commit
8db8ee4f33
@ -639,6 +639,7 @@ void Register_CURL(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("SetUnixSocket"), &CpSession::SetUnixSocket_)
|
.Func(_SC("SetUnixSocket"), &CpSession::SetUnixSocket_)
|
||||||
.Func(_SC("SetSslOptions"), &CpSession::SetSslOptions_)
|
.Func(_SC("SetSslOptions"), &CpSession::SetSslOptions_)
|
||||||
.Func(_SC("SetVerbose"), &CpSession::SetVerbose_)
|
.Func(_SC("SetVerbose"), &CpSession::SetVerbose_)
|
||||||
|
.FmtFunc(_SC("SetUserAgent"), &CpSession::SetUserAgent)
|
||||||
.FmtFunc(_SC("SetCookieFile"), &CpSession::SetCookieFile)
|
.FmtFunc(_SC("SetCookieFile"), &CpSession::SetCookieFile)
|
||||||
.FmtFunc(_SC("SetCookieJar"), &CpSession::SetCookieJar)
|
.FmtFunc(_SC("SetCookieJar"), &CpSession::SetCookieJar)
|
||||||
.Func(_SC("Delete"), &CpSession::DoDelete)
|
.Func(_SC("Delete"), &CpSession::DoDelete)
|
||||||
|
@ -1949,6 +1949,19 @@ struct CpSession : public cpr::Session
|
|||||||
return *this; // Allow chaining
|
return *this; // Allow chaining
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Modify the session cookie file name.
|
||||||
|
*/
|
||||||
|
CpSession & SetUserAgent(StackStrF & agent)
|
||||||
|
{
|
||||||
|
LockCheck();
|
||||||
|
if (cpr::Session::GetCurlHolder()->handle)
|
||||||
|
{
|
||||||
|
curl_easy_setopt(cpr::Session::GetCurlHolder()->handle, CURLOPT_USERAGENT, agent.mPtr);
|
||||||
|
} else STHROWF("Invalid CURL session");
|
||||||
|
return *this; // Allow chaining
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Modify the session cookie file name.
|
* Modify the session cookie file name.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user