亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2541 | 回復(fù): 5
打印 上一主題 下一主題

AnyEvent::http如何才能接受cookie? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2012-07-23 17:58 |只看該作者 |倒序瀏覽
AnyEvent::http如何才能接受cookie?小弟http不太熟悉,哪位幫一下?

論壇徽章:
1
2015年辭舊歲徽章
日期:2015-03-03 16:54:15
2 [報告]
發(fā)表于 2012-07-23 22:40 |只看該作者
  1. cookie_jar => $hash_ref
  2. Passing this parameter enables (simplified) cookie-processing, loosely based on the original netscape specification.

  3. The $hash_ref must be an (initially empty) hash reference which will get updated automatically. It is possible to save the cookie jar to persistent storage with something like JSON or Storable - see the AnyEvent::HTTP::cookie_jar_expire function if you wish to remove expired or session-only cookies, and also for documentation on the format of the cookie jar.

  4. Note that this cookie implementation is not meant to be complete. If you want complete cookie management you have to do that on your own. cookie_jar is meant as a quick fix to get most cookie-using sites working. Cookies are a privacy disaster, do not use them unless required to.

  5. When cookie processing is enabled, the Cookie: and Set-Cookie: headers will be set and handled by this module, otherwise they will be left untouched.
復(fù)制代碼
http://search.cpan.org/~mlehmann/AnyEvent-HTTP-2.14/HTTP.pm

論壇徽章:
0
3 [報告]
發(fā)表于 2012-07-24 09:33 |只看該作者
回復(fù) 2# py


    py兄,這個小弟已經(jīng)看過,還是不懂,能否給個例子?謝謝。

論壇徽章:
0
4 [報告]
發(fā)表于 2012-07-24 10:01 |只看該作者
  1. #!/bin/env perl

  2. use strict;
  3. use warnings;
  4. use AnyEvent;
  5. use AnyEvent::HTTP;
  6. use Data::Dumper;

  7. my $url = "http://www.baidu.com";
  8. my $cookie_jar = {};


  9. my $cv = AnyEvent->condvar;

  10. $cv->begin();
  11. http_get($url,
  12.     cookie_jar => $cookie_jar,
  13.     sub {
  14.         my ($content, $hdr) = @_;

  15.         print $hdr->{Status}, "\n";
  16.         print Dumper($cookie_jar), "\n";

  17.         $cv->end();
  18.     });

  19. $cv->recv();
復(fù)制代碼

論壇徽章:
0
5 [報告]
發(fā)表于 2012-07-24 10:18 |只看該作者
本帖最后由 wendaozhe 于 2012-07-24 10:41 編輯

回復(fù) 4# 3P主義


   自己弄錯了,謝謝兩位!

論壇徽章:
0
6 [報告]
發(fā)表于 2012-07-24 12:53 |只看該作者
抓包的結(jié)果使用AnyEvent::http 訪問和直接使用瀏覽器訪問還是有區(qū)別的,AnyEvent::http中的headers中的cookie和set-cookie如何設(shè)置?今天調(diào)了設(shè)置,可是還是不能跟瀏覽器訪問的一樣。
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP