86dcaa6650bc69009796c3bdcd7e078aa65976ae kent Tue Sep 24 17:43:01 2013 -0700 Adding cgiDictionary - something you can make from a cgi-encoded string. diff --git src/inc/cheapcgi.h src/inc/cheapcgi.h index 97236d0..26710b0 100644 --- src/inc/cheapcgi.h +++ src/inc/cheapcgi.h @@ -43,30 +43,46 @@ /* set handler for various terminal signals for logging purposes. * if dumpStack is TRUE, attempt to dump the stack. */ struct cgiVar /* Info on one cgi variable. */ { struct cgiVar *next; /* Next in list. */ char *name; /* Name - allocated in hash. */ char *val; /* Value - also not allocated here. */ boolean saved; /* True if saved. */ }; struct cgiVar* cgiVarList(); /* return the list of cgiVar's */ +struct cgiDictionary +/* Stuff to encapsulate parsed out CGI vars. */ + { + struct cgiDictionary *next; /* Next in list if we have multiple */ + char *stringData; /* Where values if cgi-vars live. */ + struct hash *hash; /* Keyed by cgi-var name, value is cgiVar */ + struct cgiVar *list; /* List of all vars. */ + }; + +void cgiDictionaryFree(struct cgiDictionary **pD); +/* Free up resources associated with dictionary. */ + +struct cgiDictionary *cgiDictionaryFromEncodedString(char *encodedString); +/* Giving a this=that&this=that string, return cgiDictionary parsed out from it. + * This does *not* destroy input like the lower level cgiParse functions do. */ + char *findCookieData(char *varName); /* Get the string associated with varName from the cookie string. */ void dumpCookieList(); /* Print out the cookie list. */ boolean cgiIsOnWeb(); /* Return TRUE if looks like we're being run as a CGI. */ char *cgiRequestMethod(); /* Return CGI REQUEST_METHOD (such as 'GET/POST/PUT/DELETE/HEAD') */ char *cgiRequestUri(); /* Return CGI REQUEST_URI */