mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
Minor lib changes
This commit is contained in:
parent
9d125eaaf2
commit
891e4fd789
4 changed files with 58 additions and 0 deletions
|
@ -865,6 +865,15 @@ namespace CURL
|
|||
[CLink, CallingConvention(.Stdcall)]
|
||||
static extern void* curl_easy_init();
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
static extern void curl_free(void* ptr);
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
static extern char8* curl_easy_escape(void* curl, char8* str, int32 length);
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
static extern char8* curl_easy_unescape(void* curl, char8* input, int32 inlength, int32* outlength);
|
||||
|
||||
[CLink, CallingConvention(.Stdcall)]
|
||||
static extern int curl_easy_setopt(void* curl, int option, int optVal);
|
||||
|
||||
|
@ -984,5 +993,26 @@ namespace CURL
|
|||
{
|
||||
curl_slist_free_all(list);
|
||||
}
|
||||
|
||||
public void Escape(StringView str, String outStr)
|
||||
{
|
||||
char8* ptr = curl_easy_escape(mCURL, str.Ptr, (.)str.Length);
|
||||
if (ptr != null)
|
||||
{
|
||||
outStr.Append(ptr);
|
||||
curl_free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unescape(StringView str, String outStr)
|
||||
{
|
||||
int32 outLen = 0;
|
||||
char8* ptr = curl_easy_unescape(mCURL, str.Ptr, (.)str.Length, &outLen);
|
||||
if (ptr != null)
|
||||
{
|
||||
outStr.Append(ptr, outLen);
|
||||
curl_free(ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -161,6 +161,22 @@ namespace CURL
|
|||
mCurl.SetOpt(.Postfields, param);
|
||||
}
|
||||
|
||||
public void Escape(StringView str, String outStr)
|
||||
{
|
||||
mCurl.Escape(str, outStr);
|
||||
}
|
||||
|
||||
public void Unescape(StringView str, String outStr)
|
||||
{
|
||||
int startPos = outStr.Length;
|
||||
|
||||
mCurl.Unescape(str, outStr);
|
||||
|
||||
for (int i = startPos; i < outStr.Length; i++)
|
||||
if (outStr[i] == '+')
|
||||
outStr[i] = ' ';
|
||||
}
|
||||
|
||||
public Result<Span<uint8>> Perform()
|
||||
{
|
||||
if (mHeaderList != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue