【问题标题】:Http request header "Accept-Charset" is not recognized无法识别 Http 请求标头“Accept-Charset”
【发布时间】:2013-11-29 07:20:36
【问题描述】:

我正在尝试使用 chrome DHC 和 Advanced REST 客户端进行 REST 调用。例如:

http://www.google.co.in 的 HEAD 呼叫 使用高级 REST 客户端给出:

Redirect To:https://www.google.co.in/ with status: 302 Show explanation HTTP/1.1 302 Found
Redirection information has not been cached.
Location: https://www.google.co.in/ 
Cache-Control: private 
Content-Type: text/html; charset=UTF-8 
Date: Fri, 29 Nov 2013 06:57:46 GMT 
Server: gws 
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic
Content-Length: 222 
Proxy-Connection: Keep-Alive
Connection: Keep-Alive
Status
200 OK Show explanation Loading time: 764


Request headers 
Accept: application/json
Accept-Language: en-US
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36
X-Chrome-Variations: <some value>
Accept-Encoding: gzip,deflate,sdch
Cookie: <some value>

Response headers 
status: 200 OK
version: HTTP/1.1
alternate-protocol: 443:quic
cache-control: private, max-age=0
content-encoding: gzip
content-length: 34821
content-type: text/html; charset=UTF-8
date: Fri, 29 Nov 2013 06:57:46 GMT
expires: -1
server: gws
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block

我对请求标头的详细信息更感兴趣,因为 "Accept-Charset" 无法识别。如果我将任何内容作为标头提供,它至少会显示在请求标头中。现在有一些问题:

  1. 为什么无法识别?这是客户端问题还是服务器问题?我需要使用任何其他客户端吗?我不知道。

  2. 如果它被识别,那么我应该能够在服务器代码中验证这个值,在我的例子中,它是在码头运行的?

谢谢, 阿喜

【问题讨论】:

    标签: http rest http-headers jetty google-chrome-app


    【解决方案1】:

    我发现这是特定于 Chrome 的客户端问题。我不知道为什么使用 chrome 这个标题会被完全忽略。 当我尝试使用 CURL 命令发送 http 请求时,我能够检索到此标头。现在我可以继续验证“Accept-Charset”标头了。

    【讨论】:

      猜你喜欢
      • 2011-12-21
      • 2020-01-21
      • 2019-12-18
      • 2015-10-02
      • 1970-01-01
      • 2020-04-07
      • 2014-12-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多