Merge pull request #301 from ksanislo/master

Add httpcSetKeepAlive() to turn HTTP Keep-Alive on and off
This commit is contained in:
fincs 2016-07-27 20:27:46 +02:00 committed by GitHub
commit 71cdc3cdbc
2 changed files with 27 additions and 0 deletions

View File

@ -25,6 +25,12 @@ typedef enum {
HTTPC_STATUS_DOWNLOAD_READY = 0x7 ///< Download ready.
} HTTPC_RequestStatus;
/// HTTP KeepAlive option.
typedef enum {
HTTPC_KEEPALIVE_DISABLED = 0x0,
HTTPC_KEEPALIVE_ENABLED = 0x1
} HTTPC_KeepAlive;
/// Result code returned when a download is pending.
#define HTTPC_RESULTCODE_DOWNLOADPENDING 0xd840a02b
@ -252,3 +258,10 @@ Result httpcCloseClientCertContext(u32 ClientCert_contexthandle);
*/
Result httpcDownloadData(httpcContext *context, u8* buffer, u32 size, u32 *downloadedsize);
/**
* @brief Sets Keep-Alive for the context.
* @param context Context to set the KeepAlive flag on.
* @param option HTTPC_KeepAlive option.
*/
Result httpcSetKeepAlive(httpcContext *context, HTTPC_KeepAlive option);

View File

@ -649,3 +649,17 @@ Result httpcCloseClientCertContext(u32 ClientCert_contexthandle)
return cmdbuf[1];
}
Result httpcSetKeepAlive(httpcContext *context, HTTPC_KeepAlive option)
{
u32* cmdbuf=getThreadCommandBuffer();
cmdbuf[0]=IPC_MakeHeader(0x37,2,0); // 0x370080
cmdbuf[1]=context->httphandle;
cmdbuf[2]=option;
Result ret=0;
if(R_FAILED(ret=svcSendSyncRequest(context->servhandle)))return ret;
return cmdbuf[1];
}