找回密码
 快速注册
搜索
查看: 76|回复: 0

客户端QQ登录后, 在网页“点击头像授权登录”的原理

[复制链接]

3149

主题

8386

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65391
QQ

显示全部楼层

hbghlyj 发表于 2022-12-22 03:38 |阅读模式
本帖最后由 hbghlyj 于 2022-12-23 00:55 编辑

快捷登录

使用QQ手机版扫码登录,或点击头像授权登录。

密码登录 注册帐号 意见反馈

localhost.ptlogin2.qq.com 会映射到127.0.0.1,为什么?

查阅多方资料发现,其实这种映射其实很简单,就是域名解析的时候将子域名映射到127.0.0.1即可(前提你有注册域名),我想腾讯应该也是这样做的,这样处理可以完美解决浏览器跨域问题。

实际上,本地QQ客户端监听了4300-4308端口,浏览器通过HTTP请求的方式,向本地QQ客户端发送请求,拿到了当前本地QQ客户端登录的账户信息。

浏览器向本地QQ发送请求时,请求中带上了能够令本地QQ确认网站合法性的参数,以防止非法用户获得当前本地QQ客户端的账户信息。

Public Wildcard Domain Name To Resolve To 127.0.0.1

DNS lookup: localhost.ptlogin2.qq.com
{"Status":0,"TC":false,"RD":true,"RA":true,"AD":false,"CD":false,"Question":[{"name":"localhost.ptlogin2.qq.com.","type":1}],"Answer":[{"name":"localhost.ptlogin2.qq.com.","type":1,"TTL":300,"data":"127.0.0.1"}],"Comment":"Response from 121.51.49.22."}
这里的TTL是指time to live varonis.com/blog/dns-ttl
DNS TTL (time to live) is a setting that tells the DNS resolver how long to cache a query before requesting a new one. The information gathered is then stored in the cache of the recursive or local resolver for the TTL before it reaches back out to collect new, updated details. For example, if the DNS TTL is set to 1800 seconds (30 mins), the resolver will have to regather the details around a website like varonis.com every 30 minutes. If 100 users visit the site in that period, they will all see the same thing, until the resolvers update their TTL. Time to live is the least understood in regards to the overall DNS strategy. In the following guide, we will learn about all the details around how DNS TTL operates and also some strategy best practices.

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 15:39

Powered by Discuz!

× 快速回复 返回顶部 返回列表