diff options
author | rhaas <rhaas@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2012-07-08 17:33:35 +0000 |
---|---|---|
committer | rhaas <rhaas@1faa4e14-9dd3-4be0-9f0e-ffe519881164> | 2012-07-08 17:33:35 +0000 |
commit | 4d7166d432e2a70a381c580168cfcb6cebe3cd09 (patch) | |
tree | 16dbb9406ace92c8bd2b7470419af290d8c36ca5 /src/http.c | |
parent | 5902f85515e0f596cb3c403aae12309d1f86faaf (diff) |
use C++ map instead of Cactus hash to store page contents
this is because the hash size can get out of hand (GBs)
git-svn-id: http://svn.cactuscode.org/arrangements/CactusConnect/HTTPD/trunk@251 1faa4e14-9dd3-4be0-9f0e-ffe519881164
Diffstat (limited to 'src/http.c')
-rw-r--r-- | src/http.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -32,7 +32,7 @@ #include "util_String.h" #include "httpd.h" -#include "util_Hash.h" +#include "httpd_Map.h" #include "SString_Namespace.h" static const char *rcsid = "$Header$"; @@ -78,12 +78,12 @@ typedef struct httpRequestTag void *connection; /* The request header lines */ - uHash *headers; + uMap headers; /* Stuff for arguments */ /* First a hash table to look the data up quickly */ - uHash *arguments; + uMap arguments; /* Now a linked list to allow walking. */ httpArg *firstarg; @@ -327,7 +327,7 @@ const char *HTTP_ArgumentValue(const httpRequest *request, const char *arg) { if(request->arguments) { - const httpArg *value = (httpArg *)Util_HashData(request->arguments, strlen(arg), arg, 0); + const httpArg *value = (httpArg *)Httpd_MapData(request->arguments, strlen(arg), arg); if(value) { @@ -386,7 +386,7 @@ const char *HTTP_HeaderValue(const httpRequest *request, const char *header) if(request->headers) { - header_line = Util_HashData(request->headers, strlen(header), header, 0); + header_line = Httpd_MapData(request->headers, strlen(header), header); if(header_line) { @@ -637,13 +637,13 @@ static int AddHeader(httpRequest *request, const char *line) if(!request->headers) { /* Need to create the hash table */ - request->headers = Util_HashCreate(INITIAL_SIZE); + request->headers = Httpd_MapCreate(); } if(request->headers) { /* Does the line already exist ? */ - header_line = (struct httpHeader *)Util_HashData(request->headers, keylength, line, 0); + header_line = (struct httpHeader *)Httpd_MapData(request->headers, keylength, line); if(header_line) { @@ -672,7 +672,7 @@ static int AddHeader(httpRequest *request, const char *line) { strcpy(header_line->line, value); - Util_HashStore(request->headers, keylength, line, 0, (void *)header_line); + Httpd_MapStore(request->headers, keylength, line, (void *)header_line); } } } @@ -708,7 +708,7 @@ static int StripArgs(httpRequest *request, char *request_uri) *position = 0; /* Create the hash table */ - request->arguments = Util_HashCreate(INITIAL_SIZE); + request->arguments = Httpd_MapCreate(); /* Parse the argument list */ position++; @@ -743,7 +743,7 @@ static int StripArgs(httpRequest *request, char *request_uri) argument->arg = Util_Strdup(token); argument->value = Util_Strdup(value); - if((stored = (httpArg *)Util_HashData(request->arguments, strlen(token), token, 0))) + if((stored = (httpArg *)Httpd_MapData(request->arguments, strlen(token), token))) { /* Argument already exists */ @@ -759,7 +759,7 @@ static int StripArgs(httpRequest *request, char *request_uri) } else { - Util_HashStore(request->arguments, strlen(token), token, 0, (void *)argument); + Httpd_MapStore(request->arguments, strlen(token), token, (void *)argument); request->n_arguments++; } /* Append to global list. */ @@ -857,12 +857,12 @@ static int ClearRequest(httpRequest *request) { if(request->arguments) { - Util_HashDestroy(request->arguments, (void (*)(void *))DestroyArgument); + Httpd_MapDestroy(request->arguments, (void (*)(void *))DestroyArgument); } if(request->headers) { - Util_HashDestroy(request->headers, (void (*)(void *))DestroyHeader); + Httpd_MapDestroy(request->headers, (void (*)(void *))DestroyHeader); } return 0; |