Http &引用;node.js:抛出e;//process.nextTick错误,";在尝试browserid时
我不打算使用其他模块,如Http &引用;node.js:抛出e;//process.nextTick错误,";在尝试browserid时,http,node.js,Http,Node.js,我不打算使用其他模块,如请求,用http, 播种到棕色的时候应该考虑什么?< /P> 错误: $ coffee server.coffee info - socket.io started to send to write end? node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: getaddrinfo ENOENT at er
请求
,用http
,播种到棕色的时候应该考虑什么?< /P> 错误:
$ coffee server.coffee
info - socket.io started
to send
to write
end?
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: getaddrinfo ENOENT
at errnoException (dns.js:31:11)
at Object.onanswer [as oncomplete] (dns.js:140:16)
资料来源:
ll = console.log
fs = require 'fs'
page = fs.readFileSync 'page.html', 'utf-8'
query = require 'querystring'
client = fs.readFileSync 'client.coffee', 'utf-8'
page = page.replace '@@@', client
handler = (req, res) ->
res.writeHead 200, 'Content-Type': 'text/html'
res.end page
http = require 'http'
app = http.createServer handler
app.listen 8000
io = (require 'socket.io').listen app
io.set 'log level', 1
io.sockets.on 'connection', (socket) ->
socket.emit 'ready', 'go'
socket.on 'assertion', (data) ->
msg = query.stringify
assertion: data
audience: 'localhost:8000'
options =
host: 'https://browserid.org'
path: '/verify'
method: 'POST'
headers:
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Length': msg.length
ll 'to send'
request = http.request options, (response) ->
str = ''
ll 'prepare'
response.on 'data', (chunk) ->
str += chunk
ll str
response.on 'end', ->
ll str
request.write msg
ll 'to write'
request.end()
ll 'end?'
对于长堆栈跟踪:
$ coffee server.coffee
info - socket.io started
to send
to write
end?
Uncaught Error: getaddrinfo ENOENT
at errnoException (dns.js:31:11)
at Object.onanswer [as oncomplete] (dns.js:140:16)
----------------------------------------
at EventEmitter.on
at Array.<anonymous> (http.js:1147:12)
at EventEmitter._tickCallback (node.js:192:40)
----------------------------------------
at EventEmitter.nextTick
at ClientRequest.onSocket (http.js:1115:11)
at Agent.addRequest (http.js:938:9)
at new ClientRequest (http.js:1068:16)
at Object.request (http.js:1331:10)
at Socket.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:52:22)
at Socket.$emit (events.js:67:17)
at SocketNamespace.handlePacket (/usr/lib/nodejs/socket.io/lib/namespace.js:335:22)
----------------------------------------
at EventEmitter.on
at SocketNamespace.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:37:19)
at SocketNamespace.$emit (events.js:88:20)
at connect (/usr/lib/nodejs/socket.io/lib/namespace.js:292:10)
at /usr/lib/nodejs/socket.io/lib/namespace.js:308:13
at SocketNamespace.authorize (/usr/lib/nodejs/socket.io/lib/namespace.js:252:5)
at SocketNamespace.handlePacket (/usr/lib/nodejs/socket.io/lib/namespace.js:302:14)
at Manager.handleClient (/usr/lib/nodejs/socket.io/lib/manager.js:669:30)
----------------------------------------
at EventEmitter.on
at Object.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:35:14)
at Object.<anonymous> (/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:71:4)
at Module._compile (module.js:441:26)
at Object.run (/usr/lib/nodejs/coffee-script/lib/coffee-script/coffee-script.js:68:25)
at /usr/lib/nodejs/coffee-script/lib/coffee-script/command.js:135:29
at /usr/lib/nodejs/coffee-script/lib/coffee-script/command.js:110:18
at [object Object].<anonymous> (fs.js:115:5)
at [object Object].emit (events.js:64:17)
Uncaught undefined
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
$coffee服务器.coffee
信息-socket.io已启动
发送
写
结束?
未捕获错误:getaddrinfo eNot
在errnoException(dns.js:31:11)
在Object.onanswer[作为oncomplete](dns.js:140:16)
----------------------------------------
在黄昏时分
在阵列上。(http.js:1147:12)
在EventEmitter上进行回调(node.js:192:40)
----------------------------------------
在EventEmitter.nextTick
在ClientRequest.onSocket(http.js:1115:11)
at Agent.addRequest(http.js:938:9)
在新的ClientRequest上(http.js:1068:16)
at Object.request(http.js:1331:10)
在插座上。(/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:52:22)
在套接字处$emit(events.js:67:17)
位于SocketNamespace.handlePacket(/usr/lib/nodejs/socket.io/lib/namespace.js:335:22)
----------------------------------------
在黄昏时分
在SocketNamespace。(/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:37:19)
在SocketNamespace.$emit(events.js:88:20)
连接时(/usr/lib/nodejs/socket.io/lib/namespace.js:292:10)
at/usr/lib/nodejs/socket.io/lib/namespace.js:308:13
位于SocketNamespace.authorize(/usr/lib/nodejs/socket.io/lib/namespace.js:252:5)
位于SocketNamespace.handlePacket(/usr/lib/nodejs/socket.io/lib/namespace.js:302:14)
位于Manager.handleClient(/usr/lib/nodejs/socket.io/lib/Manager.js:669:30)
----------------------------------------
在黄昏时分
反对。(/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:35:14)
反对。(/home/chen/code/home/git/docview/learning/coffee/browserid/server.coffee:71:4)
在模块处编译(Module.js:441:26)
在Object.run(/usr/lib/nodejs/coffee script/lib/coffee script/coffee script.js:68:25)
at/usr/lib/nodejs/coffee script/lib/coffee script/command.js:135:29
at/usr/lib/nodejs/coffee script/lib/coffee script/command.js:110:18
在[对象]。(财政司司长:115:5)
在[object].emit处(events.js:64:17)
未捕获未定义
node.js:201
抛出e;//process.nextTick错误,或第一次勾选时的“error”事件
^
查看以下内容:
选项:
- 主机:向其发出请求的服务器的域名或IP地址。默认为“localhost”
- 主机名:支持url.parse()主机名优先于主机名
- 端口:远程服务器的端口。默认值为80
options =
hostname: 'browserid.org'
port: 443
path: '/verify'
method: 'POST'
headers:
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Length': msg.length
编辑:http.request
不适用于SSL请求,为此,您需要使用https.request
。更改为该选项也会修复其他错误,默认端口为443,因此如果您愿意,可以从选项中忽略该端口。查看,我们发现:
选项:
- 主机:向其发出请求的服务器的域名或IP地址。默认为“localhost”
- 主机名:支持url.parse()主机名优先于主机名
- 端口:远程服务器的端口。默认值为80
options =
hostname: 'browserid.org'
port: 443
path: '/verify'
method: 'POST'
headers:
'Content-Type': 'application/x-www-form-urlencoded'
'Content-Length': msg.length
编辑:
http.request
不适用于SSL请求,为此,您需要使用https.request
。更改为该选项也会修复其他错误,默认端口为443,因此如果您愿意,可以从选项中忽略该端口。可能有用:可能有用:谢谢。现在似乎是。但后来我遇到了另一个问题,我很高兴听到我的答案有帮助。请考虑接受它,如果它是让你满意,为未来的访客,以及因果报应善良为你我两个!jiyinyiyong:对于https请求,您需要使用https.request
。可能与另一个问题无关,不过您会收到相同的错误消息。我将尝试使用https
。有关于http
的初学者指南吗?我已经搜索了一段时间,但还没有找到一个简单而详细的。因此,对于选项
变量中必须包含的参数,我仍然不清楚。最后,它返回正确的电子邮件地址谢谢。现在似乎是。但后来我遇到了另一个问题,我很高兴听到我的答案有帮助。请考虑接受它,如果它是让你满意,为未来的访客,以及因果报应善良为你我两个!jiyinyiyong:对于https请求,您需要使用https.request
。可能与另一个问题无关,不过您会收到相同的错误消息。我将尝试使用https
。有关于http
的初学者指南吗?我已经搜索了一段时间,但还没有找到一个简单而详细的。因此,对于选项
变量中必须包含的参数,我仍然不清楚。最后,它返回正确的电子邮件地址