首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Guzzle + openHAB REST:"cURL错误61:未识别的内容编码类型. libcurl理解充气,gzip内容编码“

Guzzle + openHAB REST:"cURL错误61:未识别的内容编码类型. libcurl理解充气,gzip内容编码“
EN

Stack Overflow用户
提问于 2020-08-04 13:52:53
回答 1查看 4.4K关注 0票数 1

我的openHAB系统的口香糖和REST API有一些问题.

我有一个新的Laravel 7安装,在这里我使用口香糖从openHAB API中检索东西。对于对/things端点的GET请求来说,这很好。但是,当我试图向特定的事物(端点/things/UUID )发送请求时,我会得到以下错误:

代码语言:javascript
运行
复制
GuzzleHttp\Exception\RequestException 

cURL error 61: Unrecognized content encoding type. libcurl understands deflate, gzip content encodings. (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

我不知道这究竟是什么意思。附加的是调试模式下的口吻请求响应的转储:

用PHP:实例化口香糖客户端

代码语言:javascript
运行
复制
$this->guzzle_client = new \GuzzleHttp\Client([
    'base_uri' => $protocol.$this->server_hostname.':'.$this->server_port.'/rest/',
    'verify' => false,
    'auth' => [$this->server_username, $this->server_password],
    'debug' => true,
]);         

调试-来自Guzzle客户端的输出:

代码语言:javascript
运行
复制
*   Trying 10.0.0.63...
* TCP_NODELAY set
* Connected to 10.0.0.63 (10.0.0.63) port 8080 (#0)
> GET /rest/things HTTP/1.1
Host: 10.0.0.63:8080
User-Agent: GuzzleHttp/6.5.5 curl/7.64.1 PHP/7.3.11
Authorization: Basic Og==

到目前为止还不错..。现在问题来了:

触发错误的口吻请求:

代码语言:javascript
运行
复制
$response = $this->api()->request('GET', 'things/'.$uid);

调试-从Guzzle请求输出:

代码语言:javascript
运行
复制
* Found bundle for host 10.0.0.63: 0x7fafc9d7acb0 [can pipeline]
* Re-using existing connection! (#0) with host 10.0.0.63
* Connected to 10.0.0.63 (10.0.0.63) port 8080 (#0)
> GET /rest/things/zwave%3Adevice%3A23daaff0%3Anode7 HTTP/1.1
Host: 10.0.0.63:8080
User-Agent: GuzzleHttp/6.5.5 curl/7.64.1 PHP/7.3.11
Authorization: Basic Og==

< HTTP/1.1 200 OK
< Content-Type: application/json
< Content-Encoding: UTF-8
< Content-Length: 7386
< Server: Jetty(9.4.20.v20190813)
< 
* Unrecognized content encoding type. libcurl understands deflate, gzip content encodings.
* Closing connection 0

我不知道在这里该怎么办?口香糖从openHAB API中获取某些内容似乎是一件微不足道的事情,所以我不明白为什么这两个系统之间会出现编码问题。

知道如何解决这个问题吗?

EN

回答 1

Stack Overflow用户

发布于 2020-08-06 21:10:32

这不是你的错,而是服务器的错。

从服务器获得的Content-Encoding: UTF-8是不正确的。这个头should contain transfer encoding type (like gzip or deflate),但不是字符集(UTF-8)。

最好的选择是与服务器的开发人员联系并解决那里的问题。在那之前你什么也做不了。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63248405

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档