Hans Leidekker (@hans) commented about dlls/winhttp/session.c:
char *tmp, *buffer = NULL;
BOOL cached = FALSE;
*out_size = 0;
AcquireSRWLockExclusive( &cache_lock );
if (cached_url && !wcscmp( cached_url, url ) && GetTickCount() - cache_update_time < 60000)
{
cached = TRUE;
if (cached_script && (buffer = malloc( cached_script_size )))
{
memcpy( buffer, cached_script, cached_script_size );
*out_size = cached_script_size;
}
}
ReleaseSRWLockExclusive( &cache_lock );
I guess we should use GetTickCount64() just in case someone runs a process for more than 49 days :-) This function is getting large, maybe you could introduce some helpers to cache and retrieve the script?