- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在阅读 the specification about HTTP/1.1重定向代码。我有很多问题:
有一段文字是这样的:
If the 301/302/307 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
问:这在什么意义上被浏览器应用了?我从未看到任何 301/302 响应让我的浏览器询问我是否要确认该操作(例如:通过 PHP 接收表单然后重定向到新输出)。
我很清楚,大多数时候我们使用 302 而不是 303 进行处理和重定向(请参阅其他 - 正是为了这个目的而创建的)。但是,我对 301 302(请注意:预期的原始行为)和 307 感到困惑。Q:在实际示例/使用中它们之间有什么区别案例?
最佳答案
大多数 301/302 重定向响应发生在常规 GET 请求(与 POST 请求相反)上,因此不需要确认。此外,尽管 RFC 在技术上建议对非 GET/HEAD 请求进行确认,但 RFC 还提到:
Note: RFC 1945 and RFC 2068 specify that the client is not allowed to change the method on the redirected request. However, most existing user agent implementations treat 302 as if it were a 303 response, performing a GET on the Location field-value regardless of the original request method. The status codes 303 and 307 have been added for servers that wish to make unambiguously clear which kind of reaction is expected of the client.
302 告诉用户代理在以后的请求中继续使用旧的 uri。 303 告诉用户代理在以后的请求中使用新的 uri。
此外,正如您链接到的 RFC 中的注释所述:
Note: Many pre-HTTP/1.1 user agents do not understand the 303
status. When interoperability with such clients is a concern, the
302 status code may be used instead, since most user agents react
to a 302 response as described here for 303.
我认为应该更改 RFC,以便 如果收到 301/302 状态代码以响应 GET 或 HEAD 以外的请求,用户代理不得自动重定向请求,除非它可以由用户确认,因为这可能会改变发出请求的条件。
应重写为如果收到 301/302 状态代码以响应 GET 或 HEAD 以外的请求,则用户代理不应自动重定向请求,除非它可以被用户确认,因为这可能会更改发出请求的条件。
否则大多数当前用户代理都违反了 RFC。
关于http - 这些 HTTP 3xx 状态代码有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25514707/
我住在荷兰,货币是用逗号 (,) 而不是点 (.)即 14.95 的 feeds 被解释为数字而不是 14.95 欧元 有没有可以解决这个问题的LINUX命令(sed?)?所以14.95变成了14,9
我想问: 我有两个表employee,其中包含字段ID、Fullname、email...和表task 包含字段 name_task、list_employee... 使用字段list_employe
请看下面的测试数据。我想获取 avgtime (=timeonsite/visits) 并在 mysql 中显示为“xx:xx:xx”结果。我怎样才能得到它? SET FOREIGN_KEY_CHEC
我必须处理一个大文件(几 MB)并从中删除带有时间标记的注释。一个例子: blablabla 12:10:40 I want to remove this blablabla some more e
所以我有这些数据直接从 iTunes 复制/粘贴: Excel 具有“XX:XX:00”格式,即“hh:mm:ss”,但您可以想象,它更像“mm:ss:00”。音乐时间不长! 由于这不是直接的单元格格
我有一个对象列表,我想使用 Option.Numero_Reference 属性对其进行排序。 Numero_reference 是一个 xx.xx.xx 格式的字符串 有没有办法按 xx 组排序?
我正在尝试部署 nginx - ingress kubectl run nginx --image=nginx kubectl get pod NAME
我有一个日期“2014-07-02 20:57:38 +0000”,我想将它的格式设置为“今天晚上 8:57”。我希望如果一个字符串是昨天,则将其显示为“昨天上午 9:00”。如果既不是今天也不是昨天
目前我使用的是Apache http components client V4.3.5。在我的例子中,我可以上传小文件(1kb),但是当我运行代码并得到异常“org.apache.http.NoHtt
我在 Linux (RHEL 7) 中运行 HTTPS 服务器。我一启动服务器就收到以下错误。 2019/09/04 15:46:16 http: TLS handshake error from x
我正在参加 CTF 挑战赛,该挑战赛有一个链接,如下所示:46.XXX.XX.XX:8008/ 如果我打开该页面中的开发者工具,我可以找到一个小程序,其属性代码值为“mPage.class”
你好 我想每隔 X 小时在我的程序中运行一个方法,该怎么做?我正在谷歌搜索,但什么也没有:/ 最佳答案 你可以考虑Quartz . 它是在 java 中运行的某种 cron。不过我承认,如果您只想安排
我正在尝试检查 NSString 是否为特定格式。 日:日:日。我在想 NSRegularExpression。有点像 /^(\d)\d:\d\d:\d\d)$/? 最佳答案 你有没有试过这样的事情:
我收到错误 git 存储库的 RSA 主机 key 不在已知主机列表中。当我使用存储库 URL 作为我的 git 克隆 URL 运行 jenkins 作业时。 我尝试在运行作业的主机中克隆相同的存储库
我有一个计数器,每 1 秒计数一次,并将 1 添加到 int。 问题 如何格式化我的字符串,使计数器看起来像这样: 00:01:23 代替: 123 我尝试过的事情 到目前为止我尝试过的事情: for
ERROR 2003 (HY000): Can't connect to MySQL server on 'xx.xx.xx.xx.' (60) 我在尝试远程连接到此服务器时收到此错误。我最近硬重启了
我正在尝试将一些数据从客户端浏览器插入到 AWS 服务器上的 MySQL 数据库。 该代码在 godaddy 上运行,因此看起来像是权限/安全问题。 $servername = "xx.xx.xx.x
我想知道是否有标准方法可以以“UTC+XX:XX”或“UTC-XX:XX”格式返回设备的当前时区? 基于格式化 NSDate 我知道可以在“ZZZZ”的帮助下获得当前时区,它给出“GMT-08:00”
我的 JVM 有 -server 选项,我相信它使 JVM 能够使用 C2 编译器,这意味着用于服务器应用程序,这些应用程序往往比客户端应用程序运行时间更长。但是,GRAAL JIT(由 -XX:+U
public void colortemperatureJSliderStateChanged(ChangeEvent event) { fahrenheitdegree = colortemp
我是一名优秀的程序员,十分优秀!