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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cookies.c

?? 著名的手機瀏覽器開源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * File: cookies.c * * Copyright 2001 Lars Clausen   <lrclause@cs.uiuc.edu> *                J鰎gen Viksell <jorgen.viksell@telia.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. *//* Handling of cookies takes place here. * This implementation aims to follow RFC 2965: * http://www.cis.ohio-state.edu/cs/Services/rfc/rfc-text/rfc2965.txt */#ifndef DISABLE_COOKIES#include <sys/types.h>#include <sys/stat.h>#include <sys/file.h>#include <fcntl.h>#include <stdlib.h>#include <stdio.h>#include <time.h>       /* for time() and time_t */#include <ctype.h>#include "msg.h"#include "IO/Url.h"#include "misc.h"#include "list.h"#include "cookies.h"#define DEBUG_LEVEL 8#include "debug.h"/* The maximum length of a line in the cookie file */#define LINE_MAXLEN 4096typedef enum {   COOKIE_ACCEPT,   COOKIE_ACCEPT_SESSION,   COOKIE_DENY} CookieControlAction;typedef struct {   CookieControlAction action;   char *domain;} CookieControl;typedef struct {   char *name;   char *value;   char *domain;   char *path;   time_t expires_at;   guint version;   char *comment;   char *comment_url;   gboolean secure;   gboolean session_only;   GList *ports;} CookieData_t;/* Hashtable indexed by domain, each value is a set of cookies for * that domain. */static GHashTable *cookies;/* Variables for access control */static CookieControl *ccontrol = NULL;static int num_ccontrol = 0;static int num_ccontrol_max = 1;static CookieControlAction default_action = COOKIE_DENY;static gboolean disabled;static FILE *file_stream;static FILE *Cookies_fopen(const char *file, gchar *init_str);static CookieControlAction Cookies_control_check(const DilloUrl *url);static CookieControlAction Cookies_control_check_domain(const char *domain);static int Cookie_control_init(void);static void Cookies_parse_ports(const DilloUrl *set_url, CookieData_t *cookie,                                const char *port_str);static char *Cookies_build_ports_str(CookieData_t *cookie);static char *Cookies_strip_path(const char *path);static void Cookies_add_cookie(CookieData_t *cookie);static void Cookies_remove_cookie(CookieData_t *cookie);static gint Cookies_equals(gconstpointer a, gconstpointer b);/* * Return a file pointer. If the file doesn't exist, try to create it, * with the optional 'init_str' as its content. */static FILE *Cookies_fopen(const char *filename, gchar *init_str){   FILE *F_in;   int fd;   if ((F_in = fopen(filename, "r+")) == NULL) {      /* Create the file */      fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);      if (fd != -1) {         if (init_str)            write(fd, init_str, strlen(init_str));         close(fd);         DEBUG_MSG(10, "Cookies: Created file: %s\n", filename);         F_in = Cookies_fopen(filename, NULL);      } else {         DEBUG_MSG(10, "Cookies: Could not create file: %s!\n", filename);      }   }   /* set close on exec */   fcntl(fileno(F_in), F_SETFD, FD_CLOEXEC | fcntl(fileno(F_in), F_GETFD));   return F_in;}static void Cookies_free_cookie(CookieData_t *cookie){   g_free(cookie->name);   g_free(cookie->value);   g_free(cookie->domain);   g_free(cookie->path);   g_free(cookie->comment);   g_free(cookie->comment_url);   g_list_free(cookie->ports);   g_free(cookie);}/* * Initialize the cookies module * (The 'disabled' variable is writable only within a_Cookies_init) */void a_Cookies_init(){   CookieData_t *cookie;   char *filename;   char line[LINE_MAXLEN];#ifndef HAVE_LOCKF   struct flock lck;#endif   /* Default setting */   disabled = TRUE;   /* Read and parse the cookie control file (cookiesrc) */   if (Cookie_control_init() != 0) {      DEBUG_MSG(10, "Disabling cookies.\n");      return;   }   /* Get a stream for the cookies file */   filename = a_Misc_prepend_user_home(".dillo/cookies");   file_stream = Cookies_fopen(filename, NULL);   g_free(filename);   if (!file_stream) {      DEBUG_MSG(10, "ERROR: Can't open ~/.dillo/cookies, disabling cookies\n");      return;   }   /* Try to get a lock from the file descriptor */#ifdef HAVE_LOCKF   disabled = (lockf(fileno(file_stream), F_TLOCK, 0) == -1);#else /* POSIX lock */   lck.l_start = 0; /* start at beginning of file */   lck.l_len = 0;  /* lock entire file */   lck.l_type = F_WRLCK;   lck.l_whence = SEEK_SET;  /* absolute offset */   disabled = (fcntl(fileno(file_stream), F_SETLK, &lck) == -1);#endif   if (disabled) {      DEBUG_MSG(10, "The cookies file has a file lock:\n"                    "  disabling cookies in this dillo!\n");      fclose(file_stream);      return;   }   DEBUG_MSG(10, "Enabling cookies as from cookiesrc...\n");   cookies = g_hash_table_new(g_str_hash, g_str_equal);   /* Get all lines in the file */   while (!feof(file_stream)) {      line[0] = '\0';      fgets(line, LINE_MAXLEN, file_stream);      /* Remove leading and trailing whitespaces */      g_strstrip(line);      if (line[0] != '\0') {         /* Would use g_strsplit, but it doesn't give empty trailing pieces.          */         /* Split the row into pieces using a tab as the delimiter.          * pieces[0] The version this cookie was set as (0 / 1)          * pieces[1] The domain name          * pieces[2] A comma separated list of accepted ports          * pieces[3] The path          * pieces[4] Is the cookie unsecure or secure (0 / 1)          * pieces[5] Timestamp of expire date          * pieces[6] Name of the cookie          * pieces[7] Value of the cookie          * pieces[8] Comment          * pieces[9] Comment url          */         CookieControlAction action;         char *piece;         char *line_marker = line;         cookie = g_new0(CookieData_t, 1);         cookie->session_only = FALSE;         piece = d_strsep(&line_marker, "\t");         if (piece != NULL)            cookie->version = strtol(piece, NULL, 10);         cookie->domain  = g_strdup(d_strsep(&line_marker, "\t"));         Cookies_parse_ports(NULL, cookie, d_strsep(&line_marker, "\t"));         cookie->path = g_strdup(d_strsep(&line_marker, "\t"));         piece = d_strsep(&line_marker, "\t");         if (piece != NULL && piece[0] == '1')            cookie->secure = TRUE;         piece = d_strsep(&line_marker, "\t");         if (piece != NULL)            cookie->expires_at = (time_t) strtol(piece, NULL, 10);         cookie->name = g_strdup(d_strsep(&line_marker, "\t"));         cookie->value = g_strdup(d_strsep(&line_marker, "\t"));         cookie->comment = g_strdup(d_strsep(&line_marker, "\t"));         cookie->comment_url = g_strdup(d_strsep(&line_marker, "\t"));         if (!cookie->domain || cookie->domain[0] == '\0' ||             !cookie->path || cookie->path[0] != '/' ||             !cookie->name || cookie->name[0] == '\0' ||             !cookie->value) {            DEBUG_MSG(8, "Malformed line in cookies file!\n");            Cookies_free_cookie(cookie);            continue;         }         action = Cookies_control_check_domain(cookie->domain);         if (action == COOKIE_DENY) {            Cookies_free_cookie(cookie);            continue;         } else if (action == COOKIE_ACCEPT_SESSION) {            cookie->session_only = TRUE;         }         /* Save cookie in memory */         Cookies_add_cookie(cookie);      }   }}/* * Save the cookies and remove them from the hash table */static gboolean Cookies_freeall_cb(gpointer key,                                   gpointer value,                                   gpointer data){   CookieData_t *cookie;   GList *domain_cookies = value;   char *ports_str;   for (; domain_cookies; domain_cookies = g_list_next(domain_cookies)) {      cookie = domain_cookies->data;      if (!cookie->session_only) {         ports_str = Cookies_build_ports_str(cookie);         fprintf(file_stream, "%d\t%s\t%s\t%s\t%d\t%ld\t%s\t%s\t%s\t%s\n",                 cookie->version,                 cookie->domain,                 ports_str,                 cookie->path,                 cookie->secure ? 1 : 0,                 (long)cookie->expires_at,                 cookie->name,                 cookie->value,                 (cookie->comment) ? cookie->comment : "",                 (cookie->comment_url) ? cookie->comment_url : "");         g_free(ports_str);      }      Cookies_free_cookie(cookie);   }   g_list_free(value);   g_free(key);   /* Return TRUE to tell GLIB to free this key from the hash table */   return TRUE;}/* * Flush cookies to disk and free all the memory allocated. */void a_Cookies_freeall(){   int fd;#ifndef HAVE_LOCKF   struct flock lck;#endif   if (disabled)      return;   rewind(file_stream);   fd = fileno(file_stream);   ftruncate(fd, 0);   g_hash_table_foreach_remove(cookies, Cookies_freeall_cb, NULL);#ifdef HAVE_LOCKF   lockf(fd, F_ULOCK, 0);#else  /* POSIX file lock */   lck.l_start = 0; /* start at beginning of file */   lck.l_len = 0;  /* lock entire file */   lck.l_type = F_UNLCK;   lck.l_whence = SEEK_SET;  /* absolute offset */   fcntl(fileno(file_stream), F_SETLKW, &lck);#endif   fclose(file_stream);}static char *months[] ={ "",  "Jan", "Feb", "Mar",  "Apr", "May", "Jun",  "Jul", "Aug", "Sep",  "Oct", "Nov", "Dec"};/* * Take a months name and return a number between 1-12. * E.g. 'April' -> 4 */static int Cookies_get_month(const char *month_name){   int i;   for (i = 1; i <= 12; i++) {      if (!g_strncasecmp(months[i], month_name, 3))         return i;   }   return 0;}/* * Return a local timestamp from a GMT date string * Accept: RFC-1123 | RFC-850 | ANSI asctime * (return 0 on malformed date string syntax) */static time_t Cookies_create_timestamp(const char *expires){   time_t ret;   int day, month, year, hour, minutes, seconds;   gchar *cp;   gchar *E_msg =      "Cookies: Expire date is malformed!\n"      " (should be RFC-1123 | RFC-850 | ANSI asctime)\n"      " Ignoring cookie...\n";   if (!(cp = strchr(expires, ',')) && strlen(expires) == 24) {      /* Looks like ANSI asctime format... */      cp = (gchar *)expires;      day = strtol(cp + 8, NULL, 10);       /* day */      month = Cookies_get_month(cp + 4);    /* month */      year = strtol(cp + 20, NULL, 10);     /* year */      hour = strtol(cp + 11, NULL, 10);     /* hour */      minutes = strtol(cp + 14, NULL, 10);  /* minutes */      seconds = strtol(cp + 17, NULL, 10);  /* seconds */   } else if (cp && ((cp - expires == 3 && strlen(cp) == 26) ||                     (cp - expires > 5  && strlen(cp) == 24))) {      /* RFC-1123 | RFC-850 format */      day = strtol(cp + 2, NULL, 10);      month = Cookies_get_month(cp + 5);      year = strtol(cp + 9, &cp, 10);      /* todo: tricky, because two digits for year IS ambiguous! */      year += (year < 70) ? 2000 : ((year < 100) ? 1900 : 0);      hour = strtol(cp + 1, NULL, 10);      minutes = strtol(cp + 4, NULL, 10);      seconds = strtol(cp + 7, NULL, 10);   } else {      DEBUG_MSG(5, E_msg);      return (time_t) 0;   }   /* Error checks  --this may be overkill */   if (!(day > 0 && day < 32 && month > 0 && month && year > 1970 &&         hour >= 0 && hour < 24 && minutes >= 0 && minutes < 60 &&         seconds >= 0 && seconds < 60)) {      DEBUG_MSG(5, E_msg);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲线精品一区二区三区八戒| 亚洲少妇最新在线视频| 欧美日韩三级一区二区| av高清久久久| 成人毛片在线观看| 国产91精品一区二区| 国产精一品亚洲二区在线视频| 久久99久久99小草精品免视看| 久久精品av麻豆的观看方式| 日本不卡一区二区三区高清视频| 丝袜亚洲另类丝袜在线| 日韩国产精品91| 麻豆国产精品官网| 国内久久精品视频| 国产mv日韩mv欧美| www..com久久爱| 色哟哟精品一区| 欧美性大战xxxxx久久久| 久久综合丝袜日本网| 精品视频一区三区九区| 国产69精品久久久久777| 高清久久久久久| 99久久久精品| 欧美日韩精品免费| 日韩女优av电影| 国产亚洲精品久| 亚洲欧美乱综合| 午夜伦理一区二区| 国产伦精品一区二区三区免费迷| 欧美伊人精品成人久久综合97| 欧洲国产伦久久久久久久| 欧美日韩黄色影视| 精品入口麻豆88视频| 国产精品欧美经典| 亚洲午夜久久久久久久久久久| 免费在线观看精品| 国产99久久久国产精品潘金| 99re热这里只有精品免费视频| 色噜噜久久综合| 欧美一卡2卡三卡4卡5免费| 久久久久久99精品| 亚洲激情图片小说视频| 免费在线观看一区二区三区| 成人激情免费电影网址| 精品1区2区3区| 久久综合丝袜日本网| 自拍偷拍亚洲欧美日韩| 日韩精品高清不卡| 成人午夜av电影| 欧美欧美午夜aⅴ在线观看| 久久蜜桃av一区精品变态类天堂| 综合网在线视频| 蜜桃视频在线观看一区二区| 不卡区在线中文字幕| 欧美精品粉嫩高潮一区二区| 欧美国产日韩在线观看| 亚洲v中文字幕| 懂色一区二区三区免费观看| 欧美裸体一区二区三区| 国产视频一区在线观看| 亚洲不卡av一区二区三区| 高潮精品一区videoshd| 在线播放/欧美激情| 亚洲欧美在线aaa| 精品一区二区三区免费观看| 91成人看片片| 国产精品热久久久久夜色精品三区| 香蕉久久一区二区不卡无毒影院| 丰满少妇久久久久久久| 日韩一区二区麻豆国产| 亚洲精品视频在线观看网站| 天天av天天翘天天综合网色鬼国产 | 色呦呦国产精品| 26uuu国产电影一区二区| 亚洲国产日韩一级| 99久久亚洲一区二区三区青草| 精品理论电影在线| 亚洲美女视频在线观看| 国产成人精品综合在线观看| 欧美一区二区三区思思人| 亚洲精品国产第一综合99久久| 国产麻豆视频精品| 日韩精品一区二区三区三区免费| 亚洲综合无码一区二区| 99久久久国产精品免费蜜臀| 久久久久久久久久久久久女国产乱| 偷窥国产亚洲免费视频| 欧美三级在线播放| 亚洲欧美国产77777| 99久久免费精品| 日本一区二区不卡视频| 国产成人在线色| 久久品道一品道久久精品| 麻豆精品国产传媒mv男同| 欧美日韩成人在线一区| 亚洲成人在线免费| 欧美性猛交一区二区三区精品| 亚洲天堂成人网| 亚洲女同ⅹxx女同tv| 国产二区国产一区在线观看| 国产露脸91国语对白| 日韩欧美一级在线播放| 日韩高清在线一区| 91精品久久久久久久99蜜桃 | 国产一区二区三区电影在线观看| 欧美精品粉嫩高潮一区二区| 亚洲电影中文字幕在线观看| 欧美午夜不卡视频| 亚洲一区二区黄色| 欧美色爱综合网| 亚洲va天堂va国产va久| 欧美色欧美亚洲另类二区| 亚洲国产婷婷综合在线精品| 欧美亚洲综合另类| 亚洲成人在线观看视频| 7777精品伊人久久久大香线蕉| 同产精品九九九| 制服视频三区第一页精品| 日韩电影在线一区二区三区| 日韩精品一区二区在线观看| 免费欧美在线视频| 精品少妇一区二区三区日产乱码| 国产一区二区在线影院| 国产午夜精品久久| 91在线免费视频观看| 亚洲国产欧美一区二区三区丁香婷| 欧美午夜在线观看| 亚洲精品在线免费观看视频| 欧美成人激情免费网| 国产精品久久久久影院老司 | 91丨porny丨最新| 亚洲免费资源在线播放| 欧美欧美午夜aⅴ在线观看| 蜜桃av一区二区| 中文字幕av免费专区久久| 色美美综合视频| 麻豆91在线播放免费| 久久久国产一区二区三区四区小说| 成人在线视频一区| 亚洲欧美另类久久久精品2019| 在线免费av一区| 久久精品久久久精品美女| 中文字幕中文在线不卡住| 欧美三电影在线| 国产精品一区二区免费不卡| 亚洲欧美电影院| 欧美va亚洲va| 色美美综合视频| 久久不见久久见中文字幕免费| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 精品国产乱码久久久久久牛牛| 成人h动漫精品| 日韩高清一区在线| 国产精品无遮挡| 91精品福利在线一区二区三区 | 国产精品二区一区二区aⅴ污介绍| 91麻豆精品国产91久久久更新时间| www.久久久久久久久| 国产一区二区三区美女| 国产在线国偷精品产拍免费yy| 91精品国产全国免费观看| 国产精品一区二区免费不卡| 亚洲一区在线观看视频| 欧美精品一区二区三区久久久| 色综合久久久网| 国产精品911| 午夜激情久久久| 日韩理论片网站| 精品久久久三级丝袜| 在线观看91精品国产入口| 国产99久久久国产精品| 奇米影视在线99精品| 亚洲一区二区三区自拍| 欧美极品少妇xxxxⅹ高跟鞋 | 在线成人午夜影院| 成人免费观看视频| 久久99久久精品欧美| 亚洲成人1区2区| 亚洲同性gay激情无套| 亚洲国产精品一区二区尤物区| 欧美性生活影院| 成人18视频在线播放| 久久www免费人成看片高清| 亚洲一区国产视频| 亚洲色图视频网| 国产欧美精品一区二区色综合| 日韩一二三四区| 欧美日韩中文一区| 91福利在线免费观看| 成人动漫一区二区三区| 国产一区二区在线电影| 午夜精品久久久久久久99水蜜桃| 精品视频在线看| 欧美性xxxxx极品少妇| 91首页免费视频| 99精品视频一区二区| 成人综合婷婷国产精品久久蜜臀 | 欧美区视频在线观看| 91成人在线免费观看| 91网站在线播放|