[英]Http error code 400 when using sim900 to send get or post requests
GET /test/data?meow HTTP/1.1 Host : www.whatever.com Connection : keep-alive
And this is the server response(body omitted):这是服务器响应(省略正文):
HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Sun, 11 Oct 2020 12:08:28 GMT Connection: close Content-Length: 339
I used Postman (application) to simulate the same request and everything worked just fine.我使用 Postman(应用程序)来模拟相同的请求,一切正常。
I also made an exact copy of a chrome request header and gave it to the module, but that didn't work either.我还制作了 chrome 请求标头的精确副本并将其提供给模块,但这也不起作用。
Note: I am not using sim900's HTTP commands I am connecting to a certain port(80 in this case) and making a get request manually.注意:我没有使用 sim900 的 HTTP 命令,而是连接到某个端口(在本例中为 80)并手动发出获取请求。
Note 2:I have been given a Plesk panel to manage my website and do not have access to certain server settings.注 2:我已获得 Plesk 面板来管理我的网站,但无权访问某些服务器设置。
The request will pass through the http.sys module before entering iis, which will intercept requests that do not comply with the rules, so your response comes from Microsoft-HTTPAPI / 2.0 with a status code of 400. The solution to this can be to modify the registry, but the setting in the registry is based on your application and request, and there is no universal modification method.请求在进入iis之前会经过http.sys模块,它会拦截不符合规则的请求,所以你的响应来自Microsoft-HTTPAPI/2.0,状态码为400。 解决方法可以是修改注册表,但是注册表中的设置是根据你的应用和要求,没有通用的修改方法。
How to troubleshoot HTTP 400 errors 如何解决 HTTP 400 错误
Http.sys registry settings for Windows Windows 的 Http.sys 注册表设置
Another method is to suggest that you use a tool similar to Fiddler to capture the request sent by sim900 and the request sent by postman respectively.另一种方法是建议你使用类似Fiddler的工具分别抓取sim900发送的请求和postman发送的请求。 After the capture, compare them in detail to find out the differences, and modify the sim900 request to be the same as the postman request, conforming to http .sys rules.
抓包后详细对比,找出不同之处,修改sim900请求与postman请求一样,符合http.sys规则。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.