//-------------------------------------------------------------------- void GSWHTTPRequest_AddHeader(GSWHTTPRequest *p_pHTTPRequest, CONST char *p_pszKey, CONST char *p_pszValue) { CONST char *pszCustomKey=GSWebHeaderForHTTPHeader(p_pszKey); CONST char *pszHeaderKey=(pszCustomKey) ? pszCustomKey : p_pszKey; if (!p_pHTTPRequest->pHeaders) p_pHTTPRequest->pHeaders = GSWDict_New(64); // Search Content Length if (p_pHTTPRequest->eMethod==ERequestMethod_Post && p_pHTTPRequest->uContentLength==0 && strcasecmp(pszHeaderKey,g_szHeader_ContentLength)==0) p_pHTTPRequest->uContentLength = atoi(p_pszValue); GSWDict_AddString(p_pHTTPRequest->pHeaders,pszHeaderKey,p_pszValue,FALSE); };
//-------------------------------------------------------------------- PSTHostent GSWUtil_FindHost(CONST char *p_pszHost, void *p_pLogServerData) { PSTHostent pHost=NULL; if (!p_pszHost) p_pszHost="localhost"; pHost = (g_pHostCache) ? (PSTHostent)GSWDict_ValueForKey(g_pHostCache,p_pszHost) : NULL; if (!pHost) { pHost = GSWUtil_HostLookup(p_pszHost,p_pLogServerData); if (pHost) { if (!g_pHostCache) g_pHostCache = GSWDict_New(32); GSWDict_Add(g_pHostCache,p_pszHost,pHost,TRUE); GSWDebugLog(p_pLogServerData,"Caching hostent for %s",p_pszHost); }; }; return pHost; };