mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-22 12:47:13 +01:00
Implement cookie file/jar.
This commit is contained in:
parent
a152fd2600
commit
1d6bca426b
@ -638,7 +638,9 @@ void Register_CURL(HSQUIRRELVM vm)
|
|||||||
.Func(_SC("SetVerifySsl"), &CpSession::SetVerifySsl_)
|
.Func(_SC("SetVerifySsl"), &CpSession::SetVerifySsl_)
|
||||||
.Func(_SC("SetUnixSocket"), &CpSession::SetUnixSocket_)
|
.Func(_SC("SetUnixSocket"), &CpSession::SetUnixSocket_)
|
||||||
.Func(_SC("SetSslOptions"), &CpSession::SetSslOptions_)
|
.Func(_SC("SetSslOptions"), &CpSession::SetSslOptions_)
|
||||||
.FmtFunc(_SC("SetVerbose"), &CpSession::SetVerbose_)
|
.Func(_SC("SetVerbose"), &CpSession::SetVerbose_)
|
||||||
|
.FmtFunc(_SC("SetCookieFile"), &CpSession::SetCookieFile)
|
||||||
|
.FmtFunc(_SC("SetCookieJar"), &CpSession::SetCookieJar)
|
||||||
.Func(_SC("Delete"), &CpSession::DoDelete)
|
.Func(_SC("Delete"), &CpSession::DoDelete)
|
||||||
.Func(_SC("Get"), &CpSession::DoGet)
|
.Func(_SC("Get"), &CpSession::DoGet)
|
||||||
.Func(_SC("Head"), &CpSession::DoHead)
|
.Func(_SC("Head"), &CpSession::DoHead)
|
||||||
|
@ -1949,6 +1949,32 @@ struct CpSession : public cpr::Session
|
|||||||
return *this; // Allow chaining
|
return *this; // Allow chaining
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Modify the session cookie file name.
|
||||||
|
*/
|
||||||
|
CpSession & SetCookieFile(StackStrF & filename)
|
||||||
|
{
|
||||||
|
LockCheck();
|
||||||
|
if (cpr::Session::GetCurlHolder()->handle)
|
||||||
|
{
|
||||||
|
curl_easy_setopt(cpr::Session::GetCurlHolder()->handle, CURLOPT_COOKIEFILE, filename.mPtr);
|
||||||
|
} else STHROWF("Invalid CURL session");
|
||||||
|
return *this; // Allow chaining
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Modify the session cookie jar name.
|
||||||
|
*/
|
||||||
|
CpSession & SetCookieJar(StackStrF & filename)
|
||||||
|
{
|
||||||
|
LockCheck();
|
||||||
|
if (cpr::Session::GetCurlHolder()->handle)
|
||||||
|
{
|
||||||
|
curl_easy_setopt(cpr::Session::GetCurlHolder()->handle, CURLOPT_COOKIEJAR, filename.mPtr);
|
||||||
|
} else STHROWF("Invalid CURL session");
|
||||||
|
return *this; // Allow chaining
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Delete request.
|
* Delete request.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user