1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-05 07:45:59 +02:00

Support custom headers

This commit is contained in:
Brian Fiete 2022-04-02 07:24:43 -07:00
parent d1902c4926
commit 560a7eb7a7
2 changed files with 36 additions and 0 deletions

View file

@ -860,6 +860,8 @@ namespace CURL
HTTP2Stream, /* 92 - stream error in HTTP/2 framing layer */
}
public struct SList;
[CLink, CallingConvention(.Stdcall)]
static extern void* curl_easy_init();
@ -881,6 +883,12 @@ namespace CURL
[CLink, CallingConvention(.Stdcall)]
static extern void* curl_easy_reset(void* curl);
[CLink, CallingConvention(.Stdcall)]
static extern SList* curl_slist_append(SList* list, char8* val);
[CLink, CallingConvention(.Stdcall)]
static extern void curl_slist_free_all(SList* list);
void* mCURL;
public this()
@ -941,6 +949,12 @@ namespace CURL
return WrapResult((ReturnCode)curl_easy_setopt(mCURL, (int)option, (int)funcPtr));
}
public Result<void, ReturnCode> SetOpt(Option option, SList* list)
{
Debug.Assert(((int)option / 10000 == 1));
return WrapResult((ReturnCode)curl_easy_setopt(mCURL, (int)option, (int)(void*)list));
}
public Result<void> GetInfo(CurlInfo info, String val)
{
char8* ptr = null;
@ -960,5 +974,15 @@ namespace CURL
{
curl_easy_reset(mCURL);
}
public SList* Add(SList* list, StringView val)
{
return curl_slist_append(list, val.ToScopeCStr!());
}
public void Free(SList* list)
{
curl_slist_free_all(list);
}
}
}