Browse Source

add minimal amount about HTTPServer to spec

v0.7.4-release
Ryan 16 years ago
parent
commit
db618cb708
  1. 6
      node_http.cc
  2. 11
      spec/index.html
  3. 2
      test/test_http_server_echo.rb

6
node_http.cc

@ -544,14 +544,10 @@ Init_http (Handle<Object> target)
{ {
HandleScope scope; HandleScope scope;
Local<Object> http = Object::New();
target->Set (String::NewSymbol("HTTP"), http);
Local<FunctionTemplate> server_t = FunctionTemplate::New(server_constructor); Local<FunctionTemplate> server_t = FunctionTemplate::New(server_constructor);
server_t->InstanceTemplate()->SetInternalFieldCount(1); server_t->InstanceTemplate()->SetInternalFieldCount(1);
http->Set(String::New("Server"), server_t->GetFunction()); target->Set(String::New("HTTPServer"), server_t->GetFunction());
path_str = Persistent<String>::New( String::NewSymbol("path") ); path_str = Persistent<String>::New( String::NewSymbol("path") );
uri_str = Persistent<String>::New( String::NewSymbol("uri") ); uri_str = Persistent<String>::New( String::NewSymbol("uri") );

11
spec/index.html

@ -86,10 +86,19 @@
<code>spawn()</code> to start a new context/event loop? <code>spawn()</code> to start a new context/event loop?
<h2 id=http_server><span class=secno>2 </span>HTTP Server</h2> <h2 id=http_server><span class=secno>2 </span>HTTP Server</h2>
<pre class=idl>[Constructor(in String host, in String port)]
interface <dfn id=httpserver>HTTPServer</dfn> {
readonly attribute String <a href="index.html#host">host</a>;
readonly attribute String <a href="index.html#port">port</a>;
// networking
attribute Function <a href="index.html#onrequest">onRequest</a>;
void close(); // yet not implemented
};</pre>
<h2 id=tcp_client><span class=secno>3 </span>TCP Client</h2> <h2 id=tcp_client><span class=secno>3 </span>TCP Client</h2>
<pre class=idl>[Constructor(in String host, in String port)] <pre class=idl>[Constructor(in String host, in String port)]
interface <dfn id=tcpclient>TCPClient</dfn> { interface <dfn id=tcpclient>TCPClient</dfn> {
readonly attribute String <a href="index.html#host">host</a>; readonly attribute String <a href="index.html#host">host</a>;
readonly attribute String <a href="index.html#port">port</a>; readonly attribute String <a href="index.html#port">port</a>;

2
test/test_http_server_echo.rb

@ -32,7 +32,7 @@ function encode(data) {
} }
var port = 8000; var port = 8000;
var server = new HTTP.Server("localhost", port); var server = new HTTPServer("localhost", port);
server.onRequest = function (request) { server.onRequest = function (request) {

Loading…
Cancel
Save