You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.1 KiB

  3. #ifndef _LIGHTTPD_BASE_H_
  4. #error Please include <lighttpd/base.h> instead of this file
  5. #endif
  6. typedef struct liEnvironment liEnvironment;
  7. typedef struct liEnvironmentDup liEnvironmentDup;
  8. struct liEnvironment {
  9. GHashTable *table;
  10. };
  11. /* read only duplicate of a real environment: use it to remember which
  12. env vars you already sent (mod_fastcgi) */
  13. struct liEnvironmentDup {
  14. GHashTable *table;
  15. };
  16. LI_API void li_environment_init(liEnvironment *env); /* create table */
  17. LI_API void li_environment_reset(liEnvironment *env); /* remove all entries */
  18. LI_API void li_environment_clear(liEnvironment *env); /* destroy table */
  19. /* overwrite previous value */
  20. LI_API void li_environment_set(liEnvironment *env, const gchar *key, size_t keylen, const gchar *val, size_t valuelen);
  21. /* do not overwrite */
  22. LI_API void li_environment_insert(liEnvironment *env, const gchar *key, size_t keylen, const gchar *val, size_t valuelen);
  23. LI_API void li_environment_remove(liEnvironment *env, const gchar *key, size_t keylen);
  24. LI_API GString* li_environment_get(liEnvironment *env, const gchar *key, size_t keylen);
  25. /* create (data) read only copy of a environment; don't modify the real environment
  26. while using the duplicate */
  27. LI_API liEnvironmentDup* li_environment_make_dup(liEnvironment *env);
  28. LI_API void li_environment_dup_free(liEnvironmentDup *envdup);
  29. /* remove an entry (this is allowed - it doesn't modify anything in the original environment);
  30. you must not modify the returned GString */
  31. LI_API GString* li_environment_dup_pop(liEnvironmentDup *envdup, const gchar *key, size_t keylen);
  32. typedef void (*liAddEnvironmentCB)(gpointer param, const gchar *key, size_t keylen, const gchar *val, size_t valuelen);
  33. /* calls callback for various CGI environment variables to add; if the variable is also present
  34. in envdup, the value from envdup is used instead for the callback and it is popped from envdup.
  35. Also adds all remaining values from envdup via callback, and then frees envdup. */
  36. LI_API void li_environment_dup2cgi(liVRequest *vr, liEnvironmentDup *envdup, liAddEnvironmentCB callback, gpointer param);
  37. #endif