cache memory ID

This commit is contained in:
Kelvin Sherlock 2012-08-26 17:54:18 -04:00
parent 1d8bed53a7
commit ab26d38790
1 changed files with 14 additions and 3 deletions

17
http.c
View File

@ -429,6 +429,7 @@ static int do_http_1_1(
Handle dict;
DictionaryEnumerator e;
Word cookie;
Word MyID = MMStartUp();
int ok;
char *cp;
@ -437,7 +438,7 @@ static int do_http_1_1(
// html headers.
// (not really needed until 1.1)
dict = DictionaryCreate(MMStartUp(), 2048);
dict = DictionaryCreate(MyID, 2048);
length = components->host.length;
cp = url + components->host.location;
@ -497,19 +498,22 @@ static int do_http_1_1(
DisposeHandle(dict);
dict = NULL;
dict = DictionaryCreate(MMStartUp(), 2048);
dict = DictionaryCreate(MyID, 2048);
ok = parseHeaders(ipid, file, dict);
// todo -- check the headers for content length, transfer-encoding.
//
#if 0
cookie = 0;
while ((cookie = DictionaryEnumerate(dict, &e, cookie)))
{
s16_debug_printf("%.*s -> %.*s",
e.keySize, e.key, e.valueSize, e.value);
}
#endif
if (ok == 200)
{
if (!flags._I)
@ -591,6 +595,13 @@ int do_http(const char *url, URLComponents *components)
}
// todo -- write to a tmp file rather than the named file.
// this will allow things like If-Modified-Since or If-None-Match
// so it only updates if changed.
// or -C continue to append
// -N -- if-modified-since header.
if (filename)
{
file = fopen(filename, "w");