1
0
Fork 0

Merge with /srv/git/elinks.git

This commit is contained in:
Petr Baudis 2006-11-08 19:46:29 +01:00 committed by Petr Baudis
commit 92c5be8e95
10 changed files with 453 additions and 365 deletions

View File

@ -32,7 +32,7 @@ if test "$CONFIG_SCRIPTING_RUBY" = "yes"; then
if test "$CONFIG_SCRIPTING_RUBY" != "no"; then
AC_MSG_CHECKING(Ruby version)
if $CONFIG_SCRIPTING_RUBY -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
if $CONFIG_SCRIPTING_RUBY -e 'puts "#{VERSION rescue RUBY_VERSION}" >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
ruby_version=`$CONFIG_SCRIPTING_RUBY -e 'puts "#{VERSION rescue RUBY_VERSION}"'`
AC_MSG_RESULT($ruby_version)

374
po/fr.po

File diff suppressed because it is too large Load Diff

370
po/pl.po

File diff suppressed because it is too large Load Diff

View File

@ -917,7 +917,7 @@ static struct option_info config_options_info[] = {
"environment) with a background image or a transparent background -\n"
"it will be visible in ELinks as well (but ELinks document color handling\n"
"will still assume the background is black so if you have a bright background\n"
"you might experience contrast problems. Note that this option makes\n"
"you might experience contrast problems). Note that this option makes\n"
"sense only when colors are enabled.")),
INIT_OPT_BOOL("terminal._template_", N_("Underline"),

View File

@ -1,5 +1,9 @@
/* Functionality for handling mime types */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* XXX: we _WANT_ strcasestr() ! */
#endif
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@ -224,6 +228,34 @@ get_cache_header_content_type(struct cache_entry *cached)
return NULL;
}
static unsigned char *
get_fragment_content_type(struct cache_entry *cached)
{
struct fragment *fragment;
size_t length;
unsigned char *sample;
unsigned char *ctype = NULL;
if (list_empty(cached->frag))
return NULL;
fragment = cached->frag.next;
if (fragment->offset)
return NULL;
length = fragment->length > 1024 ? 1024 : fragment->length;
sample = memacpy(fragment->data, length);
if (!sample)
return NULL;
if (strcasestr(sample, "<html>"))
ctype = stracpy("text/html");
mem_free(sample);
return ctype;
}
unsigned char *
get_content_type(struct cache_entry *cached)
{
@ -269,6 +301,12 @@ get_content_type(struct cache_entry *cached)
mem_free_if(ctype);
}
ctype = get_fragment_content_type(cached);
if (ctype && *ctype) {
cached->content_type = ctype;
return ctype;
}
debug_ctype(get_default_mime_type());
/* Fallback.. use some hardwired default */

View File

@ -122,6 +122,7 @@ struct s_msg_dsc {
{S_BITTORRENT_ERROR, N_("BitTorrent error")},
{S_BITTORRENT_METAINFO, N_("The BitTorrent metainfo file contained errors")},
{S_BITTORRENT_TRACKER, N_("The tracker requesting failed")},
{S_BITTORRENT_BAD_URL, N_("The BitTorrent URL does not point to a valid URL")},
#endif
{0, NULL}

View File

@ -104,6 +104,7 @@ enum connection_state {
S_BITTORRENT_ERROR = -100800,
S_BITTORRENT_METAINFO = -100801,
S_BITTORRENT_TRACKER = -100802,
S_BITTORRENT_BAD_URL = -100803,
};
unsigned char *get_state_message(enum connection_state state, struct terminal *term);

View File

@ -284,6 +284,10 @@ init_bittorrent_connection(struct connection *conn)
bittorrent->conn = conn;
bittorrent->tracker.timer = TIMER_ID_UNDEF;
/* Initialize here so that error handling can safely call
* free_list on it. */
init_list(bittorrent->meta.files);
return bittorrent;
}
@ -377,7 +381,7 @@ bittorrent_metainfo_callback(void *data, enum connection_state state,
void
bittorrent_protocol_handler(struct connection *conn)
{
struct uri *uri;
struct uri *uri = NULL;
struct bittorrent_connection *bittorrent;
bittorrent = init_bittorrent_connection(conn);
@ -386,11 +390,11 @@ bittorrent_protocol_handler(struct connection *conn)
return;
}
assert(conn->uri->datalen);
if (conn->uri->datalen)
uri = get_uri(conn->uri->data, 0);
uri = get_uri(conn->uri->data, 0);
if (!uri) {
abort_connection(conn, S_OUT_OF_MEM);
abort_connection(conn, S_BITTORRENT_BAD_URL);
return;
}

View File

@ -250,6 +250,13 @@ parse_uri(struct uri *uri, unsigned char *uristring)
datalen = strlen(prefix_end);
}
/* A bit of a special case, but using the "normal" host
* parsing seems a bit scary at this point. (see bug 107). */
if (datalen > 9 && !strncasecmp(prefix_end, "localhost/", 10)) {
prefix_end += 9;
datalen -= 9;
}
uri->data = prefix_end;
uri->datalen = datalen;

View File

@ -1143,8 +1143,15 @@ do_type_query(struct type_query *type_query, unsigned char *ct, struct mime_hand
}
text = get_dialog_offset(dlg, TYPE_QUERY_WIDGETS_COUNT);
format = _("What would you like to do with the file '%s' (type: %s%s%s)?", term);
snprintf(text, MAX_STR_LEN, format, filename.source, ct, desc_sep, description);
/* For "default directory index pages" with wrong content-type
* the filename can be NULL, e.g. http://www.spamhaus.org in bug 396. */
if (filename.length) {
format = _("What would you like to do with the file '%s' (type: %s%s%s)?", term);
snprintf(text, MAX_STR_LEN, format, filename.source, ct, desc_sep, description);
} else {
format = _("What would you like to do with the file (type: %s%s%s)?", term);
snprintf(text, MAX_STR_LEN, format, ct, desc_sep, description);
}
done_string(&filename);