g_free (_header);
}
-/**
- * zak_cgi_main_get_env:
- * @zakcgimain:
- *
- * Returns: a #GHashTable with all the environment variables as #GValue.
- */
-GHashTable
-*zak_cgi_main_get_env (ZakCgiMain *zakcgimain)
+static GHashTable
+*_zak_cgi_main_get_env (ZakCgiMain *zakcgimain)
{
ZakCgiMainPrivate *priv;
GHashTable *ht;
return ht;
}
+/**
+ * zak_cgi_main_get_env:
+ * @zakcgimain:
+ *
+ * Returns: a #GHashTable with all the environment variables as #GValue.
+ */
+G_DEPRECATED_FOR (zak_cgi_main_get_env_field)
+GHashTable
+*zak_cgi_main_get_env (ZakCgiMain *zakcgimain)
+{
+ return _zak_cgi_main_get_env (zakcgimain);
+}
+
+/**
+ * zak_cgi_main_get_env_field:
+ * @zakcgimain:
+ * @field:
+ *
+ * Returns:
+ */
+GValue
+*zak_cgi_main_get_env_field (ZakCgiMain *zakcgimain, const gchar *field)
+{
+ ZakCgiMainPrivate *priv;
+
+ GHashTable *ht;
+
+ GValue *ret;
+
+ g_return_val_if_fail (ZAK_CGI_IS_MAIN (zakcgimain), NULL);
+
+ ht = _zak_cgi_main_get_env (zakcgimain);
+
+ ret = g_hash_table_lookup (ht, field);
+
+ return ret;
+}
+
+/**
+ * zak_cgi_main_env_foreach:
+ * @zakcgimain:
+ * @func:
+ * @user_data:
+ *
+ */
+void
+zak_cgi_main_env_foreach (ZakCgiMain *zakcgimain, GHFunc func, gpointer user_data)
+{
+ ZakCgiMainPrivate *priv;
+
+ GHashTable *ht;
+
+ g_return_if_fail (ZAK_CGI_IS_MAIN (zakcgimain));
+ g_return_if_fail (func != NULL);
+
+ ht = _zak_cgi_main_get_env (zakcgimain);
+
+ g_hash_table_foreach (ht, func, user_data);
+}
+
/**
* zak_cgi_main_dump_env:
* @zakcgimain:
*
* Returns: an html table with each environment variables.
*/
+G_DEPRECATED_FOR (zak_cgi_main_env_foreach)
gchar
*zak_cgi_main_dump_env (ZakCgiMain *zakcgimain)
{
gpointer key;
gpointer value;
- ht_env = zak_cgi_main_get_env (zakcgimain);
+ ht_env = _zak_cgi_main_get_env (zakcgimain);
str = g_string_new ("");
priv->ht_cookies = g_hash_table_ref (ht);
}
- ht_env = zak_cgi_main_get_env (zakcgimain);
+ ht_env = _zak_cgi_main_get_env (zakcgimain);
cookies = g_hash_table_lookup (ht_env, "HTTP_COOKIE");
if (cookies != NULL)
&& !g_str_has_prefix (url, "https://")
&& !g_str_has_prefix (url, "ftp://"))
{
- ht_env = zak_cgi_main_get_env (zakcgimain);
+ ht_env = _zak_cgi_main_get_env (zakcgimain);
value = (gchar *)g_hash_table_lookup (ht_env, "REQUEST_SCHEME");
if (value != NULL)
ret = FALSE;
- ht = zak_cgi_main_get_env (zakcgimain);
+ ht = _zak_cgi_main_get_env (zakcgimain);
param = (gchar *)g_hash_table_lookup (ht, "REQUEST_METHOD");
if (param != NULL)
{
void zak_cgi_main_out (const gchar *header, const gchar *body);
GHashTable *zak_cgi_main_get_env (ZakCgiMain *zakcgimain);
+GValue *zak_cgi_main_get_env_field (ZakCgiMain *zakcgimain, const gchar *field);
+void zak_cgi_main_env_foreach (ZakCgiMain *zakcgimain, GHFunc func, gpointer user_data);
gchar *zak_cgi_main_dump_env (ZakCgiMain *zakcgimain);
GHashTable *zak_cgi_main_get_cookies (ZakCgiMain *zakcgimain);