Icecast 头响应是 400 和 200 [英] Icecast header response is both 400 and 200

查看:56
本文介绍了Icecast 头响应是 400 和 200的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 sub.domain.org 的 Windows 机器上运行 Icecast 2.4.4.我的网站位于 domain.org 的另一台服务器上.

I have Icecast 2.4.4 running on a Windows box at sub.domain.org. My website is on a different server at domain.org.

当我通过 SSH 连接到我的 Linux 主机 shell 并运行 curl 到挂载点时,我得到了 400 的响应,但是如果我执行 wget,我得到了 200 的响应.这怎么可能?

When I SSH into my Linux host shell and run curl to the mount point I get a response of 400, but if I do wget I get a response of 200. How can this be?

# wget https://sub.domain.org/live.mp3
--2018-12-19 17:52:58--  https://sub.domain.org/live.mp3 Resolving sub.domain.org... 111.111.111.111 Connecting to
sub.domain.org|111.111.111.111|:443... connected. HTTP request sent,
awaiting **response... 200 OK** Length: unspecified [audio/mpeg] Saving
to: `live.mp3'

    [                        <=>                 ] 96,600      3.93K/s              ^C

# curl --head  https://sub.domain.org/live.mp3
HTTP/1.0 **400 Bad Request**
Server: Icecast 2.4.4
Connection: Close Date: Thu, 20 Dec 2018
00:53:32 GMT Content-Type: text/html; charset=utf-8 Cache-Control:
no-cache, no-store Expires: Mon, 26 Jul 1997 05:00:00 GMT Pragma:
no-cache Access-Control-Allow-Origin: *

推荐答案

因为在 cURL 的情况下,您正在传递 --head 参数.这告诉 cURL 发出 HTTP HEAD 请求,而不是 wget 执行的 HTTP GET 请求.

Because in case of cURL you are passing the --head parameter. This tells cURL to make a HTTP HEAD request instead of the HTTP GET request that wget performs.

Icecast 支持 HTTP HEAD 请求,因此 HTTP 400 响应是完全合理的.

Icecast does not support HTTP HEAD requests and thus the HTTP 400 response is fully justified.

这篇关于Icecast 头响应是 400 和 200的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆