热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Google.com和clients1.google.com/generate_204-Google.comandclients1.google.com/generate_204

Iwaslookingintogoogle.comsNetactivityinfirebugjustbecauseIwascuriousandnoticedareq

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 

11 个解决方案

#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...enter image description here

我在谷歌'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&cOntext=ecetr&sei-redir=1

http://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=1417&cOntext=ecetr&sei-redir=1

(Search for generate204)

(寻找generate204)

Relevant section:

相关部门:

Among the different objects, a Javascript function triggers a generate204 request sent to the video server that is supposed to serve the video. This starts the video prefetch, which has two main goals: first, it forces the client to perform the DNS resolution of the video server name. Second, it forces the client to open a TCP connection toward the video server. Both help to speed-up the video download phase.

在不同的对象中,一个Javascript函数会触发一个generate204请求发送到该视频服务器,该服务器应该为视频服务。这将启动视频预取,它有两个主要目标:首先,它强制客户端执行视频服务器名称的DNS解析。其次,它强制客户端打开与视频服务器的TCP连接。两者都有助于加速视频下载阶段。

In addition, the generate204 request has exactly the same format and options of the real video download request, so that the video server is eventually warned that a client will possibly download that video very soon. Note that the video server replies with a 204 No Content response, as implied by the command, and no video content is downloaded so far.

另外,generate204请求与实际视频下载请求的格式和选项完全相同,因此视频服务器最终会发出警告,客户机可能很快就会下载该视频。注意,视频服务器响应的是一个204,没有内容响应,这是由命令所暗示的,而且到目前为止还没有下载视频内容。

#7


2  

I found this blog post which explains that it's used to record clicks. Without official word from Google it could be used any number of things.

我发现这篇博文解释了它是用来记录点击量的。没有谷歌的官方消息,它可以使用任何数量的东西。

http://mark.koli.ch/2009/03/howto-configure-apache-to-return-a-http-204-no-content-for-ajax.html

http://mark.koli.ch/2009/03/howto -配置- apache - -返回- http - 204 -不-内容- - - - - - - ajax。

#8


2  

Many applications access this URL to determine if they have a connection that only leads to a captive portal.

许多应用程序访问这个URL以确定它们是否有连接,而这些连接只会导致被捕获的门户。

The idea is that any captive portal thinks this is a "normal" website, and then redirects you to its portal site, which is returned with a status 200. If an application tries to access any normal website, it is confronted with a totally unexpected response and may have problems figuring out what's wrong. However, with this URL it's easy: If you get status 200, you are inside a captive portal, and you can tell your user to do something about it (usually either log in to the portal using a browser, or turn WiFi off and rely on 3G, if they are using a phone). If you get status 204, you got connected to Google, so your application is actually connected to the internet.

这个想法是,任何被囚禁的门户网站都认为这是一个“正常”的网站,然后将你重定向到它的门户网站,它的返回状态为200。如果一个应用程序试图访问任何正常的网站,它将面对一个完全出乎意料的响应,并且可能会发现问题。然而,这个URL很简单:如果你得到地位200年,你正在在一个被门户网站,你可以告诉你的用户做点什么(通常要么使用浏览器登录到门户,或者关闭WiFi和依靠3 g,如果他们使用的是电话)。如果你得到状态204,你就会连接到谷歌,所以你的应用程序实际上是连接到互联网上的。

Microsoft and Apple use a slightly different approach; 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

/ /史蒂文


推荐阅读
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 本文介绍了brain的意思、读音、翻译、用法、发音、词组、同反义词等内容,以及脑新东方在线英语词典的相关信息。还包括了brain的词汇搭配、形容词和名词的用法,以及与brain相关的短语和词组。此外,还介绍了与brain相关的医学术语和智囊团等相关内容。 ... [详细]
  • Google Play推出全新的应用内评价API,帮助开发者获取更多优质用户反馈。用户每天在Google Play上发表数百万条评论,这有助于开发者了解用户喜好和改进需求。开发者可以选择在适当的时间请求用户撰写评论,以获得全面而有用的反馈。全新应用内评价功能让用户无需返回应用详情页面即可发表评论,提升用户体验。 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • IhaveconfiguredanactionforaremotenotificationwhenitarrivestomyiOsapp.Iwanttwodiff ... [详细]
  • Java实战之电影在线观看系统的实现
    本文介绍了Java实战之电影在线观看系统的实现过程。首先对项目进行了简述,然后展示了系统的效果图。接着介绍了系统的核心代码,包括后台用户管理控制器、电影管理控制器和前台电影控制器。最后对项目的环境配置和使用的技术进行了说明,包括JSP、Spring、SpringMVC、MyBatis、html、css、JavaScript、JQuery、Ajax、layui和maven等。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • XML介绍与使用的概述及标签规则
    本文介绍了XML的基本概念和用途,包括XML的可扩展性和标签的自定义特性。同时还详细解释了XML标签的规则,包括标签的尖括号和合法标识符的组成,标签必须成对出现的原则以及特殊标签的使用方法。通过本文的阅读,读者可以对XML的基本知识有一个全面的了解。 ... [详细]
  • 本文介绍了RPC框架Thrift的安装环境变量配置与第一个实例,讲解了RPC的概念以及如何解决跨语言、c++客户端、web服务端、远程调用等需求。Thrift开发方便上手快,性能和稳定性也不错,适合初学者学习和使用。 ... [详细]
  • 关键词:Golang, Cookie, 跟踪位置, net/http/cookiejar, package main, golang.org/x/net/publicsuffix, io/ioutil, log, net/http, net/http/cookiejar ... [详细]
  • 本文介绍了如何清除Eclipse中SVN用户的设置。首先需要查看使用的SVN接口,然后根据接口类型找到相应的目录并删除相关文件。最后使用SVN更新或提交来应用更改。 ... [详细]
  • Android日历提醒软件开源项目分享及使用教程
    本文介绍了一款名为Android日历提醒软件的开源项目,作者分享了该项目的代码和使用教程,并提供了GitHub项目地址。文章详细介绍了该软件的主界面风格、日程信息的分类查看功能,以及添加日程提醒和查看详情的界面。同时,作者还提醒了读者在使用过程中可能遇到的Android6.0权限问题,并提供了解决方法。 ... [详细]
author-avatar
郭洁蓉4071_878
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有