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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:07:01+00:00 2026-06-10T07:07:01+00:00

I am using Node’s basic http.request() function without problem on normal HTTP servers. I

  • 0

I am using Node’s basic http.request() function without problem on normal HTTP servers. I need to use http.request() (or similar) with SHOUTcast servers. The SHOUTcast “protocol” is fully compatible with HTTP, except for one detail… the first response line.

Normal HTTP servers respond with:

HTTP/1.1 200 OK

SHOUTcast servers respond with:

ICY 200 OK

Again, the rest of the protocol is the same. The only difference is HTTP/1.x vs. ICY.

I would like to extend, subclass, or somehow modify Node’s http.request() function so that I can make it work with SHOUTcast servers. Connecting to SHOUTcast with Node has been done before, but only by re-inventing the entire wheel. I’d rather not do that for what amounts to be a minor protocol difference.

My Question: Is there a way to do one of the following?

  1. Extend or override the relevant parts of Node’s HTTP parser. (I doubt this is possible, as it seems the parser is native code.)

  2. Create my own bit of code that parses the relevant parts of HTTP, but reuses as many existing Node components for HTTP as possible.

  3. Create a simple internal proxy (or somehow relay data) so that I can modify that first server response line prior to it reaching Node’s HTTP parser.

  4. Something else?

I have also considered using Shred, but it does not offer an option to stream the response. (It waits for the entire server response to be complete before firing an event, which won’t work for streaming servers where the data can run indefinitely.) Along those same lines, I tried Request, but it uses Node’s own HTTP parser, so I get the same parse errors as I would with the native HTTP client.

  • 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-10T07:07:03+00:00Added an answer on June 10, 2026 at 7:07 am

    I’ve come up with another way to do this, similar to the internal proxy, but without the extra connection. It seems that it is possible to override the internally used socket for the HTTP client. When this is done, it is easy to hook in and modify data before passing it off to the original internal socket ondata function.

    Usage

    var httpicy = new HttpIcyClient();
    httpicy.request(/* your normal request parameters here */);
    

    Source

    var http = require('http');
    
    var HttpIcyClient = function () {};
    HttpIcyClient.prototype.request = function (options, callback) {
        var req = http.request(options, callback),
            originalOnDataFunction,
            receiveBuffer = new Buffer(0);
    
        req.on('socket', function (socket) {
            originalOnDataFunction = socket.ondata;
            socket.ondata = function (d, start, end) {
                receiveBuffer = Buffer.concat([receiveBuffer, d.slice(start, end)]);
                if (receiveBuffer.length >= 4) {
                    socket.ondata = originalOnDataFunction;
                    if (receiveBuffer.toString('ascii', 0, 4) === 'ICY ') {
                        receiveBuffer = Buffer.concat([new Buffer('HTTP/1.0 ', 'ascii'), receiveBuffer.slice(4)]);
                    }
                    socket.ondata.apply(this, [receiveBuffer, 0, receiveBuffer.length]);
                }
            };
        });
        return req;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using node.js to make a http request to a host. I found the
I'm using node.js and the less compiler middleware: app.configure(function() { // ... app.use(express.compiler({ src:
I'm (almost) successfully using Node.js with Express and Redis to handle sessions. The problem
I am using node-http-proxy . However, in addition to relaying HTTP requests, I also
I'm using Node.js together with Express framework and i18n module . So I use
I'm using node.js and express to handle HTTP requests and responses. By using the
hi I'm trying create chat using node.js I see example in http://chat.nodejs.org/ I have
I have been using node and redis for some time. The problem I am
I am using node and express. To register a controller I call: app.get('/user/:id', function
I'm using Node.js and WebSocket-Node ( WebSocket-Node ) to create a WebService. I need

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.