标签:
var http = require(‘http‘); http.createServer(function (req, res) { console.log(req.url); console.log(req.method); console.log(‘-------------------------------------------‘); res.writeHead(200, {‘Content-Type‘: ‘text/plain‘}); res.end(‘Hello World\n‘); }).listen(1337, "127.0.0.1"); console.log(‘Server running at http://127.0.0.1:1337/‘);
访问时服务器端输出如下:
/ssss?ss GET ------------------------------------------- /favicon.ico GET ------------------------------------------- /ssssq GET ------------------------------------------- /favicon.ico GET ------------------------------------------- /ssssq/index.html GET ------------------------------------------- /favicon.ico GET -------------------------------------------
原来每次访问网页之时浏览器都会发出两次请求,一次正常请求,一次图标请求,应该对图标请求做专门的处理
标签:
原文地址:http://my.oschina.net/u/861926/blog/468880