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

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

?? cookies.c

?? Wget很好的處理了http和ftp的下載,很值得學(xué)習(xí)的經(jīng)典代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
  struct weighed_cookie *wc2 = (struct weighed_cookie *)p2;  /* Subtractions take `wc2' as the first argument becauase we want a     sort in *decreasing* order of goodness.  */  int dgdiff = wc2->domain_goodness - wc1->domain_goodness;  int pgdiff = wc2->path_goodness - wc1->path_goodness;  /* Sort by domain goodness; if these are the same, sort by path     goodness.  (The sorting order isn't really specified; maybe it     should be the other way around.)  */  return dgdiff ? dgdiff : pgdiff;}/* Generate a `Cookie' header for a request that goes to HOST:PORT and   requests PATH from the server.  The resulting string is allocated   with `malloc', and the caller is responsible for freeing it.  If no   cookies pertain to this request, i.e. no cookie header should be   generated, NULL is returned.  */char *cookie_header (struct cookie_jar *jar, const char *host,               int port, const char *path, bool secflag){  struct cookie **chains;  int chain_count;  struct cookie *cookie;  struct weighed_cookie *outgoing;  int count, i, ocnt;  char *result;  int result_size, pos;  PREPEND_SLASH (path);         /* see cookie_handle_set_cookie */  /* First, find the cookie chains whose domains match HOST. */  /* Allocate room for find_chains_of_host to write to.  The number of     chains can at most equal the number of subdomains, hence     1+<number of dots>.  */  chains = alloca_array (struct cookie *, 1 + count_char (host, '.'));  chain_count = find_chains_of_host (jar, host, chains);  /* No cookies for this host. */  if (!chain_count)    return NULL;  cookies_now = time (NULL);  /* Now extract from the chains those cookies that match our host     (for domain_exact cookies), port (for cookies with port other     than PORT_ANY), etc.  See matching_cookie for details.  */  /* Count the number of matching cookies. */  count = 0;  for (i = 0; i < chain_count; i++)    for (cookie = chains[i]; cookie; cookie = cookie->next)      if (cookie_matches_url (cookie, host, port, path, secflag, NULL))        ++count;  if (!count)    return NULL;                /* no cookies matched */  /* Allocate the array. */  outgoing = alloca_array (struct weighed_cookie, count);  /* Fill the array with all the matching cookies from the chains that     match HOST. */  ocnt = 0;  for (i = 0; i < chain_count; i++)    for (cookie = chains[i]; cookie; cookie = cookie->next)      {        int pg;        if (!cookie_matches_url (cookie, host, port, path, secflag, &pg))          continue;        outgoing[ocnt].cookie = cookie;        outgoing[ocnt].domain_goodness = strlen (cookie->domain);        outgoing[ocnt].path_goodness   = pg;        ++ocnt;      }  assert (ocnt == count);  /* Eliminate duplicate cookies; that is, those whose name and value     are the same.  */  count = eliminate_dups (outgoing, count);  /* Sort the array so that best-matching domains come first, and     that, within one domain, best-matching paths come first. */  qsort (outgoing, count, sizeof (struct weighed_cookie), goodness_comparator);  /* Count the space the name=value pairs will take. */  result_size = 0;  for (i = 0; i < count; i++)    {      struct cookie *c = outgoing[i].cookie;      /* name=value */      result_size += strlen (c->attr) + 1 + strlen (c->value);    }  /* Allocate output buffer:     name=value pairs -- result_size     "; " separators  -- (count - 1) * 2     \0 terminator    -- 1 */  result_size = result_size + (count - 1) * 2 + 1;  result = xmalloc (result_size);  pos = 0;  for (i = 0; i < count; i++)    {      struct cookie *c = outgoing[i].cookie;      int namlen = strlen (c->attr);      int vallen = strlen (c->value);      memcpy (result + pos, c->attr, namlen);      pos += namlen;      result[pos++] = '=';      memcpy (result + pos, c->value, vallen);      pos += vallen;      if (i < count - 1)        {          result[pos++] = ';';          result[pos++] = ' ';        }    }  result[pos++] = '\0';  assert (pos == result_size);  return result;}/* Support for loading and saving cookies.  The format used for   loading and saving should be the format of the `cookies.txt' file   used by Netscape and Mozilla, at least the Unix versions.   (Apparently IE can export cookies in that format as well.)  The   format goes like this:       DOMAIN DOMAIN-FLAG PATH SECURE-FLAG TIMESTAMP ATTR-NAME ATTR-VALUE     DOMAIN      -- cookie domain, optionally followed by :PORT     DOMAIN-FLAG -- whether all hosts in the domain match     PATH        -- cookie path     SECURE-FLAG -- whether cookie requires secure connection     TIMESTAMP   -- expiry timestamp, number of seconds since epoch     ATTR-NAME   -- name of the cookie attribute     ATTR-VALUE  -- value of the cookie attribute (empty if absent)   The fields are separated by TABs.  All fields are mandatory, except   for ATTR-VALUE.  The `-FLAG' fields are boolean, their legal values   being "TRUE" and "FALSE'.  Empty lines, lines consisting of   whitespace only, and comment lines (beginning with # optionally   preceded by whitespace) are ignored.   Example line from cookies.txt (split in two lines for readability):       .google.com      TRUE    /       FALSE   2147368447      \       PREF     ID=34bb47565bbcd47b:LD=en:NR=20:TM=985172580:LM=985739012*//* If the region [B, E) ends with :<digits>, parse the number, return   it, and store new boundary (location of the `:') to DOMAIN_E_PTR.   If port is not specified, return 0.  */static intdomain_port (const char *domain_b, const char *domain_e,             const char **domain_e_ptr){  int port = 0;  const char *p;  const char *colon = memchr (domain_b, ':', domain_e - domain_b);  if (!colon)    return 0;  for (p = colon + 1; p < domain_e && ISDIGIT (*p); p++)    port = 10 * port + (*p - '0');  if (p < domain_e)    /* Garbage following port number. */    return 0;  *domain_e_ptr = colon;  return port;}#define GET_WORD(p, b, e) do {                  \  b = p;                                        \  while (*p && *p != '\t')                      \    ++p;                                        \  e = p;                                        \  if (b == e || !*p)                            \    goto next;                                  \  ++p;                                          \} while (0)/* Load cookies from FILE.  */voidcookie_jar_load (struct cookie_jar *jar, const char *file){  char *line;  FILE *fp = fopen (file, "r");  if (!fp)    {      logprintf (LOG_NOTQUIET, _("Cannot open cookies file `%s': %s\n"),                 file, strerror (errno));      return;    }  cookies_now = time (NULL);  for (; ((line = read_whole_line (fp)) != NULL); xfree (line))    {      struct cookie *cookie;      char *p = line;      double expiry;      int port;      char *domain_b  = NULL, *domain_e  = NULL;      char *domflag_b = NULL, *domflag_e = NULL;      char *path_b    = NULL, *path_e    = NULL;      char *secure_b  = NULL, *secure_e  = NULL;      char *expires_b = NULL, *expires_e = NULL;      char *name_b    = NULL, *name_e    = NULL;      char *value_b   = NULL, *value_e   = NULL;      /* Skip leading white-space. */      while (*p && ISSPACE (*p))        ++p;      /* Ignore empty lines.  */      if (!*p || *p == '#')        continue;      GET_WORD (p, domain_b,  domain_e);      GET_WORD (p, domflag_b, domflag_e);      GET_WORD (p, path_b,    path_e);      GET_WORD (p, secure_b,  secure_e);      GET_WORD (p, expires_b, expires_e);      GET_WORD (p, name_b,    name_e);      /* Don't use GET_WORD for value because it ends with newline,         not TAB.  */      value_b = p;      value_e = p + strlen (p);      if (value_e > value_b && value_e[-1] == '\n')        --value_e;      if (value_e > value_b && value_e[-1] == '\r')        --value_e;      /* Empty values are legal (I think), so don't bother checking. */      cookie = cookie_new ();      cookie->attr    = strdupdelim (name_b, name_e);      cookie->value   = strdupdelim (value_b, value_e);      cookie->path    = strdupdelim (path_b, path_e);      cookie->secure  = BOUNDED_EQUAL (secure_b, secure_e, "TRUE");      /* Curl source says, quoting Andre Garcia: "flag: A TRUE/FALSE         value indicating if all machines within a given domain can         access the variable.  This value is set automatically by the         browser, depending on the value set for the domain."  */      cookie->domain_exact = !BOUNDED_EQUAL (domflag_b, domflag_e, "TRUE");      /* DOMAIN needs special treatment because we might need to         extract the port.  */      port = domain_port (domain_b, domain_e, (const char **)&domain_e);      if (port)        cookie->port = port;      if (*domain_b == '.')        ++domain_b;             /* remove leading dot internally */      cookie->domain  = strdupdelim (domain_b, domain_e);      /* safe default in case EXPIRES field is garbled. */      expiry = (double)cookies_now - 1;      /* I don't like changing the line, but it's safe here.  (line is         malloced.)  */      *expires_e = '\0';      sscanf (expires_b, "%lf", &expiry);      if (expiry == 0)        {          /* EXPIRY can be 0 for session cookies saved because the             user specified `--keep-session-cookies' in the past.             They remain session cookies, and will be saved only if             the user has specified `keep-session-cookies' again.  */        }      else        {          if (expiry < cookies_now)            goto abort_cookie;  /* ignore stale cookie. */          cookie->expiry_time = expiry;          cookie->permanent = 1;        }      store_cookie (jar, cookie);    next:      continue;    abort_cookie:      delete_cookie (cookie);    }  fclose (fp);}/* Save cookies, in format described above, to FILE. */voidcookie_jar_save (struct cookie_jar *jar, const char *file){  FILE *fp;  hash_table_iterator iter;  DEBUGP (("Saving cookies to %s.\n", file));  cookies_now = time (NULL);  fp = fopen (file, "w");  if (!fp)    {      logprintf (LOG_NOTQUIET, _("Cannot open cookies file `%s': %s\n"),                 file, strerror (errno));      return;    }  fputs ("# HTTP cookie file.\n", fp);  fprintf (fp, "# Generated by Wget on %s.\n", datetime_str (cookies_now));  fputs ("# Edit at your own risk.\n\n", fp);  for (hash_table_iterate (jar->chains, &iter);       hash_table_iter_next (&iter);       )    {      const char *domain = iter.key;      struct cookie *cookie = iter.value;      for (; cookie; cookie = cookie->next)        {          if (!cookie->permanent && !opt.keep_session_cookies)            continue;          if (cookie_expired_p (cookie))            continue;          if (!cookie->domain_exact)            fputc ('.', fp);          fputs (domain, fp);          if (cookie->port != PORT_ANY)            fprintf (fp, ":%d", cookie->port);          fprintf (fp, "\t%s\t%s\t%s\t%.0f\t%s\t%s\n",                   cookie->domain_exact ? "FALSE" : "TRUE",                   cookie->path, cookie->secure ? "TRUE" : "FALSE",                   (double)cookie->expiry_time,                   cookie->attr, cookie->value);          if (ferror (fp))            goto out;        }    } out:  if (ferror (fp))    logprintf (LOG_NOTQUIET, _("Error writing to `%s': %s\n"),               file, strerror (errno));  if (fclose (fp) < 0)    logprintf (LOG_NOTQUIET, _("Error closing `%s': %s\n"),               file, strerror (errno));  DEBUGP (("Done saving cookies.\n"));}/* Clean up cookie-related data. */voidcookie_jar_delete (struct cookie_jar *jar){  /* Iterate over chains (indexed by domain) and free them. */  hash_table_iterator iter;  for (hash_table_iterate (jar->chains, &iter); hash_table_iter_next (&iter); )    {      struct cookie *chain = iter.value;      xfree (iter.key);      /* Then all cookies in this chain. */      while (chain)        {          struct cookie *next = chain->next;          delete_cookie (chain);          chain = next;        }    }  hash_table_destroy (jar->chains);  xfree (jar);}/* Test cases.  Currently this is only tests parse_set_cookies.  To   use, recompile Wget with -DTEST_COOKIES and call test_cookies()   from main.  */#ifdef TEST_COOKIESvoidtest_cookies (void){  /* Tests expected to succeed: */  static struct {    const char *data;    const char *results[10];  } tests_succ[] = {    { "arg=value", {"arg", "value", NULL} },    { "arg1=value1;arg2=value2", {"arg1", "value1", "arg2", "value2", NULL} },    { "arg1=value1; arg2=value2", {"arg1", "value1", "arg2", "value2", NULL} },    { "arg1=value1;  arg2=value2;", {"arg1", "value1", "arg2", "value2", NULL} },    { "arg1=value1;  arg2=value2;  ", {"arg1", "value1", "arg2", "value2", NULL} },    { "arg1=\"value1\"; arg2=\"\"", {"arg1", "value1", "arg2", "", NULL} },    { "arg=", {"arg", "", NULL} },    { "arg1=; arg2=", {"arg1", "", "arg2", "", NULL} },    { "arg1 = ; arg2= ", {"arg1", "", "arg2", "", NULL} },  };  /* Tests expected to fail: */  static char *tests_fail[] = {    ";",    "arg=\"unterminated",    "=empty-name",    "arg1=;=another-empty-name",  };  int i;  for (i = 0; i < countof (tests_succ); i++)    {      int ind;      const char *data = tests_succ[i].data;      const char **expected = tests_succ[i].results;      struct cookie *c;      c = parse_set_cookie (data, true);      if (!c)        {          printf ("NULL cookie returned for valid data: %s\n", data);          continue;        }      /* Test whether extract_param handles these cases correctly. */      {        param_token name, value;        const char *ptr = data;        int j = 0;        while (extract_param (&ptr, &name, &value, ';'))          {            char *n = strdupdelim (name.b, name.e);            char *v = strdupdelim (value.b, value.e);            if (!expected[j])              {                printf ("Too many parameters for '%s'\n", data);                break;              }            if (0 != strcmp (expected[j], n))              printf ("Invalid name %d for '%s' (expected '%s', got '%s')\n",                      j / 2 + 1, data, expected[j], n);            if (0 != strcmp (expected[j + 1], v))              printf ("Invalid value %d for '%s' (expected '%s', got '%s')\n",                      j / 2 + 1, data, expected[j + 1], v);            j += 2;            free (n);            free (v);          }        if (expected[j])          printf ("Too few parameters for '%s'\n", data);      }    }  for (i = 0; i < countof (tests_fail); i++)    {      struct cookie *c;      char *data = tests_fail[i];      c = parse_set_cookie (data, true);      if (c)        printf ("Failed to report error on invalid data: %s\n", data);    }}#endif /* TEST_COOKIES */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区不卡在线| 亚洲网友自拍偷拍| 国产成人av网站| 久久精品一区四区| 99精品在线观看视频| 亚洲欧美日韩小说| 欧美日韩免费一区二区三区视频| 天天色综合成人网| 日韩色视频在线观看| 国产一区三区三区| 中文久久乱码一区二区| 欧洲精品在线观看| 天天影视色香欲综合网老头| 亚洲精品一线二线三线无人区| 国产一区美女在线| 一区二区成人在线| 日韩欧美在线123| 成人久久视频在线观看| 亚洲一区二三区| 久久中文字幕电影| 色综合久久六月婷婷中文字幕| 男女男精品网站| 国产精品福利一区二区三区| 欧美嫩在线观看| 国产综合色在线| 亚洲精品综合在线| 精品久久久久久最新网址| 波多野结衣视频一区| 日韩制服丝袜av| 国产精品美女一区二区| 911国产精品| 成人av中文字幕| 奇米影视在线99精品| 国产精品乱码人人做人人爱| 欧美精品丝袜久久久中文字幕| 国产大片一区二区| 天天色天天爱天天射综合| 国产精品视频九色porn| 日韩视频不卡中文| 欧美性受xxxx| 99久久精品情趣| 国产真实乱子伦精品视频| 亚洲一区二区三区在线看| 国产偷国产偷精品高清尤物 | 久久久午夜精品| 欧美中文字幕一区| 成人一区二区三区在线观看| 日韩激情中文字幕| 亚洲精品亚洲人成人网在线播放| 国产丝袜在线精品| 欧美tk—视频vk| 欧美精品乱码久久久久久按摩| 97se亚洲国产综合自在线观| 国产精品亚洲视频| 久久99精品久久只有精品| 亚洲国产美女搞黄色| 亚洲青青青在线视频| 国产精品免费aⅴ片在线观看| 久久综合网色—综合色88| 日韩美一区二区三区| 欧美日韩国产123区| 欧美一a一片一级一片| 日本电影亚洲天堂一区| 97久久久精品综合88久久| 成人一区二区三区在线观看| 国产精品夜夜爽| 国产一区二区三区免费播放 | 亚洲精品日产精品乱码不卡| 国产三级精品三级| 久久久av毛片精品| 久久这里只有精品视频网| 精品成人一区二区| 精品国产电影一区二区| 欧美mv日韩mv国产网站app| 日韩欧美资源站| 日韩美女一区二区三区| 日韩美女天天操| 久久精品一区二区三区av| 欧美精品一区二区三区在线播放| 欧美电视剧免费观看| 精品久久久久久久久久久久久久久久久 | 亚洲欧洲日韩av| 国产精品成人一区二区三区夜夜夜| 国产亚洲欧美一区在线观看| 中文字幕精品综合| 国产精品久线观看视频| 自拍偷在线精品自拍偷无码专区| 亚洲摸摸操操av| 亚洲成人免费在线观看| 亚洲图片有声小说| 人人狠狠综合久久亚洲| 精品午夜久久福利影院| 国产精品一区二区你懂的| 成人一区二区在线观看| 色网综合在线观看| 欧美肥大bbwbbw高潮| 欧美大黄免费观看| 国产精品免费aⅴ片在线观看| 亚洲人成人一区二区在线观看| 一个色在线综合| 蜜臀av亚洲一区中文字幕| 韩国三级在线一区| 成人av网站在线观看免费| 色94色欧美sute亚洲线路一ni| 3atv在线一区二区三区| 久久综合资源网| 亚洲精品中文字幕乱码三区 | 欧美成人一区二区三区片免费 | 极品少妇一区二区| 国v精品久久久网| 在线国产电影不卡| 精品国产一区二区精华| 中文字幕在线观看不卡| 日韩精品电影在线观看| 国产99久久久精品| 精品视频在线免费看| 久久久久久久久久久久久夜| 亚洲另类在线视频| 免费成人美女在线观看.| 不卡视频在线观看| 69久久夜色精品国产69蝌蚪网| 国产日韩精品一区二区三区| 亚洲一级二级在线| 国产精品18久久久| 欧美日韩一区二区三区高清| 欧美精彩视频一区二区三区| 亚洲午夜国产一区99re久久| 国产成人av电影在线| 91精品国产综合久久久久| 中文字幕亚洲在| 狠狠狠色丁香婷婷综合久久五月| 99久久精品国产一区二区三区| 欧美岛国在线观看| 亚洲高清视频中文字幕| aaa欧美大片| 精品国产乱码久久久久久久| 午夜精品久久久久久久久久久| 成人一级黄色片| 精品国产不卡一区二区三区| 亚洲国产精品人人做人人爽| proumb性欧美在线观看| 26uuu欧美| 蜜桃精品视频在线| 欧美精品三级在线观看| 亚洲免费毛片网站| av不卡一区二区三区| 国产色婷婷亚洲99精品小说| 蜜桃视频免费观看一区| 欧美日韩第一区日日骚| 亚洲激情六月丁香| 成人免费观看av| 国产三级精品视频| 国产美女视频91| 久久久国产精品麻豆| 看电视剧不卡顿的网站| 91精品久久久久久久91蜜桃 | 欧美a级一区二区| 欧美日韩精品一区二区三区 | 一个色综合网站| 色系网站成人免费| 亚洲乱码国产乱码精品精的特点| 粉嫩aⅴ一区二区三区四区| 久久网这里都是精品| 狠狠色狠狠色合久久伊人| 亚洲精品一线二线三线| 激情五月婷婷综合网| 欧美www视频| 国产黑丝在线一区二区三区| 2023国产精品| 国产大陆a不卡| 国产精品乱码人人做人人爱| 波多野结衣中文字幕一区二区三区| 国产人久久人人人人爽| 国产成人精品免费一区二区| 久久久91精品国产一区二区三区| 国产传媒久久文化传媒| 国产精品久久久久久一区二区三区| 成年人网站91| 亚洲欧美区自拍先锋| 欧美日韩黄色一区二区| 欧美96一区二区免费视频| 久久久久久久综合| jlzzjlzz欧美大全| 亚洲精品亚洲人成人网| 欧美久久免费观看| 久久国产成人午夜av影院| 久久久不卡网国产精品一区| 成人av资源站| 香蕉久久一区二区不卡无毒影院| 在线成人高清不卡| 国产在线国偷精品产拍免费yy| 中文字幕av一区二区三区免费看| 99国产精品视频免费观看| 亚洲图片自拍偷拍| 亚洲精品一线二线三线| 色一情一乱一乱一91av| 久久99热国产| 亚洲欧美色综合| 欧美成人精品高清在线播放| www.爱久久.com|