forked from wolfSSL/wolfssl
wolfIO_HttpBuildRequest_ex
This commit is contained in:
20
src/wolfio.c
20
src/wolfio.c
@ -1139,11 +1139,17 @@ int wolfIO_HttpProcessResponse(int sfd, const char** appStrList,
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int wolfIO_HttpBuildRequest(const char* reqType, const char* domainName,
|
||||
const char* path, int pathLen, int reqSz, const char* contentType,
|
||||
const char* exHdrs, byte* buf, int bufSize)
|
||||
int wolfIO_HttpBuildRequest(const char *reqType, const char *domainName,
|
||||
const char *path, int pathLen, int reqSz, const char *contentType,
|
||||
byte *buf, int bufSize)
|
||||
{
|
||||
return wolfIO_HttpBuildRequest_ex(reqType, domainName, path, pathLen, reqSz, contentType, "", buf, bufSize);
|
||||
}
|
||||
|
||||
int wolfIO_HttpBuildRequest_ex(const char *reqType, const char *domainName,
|
||||
const char *path, int pathLen, int reqSz, const char *contentType,
|
||||
const char *exHdrs, byte *buf, int bufSize)
|
||||
{
|
||||
word32 reqTypeLen, domainNameLen, reqSzStrLen, contentTypeLen, exHdrsLen, maxLen;
|
||||
char reqSzStr[6];
|
||||
char* req = (char*)buf;
|
||||
@ -1152,7 +1158,7 @@ int wolfIO_HttpBuildRequest(const char* reqType, const char* domainName,
|
||||
const char* hostStr = "\r\nHost: ";
|
||||
const char* contentLenStr = "\r\nContent-Length: ";
|
||||
const char* contentTypeStr = "\r\nContent-Type: ";
|
||||
const char *singleCrLfStr = "\r\n";
|
||||
const char* singleCrLfStr = "\r\n";
|
||||
const char* doubleCrLfStr = "\r\n\r\n";
|
||||
word32 blankStrLen, http11StrLen, hostStrLen, contentLenStrLen,
|
||||
contentTypeStrLen, singleCrLfStrLen, doubleCrLfStrLen;
|
||||
@ -1250,7 +1256,7 @@ int wolfIO_HttpBuildRequestOcsp(const char* domainName, const char* path,
|
||||
int ocspReqSz, byte* buf, int bufSize)
|
||||
{
|
||||
const char *cacheCtl = "Cache-Control: no-cache";
|
||||
return wolfIO_HttpBuildRequest("POST", domainName, path, (int)XSTRLEN(path),
|
||||
return wolfIO_HttpBuildRequest_ex("POST", domainName, path, (int)XSTRLEN(path),
|
||||
ocspReqSz, "application/ocsp-request", cacheCtl, buf, bufSize);
|
||||
}
|
||||
|
||||
@ -1364,7 +1370,7 @@ int wolfIO_HttpBuildRequestCrl(const char* url, int urlSz,
|
||||
const char* domainName, byte* buf, int bufSize)
|
||||
{
|
||||
const char *cacheCtl = "Cache-Control: no-cache";
|
||||
return wolfIO_HttpBuildRequest("GET", domainName, url, urlSz, 0, "",
|
||||
return wolfIO_HttpBuildRequest_ex("GET", domainName, url, urlSz, 0, "",
|
||||
cacheCtl, buf, bufSize);
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,10 @@ WOLFSSL_API int BioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
|
||||
|
||||
WOLFSSL_API int wolfIO_HttpBuildRequest(const char* reqType,
|
||||
const char* domainName, const char* path, int pathLen, int reqSz,
|
||||
const char* contentType, const char* exHdrs, unsigned char* buf, int bufSize);
|
||||
const char* contentType, unsigned char* buf, int bufSize);
|
||||
WOLFSSL_LOCAL int wolfIO_HttpBuildRequest_ex(const char* reqType,
|
||||
const char* domainName, const char* path, int pathLen, int reqSz,
|
||||
const char* contentType, const char *exHdrs, unsigned char* buf, int bufSize);
|
||||
WOLFSSL_API int wolfIO_HttpProcessResponse(int sfd, const char** appStrList,
|
||||
unsigned char** respBuf, unsigned char* httpBuf, int httpBufSz,
|
||||
int dynType, void* heap);
|
||||
|
Reference in New Issue
Block a user