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

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

?? cookies.c

?? 基于minigui的瀏覽器. 這是最新版本.
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * File: cookies.c * Cookies server. * * Copyright 2001 Lars Clausen   <lrclause@cs.uiuc.edu> *                J鰎gen Viksell <jorgen.viksell@telia.com> * Copyright 2002-2005 Jorge Arellano Cid <jcid@dillo.org> * * 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 *//* Todo: this server is not assembling the received packets. * This means it currently expects dillo to send full dpi tags * within the socket; if that fails, everything stops. * This is not hard to fix, mainly is a matter of expecting the * final '>' of a tag. */#ifdef DISABLE_COOKIESint main(void){   return 0; /* never called */}#else#include <sys/types.h>#include <sys/socket.h>#include <sys/stat.h>#include <sys/un.h>#include <fcntl.h>#include <unistd.h>#include <errno.h>#include <stddef.h>#include <string.h>#include <stdlib.h>#include <stdio.h>#include <time.h>       /* for time() and time_t */#include <ctype.h>#include <netdb.h>#include <signal.h>#include "dpiutil.h"#include "../dpip/dpip.h"#include <glib.h>/* This one is tricky, some sources state it should include the byte * for the terminating NULL, and others say it shouldn't. */# define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \                        + strlen ((ptr)->sun_path))/* Debugging macros */#define _MSG(fmt...)#define MSG(fmt...)  g_print("[cookies dpi]: " fmt)/* * a_List_add() * * Make sure there's space for 'num_items' items within the list * (First, allocate an 'alloc_step' sized chunk, after that, double the *  list size --to make it faster) */#define a_List_add(list,num_items,alloc_step) \   if ( !list ) { \      list = g_malloc(alloc_step * sizeof((*list))); \   } \   if ( num_items >= alloc_step ){ \      while ( num_items >= alloc_step ) \         alloc_step <<= 1; \      list = g_realloc(list, alloc_step * sizeof((*list))); \   }/* 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;/* * Local data *//* 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 char *cookies_txt_header_str ="# HTTP Cookie File\n""# http://www.netscape.com/newsref/std/cookie_spec.html\n""# This is a generated file!  Do not edit.\n\n";/* * Forward declarations */static gchar *d_strsep(char **orig, const char *delim);static FILE *Cookies_fopen(const char *file, gchar *init_str);static CookieControlAction Cookies_control_check_domain(const char *domain);static int Cookie_control_init(void);static void Cookies_parse_ports(gint url_port, 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);/* * strsep implementation */gchar *d_strsep(char **orig, const char *delim){   gchar *str, *p;   if (!(str = *orig))      return NULL;   p = strpbrk(str, delim);   if (p) {      *p++ = 0;      *orig = p;   } else {      *orig = NULL;   }   return str;}/* * 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);         MSG("Created file: %s\n", filename);         F_in = Cookies_fopen(filename, NULL);      } else {         MSG("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 Cookies_init) */void Cookies_init(){   CookieData_t *cookie;   char *filename;   char line[LINE_MAXLEN];#ifndef HAVE_LOCKF   struct flock lck;#endif   FILE *old_cookies_file_stream;   /* Default setting */   disabled = TRUE;   /* Read and parse the cookie control file (cookiesrc) */   if (Cookie_control_init() != 0) {      MSG("Disabling cookies.\n");      return;   }   /* Get a stream for the cookies file */   filename = g_strconcat(g_get_home_dir(), "/.dillo/cookies.txt", NULL);   file_stream = Cookies_fopen(filename, cookies_txt_header_str);   g_free(filename);   if (!file_stream) {      MSG("ERROR: Can't open ~/.dillo/cookies.txt, 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) {      MSG("The cookies file has a file lock: disabling cookies!\n");      fclose(file_stream);      return;   }   MSG("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') && (line[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 domain name          * pieces[1] TRUE/FALSE: is the domain a suffix, or a full domain?          * pieces[2] The path          * pieces[3] Is the cookie unsecure or secure (TRUE/FALSE)          * pieces[4] Timestamp of expire date          * pieces[5] Name of the cookie          * pieces[6] Value of the cookie          */         CookieControlAction action;         char *piece;         char *line_marker = line;         cookie = g_new0(CookieData_t, 1);         cookie->session_only = FALSE;         cookie->version = 0;         cookie->domain = g_strdup(d_strsep(&line_marker, "\t"));         d_strsep(&line_marker, "\t"); /* we use domain always as sufix */         cookie->path = g_strdup(d_strsep(&line_marker, "\t"));         piece = d_strsep(&line_marker, "\t");         if (piece != NULL && piece[0] == 'T')            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"));         if (!cookie->domain || cookie->domain[0] == '\0' ||             !cookie->path || cookie->path[0] != '/' ||             !cookie->name || cookie->name[0] == '\0' ||             !cookie->value) {            MSG("Malformed line in cookies.txt 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);      }   }   filename = g_strconcat(g_get_home_dir(), "/.dillo/cookies", NULL);   if ((old_cookies_file_stream = fopen(filename, "r")) != NULL) {      g_free(filename);      MSG("WARNING: Reading old cookies file ~/.dillo/cookies too\n");      /* Get all lines in the file */      while (!feof(old_cookies_file_stream)) {         line[0] = '\0';         fgets(line, LINE_MAXLEN, old_cookies_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(0, 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) {               MSG("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);         }      }   fclose(old_cookies_file_stream);   } else {      g_free(filename);   }}/* * 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, "%s\tTRUE\t%s\t%s\t%ld\t%s\t%s\n",                 cookie->domain,                 cookie->path,                 cookie->secure ? "TRUE" : "FALSE",                 (long)cookie->expires_at,                 cookie->name,                 cookie->value);/*         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 Cookies_freeall(){   int fd;#ifndef HAVE_LOCKF   struct flock lck;#endif   if (disabled)      return;   rewind(file_stream);   fd = fileno(file_stream);   ftruncate(fd, 0);   fprintf(file_stream, cookies_txt_header_str);   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)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费成人在线观看视频| 色88888久久久久久影院野外 | 一区二区三区国产| 亚洲精品视频在线观看免费| 一区二区免费在线| 日产国产欧美视频一区精品 | 久久久久亚洲蜜桃| 中文久久乱码一区二区| 中文字幕永久在线不卡| 亚洲一卡二卡三卡四卡无卡久久| 亚洲一区二区欧美激情| 麻豆精品一二三| 高清不卡一二三区| 精品美女被调教视频大全网站| 精品国产一二三| 亚洲啪啪综合av一区二区三区| 婷婷一区二区三区| 国产suv一区二区三区88区| 色美美综合视频| 欧美mv日韩mv国产网站app| 一区二区三区四区精品在线视频| 日韩精品电影在线| av中文字幕不卡| 精品国产乱码久久久久久图片 | 久久99国产乱子伦精品免费| 9人人澡人人爽人人精品| 欧美一区二区国产| 亚洲黄一区二区三区| 国产精品一区一区| 日韩三区在线观看| 视频一区中文字幕国产| 色噜噜狠狠一区二区三区果冻| 精品久久久久久综合日本欧美| 亚洲一区二区黄色| 99久精品国产| 国产精品第五页| 国产成人av一区二区| 日韩一区二区不卡| 三级一区在线视频先锋| 在线观看一区不卡| 一区二区三区丝袜| 一本色道久久综合亚洲aⅴ蜜桃 | 精品国产乱码久久久久久图片| 国内精品久久久久影院薰衣草| 成人欧美一区二区三区在线播放| 亚洲欧洲美洲综合色网| 久久国产三级精品| 欧美日韩亚洲国产综合| 一区二区三区四区国产精品| 欧美一级免费大片| 福利电影一区二区| 蜜桃视频在线观看一区| 国产精品女主播在线观看| 欧美精品色一区二区三区| 成人夜色视频网站在线观看| 性做久久久久久免费观看欧美| 日韩美女在线视频| 欧美无乱码久久久免费午夜一区| 久久99国产精品久久99果冻传媒| 亚洲欧美视频一区| 久久伊人中文字幕| 91精品国产高清一区二区三区| 99久久婷婷国产综合精品| 久久国内精品自在自线400部| 亚洲丝袜另类动漫二区| 久久久久久久久久久久电影| 91精品综合久久久久久| 精品国内二区三区| 日韩不卡免费视频| 精品乱人伦一区二区三区| 久久福利视频一区二区| 国产精品久久久久久久久久久免费看 | 国产亲近乱来精品视频| av不卡一区二区三区| 麻豆精品视频在线| 久久久综合激的五月天| 97se狠狠狠综合亚洲狠狠| 一卡二卡三卡日韩欧美| 欧美视频一二三区| 老司机午夜精品99久久| 综合婷婷亚洲小说| 欧美麻豆精品久久久久久| 丰满少妇在线播放bd日韩电影| 国产精品一二三| 久久亚洲精华国产精华液| 中文字幕在线观看不卡视频| 精品一区二区三区在线播放 | 911国产精品| 免费观看一级欧美片| 一区二区三区中文字幕| 亚洲国产精品一区二区久久恐怖片| 亚洲乱码国产乱码精品精的特点 | 欧美一区日本一区韩国一区| 欧美夫妻性生活| 精品国产伦一区二区三区观看体验| 久久久久久免费网| 日韩毛片精品高清免费| 五月激情综合色| 国产成人av自拍| 成人动漫一区二区三区| 色综合网色综合| 日韩美女在线视频| 中文字幕亚洲视频| 青娱乐精品在线视频| 97久久久精品综合88久久| 777色狠狠一区二区三区| 1024成人网色www| 欧美伊人久久久久久午夜久久久久| 日韩在线卡一卡二| 蜜桃视频免费观看一区| 六月丁香综合在线视频| 国产成a人亚洲| 91久久国产综合久久| 91精品欧美一区二区三区综合在| 欧美成人精品二区三区99精品| 2020国产成人综合网| 亚洲男人的天堂网| 美腿丝袜亚洲色图| 久久99热99| 久久精品国产免费看久久精品| 亚洲国产日日夜夜| 亚洲va天堂va国产va久| 中文字幕免费一区| 国产精品丝袜黑色高跟| 久久久久9999亚洲精品| 久久蜜桃一区二区| 欧美国产成人精品| 亚洲国产日日夜夜| a级高清视频欧美日韩| 91精品国产高清一区二区三区| 国产精品久久国产精麻豆99网站| 亚洲免费资源在线播放| 免费在线观看不卡| 欧美视频自拍偷拍| 中文字幕一区日韩精品欧美| 国产精品99久久久| 91黄色免费版| 国产精品二三区| 夫妻av一区二区| 久久亚洲捆绑美女| 老司机精品视频导航| 欧美精品在线视频| 亚洲制服丝袜av| 91麻豆精品一区二区三区| 久久久五月婷婷| 高清在线观看日韩| 中文字幕高清不卡| 国产精品亚洲第一区在线暖暖韩国| 日韩亚洲欧美一区二区三区| 亚洲不卡一区二区三区| 91成人免费在线视频| 亚洲va在线va天堂| 91亚洲精品乱码久久久久久蜜桃| 日韩一区二区电影| 亚洲免费观看高清在线观看| 激情欧美一区二区| 97精品电影院| 精品福利视频一区二区三区| 亚洲精品午夜久久久| 蜜臀久久久99精品久久久久久| 在线观看亚洲一区| 性久久久久久久久| 日韩西西人体444www| 久久www免费人成看片高清| 久久亚洲精品小早川怜子| 国产成人啪免费观看软件| 亚洲三级小视频| 国产风韵犹存在线视精品| 国产精品免费久久久久| 日本大胆欧美人术艺术动态| 91蜜桃网址入口| 中文字幕亚洲精品在线观看| 在线观看成人小视频| 亚洲国产日韩av| 欧美理论在线播放| 亚洲成人免费影院| 精品福利一区二区三区| 91麻豆国产自产在线观看| 天天综合色天天综合色h| 精品国产乱码久久久久久老虎 | 国产一区免费电影| 亚洲免费大片在线观看| 日韩欧美一区在线| 色素色在线综合| 国产成人精品影院| 日韩av在线发布| 亚洲免费色视频| 欧美国产乱子伦 | 中文一区二区完整视频在线观看| 欧美日韩久久久一区| 另类欧美日韩国产在线| 亚洲一区二区三区四区在线观看| 久久美女艺术照精彩视频福利播放| 欧美日韩视频在线观看一区二区三区| 国产99一区视频免费| 老司机精品视频线观看86| 五月激情综合婷婷| 一区二区在线看| 亚洲欧美日韩综合aⅴ视频| 国产色产综合产在线视频|