Https 标题相同的firefox和luasocket之间的差异

Https 标题相同的firefox和luasocket之间的差异,https,lua,google-translate,luasocket,Https,Lua,Google Translate,Luasocket,我正在尝试通过luasocket获取“” 标头基于HttpFox的输出 我获取内容的尝试: local r, c, h, fc = http.request { -- result (1 or nil on error), code (should be 200), headers, fancy code url = 'http://translate.google.com'; method = 'GET'; sink = sink; headers = {

我正在尝试通过
luasocket
获取“”

标头基于HttpFox的输出

我获取内容的尝试:

local r, c, h, fc = http.request { -- result (1 or nil on error), code (should be 200), headers, fancy code
    url = 'http://translate.google.com';
    method = 'GET';
    sink = sink;
    headers = {
        ['User-Agent'] = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0';
        ['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
        ['Host'] = 'translate.google.com';
        ['Accept-Encoding'] = 'gzip, deflate, br';
        ['Accept-Language'] = 'ru,ru-RU;q=0.8,en;q=0.5,en-US;q=0.3';
        ['DNT'] = '1';
        ['Upgrade-Insecure-Requests'] = '1';
        ['Connection'] = 'close';
    };
}
接收器
是有效的ltn12接收器

结果:

Code: HTTP/1.1 302 Found
Headers: {
  content-type : "text/html; charset=UTF-8"
  connection : "close"
  content-length : "226"
  x-xss-protection : "1; mode=block"
  p3p : "CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info.""
  server : "HTTP server (unknown)"
  cache-control : "private, max-age=0"
  content-language : "ru"
  date : "Tue, 03 Oct 2017 13:50:21 GMT"
  set-cookie : "NID=113=CO3BdznV6UYwcIZoIdF9F7dW1Cooi5ZVmNML0cQI6kA_TvfNig8xRQgS5E9dSKnIZxcfR3jxUbo3RA-7AEsqOCakciOo7Swtrcvz70Cmpm5M-_m1UQYTBBCg8VyNxzBW; expires=Wed, 04-Apr-2018 13:50:21 GMT; path=/; domain=.google.com; HttpOnly"
  x-content-type-options : "nosniff"
  expires : "Tue, 03 Oct 2017 13:50:21 GMT"
  location : "https://translate.google.com/"
}
Body: 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="https://translate.google.com/">here</A>.
</BODY></HTML>
代码:找到HTTP/1.1 302 标题:{ 内容类型:“text/html;charset=UTF-8” 连接:“关闭” 内容长度:“226” x-xss-保护:“1;模式=块” p3p:“CP=”这不是p3p策略!请参阅https://www.google.com/support/accounts/answer/151657?hl=en 有关详细信息。“” 服务器:“HTTP服务器(未知)” 缓存控制:“专用,最大年龄=0” 内容语言:“ru” 日期:“2017年10月3日星期二13:50:21 GMT” 设置cookie:“NID=113=CO3BDZNV6UYWCIZOIDF9F7DW1COOI5ZVTMNML0CQI6KA_TVfNIG8XRQGS5E9DSKNIZCxCFR3JXUBO3RA-7AESQOCAKCIO7SWTRCVZ70CMPM5M-_m1uQYTBCG8VYNxZBW;到期日=2018年4月4日13:50:21 GMT;路径=/;域名=.google.com;HttpOnly” x-content-type-options:“nosniff” 到期时间:“2017年10月3日星期二13:50:21 GMT” 地点:“https://translate.google.com/" } 正文: 302移动 302移动 文档已移动 . 我的要求怎么了?为什么firefox有正确的页面而我没有

Code: HTTP/1.1 302 Found
location : "https://translate.google.com/"
这是对HTTPS位置的重定向,但luasocket不“知道”如何处理HTTPS,因此它不遵循重定向。如果您安装了
local http=require“socket.http”
,并将其替换为
local http=require“ssl.https”
,则应该返回如下内容:

1   200 table: 0x000274e0   HTTP/1.1 200 OK