技术的本质 - 围观不会设置User-Agent的美国菜鸟

5 views
Skip to first unread message

benegg

unread,
Oct 12, 2009, 1:52:04 AM10/12/09
to online_game_dev
最近, 网上盛传一个笑话, 一般名字叫做"围观不会设置Java User-Agent的菜鸟". 讲的是国外一个用Java开发Web爬虫获取网页
的菜鸟, 不知道怎么设置自己虫子的User-Agent字段, 该字段可以告诉Web服务器, 对方用的是什么工具或者软件. 这个笑话中的事情确有
其事, 见下面URL:

https://groups.google.com/group/comp.lang.java/browse_thread/thread/6923c024ed392c85

这个帖子(邮件)的发贴人使用的邮箱后缀是cs.stanford.edu, 他是斯坦福大学的学生. 发贴的时间是1996年1月, 使用的Java
是1.0beta2. 当时, Web爬虫技术应该是非常稀有的技术, Java/1.0beta2的HTTP相关库也应该非常难用. 现在看来, 那
时的人, 那时的技术, 都像是婴儿. 所以, 这看起来像个笑话.

但是, "笑话"的笑点在这里吗? 我相信, 大家在看到这个所谓的笑话时, 可能会心里或者面上露出笑, 但应该是感悟的笑, 自嘲的笑, 无奈的
笑, 思索的笑...肯定不会有快乐的笑. 为什么? 因为发贴的人是Larray Page, 是Google公司的创始人之一. 他创造了全球许多
技术人员的上帝, 他创造了巨大的财富, 他创造了技术和商业神话. 可是, 他曾经做过的事, 使用的技术, 开发出的产品, 遇到的无法逾越的问
题, 向人讨教时的心情, 和我们那么接近, 甚至对我们大部分技术人员简直是小菜一碟. 在每一个人心中, 这都是一个历史笑话, 让我们思考技术的
本质.

我把这封邮件引用在这里, 做个留念:

I have a web robot which is a Java app. I need to be able to set
the User-Agent field in the HTTP header in order to be a good net
citizen (so people know who is accessing their server). Anyone have
any ideas?

Right now, Java sends a request that includes something like:

User-Agent: Java/1.0beta2

I'd rather not rewrite all the HTTP stuff myself. I tried just
searching in the JDK for the Java/1.0beta2 figuring I could just
change the string, but I couldn't find it. Perhaps it is stored as a
unicode string?

An easy method of setting the User-Agent field should probably be
added to Java, so people can properly identify their programs.

Thanks, Larry Page

转自: http://www.ideawu.net/blog/?p=428

Reply all
Reply to author
Forward
0 new messages