currently I am doing a work to handle the 400 bad request status error. I am wondering how to create a request that server will return 400 status.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
A HTTP 400 error occurs due to bad syntax in the request.
To create a request that forces the server to return a 400 error, you can:
- Open a TCP connection to port 80 on your server
- Send junk
- Observe response.
回答2:
I found an easy way to generate 400 Bad Request Error:
Appending /%
at the end of the URL should work for most websites.
For example:
http://abc.go.com/%
http://www.checkupdown.com/%
https://www.oath.com/%
https://www.apple.com/%
The above URLs generate the following page:
Note that this method doesn't work for ALL websites on the internet.
Since the server can decide what to do when seeing /%
.