Ryan
c226f81768
Fix HTTP client output bug.
2009-06-04 15:44:38 +02:00
Ryan
c457b829e2
If http.Client has an error, do not continue to reconnect.
2009-06-04 12:39:19 +02:00
Ryan
8cfdd326a8
Add "had_error" argument to the "onDisconnect" in node.tcp.Client
...
This is a boolean value which allows one to detect if the socket was closed
due to errors. There is not yet a way to look up the actual error code.
2009-06-04 12:33:19 +02:00
Ryan
8bf2a2fa55
Rename req.uri.queryKey to req.uri.params. More familar to rails users.
2009-06-01 20:59:33 +02:00
Ryan
ed283dc280
Fix bug: catting non-existent files
2009-06-01 12:56:28 +02:00
Ryan
aceb1987ed
Remove complex string appending in http's send() method.
...
That seems to churn the garbage collector like mad.
Before: http://s3.amazonaws.com/four.livejournal/20090529/timeseries6.png
After: http://s3.amazonaws.com/four.livejournal/20090529/timeseries11.png
Got a nice tight side profile for this benchmark now:
http://s3.amazonaws.com/four.livejournal/20090529/hist10.png
2009-05-29 17:05:03 +02:00
Ryan
247c9d2210
Remove unnecessary AdjustAmountOfExternalAllocatedMemory from node.http.
2009-05-29 13:58:52 +02:00
Ryan
34a6f10695
Fix ::exit() compile issues.
...
Thanks Matthias!
2009-05-28 14:47:16 +02:00
Ryan
11b2e5dcc4
Remove file access flags that arn't present in macintosh.
2009-05-26 20:35:42 +02:00
Ryan
b260a9108b
Add errno constants. Move all constants to node.constants namespace.
2009-05-26 19:48:49 +02:00
Ryan
3bdd042a6e
Rename fatal_exception to FatalException
2009-05-26 18:18:17 +02:00
Ryan
c4e53c7ceb
Have connection.setEncoding use node::ParseEncoding
2009-05-26 18:14:32 +02:00
Ryan
e8f177aa2d
Clean up outgoing encoding API. Generally: send(chunk, encoding).
2009-05-26 17:48:59 +02:00
Ryan
c326614c8d
More docs. Add rmdir and unlink.
2009-05-26 12:11:31 +02:00
Ryan
a9f29cd18d
File I/O documentation. Remove necessity of class="sh_javascript".
2009-05-26 11:39:40 +02:00
Ryan
2fe090b7f6
Add node.fs prefix to some constants. oops.
2009-05-26 03:37:18 +02:00
Ryan
d1b0ce6d37
Large refactor of file code.
...
All the c++ code is now reduced to simple wrappers. The node.fs.File object
is defined entirely in javascript now. As is the actionQueue methods.
This makes the boundaries much cleaner. There is still some thought that
needs to go into how exactly the API should behave but this simplification
is a first step.
2009-05-26 03:30:51 +02:00
Ryan
3eb4819db1
Add docs. Rename exit() to node.exit().
2009-05-25 13:38:36 +02:00
Ryan
5c2389fada
Remove error codes from file on_completion callbacks. Use file.onError.
...
The error codes still remain for the two general file system operations:
rename and stat.
Additionally I've removed the actionQueue for file system operations. They
are sent directly into the thread pool.
2009-05-25 13:17:35 +02:00
Ryan
58c13e5192
Namespace File stuff in node.fs
2009-05-21 12:49:41 +02:00
Ryan
6244f77822
Beginnings of file i/o docs. Finish up timers.
2009-05-21 12:33:57 +02:00
Ryan
cb3a11d72a
Camel case status_code and http_version.
2009-05-20 16:06:08 +02:00
Ryan
81b39a04cd
Add setBodyEncoding to http client responses.
2009-05-20 13:00:20 +02:00
Ryan
a1aecc9378
HTTP Server: Close 1.0 connections properly.
2009-05-20 10:28:10 +02:00
Ryan
0ef5c99973
Add http.ServerRequest.setBodyEncoding. Needs test still.
2009-05-20 10:17:07 +02:00
Ryan
1b54e3d87d
Change encoding setter/getter to setEncoding function.
2009-05-20 10:02:02 +02:00
Ryan
82e773630b
HTTP Client: add fix to allow TCP connection to reconnect.
2009-05-19 21:53:26 +02:00
Ryan
b445514898
Remove debugging statement.
2009-05-19 20:40:56 +02:00
Ryan
6a172d7119
Fix a bug in HTTP server when receiving half-closes.
2009-05-19 20:24:37 +02:00
Ryan
a5d5056327
Bug fix: need to return readyState symbol from scope.
2009-05-19 16:19:47 +02:00
Ryan
536eceaa2d
Debugging http. Add simple test. (Does not pass.)
2009-05-19 14:50:09 +02:00
Ryan
3700568322
Add request method. (How could that be missing still?)
2009-05-19 14:46:07 +02:00
Ryan
87e6578aa9
Simple HTTP client is working a bit.
2009-05-19 13:12:46 +02:00
Ryan
3bc73ba967
Add ParseUri to the node namespace
2009-05-19 00:01:11 +02:00
Ryan
edc38b4134
Use parseUri() for req.uri. Update docs.
2009-05-18 19:33:05 +02:00
Ryan
9c70bf356b
HTTP Server: check the ready state of the connection before each send.
2009-05-18 14:02:50 +02:00
Ryan
310eed03e0
Clean up readyState handling. Add test.
2009-05-18 13:53:39 +02:00
Ryan
69ab87ca53
Fix crash in oi_socket; add ready state reader to Connection objects.
2009-05-18 13:38:15 +02:00
Ryan
478e45a32f
Change request handler to take two parameters: req, res.
...
This is more semantic, albeit unnecessary, usage. I think users will
be able to remember the API more easily.
2009-05-18 12:44:01 +02:00
Ryan
9a63d8ec28
Remove v8 prefix from function template callbacks.
2009-05-16 12:54:44 +02:00
Ryan
175223d5d7
Remove HTTP parser callbacks for fragment, query_string, path.
...
Instead we're going to just get a single callback for the URI. This can be
parsed additionally in javascript using parseuri:
http://blog.stevenlevithan.com/archives/parseuri
I haven't added that yet, but it will come soon.
2009-05-16 12:53:24 +02:00
Ryan
91bd3124ad
Add sendUtf8 method to socket objects.
...
Encoding UTF-16 (the native string representation) to UTF-8 is rather
expensive, however just chopping off the second bit to convert UTF-16 to
ASCII is rather fast. I've noticed major performance issues with
String::WriteUtf8 and thus I'm going to explicitly separate in the API.
Still need interfaces to this for the web server.
2009-05-16 12:44:49 +02:00
Ryan
2cb81113ec
Slightly better buffer allocation. (Probably not worth it.)
2009-05-15 22:41:36 +02:00
Ryan
fb96f07ece
Commit partial work in http.js. Comment out V8::Dispose(); in node.cc
2009-05-15 18:11:49 +02:00
Ryan
baed9d514d
Inform V8 of external allocations.
...
This is sloppy: after each ObjectWrap allocation the user needs to
call ObjectWrap::InformV8ofAllocation(). In addition each class deriving
from ObjectWrap needs to implement the virtual method size() which should
return the size of the derived class. If I was better at C++ I could
possibly make this less ugly. For now this is how it is.
Memory usage looks much better after this commit.
2009-05-15 16:28:10 +02:00
Ryan
81691c7dc5
Fixes to get HTTP working with new TCP API.
2009-05-15 01:47:17 +02:00
Ryan
589d8af5d4
Wrap NewInstance with TryCatch. (Was still missing the error.)
2009-05-15 01:36:51 +02:00
Ryan
febbf75302
Wrap calls in TryCatch; Check return values after UNWRAP.
...
This is to avoid a segfault when you don't use the API correctly.
2009-05-15 01:12:46 +02:00
Ryan
73fb24f48d
Relatively large update to TCP API. No more "protocol".
...
Instead servers are passed a function which gets called on connection (like
in the original design) which has one argument, the connecting socket. The
user sets up callbacks on that. It's pretty much how I had it originally.
Encoding is now set via v8 getter/setter and can be changed dynamically.
The timeout for all sockets is fixed at 60 seconds for now. Need to fix
that.
2009-05-14 23:47:21 +02:00
Ryan
31ba3cde17
Rename TCP classes to sit in node hierarchy.
2009-05-14 20:34:14 +02:00
Ryan
de6036669d
Add p() like in Ruby.
2009-05-14 18:37:53 +02:00
Ryan
427e3f5dcb
Introduce NODE_SET_PROTOTYPE_METHOD which properly sets the signature.
2009-05-14 13:16:45 +02:00
Ryan
8d00691f78
Was not properly passing the host parameter to Acceptor::Listen.
2009-05-13 23:44:05 +02:00
Ryan
740139408d
Fix memory leak in timer.
2009-05-13 23:35:36 +02:00
Ryan
3212b31ea1
Rename main.js to node.js.
2009-05-13 21:43:24 +02:00
Ryan
f6c955b7f4
Move Timer class into node namespace.
2009-05-13 21:42:18 +02:00
Ryan
4d39a3586c
Path, URI, Fragment, etc were not getting passed to RequestHandler.
2009-05-12 11:39:42 +02:00
Ryan
15c1e0b007
Random clean-ups to the web server.
2009-05-12 03:46:04 +02:00
Ryan
7869ed6681
Add keep-alive handling.
2009-05-11 23:38:41 +02:00
Ryan
918c71856a
Add status code reasons to server API.
2009-05-11 19:08:29 +02:00
Ryan
421b955888
change the http server response api slightly
2009-05-11 18:54:52 +02:00
Ryan
55d840ea96
Add profile window around socket on_read.
2009-05-11 17:16:14 +02:00
Ryan
43531093a3
don't die on EPIPE
2009-05-07 16:32:36 +02:00
Ryan
ba17940551
Add accessor File#encoding
2009-05-07 16:15:07 +02:00
Ryan
103a8800c7
Binary HTTP bodies for both requests and responses.
2009-05-07 12:15:01 +02:00
Ryan
62a1465332
get chunked responses working
2009-05-06 19:08:38 +02:00
Ryan
9f2938b713
node.http.Server was not getting req.path, etc.
2009-05-06 15:03:13 +02:00
Ryan
a80591aff6
Create node.http.Server and node.http.LowLevelServer
...
The LowLevelServer is a direct interface to the parser given people access
to things like partially received headers. This could be used to implement
an extremely optimized server which acts before parsing is complete.
Most people will be using node.http.Server which is still rather low-level
compared to other http interfaces, but does take care of some details for
you.
2009-05-06 14:54:28 +02:00
Ryan
0bb12be660
link to google profiler
2009-05-05 21:16:19 +02:00
Ryan
ae7c6314ca
Various fixes to make the web server not give off so many errors.
2009-05-05 19:39:08 +02:00
Ryan
cfd61622ae
Reference counting. Network bugs.
...
Connections were being garbage collected while they were still in progress
since the object would leave scope. This commit adds ObjectWrap::Attach()
and ObjectWrap::Detach() to tell v8 that an object is currently on the event
loop and will be needed in the future.
Other changes to oi_socket.c and net.cc are to fix bugs encountered while
running the HTTP server.
2009-05-05 18:15:59 +02:00
Ryan
30450388d6
update oi_socket - modify node code to match
2009-05-05 12:52:18 +02:00
Ryan
2e5b85a13b
Some fixes to allow HTTPServer to begin listening.
...
Just tested it and it is accepting connections and parsing! Will add units
soon.
2009-05-04 17:38:17 +02:00
Ryan
9c3770d999
Implement HTTPServer (untested!)
...
Mostly this is setting up the proper interface to be able to create the HTTP
server.
2009-05-04 17:19:04 +02:00
Ryan
b763ee0ad4
Make onError work for TCPConnection.
2009-05-04 16:36:57 +02:00
Ryan
6149c6c49a
Fix HTTPConnection javascript inheritance.
2009-05-04 16:23:30 +02:00
Ryan
38726e7272
various clean ups; HTTPConnection (js side) inherits from TCPConnection
2009-05-04 15:39:36 +02:00
Ryan
09c2ae5c3e
Slight change in tcp connection constructor
...
For server-side sockets, no longer pass the server object to the
js constructor. This is set later with SetAcceptor.
I think the change is a bit strage and convoluted but it allows one give
protocol /classes/ to the c++ constructors instead of protocol instances.
This is nice because derived classes (like HTTP) don't need to copy the
protocol instanciation code.
2009-05-04 12:08:13 +02:00
Ryan
4860f1c92c
add onMessageComplete and onBody handlers.
2009-05-03 21:37:10 +02:00
Ryan
be6b3acf0e
extract headers, status_code, path, http version from http messages.
...
still a work in progress.
2009-05-03 21:06:20 +02:00
Ryan
5a071ad72f
Begin refactor of http.cc. Remove libebb add http_parser.
...
And most of http.cc was deleted.
2009-05-03 14:09:16 +02:00
Ryan
bb6057d9ad
rename Connection.disconnect -> Connection.close
2009-05-03 01:11:39 +02:00
Ryan
13062832d8
cleanup: rename some of the callbacks
2009-05-03 01:06:21 +02:00
Ryan
1713386580
add Connection::SendEOF. modify test accordingly.
2009-05-03 01:01:42 +02:00
Ryan
15d24d8002
Major refactor of network code
...
Here I massively change both the external and internal API of the TCP
sockets and servers.
This change introduces the concept of a protocol object like is found in
Twisted Python. I believe this allows for a much cleaner description of how
a socket behaves. What was once a single object "client" or "connection" is
now represented by two objects: a "connection" and a "protocol".
Well - I don't want to ramble too much because neither API is yet public or
documented. Look the diff of test/test-pingpong.js to see how things have
changed.
2009-05-02 16:34:24 +02:00
Ryan
fd392d0a50
Remove if (pointer == NULL) after allocations with new.
...
I'm still learning C++.
2009-04-29 14:05:25 +02:00
Ryan
cbd342a12d
Publicize Socket and Server for eventual cooperation with HttpServer.
...
Also changed Init_net() to Socket::Initialize() and Server::Initialize().
Seems more object oriented, but I'm unsure how this will play when I want
load modules dynamically with dlopen(). I'll sit with it for a while and
see how it feels.
2009-04-29 14:00:22 +02:00
Ryan
0f5170339c
remove process.{cc,h} process.exit() now exit()
...
the process object might return in the future but for now it is going away.
2009-04-29 11:09:32 +02:00
Ryan
f213a27657
Refactor setTimeout to be a Timer object.
...
Timer now uses ObjectWrap. setTimeout, setInterval are now implemented in
javascript.
2009-04-29 11:00:46 +02:00
Ryan
064c8f0252
Use ObjectWrap base class for File, Socket, Server.
2009-04-29 01:07:19 +02:00
Ryan
cf1c58063e
Create a node namespace
...
Part of general reorganization.
2009-04-28 23:09:56 +02:00
Ryan
90fc8d3622
Update liboi. Use EV_MULTIPLICITY=0.
...
This might need to be changed in the future if ev is needed in thread pools
or extension libraries. However for now it makes sense to just use a single
loop.
2009-04-28 22:37:03 +02:00
Ryan
0ea7577a72
sign error on file position argument
2009-04-23 15:07:54 +02:00
Ryan
8a8e9df72e
wasn't sending pos arg for puts()
2009-04-23 14:22:57 +02:00
Ryan
0b1e3240be
add position arguments to File#read and File#write
2009-04-23 12:10:57 +02:00
Ryan
63ec0454d2
add echo test. remove debug printfs
2009-04-22 15:52:23 +02:00
Ryan
d996b59d9c
fix some errors/memleaks
2009-04-22 15:48:29 +02:00
Ryan
48b4ac4a8d
implment server.close
2009-04-22 14:09:17 +02:00
Ryan
c986b99ddc
throw error when given a bad arguement to socket.write
2009-04-22 14:01:45 +02:00
Ryan
3095861199
bug fix: recving raw data was incorrect.
2009-04-22 13:59:28 +02:00
Ryan
5f902a61e1
tcp server is accepting connections now.
...
(experiencing a problem with writing rawEncoding on the sockets. will fix in next commit.)
2009-04-22 13:52:30 +02:00
Ryan
822d7fa27e
add framework for tcp server. change eio stacksize to 16kb.
2009-04-22 10:29:45 +02:00
Ryan
140a032894
oops. call onConnect callback not onRead callback after connecting
2009-04-21 23:36:01 +02:00
Ryan
1542fc6a0b
add async dns for Socket
2009-04-21 23:13:13 +02:00
Ryan
707f244291
begin clean up of Socket
2009-04-21 19:56:30 +02:00
Ryan
d105d88625
on_load -> onLoad
2009-04-21 16:30:47 +02:00
Ryan
5d57fa5060
clean up timers a bit
2009-04-21 16:24:56 +02:00
Ryan
47fad676b4
Rename JS_ to NODE_ for method macros. add marcos to timers.cc
2009-04-21 15:55:11 +02:00
Ryan
a0f2b8a0c5
remove debug messages from module loading.
2009-04-21 14:38:55 +02:00
Ryan
408526a1c1
debugging/improving the module framework
2009-04-21 13:52:21 +02:00
Ryan
64117d9c94
small cleanups to the require structure
2009-04-20 18:44:30 +02:00
Ryan
93f7f0dca0
reimplement module loading
...
still missing several important features and its mostly untested but the script
test/test-test.js is working and thats enough for now.
2009-04-20 02:55:08 +02:00
Ryan
c2decd720f
add File.cat
2009-04-20 02:54:36 +02:00
Ryan
67af958f81
rename a few files to remove node_ prefix
2009-04-18 15:37:53 +02:00
Ryan
102c6399ac
rename NewFile to File::New
2009-04-18 14:34:56 +02:00
Ryan
e7dd20dc6e
add File.stat File.exists File.strerror
2009-04-18 10:58:41 +02:00
Ryan
5207226da3
fix a bug with eio polling.
2009-04-18 02:01:23 +02:00
Ryan
dd691decd2
file system methods to be queued.
2009-04-17 18:54:29 +02:00
Ryan
c8e20fbf81
add file.read only. raw encoding right now.
2009-04-16 21:05:41 +02:00
Ryan
12d31dd0b7
file operations are queued.
2009-04-16 20:09:55 +02:00
Ryan
e303d950d9
add stdout stderr global file objects. remove node.blocking.print
2009-04-16 13:58:10 +02:00
Ryan
c0b90ca763
only store fd in javascript (not in c++)
2009-04-16 13:42:34 +02:00
Ryan
470c6342cc
Change symantics of file.open. Now takes a callback argument.
2009-04-16 13:20:35 +02:00
Ryan
7e1350f6e4
add file.write()
2009-04-16 11:37:44 +02:00
Ryan
e8ce6ef790
add file open/close
2009-04-15 21:23:10 +02:00
Ryan
63a9cd3897
everything is changed. i've waited much too long to commit.
...
this is awful. i'm sorry for being so messy.
2009-04-15 10:08:28 +02:00
Ryan
0e9e927fcb
enable support for the thread pool
2009-04-04 16:53:43 +02:00
Ryan
1a126ed11c
use the WAF build system
2009-04-04 14:50:15 +02:00