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

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

?? cookies.c

?? Wget很好的處理了http和ftp的下載,很值得學習的經典代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* Support for cookies.   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,   2008 Free Software Foundation, Inc.This file is part of GNU Wget.GNU Wget is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 3 of the License, or (atyour option) any later version.GNU Wget is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with Wget.  If not, see <http://www.gnu.org/licenses/>.Additional permission under GNU GPL version 3 section 7If you modify this program, or any covered work, by linking orcombining it with the OpenSSL project's OpenSSL library (or amodified version of that library), containing parts covered by theterms of the OpenSSL or SSLeay licenses, the Free Software Foundationgrants you additional permission to convey the resulting work.Corresponding Source for a non-source form of such a combinationshall include the source code for the parts of OpenSSL used as wellas that of the covered work.  *//* Written by Hrvoje Niksic.  Parts are loosely inspired by the   cookie patch submitted by Tomasz Wegrzanowski.   This implements the client-side cookie support, as specified   (loosely) by Netscape's "preliminary specification", currently   available at:       http://wp.netscape.com/newsref/std/cookie_spec.html   rfc2109 is not supported because of its incompatibilities with the   above widely-used specification.  rfc2965 is entirely ignored,   since popular client software doesn't implement it, and even the   sites that do send Set-Cookie2 also emit Set-Cookie for   compatibility.  */#include <config.h>#include <stdio.h>#include <string.h>#include <stdlib.h>#include <assert.h>#include <errno.h>#include <time.h>#include "wget.h"#include "utils.h"#include "hash.h"#include "cookies.h"#include "http.h"               /* for http_atotm *//* Declarations of `struct cookie' and the most basic functions. *//* Cookie jar serves as cookie storage and a means of retrieving   cookies efficiently.  All cookies with the same domain are stored   in a linked list called "chain".  A cookie chain can be reached by   looking up the domain in the cookie jar's chains_by_domain table.   For example, to reach all the cookies under google.com, one must   execute hash_table_get(jar->chains_by_domain, "google.com").  Of   course, when sending a cookie to `www.google.com', one must search   for cookies that belong to either `www.google.com' or `google.com'   -- but the point is that the code doesn't need to go through *all*   the cookies.  */struct cookie_jar {  /* Cookie chains indexed by domain.  */  struct hash_table *chains;  int cookie_count;             /* number of cookies in the jar. */};/* Value set by entry point functions, so that the low-level   routines don't need to call time() all the time.  */static time_t cookies_now;struct cookie_jar *cookie_jar_new (void){  struct cookie_jar *jar = xnew (struct cookie_jar);  jar->chains = make_nocase_string_hash_table (0);  jar->cookie_count = 0;  return jar;}struct cookie {  char *domain;                 /* domain of the cookie */  int port;                     /* port number */  char *path;                   /* path prefix of the cookie */  unsigned discard_requested :1; /* whether cookie was created to                                   request discarding another                                   cookie. */  unsigned secure :1;           /* whether cookie should be                                   transmitted over non-https                                   connections. */  unsigned domain_exact :1;     /* whether DOMAIN must match as a                                   whole. */  unsigned permanent :1;        /* whether the cookie should outlive                                   the session. */  time_t expiry_time;           /* time when the cookie expires, 0                                   means undetermined. */  char *attr;                   /* cookie attribute name */  char *value;                  /* cookie attribute value */  struct cookie *next;          /* used for chaining of cookies in the                                   same domain. */};#define PORT_ANY (-1)/* Allocate and return a new, empty cookie structure. */static struct cookie *cookie_new (void){  struct cookie *cookie = xnew0 (struct cookie);  /* Both cookie->permanent and cookie->expiry_time are now 0.  This     means that the cookie doesn't expire, but is only valid for this     session (i.e. not written out to disk).  */  cookie->port = PORT_ANY;  return cookie;}/* Non-zero if the cookie has expired.  Assumes cookies_now has been   set by one of the entry point functions.  */static boolcookie_expired_p (const struct cookie *c){  return c->expiry_time != 0 && c->expiry_time < cookies_now;}/* Deallocate COOKIE and its components. */static voiddelete_cookie (struct cookie *cookie){  xfree_null (cookie->domain);  xfree_null (cookie->path);  xfree_null (cookie->attr);  xfree_null (cookie->value);  xfree (cookie);}/* Functions for storing cookies.   All cookies can be reached beginning with jar->chains.  The key in   that table is the domain name, and the value is a linked list of   all cookies from that domain.  Every new cookie is placed on the   head of the list.  *//* Find and return a cookie in JAR whose domain, path, and attribute   name correspond to COOKIE.  If found, PREVPTR will point to the   location of the cookie previous in chain, or NULL if the found   cookie is the head of a chain.   If no matching cookie is found, return NULL. */static struct cookie *find_matching_cookie (struct cookie_jar *jar, struct cookie *cookie,                      struct cookie **prevptr){  struct cookie *chain, *prev;  chain = hash_table_get (jar->chains, cookie->domain);  if (!chain)    goto nomatch;  prev = NULL;  for (; chain; prev = chain, chain = chain->next)    if (0 == strcmp (cookie->path, chain->path)        && 0 == strcmp (cookie->attr, chain->attr)        && cookie->port == chain->port)      {        *prevptr = prev;        return chain;      } nomatch:  *prevptr = NULL;  return NULL;}/* Store COOKIE to the jar.   This is done by placing COOKIE at the head of its chain.  However,   if COOKIE matches a cookie already in memory, as determined by   find_matching_cookie, the old cookie is unlinked and destroyed.   The key of each chain's hash table entry is allocated only the   first time; next hash_table_put's reuse the same key.  */static voidstore_cookie (struct cookie_jar *jar, struct cookie *cookie){  struct cookie *chain_head;  char *chain_key;  if (hash_table_get_pair (jar->chains, cookie->domain,                           &chain_key, &chain_head))    {      /* A chain of cookies in this domain already exists.  Check for         duplicates -- if an extant cookie exactly matches our domain,         port, path, and name, replace it.  */      struct cookie *prev;      struct cookie *victim = find_matching_cookie (jar, cookie, &prev);      if (victim)        {          /* Remove VICTIM from the chain.  COOKIE will be placed at             the head. */          if (prev)            {              prev->next = victim->next;              cookie->next = chain_head;            }          else            {              /* prev is NULL; apparently VICTIM was at the head of                 the chain.  This place will be taken by COOKIE, so                 all we need to do is:  */              cookie->next = victim->next;            }          delete_cookie (victim);          --jar->cookie_count;          DEBUGP (("Deleted old cookie (to be replaced.)\n"));        }      else        cookie->next = chain_head;    }  else    {      /* We are now creating the chain.  Use a copy of cookie->domain         as the key for the life-time of the chain.  Using         cookie->domain would be unsafe because the life-time of the         chain may exceed the life-time of the cookie.  (Cookies may         be deleted from the chain by this very function.)  */      cookie->next = NULL;      chain_key = xstrdup (cookie->domain);    }  hash_table_put (jar->chains, chain_key, cookie);  ++jar->cookie_count;  IF_DEBUG    {      time_t exptime = cookie->expiry_time;      DEBUGP (("\nStored cookie %s %d%s %s <%s> <%s> [expiry %s] %s %s\n",               cookie->domain, cookie->port,               cookie->port == PORT_ANY ? " (ANY)" : "",               cookie->path,               cookie->permanent ? "permanent" : "session",               cookie->secure ? "secure" : "insecure",               cookie->expiry_time ? datetime_str (exptime) : "none",               cookie->attr, cookie->value));    }}/* Discard a cookie matching COOKIE's domain, port, path, and   attribute name.  This gets called when we encounter a cookie whose   expiry date is in the past, or whose max-age is set to 0.  The   former corresponds to netscape cookie spec, while the latter is   specified by rfc2109.  */static voiddiscard_matching_cookie (struct cookie_jar *jar, struct cookie *cookie){  struct cookie *prev, *victim;  if (!hash_table_count (jar->chains))    /* No elements == nothing to discard. */    return;  victim = find_matching_cookie (jar, cookie, &prev);  if (victim)    {      if (prev)        /* Simply unchain the victim. */        prev->next = victim->next;      else        {          /* VICTIM was head of its chain.  We need to place a new             cookie at the head.  */          char *chain_key = NULL;          int res;          res = hash_table_get_pair (jar->chains, victim->domain,                                     &chain_key, NULL);          assert (res != 0);          if (!victim->next)            {              /* VICTIM was the only cookie in the chain.  Destroy the                 chain and deallocate the chain key.  */              hash_table_remove (jar->chains, victim->domain);              xfree (chain_key);            }          else            hash_table_put (jar->chains, chain_key, victim->next);        }      delete_cookie (victim);      DEBUGP (("Discarded old cookie.\n"));    }}/* Functions for parsing the `Set-Cookie' header, and creating new   cookies from the wire.  */#define TOKEN_IS(token, string_literal)                         \  BOUNDED_EQUAL_NO_CASE (token.b, token.e, string_literal)#define TOKEN_NON_EMPTY(token) (token.b != NULL && token.b != token.e)/* Parse the contents of the `Set-Cookie' header.  The header looks   like this:   name1=value1; name2=value2; ...   Trailing semicolon is optional; spaces are allowed between all   tokens.  Additionally, values may be quoted.   A new cookie is returned upon success, NULL otherwise.   The first name-value pair will be used to set the cookie's   attribute name and value.  Subsequent parameters will be checked   against field names such as `domain', `path', etc.  Recognized   fields will be parsed and the corresponding members of COOKIE   filled.  */static struct cookie *parse_set_cookie (const char *set_cookie, bool silent){  const char *ptr = set_cookie;  struct cookie *cookie = cookie_new ();  param_token name, value;  if (!extract_param (&ptr, &name, &value, ';'))    goto error;  if (!value.b)    goto error;  cookie->attr = strdupdelim (name.b, name.e);  cookie->value = strdupdelim (value.b, value.e);  while (extract_param (&ptr, &name, &value, ';'))    {      if (TOKEN_IS (name, "domain"))        {          if (!TOKEN_NON_EMPTY (value))            goto error;          xfree_null (cookie->domain);          /* Strictly speaking, we should set cookie->domain_exact if the             domain doesn't begin with a dot.  But many sites set the             domain to "foo.com" and expect "subhost.foo.com" to get the             cookie, and it apparently works in browsers.  */          if (*value.b == '.')            ++value.b;          cookie->domain = strdupdelim (value.b, value.e);        }      else if (TOKEN_IS (name, "path"))        {          if (!TOKEN_NON_EMPTY (value))            goto error;          xfree_null (cookie->path);          cookie->path = strdupdelim (value.b, value.e);        }      else if (TOKEN_IS (name, "expires"))        {          char *value_copy;          time_t expires;          if (!TOKEN_NON_EMPTY (value))            goto error;          BOUNDED_TO_ALLOCA (value.b, value.e, value_copy);          expires = http_atotm (value_copy);          if (expires != (time_t) -1)            {              cookie->permanent = 1;              cookie->expiry_time = expires;              /* According to netscape's specification, expiry time in                 the past means that discarding of a matching cookie                 is requested.  */              if (cookie->expiry_time < cookies_now)                cookie->discard_requested = 1;            }          else            /* Error in expiration spec.  Assume default (cookie doesn't               expire, but valid only for this session.)  */            ;        }      else if (TOKEN_IS (name, "max-age"))        {          double maxage = -1;          char *value_copy;          if (!TOKEN_NON_EMPTY (value))            goto error;          BOUNDED_TO_ALLOCA (value.b, value.e, value_copy);          sscanf (value_copy, "%lf", &maxage);          if (maxage == -1)            /* something went wrong. */            goto error;          cookie->permanent = 1;          cookie->expiry_time = cookies_now + maxage;          /* According to rfc2109, a cookie with max-age of 0 means that             discarding of a matching cookie is requested.  */          if (maxage == 0)            cookie->discard_requested = 1;        }      else if (TOKEN_IS (name, "secure"))        {          /* ignore value completely */          cookie->secure = 1;        }      else        /* Ignore unrecognized attribute. */        ;    }  if (*ptr)    /* extract_param has encountered a syntax error */    goto error;  /* The cookie has been successfully constructed; return it. */  return cookie; error:  if (!silent)    logprintf (LOG_NOTQUIET,               _("Syntax error in Set-Cookie: %s at position %d.\n"),               escnonprint (set_cookie), (int) (ptr - set_cookie));  delete_cookie (cookie);  return NULL;}#undef TOKEN_IS#undef TOKEN_NON_EMPTY/* Sanity checks.  These are important, otherwise it is possible for   mailcious attackers to destroy important cookie information and/or   violate your privacy.  */#define REQUIRE_DIGITS(p) do {                  \  if (!ISDIGIT (*p))                            \    return false;                               \  for (++p; ISDIGIT (*p); p++)                  \    ;                                           \} while (0)#define REQUIRE_DOT(p) do {                     \  if (*p++ != '.')                              \    return false;                               \} while (0)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区在线观看免费| 国产高清一区日本| 国产精品综合在线视频| 在线亚洲高清视频| 久久久久国产精品免费免费搜索| 亚洲综合一区二区精品导航| 成人国产精品免费观看视频| 欧美一级日韩不卡播放免费| 亚洲女人的天堂| 岛国一区二区三区| 日韩欧美色综合网站| 亚洲成人中文在线| 在线视频一区二区免费| 中文字幕一区二区在线播放| 国产乱码精品一区二区三| 欧美一区二区视频在线观看| 亚洲精品第1页| 欧美高清视频在线高清观看mv色露露十八| 91美女片黄在线| 欧美日韩dvd在线观看| 国产精品另类一区| 激情图区综合网| 欧美电影免费观看高清完整版在线观看| 亚洲午夜久久久久| 色综合天天视频在线观看| 日本一区二区三级电影在线观看 | 五月天中文字幕一区二区| jiyouzz国产精品久久| 国产清纯白嫩初高生在线观看91 | 国产亚洲自拍一区| 黄页网站大全一区二区| 欧美一区二区视频网站| 日韩电影免费一区| 欧美一区二区福利视频| 青草av.久久免费一区| 欧美日韩国产bt| 奇米影视7777精品一区二区| 欧美一区二区三区免费| 成人av集中营| 国产精品狼人久久影院观看方式| 丁香天五香天堂综合| 国产精品欧美一区喷水| av一二三不卡影片| 一个色综合网站| 在线不卡中文字幕| 国产一区在线观看麻豆| 国产精品久久久久久亚洲伦| 色综合天天天天做夜夜夜夜做| 一区二区三区久久久| 欧美精品久久99久久在免费线| 日韩有码一区二区三区| 亚洲精品在线观看网站| gogo大胆日本视频一区| 亚洲国产aⅴ天堂久久| 91麻豆精品国产自产在线| 激情五月婷婷综合网| 国产精品久久久久久福利一牛影视| 色婷婷综合五月| 蜜桃视频在线一区| 国产精品久久网站| 精品视频一区 二区 三区| 久久国产精品72免费观看| 国产精品免费视频一区| 欧美天天综合网| 国产在线乱码一区二区三区| 自拍偷拍亚洲综合| 日韩精品在线一区二区| av亚洲精华国产精华精华 | 亚洲欧美激情小说另类| 欧美一激情一区二区三区| 成人激情综合网站| 日本欧美一区二区在线观看| 中文幕一区二区三区久久蜜桃| 在线观看视频一区二区欧美日韩| 国内成+人亚洲+欧美+综合在线| 亚洲黄色在线视频| 国产三级精品在线| 正在播放亚洲一区| 99v久久综合狠狠综合久久| 日韩av中文字幕一区二区三区| 国产精品毛片高清在线完整版| 91精品国产综合久久久久久漫画 | 一区二区不卡在线视频 午夜欧美不卡在| 69av一区二区三区| 一本久久a久久精品亚洲| 狠狠狠色丁香婷婷综合激情| 亚洲国产成人tv| 最新欧美精品一区二区三区| 亚洲精品在线网站| 在线电影欧美成精品| 91在线国产福利| 国产精品一区二区视频| 蜜桃在线一区二区三区| 亚洲成av人片www| 亚洲欧美视频在线观看视频| 久久综合九色综合97_久久久| 制服丝袜亚洲精品中文字幕| 日本韩国欧美国产| 97成人超碰视| 99久久精品国产毛片| 国产98色在线|日韩| 韩国午夜理伦三级不卡影院| 免费观看成人鲁鲁鲁鲁鲁视频| 国产成人av电影在线观看| 麻豆视频观看网址久久| 爽好久久久欧美精品| 丝瓜av网站精品一区二区| 亚洲黄色尤物视频| 亚洲一区二区三区三| 亚洲在线免费播放| 亚洲一区在线观看网站| 亚洲国产成人av网| 日本亚洲最大的色成网站www| 亚洲午夜视频在线| 亚洲成人av一区| 亚洲大型综合色站| 日韩电影在线免费看| 日韩国产一二三区| 日本大胆欧美人术艺术动态| 免费欧美日韩国产三级电影| 麻豆国产一区二区| 国产成人免费在线观看不卡| 成人黄色777网| 91老师国产黑色丝袜在线| 色丁香久综合在线久综合在线观看| 一本大道久久a久久精二百| 色偷偷久久一区二区三区| 欧美日韩和欧美的一区二区| 91精品国产综合久久婷婷香蕉| 精品少妇一区二区三区日产乱码| 亚洲精品一区二区三区香蕉| 国产日韩精品一区二区三区| 中文字幕在线观看不卡视频| 一区二区三区美女视频| 日本欧美大码aⅴ在线播放| 韩国中文字幕2020精品| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 91国模大尺度私拍在线视频| 欧美无乱码久久久免费午夜一区| 欧美一区二区不卡视频| 久久九九全国免费| 亚洲欧美日韩国产综合| 日韩高清不卡一区二区三区| 激情综合网最新| 91麻豆成人久久精品二区三区| 在线综合+亚洲+欧美中文字幕| 精品欧美乱码久久久久久1区2区| 国产精品无遮挡| 日本中文字幕一区二区有限公司| 国产一区二区三区精品欧美日韩一区二区三区 | 偷拍亚洲欧洲综合| 美女视频黄a大片欧美| 成人午夜激情在线| 欧美日韩久久一区| 国产夜色精品一区二区av| 一区二区三区在线免费播放| 国产乱码一区二区三区| 欧美午夜精品一区二区三区| 久久伊人蜜桃av一区二区| 亚洲美女区一区| 精品亚洲porn| 制服丝袜亚洲精品中文字幕| 亚洲视频一区二区在线观看| 国内精品不卡在线| 欧美乱熟臀69xxxxxx| 国产精品久久久久7777按摩 | 精品久久久久久久久久久院品网| 国产精品久久久久一区| 青青草原综合久久大伊人精品 | 午夜欧美一区二区三区在线播放| 国产成人精品影视| 日韩欧美在线一区二区三区| 亚洲精选视频免费看| 国产精品99久久久| 精品国产一二三| 日本不卡的三区四区五区| 欧洲在线/亚洲| 亚洲欧洲av在线| 国产成人免费av在线| 精品免费一区二区三区| 日韩高清在线观看| 欧美精品色一区二区三区| 亚洲精品视频一区| av爱爱亚洲一区| 日本一区二区动态图| 国内不卡的二区三区中文字幕 | 欧美一卡二卡在线| 午夜亚洲国产au精品一区二区| 色综合天天综合在线视频| 国产精品久久三区| www.成人网.com| 日韩毛片精品高清免费| 99久久精品国产一区| 亚洲欧洲精品一区二区三区不卡| 成人午夜av影视| 中文字幕一区二区三| 一本色道久久综合精品竹菊| 亚洲免费在线视频| 欧洲亚洲精品在线| 亚洲香蕉伊在人在线观|