var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
server.listen(8000);
console.log("Server running at http://127.0.0.1:8000/");
我执行了以下 curl 命令:
curl "http://127.0.0.1:8000/"
Hello World
// space is not encoded
curl "http://127.0.0.1:8000/x y"
curl: (52) Empty reply from server
curl "http://127.0.0.1:8000/x"
Hello World
// space is encoded
curl "http://127.0.0.1:8000/x%20y"
Hello World
你能解释一下为什么我得到 curl 52 吗???
在这种情况下,我想寄回 500。我可以这样做吗?