static void add_cookie_info_to_string(struct string *string, struct cookie *cookie, struct terminal *term) { add_format_to_string(string, "\n%s: %s", _("Name", term), cookie->name); add_format_to_string(string, "\n%s: %s", _("Value", term), cookie->value); add_format_to_string(string, "\n%s: %s", _("Domain", term), cookie->domain); add_format_to_string(string, "\n%s: %s", _("Path", term), cookie->path); if (!cookie->expires) { add_format_to_string(string, "\n%s: ", _("Expires", term)); add_to_string(string, _("at quit time", term)); #ifdef HAVE_STRFTIME } else { add_format_to_string(string, "\n%s: ", _("Expires", term)); add_date_to_string(string, get_opt_str((const unsigned char *)"ui.date_format", NULL), &cookie->expires); #endif } add_format_to_string(string, "\n%s: %s", _("Secure", term), _(cookie->secure ? N_("yes") : N_("no"), term)); }
static unsigned char * get_cache_entry_info(struct listbox_item *item, struct terminal *term) { struct cache_entry *cached = item->udata; struct string msg; if (item->type == BI_FOLDER) return NULL; if (!init_string(&msg)) return NULL; add_to_string(&msg, _("URL", term)); add_to_string(&msg, ": "); add_uri_to_string(&msg, cached->uri, URI_PUBLIC); /* No need to use compare_uri() here we only want to check whether they * point to the same URI. */ if (cached->proxy_uri != cached->uri) { add_format_to_string(&msg, "\n%s: ", _("Proxy URL", term)); add_uri_to_string(&msg, cached->proxy_uri, URI_PUBLIC); } if (cached->redirect) { add_format_to_string(&msg, "\n%s: ", _("Redirect", term)); add_uri_to_string(&msg, cached->redirect, URI_PUBLIC); if (cached->redirect_get) { add_to_string(&msg, " (GET)"); } } add_format_to_string(&msg, "\n%s: %" OFF_T_FORMAT, _("Size", term), cached->length); add_format_to_string(&msg, "\n%s: %" OFF_T_FORMAT, _("Loaded size", term), cached->data_size); if (cached->content_type) { add_format_to_string(&msg, "\n%s: %s", _("Content type", term), cached->content_type); } if (cached->last_modified) { add_format_to_string(&msg, "\n%s: %s", _("Last modified", term), cached->last_modified); } if (cached->etag) { add_format_to_string(&msg, "\n%s: %s", "ETag", cached->etag); } if (cached->ssl_info) { add_format_to_string(&msg, "\n%s: %s", _("SSL Cipher", term), cached->ssl_info); } if (cached->encoding_info) { add_format_to_string(&msg, "\n%s: %s", _("Encoding", term), cached->encoding_info); } if (cached->incomplete || !cached->valid) { add_char_to_string(&msg, '\n'); add_to_string(&msg, _("Flags", term)); add_to_string(&msg, ": "); if (cached->incomplete) { add_to_string(&msg, _("incomplete", term)); add_char_to_string(&msg, ' '); } if (!cached->valid) add_to_string(&msg, _("invalid", term)); } #ifdef HAVE_STRFTIME if (cached->expire) { time_t expires = timeval_to_seconds(&cached->max_age); add_format_to_string(&msg, "\n%s: ", _("Expires", term)); add_date_to_string(&msg, get_opt_str("ui.date_format"), &expires); } #endif #ifdef CONFIG_DEBUG add_format_to_string(&msg, "\n%s: %d", "Refcount", get_object_refcount(cached)); add_format_to_string(&msg, "\n%s: %u", _("ID", term), cached->id); if (cached->head && *cached->head) { add_format_to_string(&msg, "\n%s:\n\n%s", _("Header", term), cached->head); } #endif return msg.source; }
static unsigned char * get_cache_entry_info(struct listbox_item *item, struct terminal *term) { struct cache_entry *cached = item->udata; struct string msg; if (item->type == BI_FOLDER) return NULL; if (!init_string(&msg)) return NULL; add_to_string(&msg, _("URL", term)); add_to_string(&msg, ": "); add_uri_to_string(&msg, cached->uri, URI_PUBLIC); /* No need to use compare_uri() here we only want to check whether they * point to the same URI. */ if (cached->proxy_uri != cached->uri) { add_format_to_string(&msg, "\n%s: ", _("Proxy URL", term)); add_uri_to_string(&msg, cached->proxy_uri, URI_PUBLIC); } if (cached->redirect) { add_format_to_string(&msg, "\n%s: ", _("Redirect", term)); add_uri_to_string(&msg, cached->redirect, URI_PUBLIC); if (cached->redirect_get) { add_to_string(&msg, " (GET)"); } } add_format_to_string(&msg, "\n%s: %" OFF_PRINT_FORMAT, _("Size", term), (off_print_T) cached->length); add_format_to_string(&msg, "\n%s: %" OFF_PRINT_FORMAT, _("Loaded size", term), (off_print_T) cached->data_size); if (cached->content_type) { add_format_to_string(&msg, "\n%s: %s", _("Content type", term), cached->content_type); } if (cached->last_modified) { add_format_to_string(&msg, "\n%s: %s", _("Last modified", term), cached->last_modified); } if (cached->etag) { add_format_to_string(&msg, "\n%s: %s", "ETag", cached->etag); } if (cached->ssl_info) { add_format_to_string(&msg, "\n%s: %s", _("SSL Cipher", term), cached->ssl_info); } if (cached->encoding_info) { add_format_to_string(&msg, "\n%s: %s", _("Encoding", term), cached->encoding_info); } if (cached->incomplete || !cached->valid) { add_char_to_string(&msg, '\n'); add_to_string(&msg, _("Flags", term)); add_to_string(&msg, ": "); if (cached->incomplete) { add_to_string(&msg, _("incomplete", term)); add_char_to_string(&msg, ' '); } if (!cached->valid) add_to_string(&msg, _("invalid", term)); } #ifdef HAVE_STRFTIME if (cached->expire) { time_t expires = timeval_to_seconds(&cached->max_age); add_format_to_string(&msg, "\n%s: ", _("Expires", term)); add_date_to_string(&msg, get_opt_str("ui.date_format", NULL), &expires); } #endif add_format_to_string(&msg, "\n%s: ", _("Cache mode", term)); switch (cached->cache_mode) { case CACHE_MODE_NEVER: add_to_string(&msg, _("never use cache entry", term)); break; case CACHE_MODE_ALWAYS: add_to_string(&msg, _("always use cache entry", term)); break; case CACHE_MODE_INCREMENT: case CACHE_MODE_NORMAL: case CACHE_MODE_CHECK_IF_MODIFIED: case CACHE_MODE_FORCE_RELOAD: /* Cache entries only use two values of enum cache_mode. */ INTERNAL("cached->cache_mode = %d", cached->cache_mode); break; } #ifdef CONFIG_DEBUG add_format_to_string(&msg, "\n%s: %d", "Refcount", get_object_refcount(cached)); add_format_to_string(&msg, "\n%s: %u", _("ID", term), cached->cache_id); if (cached->head && *cached->head) { add_format_to_string(&msg, "\n%s:\n\n%s", _("Header", term), cached->head); } #endif return msg.source; }