Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7735827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:35:50+00:00 2026-06-01T07:35:50+00:00

I’m not going to use other module like request , how about writing this

  • 0

I’m not going to use other module like request, how about writing this with http,
What should I consider while seeding post to browserid?

error:

$ 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)

source:

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?'

with long-stack-traces:

$ 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
          ^
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:35:52+00:00Added an answer on June 1, 2026 at 7:35 am

    Looking at the http.request documentation, we find:

    Options:

    • host: A domain name or IP address of the server to issue the request to. Defaults to ‘localhost’.
    • hostname: To support url.parse() hostname is preferred over host
    • port: Port of remote server. Defaults to 80.

    You might try these options instead:

    options =
      hostname: 'browserid.org'
      port: 443
      path: '/verify'
      method: 'POST'
      headers:
        'Content-Type':  'application/x-www-form-urlencoded'
        'Content-Length': msg.length
    

    Edit: http.request doesn’t work for SSL requests, for this, you need to use https.request. Changing to that fixes your other error as well, and the default port is 443 so you can omit that from the options if you wish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.