20140521 午夜俱乐部

2014 年 5 月 20 日
 iqincai
终于把家附近商店里的所有类型的方便面都尝过一遍了o(`ω´ )o

还是喜欢偏酸的
3684 次点击
所在节点    天黑以后
35 条回复
elvba
2014 年 5 月 21 日
@RIcter

Help!用python提交POST模拟登陆遇到302跳转跑不过去了,试过加headers也不行。
菊苣快来鞭打指教我。
测试地址: http://ilvsx.im/admin/login.php
账号:cee
密码:490896040
txx
2014 年 5 月 21 日
楼下一群老外在踢瓶子,聊天。吵死了 T.T
zorceta
2014 年 5 月 21 日
无聊了给 MDN 贡献了两篇 Wiki 翻译。
Keinez
2014 年 5 月 21 日
@Sunyanzi 瞎了……
109109
2014 年 5 月 21 日
Cee
2014 年 5 月 21 日
>_> @109109 发现在做我应该做的事情orz
还在写算法
alexrezit
2014 年 5 月 21 日
@RIcter
你好, 我是萌妹子.
RIcter
2014 年 5 月 21 日
@alexrezit =3=萌妹子我喜欢你哒哟
popo233
2014 年 5 月 21 日
@RIcter 你好,我也是萌妹子o( ̄ヘ ̄o* )
Cee
2014 年 5 月 21 日
@RIcter
你好, 我是学姐.
RIcter
2014 年 5 月 21 日
@popo233
@Cee 啪啪啪啪啪
elvba
2014 年 5 月 21 日
@109109 谢谢~因为我用的是httplib2,它的example这么写的:

At this point, our "response" variable contains a dictionary of HTTP header fields that were returned by the server. If a cookie was returned, you would see a "set-cookie" field containing the cookie value. We want to take this value and put it into the outgoing HTTP header for our subsequent requests:

headers['Cookie'] = response['set-cookie']

Now we can send a request using this header and it will contain the cookie, so the server can recognize us.

经过多次尝试发现,response获得的set-cookie如下:

'set-cookie': 'ac7a01853674b6a123603b654daa46ae__typecho_uid=1; path=/, ac7a01853674b6a123603b654daa46ae__typecho_authCode=%24T%24hXP2M1zQKe39302496417bc276ae46f0c737fdce7; path=/'

然后我就直接把set-cookie的内容给发了过去,也就是带" path=/",嗯……没错,我就这么发过去的,因为example都这么写的啊……
经过半天的折腾,把" path=/"去掉就正常了。

深深的感觉到了来自世界的恶意啊……
虽然从原理上来讲httplib2这么处理是没错的,但是example能靠谱点么= =||


urllib2对cookies是自动处理的,所以不存在这个问题。
hjse7en
2014 年 5 月 21 日
@elvba 暴露麻花藤
Jelen
2014 年 5 月 21 日
我的天,这是什么贴,内容好充实
elvba
2014 年 5 月 22 日
@hjse7en 不会吧……马化腾貌似没暴露出来- -

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://study.congcong.us/t/113503

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX