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 7159297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:12:27+00:00 2026-05-28T13:12:27+00:00

I am using node.js v. 0.4.8. When I create a HTTPS server, I never

  • 0

I am using node.js v. 0.4.8. When I create a HTTPS server, I never get the response.on(‘end’, …) event (but I do for a HTTP one). I read the issue reports on node’s github page – https://github.com/joyent/node/issues/728, and apparently this is an issue that regressed into 0.4.8. response.on(‘close’, …) seems to have the same functionality, but I do not know enough about HTTP/HTTPS to judge. Can I use it as replacement for response.on(‘end’, …), and is this likely to cause any problems in future?

You can see a code sample below.
Thanks in advance!

var request = "JSON_request";
var https = require('https');
var options = { 
        host:"someHost.com",
        path:"somePath",
        method: "POST", 
        headers: {
            'Content-Type': 'application/json',
            'Content-Length': Buffer.byteLength(request)
        }
    };

var req = https.request(options, function(res){
    var response = "";
    res.setEncoding('utf8');

    res.on('data', function(chunk){
        console.log("INFO: "+chunk);
        response += chunk;
    });

    // This never happens
    res.on('end', function(){
        console.log("End received!");
    });

    // But this does
    res.on('close', function(){
        console.log("Close received!");
    });
});

req.on('error', function(error){
    console.log("Error: "+error);
});

req.write(request);
req.end();
  • 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-05-28T13:12:28+00:00Added an answer on May 28, 2026 at 1:12 pm

    I believe this issue has been fixed as of commit de09168, and there hasn’t been any action on this question for months BUT here is the answer:

    On the comments for issue 728 Node.js creator Ryan Dahl says:

    This isn’t a bug. Responses are not guaranteed to have an ‘end’ event. Use ‘close’.

    Though later he says:

    i take back what i said before. we should probably make this work.

    Either way it seems close and end are pretty much interoperable in this use case. The relevent code in the node.js core tls.js:681 renforces that interpretation:

    process.nextTick(function() {
      self.encrypted.emit('end');
      self.cleartext.emit('end');
      self.encrypted.emit('close');
      self.cleartext.emit('close');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using nodejs to create a simple proxy server that logs http and https
hi I'm trying create chat using node.js I see example in http://chat.nodejs.org/ I have
I just installed Ubuntu 10.10 server with NodeJS 0.4.6 using this guide: http://www.codediesel.com/linux/installing-node-js-on-ubuntu-10-04/ on
How can I create a node in Scala without using literals? What I need
I'm interested in using Node.js as a socket server for stream-based communication with tens
Anyone know how to get the position of a node using XPath? Say I
How can one select a specific sibling of a context node using jQuery? Specifically,
Here's my problem: I have server A, running node.js and using socket.io for communicating
I am trying to create a chrome extension using HTML5 WebSockets and can't get
Node.js noob. I am using node.io to scrape websites but I would love to

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.