links2

links 2.15+ fork
git clone git://git.codemadness.org/links2
Log | Files | Refs | README

commit 8e2607ae8dd0876820ea3da2b3bc61e6a0379b5d
parent c61e228d4833949cb9e9e559b44e188d81033c03
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat,  5 May 2018 13:55:45 +0200

force some privacy settings, remove unused code

Diffstat:
http.c | 23++++++++++++++++++++---
view.c | 24------------------------
2 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/http.c b/http.c @@ -370,6 +370,9 @@ static void test_restart(struct connection *c) static void add_user_agent(unsigned char **hdr, int *l) { + /* XXX: never add User-Agent */ + return; + add_to_str(hdr, l, cast_uchar "User-Agent: "); if (SCRUB_HEADERS) { add_to_str(hdr, l, cast_uchar "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0\r\n"); @@ -403,6 +406,9 @@ static void add_user_agent(unsigned char **hdr, int *l) static void add_referer(unsigned char **hdr, int *l, unsigned char *url, unsigned char *prev_url) { + /* XXX: force referer: only for same server */ + http_options.header.referer = REFERER_REAL_SAME_SERVER; + switch (http_options.header.referer) { case REFERER_FAKE: { add_to_str(hdr, l, cast_uchar "Referer: "); @@ -423,7 +429,9 @@ static void add_referer(unsigned char **hdr, int *l, unsigned char *url, unsigne int brk = 1; if ((h = get_host_name(url))) { if ((j = get_host_name(prev_url))) { - if (!casestrcmp(h, j)) brk = 0; + if (!casestrcmp(h, j)) + brk = 0; +#if 0 else if (!casestrcmp(h, cast_uchar "imageproxy.jxs.cz")) { int l = (int)strlen(cast_const_char j); int q = (int)strlen(".blog.cz"); @@ -433,6 +441,7 @@ static void add_referer(unsigned char **hdr, int *l, unsigned char *url, unsigne unsigned char *c = get_url_data(url); if (c && !strncmp(cast_const_char c, "recaptcha/api/", 14)) brk = 0; } +#endif mem_free(j); } mem_free(h); @@ -461,6 +470,7 @@ static void add_referer(unsigned char **hdr, int *l, unsigned char *url, unsigne static void add_accept(unsigned char **hdr, int *l) { + /* TODO */ if (SCRUB_HEADERS) { add_to_str(hdr, l, cast_uchar "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"); } else { @@ -470,6 +480,9 @@ static void add_accept(unsigned char **hdr, int *l) static void add_accept_language(unsigned char **hdr, int *l, struct http_connection_info *info) { + /* XXX: dont sent Accept-Language */ + return; + if (!(info->bl_flags & BL_NO_ACCEPT_LANGUAGE)) { add_to_str(hdr, l, cast_uchar "Accept-Language: "); if (SCRUB_HEADERS) { @@ -557,8 +570,9 @@ static void add_accept_charset(unsigned char **hdr, int *l, struct http_connecti static void add_dnt(unsigned char **hdr, int *l) { - if (http_options.header.do_not_track) - add_to_str(hdr, l, cast_uchar "DNT: 1\r\n"); +/* if (http_options.header.do_not_track)*/ + /* NOTE: always add DNT */ + add_to_str(hdr, l, cast_uchar "DNT: 1\r\n"); } static void add_connection(unsigned char **hdr, int *l, int http10, int proxy, int alive) @@ -580,6 +594,9 @@ static void add_upgrade(unsigned char **hdr, int *l) static void add_if_modified(unsigned char **hdr, int *l, struct connection *c) { + /* XXX: disabled for privacy reasons */ + return; + struct cache_entry *e; if ((e = c->cache)) { int code = 0; /* against warning */ diff --git a/view.c b/view.c @@ -18,7 +18,6 @@ static void update_braille_link(struct f_data_c *f); static int is_active_frame(struct session *ses, struct f_data_c *f); - struct view_state *create_vs(void) { struct view_state *vs; @@ -45,19 +44,6 @@ void destroy_vs(struct view_state *vs) mem_free(vs); } -#if 0 -static void copy_vs(struct view_state *dst, struct view_state *src) -{ - int i; - memcpy(dst, src, sizeof(struct view_state)); - if ((unsigned)src->form_info_len > MAXINT / sizeof(struct form_state)) overalloc(); - dst->form_info = mem_alloc(src->form_info_len * sizeof(struct form_state)); - memcpy(dst->form_info, src->form_info, src->form_info_len * sizeof(struct form_state)); - for (i = 0; i < src->form_info_len; i++) if (src->form_info[i].value) dst->form_info[i].value = stracpy(src->form_info[i].value); -} -#endif - - void free_js_event_spec(struct js_event_spec *j) { } @@ -3983,17 +3969,7 @@ unsigned char *print_current_title(struct session *ses) static inline int find_in_cache_idn(unsigned char *xurl, struct cache_entry **ce) { -#if 0 - unsigned char *url; - int r; - url = idn_encode_url(xurl, 0); - if (!url) url = stracpy(xurl); - r = find_in_cache(url, ce); - mem_free(url); - return r; -#else return find_in_cache(xurl, ce); -#endif } void loc_msg(struct terminal *term, struct location *lo, struct f_data_c *frame)