亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cookies.c

?? 一個很有名的瀏覽器
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* Internal cookies implementation *//* $Id: cookies.c,v 1.192.2.4 2005/05/01 22:03:23 jonas Exp $ */#ifdef HAVE_CONFIG_H#include "config.h"#endif#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h> /* OS/2 needs this after sys/types.h */#ifdef HAVE_TIME_H#include <time.h>#endif#include "elinks.h"#if 0#define DEBUG_COOKIES#endif#include "bfu/dialog.h"#include "cookies/cookies.h"#include "cookies/dialogs.h"#include "cookies/parser.h"#include "config/kbdbind.h"#include "config/options.h"#include "intl/gettext/libintl.h"#include "lowlevel/home.h"#include "modules/module.h"#include "protocol/date.h"#include "protocol/header.h"#include "protocol/protocol.h"#include "protocol/uri.h"#include "sched/session.h"#include "terminal/terminal.h"#include "util/conv.h"#ifdef DEBUG_COOKIES#include "util/error.h"#endif#include "util/file.h"#include "util/memory.h"#include "util/object.h"#include "util/secsave.h"#include "util/string.h"#include "util/ttime.h"#define COOKIES_FILENAME		"cookies"static int cookies_nosave = 0;static INIT_LIST_HEAD(cookies);struct c_domain {	LIST_HEAD(struct c_domain);	unsigned char domain[1]; /* Must be at end of struct. */};static INIT_LIST_HEAD(c_domains);static INIT_LIST_HEAD(cookie_servers);static int cookies_dirty = 0;enum cookies_option {	COOKIES_TREE,	COOKIES_ACCEPT_POLICY,	COOKIES_MAX_AGE,	COOKIES_PARANOID_SECURITY,	COOKIES_SAVE,	COOKIES_RESAVE,	COOKIES_OPTIONS,};static struct option_info cookies_options[] = {	INIT_OPT_TREE("", N_("Cookies"),		"cookies", 0,		N_("Cookies options.")),	INIT_OPT_INT("cookies", N_("Accept policy"),		"accept_policy", 0,		COOKIES_ACCEPT_NONE, COOKIES_ACCEPT_ALL, COOKIES_ACCEPT_ALL,		N_("Cookies accepting policy:\n"		"0 is accept no cookies\n"		"1 is ask for confirmation before accepting cookie\n"		"2 is accept all cookies")),	INIT_OPT_INT("cookies", N_("Maximum age"),		"max_age", 0, -1, 10000, -1,		N_("Cookie maximum age (in days):\n"		"-1 is use cookie's expiration date if any\n"		"0  is force expiration at the end of session, ignoring cookie's\n"		"   expiration date\n"		"1+ is use cookie's expiration date, but limit age to the given\n"		"   number of days")),	INIT_OPT_BOOL("cookies", N_("Paranoid security"),		"paranoid_security", 0, 0,		N_("When enabled, we'll require three dots in cookies domain for all\n"		"non-international domains (instead of just two dots). Some countries\n"		"have generic second level domains (eg. .com.pl, .co.uk) and allowing\n"		"sites to set cookies for these generic domains could potentially be\n"		"very bad. Note, it is off by default as it breaks a lot of sites.")),	INIT_OPT_BOOL("cookies", N_("Saving"),		"save", 0, 1,		N_("Whether cookies should be loaded from and save to disk.")),	INIT_OPT_BOOL("cookies", N_("Resaving"),		"resave", 0, 1,		N_("Save cookies after each change in cookies list? No effect when\n"		"cookie saving (cookies.save) is off.")),	NULL_OPTION_INFO,};#define get_opt_cookies(which)		cookies_options[(which)].option.value#define get_cookies_accept_policy()	get_opt_cookies(COOKIES_ACCEPT_POLICY).number#define get_cookies_max_age()		get_opt_cookies(COOKIES_MAX_AGE).number#define get_cookies_paranoid_security()	get_opt_cookies(COOKIES_PARANOID_SECURITY).number#define get_cookies_save()		get_opt_cookies(COOKIES_SAVE).number#define get_cookies_resave()		get_opt_cookies(COOKIES_RESAVE).numberstatic struct cookie_server *get_cookie_server(unsigned char *host, int hostlen){	struct cookie_server *sort_spot = NULL;	struct cookie_server *cs;	foreach (cs, cookie_servers) {		/* XXX: We must count with cases like "x.co" vs "x.co.uk"		 * below! */		int cslen = strlen(cs->host);		int cmp = strncasecmp(cs->host, host, hostlen);		if (!sort_spot && (cmp > 0 || (cmp == 0 && cslen > hostlen))) {			/* This is the first @cs with name greater than @host,			 * our dream sort spot! */			sort_spot = cs->prev;		}		if (cmp || cslen != hostlen)			continue;		object_lock(cs);		return cs;	}	cs = mem_calloc(1, sizeof(*cs) + hostlen);	if (!cs) return NULL;	memcpy(cs->host, host, hostlen);	object_nolock(cs, "cookie_server");	cs->box_item = add_listbox_folder(&cookie_browser, NULL, cs);	object_lock(cs);	if (!sort_spot) {		/* No sort spot found, therefore this sorts at the end. */		add_to_list_end(cookie_servers, cs);		del_from_list(cs->box_item);		add_to_list_end(cookie_browser.root.child, cs->box_item);	} else {		/* Sort spot found, sort after it. */		add_at_pos(sort_spot, cs);		if (sort_spot != (struct cookie_server *) &cookie_servers) {			del_from_list(cs->box_item);			add_at_pos(sort_spot->box_item, cs->box_item);		} /* else we are already at the top anyway. */	}	return cs;}static voiddone_cookie_server(struct cookie_server *cs){	object_unlock(cs);	if (is_object_used(cs)) return;	if (cs->box_item) done_listbox_item(&cookie_browser, cs->box_item);	del_from_list(cs);	mem_free(cs);}voidfree_cookie(struct cookie *c){	if (c->box_item) done_listbox_item(&cookie_browser, c->box_item);	if (c->server) done_cookie_server(c->server);	mem_free_if(c->name);	mem_free_if(c->value);	mem_free_if(c->path);	mem_free_if(c->domain);	mem_free(c);}/* Check whether cookie's domain matches server. * It returns 1 if ok, 0 else. */static intis_domain_security_ok(unsigned char *domain, unsigned char *server, int server_len){	int i;	int domain_len;	int need_dots;	if (domain[0] == '.') domain++;	domain_len = strlen(domain);	/* Match domain and server.. */	/* XXX: Hmm, can't we use strlcasecmp() here? --pasky */	if (domain_len > server_len) return 0;	/* Ensure that the domain is atleast a substring of the server before	 * continuing. */	if (strncasecmp(domain, server + server_len - domain_len, domain_len))		return 0;	/* Allow domains which are same as servers. --<rono@sentuny.com.au> */	/* Mozilla does it as well ;))) and I can't figure out any security	 * risk. --pasky */	if (server_len == domain_len)		return 1;	/* Check whether the server is an IP address, and require an exact host	 * match for the cookie, so any chance of IP address funkiness is	 * eliminated (e.g. the alias 127.1 domain-matching 99.54.127.1). Idea	 * from mozilla. (bug 562) */	if (is_ip_address(server, server_len))		return 0;	/* Also test if domain is secure en ugh.. */	need_dots = 1;	if (get_cookies_paranoid_security()) {		/* This is somehow controversial attempt (by the way violating		 * RFC) to increase cookies security in national domains, done		 * by Mikulas. As it breaks a lot of sites, I decided to make		 * this optional and off by default. I also don't think this		 * improves security considerably, as it's SITE'S fault and		 * also no other browser probably does it. --pasky */		/* Mikulas' comment: Some countries have generic 2-nd level		 * domains (like .com.pl, .co.uk ...) and it would be very bad		 * if someone set cookies for these generic domains.  Imagine		 * for example that server http://brutalporn.com.pl sets cookie		 * Set-Cookie: user_is=perverse_pig; domain=.com.pl -- then		 * this cookie would be sent to all commercial servers in		 * Poland. */		need_dots = 2;		if (domain_len > 0) {			int pos = end_with_known_tld(domain, domain_len);			if (pos >= 1 && domain[pos - 1] == '.')				need_dots = 1;		}	}	for (i = 0; domain[i]; i++)		if (domain[i] == '.' && !--need_dots)			break;	if (need_dots > 0) return 0;	return 1;}voidset_cookie(struct uri *uri, unsigned char *str){	unsigned char *secure, *path;	struct cookie *cookie;	struct cookie_str cstr;	int max_age;	if (get_cookies_accept_policy() == COOKIES_ACCEPT_NONE)		return;#ifdef DEBUG_COOKIES	DBG("set_cookie -> (%s) %s", struri(uri), str);#endif	if (!parse_cookie_str(&cstr, str)) return;	cookie = mem_calloc(1, sizeof(*cookie));	if (!cookie) return;	object_nolock(cookie, "cookie"); /* Debugging purpose. */	/* Fill main fields */	cookie->name = memacpy(str, cstr.nam_end - str);	cookie->value = memacpy(cstr.val_start, cstr.val_end - cstr.val_start);	cookie->server = get_cookie_server(uri->host, uri->hostlen);	cookie->domain = parse_header_param(str, "domain");	if (!cookie->domain) cookie->domain = memacpy(uri->host, uri->hostlen);	/* Now check that all is well */	if (!cookie->domain	    || !cookie->name	    || !cookie->value	    || !cookie->server) {		free_cookie(cookie);		return;	}#if 0	/* We don't actually set ->accept at the moment. But I have kept it	 * since it will maybe help to fix bug 77 - Support for more	 * finegrained control upon accepting of cookies. */	if (!cookie->server->accept) {#ifdef DEBUG_COOKIES		DBG("Dropped.");#endif		free_cookie(cookie);		return;	}#endif	/* Set cookie expiration if needed.	 * Cookie expires at end of session by default,	 * set to 0 by calloc().	 *	 * max_age:	 * -1 is use cookie's expiration date if any	 * 0  is force expiration at the end of session,	 *    ignoring cookie's expiration date	 * 1+ is use cookie's expiration date,	 *    but limit age to the given number of days.	 */	max_age = get_cookies_max_age();	if (max_age) {		unsigned char *date = parse_header_param(str, "expires");		if (date) {			ttime expires = parse_date(&date, NULL, 0, 1); /* Convert date to seconds. */			mem_free(date);			if (expires) {				if (max_age > 0) {					int seconds = max_age*24*3600;					ttime deadline = time(NULL) + seconds;					if (expires > deadline) /* Over-aged cookie ? */						expires = deadline;				}				cookie->expires = expires;			}		}	}	path = parse_header_param(str, "path");	if (!path) {		unsigned char *path_end;		path = get_uri_string(uri, URI_PATH);		if (!path) {			free_cookie(cookie);			return;		}		for (path_end = path + strlen(path) - 1;		     path_end >= path; path_end--) {			if (*path_end == '/') {				path_end[1] = '\0';				break;			}		}	} else {		if (!path[0]		    || path[strlen(path) - 1] != '/')			add_to_strn(&path, "/");		if (path[0] != '/') {			add_to_strn(&path, "x");			memmove(path + 1, path, strlen(path) - 1);			path[0] = '/';		}	}	cookie->path = path;	if (cookie->domain[0] == '.')		memmove(cookie->domain, cookie->domain + 1,			strlen(cookie->domain));	/* cookie->secure is set to 0 by default by calloc(). */	secure = parse_header_param(str, "secure");	if (secure) {		cookie->secure = 1;		mem_free(secure);	}#ifdef DEBUG_COOKIES	{		DBG("Got cookie %s = %s from %s, domain %s, "		      "expires at %d, secure %d", cookie->name,		      cookie->value, cookie->server->host, cookie->domain,		      cookie->expires, cookie->secure);	}#endif	if (!is_domain_security_ok(cookie->domain, uri->host, uri->hostlen)) {#ifdef DEBUG_COOKIES		DBG("Domain security violated: %s vs %.*s", cookie->domain,

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲丝袜自拍清纯另类| 成人黄色大片在线观看| 亚洲成av人在线观看| 亚洲手机成人高清视频| 亚洲婷婷在线视频| 亚洲人xxxx| 亚洲美女在线国产| 一区二区久久久久| 亚洲国产精品一区二区久久| 午夜久久久影院| 蜜芽一区二区三区| 久久99日本精品| 激情五月婷婷综合| 成人一道本在线| 99视频精品免费视频| 欧美性受xxxx黑人xyx性爽| 欧美日韩中文字幕一区| 538在线一区二区精品国产| 欧美一区二区三区视频免费播放| 欧美精品电影在线播放| 精品裸体舞一区二区三区| 久久久三级国产网站| 国产精品成人一区二区艾草 | 亚洲色图欧洲色图| 亚洲午夜电影在线观看| 日本不卡不码高清免费观看| 精品在线一区二区| 国产成a人亚洲精品| 日本高清无吗v一区| 欧美精品一卡两卡| 久久九九国产精品| 亚洲精品乱码久久久久久日本蜜臀| 亚洲一区二区影院| 久久国产精品72免费观看| 懂色av一区二区三区免费看| 欧洲日韩一区二区三区| 日韩一级二级三级| 国产色婷婷亚洲99精品小说| 一区二区成人在线| 久久99国产精品麻豆| 99国产精品99久久久久久| 91精品国产一区二区| 欧美激情综合在线| 性做久久久久久免费观看 | 欧美大片一区二区| 亚洲欧洲日韩在线| 热久久一区二区| 99久久免费视频.com| 欧美一区二区三区四区视频| 国产视频一区二区三区在线观看| 亚洲精品亚洲人成人网在线播放| 久久99精品久久久久久国产越南| 91一区一区三区| 日韩欧美黄色影院| 亚洲女同ⅹxx女同tv| 久久国产乱子精品免费女| 一本久久a久久精品亚洲| 日韩美女在线视频| 一区二区三区在线观看动漫| 久久99精品久久久久| 欧美在线一二三四区| 久久一日本道色综合| 天天综合网 天天综合色| 成人黄色av电影| 久久综合久色欧美综合狠狠| 亚洲国产毛片aaaaa无费看| 成人h动漫精品| 精品国产污污免费网站入口 | 一区二区久久久久| 国产成人免费视频一区| 欧美一区二区网站| 一区二区三区四区不卡视频 | 8x8x8国产精品| 亚洲欧美日韩中文字幕一区二区三区 | 中文字幕一区二区三区不卡在线 | 91视频国产资源| 久久久久高清精品| 免费xxxx性欧美18vr| 欧美日韩国产一级片| 亚洲精品久久久久久国产精华液| 国产精品资源站在线| 日韩免费高清av| 天天综合色天天| 欧美亚洲一区二区在线| 国产精品不卡在线观看| 国产精品1区二区.| 精品国产电影一区二区| 青青草国产成人99久久| 欧美亚洲综合网| 亚洲综合另类小说| 在线视频欧美精品| 亚洲男同1069视频| 91年精品国产| 亚洲四区在线观看| 色综合久久综合网欧美综合网| 国产日本亚洲高清| 国产v综合v亚洲欧| 国产精品热久久久久夜色精品三区 | 国产精品色婷婷| 成人手机电影网| 国产精品无码永久免费888| 成人网男人的天堂| 最新日韩在线视频| 99re这里都是精品| 洋洋成人永久网站入口| 色播五月激情综合网| 一区二区三区高清| 在线免费观看日本欧美| 亚洲成人tv网| 欧美一二区视频| 精品无人码麻豆乱码1区2区| 精品久久国产字幕高潮| 国产成人综合网| 国产精品久久久久三级| 日本乱人伦aⅴ精品| 亚洲不卡av一区二区三区| 4hu四虎永久在线影院成人| 日本不卡一二三区黄网| 久久综合色婷婷| av在线不卡观看免费观看| 亚洲色图制服丝袜| 欧美丰满一区二区免费视频| 九色|91porny| 中文字幕成人在线观看| 欧美又粗又大又爽| 日本亚洲一区二区| 久久久午夜精品理论片中文字幕| 成人在线视频一区| 亚洲午夜精品在线| 精品国偷自产国产一区| 成a人片国产精品| 一个色在线综合| 日韩欧美电影一区| jlzzjlzz欧美大全| 亚洲国产aⅴ成人精品无吗| 日韩欧美中文字幕精品| 国产成人免费视频网站高清观看视频| 综合在线观看色| 3atv一区二区三区| 成人午夜精品在线| 日韩综合小视频| 国产丝袜美腿一区二区三区| 在线观看一区二区视频| 久久精品国产一区二区| 国产精品传媒在线| 91精品在线免费观看| 高清久久久久久| 天堂在线亚洲视频| 中文字幕日韩一区| 欧美一区二区精品久久911| 高清国产一区二区| 日本在线不卡一区| 亚洲欧美日韩系列| 精品国产乱码久久久久久闺蜜| 色综合久久久久久久久| 国产在线视视频有精品| 亚洲精品欧美二区三区中文字幕| 精品国产网站在线观看| 在线观看网站黄不卡| 国产成人久久精品77777最新版本| 亚洲成人综合视频| 欧美经典一区二区三区| 欧美日韩精品系列| 成年人网站91| 国精产品一区一区三区mba桃花| 亚洲综合免费观看高清完整版 | 精品久久久久香蕉网| 在线看国产一区| 成人av片在线观看| 精品欧美乱码久久久久久| 婷婷久久综合九色综合绿巨人| 精品无人码麻豆乱码1区2区| 精品一区二区免费看| 亚洲欧洲日韩在线| 精品剧情在线观看| 欧美日韩亚洲高清一区二区| 国产成人亚洲综合a∨猫咪| 三级久久三级久久| 亚洲一卡二卡三卡四卡无卡久久| 久久精品视频免费| 欧美成人精品3d动漫h| 欧美日韩精品欧美日韩精品一| 不卡的av中国片| 国产成人在线视频网站| 精品亚洲aⅴ乱码一区二区三区| 午夜不卡av在线| 亚洲影院久久精品| 亚洲日本韩国一区| 日本一区二区成人在线| 久久综合色婷婷| 日韩精品中午字幕| 91精品国产色综合久久不卡电影 | 麻豆精品精品国产自在97香蕉| 亚洲图片欧美一区| 一区二区三区国产豹纹内裤在线| 国产精品久久久一本精品| 国产色婷婷亚洲99精品小说| 久久久91精品国产一区二区精品| 精品美女在线观看| 精品国偷自产国产一区|