1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Content-type support

This commit is contained in:
Brian Fiete 2021-10-13 12:09:57 -07:00
parent b3ef4be15d
commit 6303ad0c53
2 changed files with 16 additions and 1 deletions

View file

@ -876,7 +876,7 @@ namespace CURL
static extern int curl_easy_perform(void* curl);
[CLink, CallingConvention(.Stdcall)]
static extern void* curl_easy_getinfo(void* curl, Option option, void* ptr);
static extern void* curl_easy_getinfo(void* curl, CurlInfo info, void* ptr);
[CLink, CallingConvention(.Stdcall)]
static extern void* curl_easy_reset(void* curl);
@ -941,6 +941,16 @@ namespace CURL
return WrapResult((ReturnCode)curl_easy_setopt(mCURL, (int)option, (int)funcPtr));
}
public Result<void> GetInfo(CurlInfo info, String val)
{
char8* ptr = null;
curl_easy_getinfo(mCURL, info, &ptr);
if (ptr == null)
return .Err;
val.Append(ptr);
return .Ok;
}
public Result<void, ReturnCode> Perform()
{
return WrapResult((ReturnCode)curl_easy_perform(mCURL));

View file

@ -195,6 +195,11 @@ namespace CURL
return mResult;
}
public void GetContentType(String outContentType)
{
mCurl.GetInfo(.ContentType, outContentType);
}
public void Cancel(bool wait = false)
{
mCancelling = true;