add minimal amount about HTTPServer to spec
This commit is contained in:
Родитель
bc1ebdf5a5
Коммит
db618cb708
|
@ -544,14 +544,10 @@ Init_http (Handle<Object> target)
|
|||
{
|
||||
HandleScope scope;
|
||||
|
||||
Local<Object> http = Object::New();
|
||||
target->Set (String::NewSymbol("HTTP"), http);
|
||||
|
||||
Local<FunctionTemplate> server_t = FunctionTemplate::New(server_constructor);
|
||||
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") );
|
||||
uri_str = Persistent<String>::New( String::NewSymbol("uri") );
|
||||
|
|
|
@ -86,10 +86,19 @@
|
|||
<code>spawn()</code> to start a new context/event loop?
|
||||
|
||||
<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>
|
||||
<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#port">port</a>;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function encode(data) {
|
|||
}
|
||||
|
||||
var port = 8000;
|
||||
var server = new HTTP.Server("localhost", port);
|
||||
var server = new HTTPServer("localhost", port);
|
||||
|
||||
server.onRequest = function (request) {
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче