I was looking into google.com's Net activity in firebug just because I was curious and noticed a request was returning "204 No Content."
我当时正在查看google。com在firebug中的网络活动,只是因为我很好奇,并注意到一个请求正在返回“204 No Content”。
It turns out that a 204 No Content "is primarily intended to allow input for actions to take place without causing a change to the user agent's active document view, although any new or updated metainformation SHOULD be applied to the document currently in the user agent's active view." Whatever.
事实证明,一个204无内容“主要是为了允许对操作进行输入,而不会对用户代理的活动文档视图进行更改,尽管任何新的或更新的信息源都应该应用于当前用户代理的活动视图中的文档。”无论什么。
I've looked into the JS source code and saw that "generate_204" is requested like this:
我查看了JS源代码,并看到“generate_204”是这样要求的:
(new Image).src="http://clients1.google.com/generate_204"No variable declaration/assignment at all.
没有变量声明/分配。
My first idea is that it was being used to track if Javascript is enabled. But the "(new Image).src='...'" call is called from a dynamically loaded external JS file anyway, so that would be pointless.
我的第一个想法是,它是用来跟踪Javascript是否启用的。但“(新形象).src = '……无论如何,调用是从动态加载的外部JS文件中调用的,所以这是没有意义的。
Anyone have any ideas as to what the point could be?
大家有什么想法吗?
UPDATE
更新
"/generate_204" appears to be available on many google services/servers (e.g., maps.google.com/generate_204, maps.gstatic.com/generate_204, etc...).
“/generate_204”在许多谷歌服务/服务器上都可以使用(例如,maps.google.com/generate_204, maps.gstatic.com/generate_204,等等)。
You can take advantage of this by pre-fetching the generate_204 pages for each google-owned service your web app may use. Like This:
您可以利用这一点,为您的web应用程序可能使用的每个google拥有的服务预取generate_204页。是这样的:
window.Onload= function(){ var two_o_fours = [ // google maps domain ... "http://maps.google.com/generate_204", // google maps images domains ... "http://mt0.google.com/generate_204", "http://mt1.google.com/generate_204", "http://mt2.google.com/generate_204", "http://mt3.google.com/generate_204", // you can add your own 204 page for your subdomains too! "http://sub.domain.com/generate_204" ]; for(var i = 0, l = two_o_fours.length; i#1
24
Like Snukker said, clients1.google.com is where the search suggestions come from. My guess is that they make a request to force clients1.google.com into your DNS cache before you need it, so you will have less latency on the first "real" request.
就像Snukker说的,clients1.google.com是搜索建议的来源。我的猜测是,在你需要它之前,他们会请求将clients1.google.com强制到你的DNS缓存中,这样你在第一个“真实”请求上的延迟就会减少。
Google Chrome already does that for any links on a page, and (I think) when you type an address in the location bar. This seems like a way to get all browsers to do the same thing.
谷歌Chrome已经为页面上的任何链接做了这样的操作,并且(我认为)当你在地址栏中键入地址时。这似乎是一种让所有浏览器都做同样事情的方法。
#2
33
I found this old Thread while google'ing for generate_204 as Android seems to use this to determine if the wlan is open (response 204 is received) closed (no response at all) or blocked (redirect to captive portal is present). In that case a notification is shown that a log-in to WiFi is required...
我在谷歌'ing的generate_204中发现了这个旧的线程,因为Android似乎用它来确定wlan是否打开(响应204被接收)关闭(没有响应)或阻塞(重定向到被捕获的门户)。在这种情况下,通知会显示登录到WiFi是必需的…
#3
15
In the event that Chrome detects SSL connection timeouts, certificate errors, or other network issues that might be caused by a captive portal (a hotel's WiFi network, for instance), Chrome will make a COOKIEless request to http://www.gstatic.com/generate_204 and check the response code. If that request is redirected, Chrome will open the redirect target in a new tab on the assumption that it's a login page. Requests to the captive portal detection page are not logged.
如果Chrome检测到SSL连接超时、证书错误或其他网络问题(比如酒店的WiFi网络),Chrome将对http://www.gstatic.com/generate_204进行无COOKIE的请求,并检查响应代码。如果这个请求被重定向,Chrome将在一个新的标签页上打开一个重定向目标,假设它是一个登录页面。对被捕获的门户检测页面的请求没有被记录。
Font: Google Chrome Privacy Whitepaper
字体:谷歌Chrome隐私白皮书。
#4
9
Google is using this to detect whether the device is online or in captive portal.
谷歌使用它来检测设备是在线的还是被捕获的门户。
Shill, the connection manager for Chromium OS, attempts to detect services that are within a captive portal whenever a service transitions to the ready state. This determination of being in a captive portal or being online is done by attempting to retrieve the webpage http://clients3.google.com/generate_204. This well known URL is known to return an empty page with an HTTP status 204. If for any reason the web page is not returned, or an HTTP response other than 204 is received, then shill marks the service as being in the portal state.
当服务转换到就绪状态时,Chromium OS的连接管理器Shill尝试检测在一个被捕获的门户内的服务。通过尝试检索网页http://clients3.google.com/generate_204,可以确定在被捕获的门户网站或在线状态。众所周知,这个众所周知的URL返回一个带有HTTP状态204的空页面。如果由于任何原因,web页面没有返回,或者接收到超过204的HTTP响应,则shill将服务标记为处于门户状态。
Here is the relevant explanation from the Google Chrome Privacy Whitepaper:
以下是谷歌Chrome隐私白皮书的相关说明:
In the event that Chrome detects SSL connection timeouts, certificate errors, or other network issues that might be caused by a captive portal (a hotel's WiFi network, for instance), Chrome will make a COOKIEless request to http://www.gstatic.com/generate_204 and check the response code. If that request is redirected, Chrome will open the redirect target in a new tab on the assumption that it's a login page. Requests to the captive portal detection page are not logged.
如果Chrome检测到SSL连接超时、证书错误或其他网络问题(比如酒店的WiFi网络),Chrome将对http://www.gstatic.com/generate_204进行无COOKIE的请求,并检查响应代码。如果这个请求被重定向,Chrome将在一个新的标签页上打开一个重定向目标,假设它是一个登录页面。对被捕获的门户检测页面的请求没有被记录。
More info: http://www.chromium.org/chromium-os/chromiumos-design-docs/network-portal-detection
更多信息:http://www.chromium.org/chromium-os/chromiumos-design-docs/network-portal-detection。
#5
5
204 responses are sometimes used in AJAX to track clicks and page activity. In this case, the only information being passed to the server in the get request is a COOKIE and not specific information in request parameters, so this doesn't seem to be the case here.
在AJAX中,有时会使用204个响应来跟踪单击和页面活动。在这种情况下,在get请求中传递给服务器的唯一信息是一个COOKIE,而不是请求参数中的特定信息,所以这里似乎不是这样。
It seems that clients1.google.com is the server behind google search suggestions. When you visit http://www.google.com, the COOKIE is passed to http://clients1.google.com/generate_204. Perhaps this is to start up some kind of session on the server? Whatever the use, I doubt it's a very standard use.
看起来,clients1.google.com是谷歌搜索建议背后的服务器。访问http://www.google.com时,COOKIE被传递给http://clients1.google.com/generate_204。也许这是在服务器上启动某种会话?无论使用什么,我怀疑这是一个非常标准的用法。
#6
3
This documents explains:
本文件解释:
http://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=1417 they both have some URLs that return a very specific short text message with a status 200, so instead of accessing the Google url you can for example go to "captive.apple.com" and check for status 200 with data = "Success" and nothing else. If you get status 200 and not exactly that data then you are again in a captive portal.
微软和苹果的做法略有不同;它们都有一些url,它们返回一个非常特定的短文本消息,其中有一个状态200,因此,您可以访问“captive.apple.com”,而不是访问谷歌url,并检查状态为200的数据=“成功”,其他什么都没有。如果你获得了状态200,而不是确切的数据,那么你将再次进入一个被囚禁的门户。
#9
1
with the massive remit by google to stop both spam and the scraping of their search database, I believe that this is part of the effort to track bots etc.
通过谷歌的大量工作来阻止垃圾邮件和搜索数据库的抓取,我相信这是追踪机器人的努力的一部分。
some simple anti bot pseudo could go like this.
一些简单的反机器人可以这样做。
On GET (google.*) Save RemoteEndPoint{ If RemoteEndPoint GETs (clients1.google.com/generate_204) Then Set botAlert_stage1 = false; Else Set botAlert_stage1 = true; End If}I also believe that the latest google frontpage 'theme' is also a new tool to help with the anti spam/bot activity.
我还认为最新的谷歌frontpage“主题”也是一个新的工具来帮助反垃圾邮件/bot活动。
** NOTE ** ipv6.google.com also includes this measure.
也包括这一措施。
Just my unfounded unproofed two 2p.
只是我的毫无根据的两个2p。
#10
0
The generate 204 might be dynamically loading the suggestions of search criteria. AS i can see from my load test script, this is seemingly responsible for every server call each time the user types into the text box
生成的204可能会动态加载搜索条件的建议。从我的负载测试脚本中可以看到,这似乎是每一次服务器调用用户类型进入文本框时的责任。
#11
-1
Well i have been looking at this for a few times and resulted that Google logs referer's where they come from first time visiting the google.com for ex; tracking with Google Chrome i have a 90% guess that its for Logging Referers, maybe User-Agent statistics well known when Google release its list of standards of browser usage:
我已经看了好几次了,结果是谷歌记录了referer他们是第一次访问Google。com的时候;在谷歌Chrome的跟踪中,我有90%的猜测是用于登录的用户,也许是用户代理统计数据,当谷歌发布浏览器使用标准列表时,我们就知道了:
Request URL: http://clients1.google.se/generate_204
请求URL:http://clients1.google.se/generate_204
Request Method: GET
请求方法:
Status Code: 204 No Content
状态代码:204无内容。
Response Headers
响应头
- Content-Length: 0
- 内容长度:0
- Content-Type: text/html
- 内容类型:text / html
- Date: Fri, 21 May 2010 17:06:24 GMT
- 日期:2010年5月21日星期五17:06:24
- Server: GFE/2.0
- 服务器:GFE / 2.0
Here "Referer" under "^Request Headers" shows Googles statistics that many folks come from Microsoft.com, also parsing out the word "Windows 7" to help me focus on Windows 7 in my up-following searches that session
在“Request Headers”下的“Referer”显示了google的统计数据,很多人来自Microsoft.com,也分析了“Windows 7”这个词,以帮助我在接下来的搜索中关注Windows 7。
//Steven
/ /史蒂文