我试图使用Sulley模糊框架来处理服务器。
我在Wireshark观察到了下面的流。该错误讨论了JSON解析中的一个问题,但是,当我使用Google的Postman扩展尝试相同的HTTP请求时,它成功了。
有人能解释一下这个HTTP请求有什么问题吗?JSON看起来是有效的。
POST /restconf/config HTTP/1.1
Host: 127.0.0.1:8080
Accept: */*
Content-Type: application/yang.data+json
{ "toaster:toaster" : { "toaster:toasterManufacturer" : "Geqq", "toaster:toasterModelNumber" : "asaxc", "toaster:toasterStatus" : "_." }}
HTTP/1.1 400 Bad Request
Server: Apache-Coyote/1.1
Content-Type: */*
Transfer-Encoding: chunked
Date: Sat, 07 Jun 2014 05:26:35 GMT
Connection: close
152
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>protocol</error-type>
<error-tag>malformed-message</error-tag>
<error-message>Error parsing input: Root element of Json has to be Object</error-message>
</error>
</errors>
0发布于 2014-06-08 05:07:15
它是标题中缺少的“内容长度”属性,服务器认为它是强制性的,我认为它不应该是强制性的?
在将“内容长度”添加到标题后,工作起来就像一种魅力。
发布于 2014-06-07 09:33:12
根据您的消息,它应该是在POST请求正文之前的空行。你能试着加一个吗?
如前所述,服务器可以看到没有主体和标题的请求,如下所示:
{ "toaster:toaster" : value这就解释了这个错误。
发布于 2014-06-07 08:22:18
也许是因为“内容类型”的标题。如果服务器配置为只接受"application/json“,那么它可能返回此错误代码。尽管它应该返回"415不支持的媒体类型“,根据RFC2616。
这只是猜测,但您可以尝试将“Content”标题更改为"application/json“。
https://serverfault.com/questions/602525
复制相似问题