2009-10-10

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

Views: 19528 | 3 Comments

最近, 网上盛传一个笑话, 一般名字叫做"围观不会设置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公司的创始人之一. 他创造了全球许多技术人员的上帝, 他创造了巨大的财富, 他创造了技术和商业神话. 可是, 他曾经做过的事, 使用的技术, 开发出的产品, 遇到的无法逾越的问题, 向人讨教时的心情, 和我们那么接近, 甚至对我们大部分技术人员简直是小菜一碟. 在每一个人心中, 这都是一个历史笑话, 让我们思考技术的本质.

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

Jan 7 1996, 4:00 pm

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

Related posts:

  1. WordPress category widget using new 2.8 API
  2. 宽带网络运营商劫持网站的技术分析
  3. 史上最强大的PHP MySQL操作类
  4. Web应用中基于组的用户权限管理在Spring框架下的实现
  5. 使用 Ideawu.P2P.Core.AccountManager 登录服务中心
Posted by ideawu at 2009-10-10 14:57:14

3 Responses to "技术的本质 – 围观不会设置User-Agent的美国菜鸟"

Leave a Comment