Skip to content
This repository has been archived by the owner on Feb 13, 2018. It is now read-only.

Commit

Permalink
function names changed in version of Node. res.writeHead() req.setEnc…
Browse files Browse the repository at this point in the history
…oding() res.end()
  • Loading branch information
Tim Whitlock committed Jul 23, 2010
1 parent 24e508a commit 62a85b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions node-amf/http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exports.start = function( listenPort, listenHost, methods ){
function onRequest( req, res ){

// we must work in binary, UTF-8 strings will be handled by deserializer
req.setBodyEncoding('binary');
req.setEncoding('binary');

// collect body on data events
var body = '';
Expand Down Expand Up @@ -79,26 +79,26 @@ exports.start = function( listenPort, listenHost, methods ){
// errors respond with an onStatus method request to the client - no responseURI required
catch( Er ){
//sys.puts('Error: ' + Er.message);
responseMessage = createMessage( [Er.message], requestMessage.responseURI+'/onStatus', '' );
responseMessage = createMessage( Er.message, requestMessage.responseURI+'/onStatus', '' );
}
responsePacket.messages.push( responseMessage );
}
// flush HTTP response
var bin = responsePacket.serialize();
//sys.puts( utils.hex(bin) );
//sys.puts( sys.inspect(responsePacket) );
res.writeHeader( 200, {
res.writeHead( 200, {
'Content-Type': 'application/amf',
'Content-Length': bin.length
} );
res.write( bin, "binary" );
}
catch( e ){
//sys.puts( 'Error: ' + e.message );
res.writeHeader( 500, {'Content-Type': 'text/plain'} );
res.writeHead( 500, {'Content-Type': 'text/plain'} );
res.write( 'Error serializing AMF packet:\n' + e.message );
}
res.close();
res.end();
} );
}

Expand Down

0 comments on commit 62a85b8

Please sign in to comment.