Commit Graph

87 Commits

Author SHA1 Message Date
Joris Vink cda09b6065 Add http_response_stream() which can stream data from a buffer to the client. 2014-08-07 14:23:26 +02:00
Joris Vink e3ae1b4e2d Implement some great SPDY improvements.
* Bump spdy announcement to the correct draft version
* When receiving a RST, clean out the netbuf chain of that stream
2014-08-07 10:22:54 +02:00
Joris Vink a2a87adf19 Euhm, revert last commit. 2014-08-01 10:33:26 +02:00
Joris Vink cee7d34020 Properly check for EWOULDBLOCK as well 2014-08-01 10:32:31 +02:00
Joris Vink c2e4d55235 Add a BENCHMARK compile option which compiles without OpenSSL.
Personally use this for testing Kore its performance without
letting the OpenSSL stack get in the way too much.

Note that it leaves data structures as is, and just removes
any calls to OpenSSL (and removes the linking vs OpenSSL).
2014-08-01 10:22:32 +02:00
Joris Vink baac693f2f Change type for data to void * 2014-07-04 11:25:05 +02:00
Joris Vink f0a9c1fe73 Major improvements to HTTP/1.1 behaviour, error reporting and handling.
This comes with changes to http_response() (no longer returns a result).
2014-01-29 22:48:51 +01:00
Joris Vink b64f674db2 Handle SPDY streams better when sending data. 2014-01-14 21:43:45 +01:00
Joris Vink 6f311a06cf Do not get stuck processing HTTP requests, found by Thorduri 2013-11-25 14:21:47 +01:00
Joris Vink 2aa4edb04e Kill unused vars 2013-10-26 00:59:03 +02:00
Joris Vink f17242262b Improve on sending data to the client.
- Attempt to chain as much as we can in the send netbufs
  (keeps down the SSL_write calls, silly seeing it go out with 8 bytes)
- Change NETBUF_SEND_PAYLOAD_MAX to 4K
- Call SSL_write() with max NETBUF_SEND_PAYLOAD_MAX in size
- Go back to flushing the send buffers after each request
- No more need for a fixed pool for nb->buf, go back to the heap for now
- Disable Nagle, we're doing the chaining now anyway
2013-10-26 00:48:09 +02:00
Joris Vink 4247d3139c Chain our sending netbufs together. Gives us a lot less SSL_write() calls. 2013-10-25 14:22:29 +02:00
Joris Vink 4922171d96 Change net_send_queue() in preparation for improving send performance.
No longer takes callbacks, flags, or *out arguments.

Update rest of the code that called these callbacks whenever sending
was completed, instead call them right away now.
2013-10-25 11:10:03 +02:00
Joris Vink 07079dc8c0 Do not kill a connection if nb->len is 0 when sending data. 2013-10-15 11:09:33 +02:00
Joris Vink 29fa49ba83 Add fixed size memory pools and use them throughout Kore. 2013-07-15 11:06:36 +02:00
Joris Vink 9c7aaf179f Remove unneeded malloc result casting, annoying habbit of mine but serves no purpose. 2013-07-13 21:08:55 +02:00
Joris Vink 0fee1247c9 TAILQ_REMOVE() the netbuf before adding it to the HEAD of recv_queue again. 2013-07-12 15:49:49 +02:00
Joris Vink bb2d4903f2 remove NETBUF_RETAIN, no longer needed 2013-07-10 13:39:35 +02:00
Joris Vink c1723f2db5 Clean up header includes, based on a diff from Ewan Higgs via github.
And while we're messing in it, make sure bsd.c compiles again.
2013-07-06 20:55:22 +02:00
Joris Vink b4a0330a96 - Better spread load between all worker processes.
- Introduce own memory management system on top of malloc to keep track
  of all our allocations and free's. Later we should introduce a pooling
  mechanism for fixed size allocations (http_request comes to mind).
- Introduce ssl_cipher in configuration.

Memory usage is kind of high right now, but it seems its OpenSSL
doing it rather then Kore.
2013-06-27 08:43:07 +02:00
Joris Vink 2fc5233358 Rework the way worker processes give each other the accept lock.
Instead of waiting until one worker is filled up on connections
the workers find the next lowest loaded worker and will hand
over the lock to them instead. This will cause a nicer spread of load.

Instead of running one accept per event loop, we attempt to accept
as many as worker_max_connections allows.

Refactor net sending/recv code a bit.
2013-06-27 00:22:48 +02:00
Joris Vink 25f1ab9865 Add BSD kqueue(2) support. Compile with make bsd (or make linux for linux) 2013-06-17 23:39:17 +02:00
Joris Vink e7db5ee6b1 rename kore_log to kore_debug, and allow one to turn it off. 2013-06-04 16:30:53 +02:00
Joris Vink ce729010f7 - simplify header building using kore_buf_appendf() for normal HTTP requests.
- make sure we dont free nb->buf if its NULL. (semantics).
- remove some superfluffy debug.
- make sure we call [inflate|deflate]End when we dc a client that used zlib.
2013-05-04 20:44:16 +02:00
Joris Vink 088d877715 switch dynamic handlers to regex based patterns, much easier. 2013-05-29 14:29:46 +02:00
Joris Vink f61bbe8ff4 move buf stuff back into kore.h, wont need it separately 2013-05-02 15:14:00 +02:00
Joris Vink 84428f7133 move buf stuff into its own header, so we can use it in spdy.h 2013-05-02 14:55:57 +02:00
Joris Vink 60ed3e0fd2 the net qeueuing functions don't need to return status codes, simplifies a lot of other code that revolves around those.
prepare for POST support
2013-05-02 14:47:02 +02:00
Joris Vink 364dc58219 rework disconnecting clients and fix bug where spdy ocnnections could segfault after disconnecting 2013-05-02 09:10:35 +02:00
Joris Vink 5f983d575b add flags to net_recv_queue() and net_send_queue(),.
NETBUF_CALL_CB_ALWAYS flag, calls the registered cb everytime data has
been received or sent.
2013-05-02 00:28:49 +02:00
Joris Vink a074258dcc rework the way events trigger and the way we handle them. follow the manual for once, as edge trigger does not refire until we got an EAGAIN.
introduce net_send_flush() and net_recv_flush() for this purpose, we attempt to make as much headway as possible until we reach EAGAIN or until we can simply pickup again later.

should merge all the stuff in http_response() into a single send buffer, **out is in place in net_send_queue() for that purpose.
2013-05-01 13:43:47 +02:00
Joris Vink d59847c448 SPDY works, we can serve content. Now for dynamic modules so we can
get stuff on the road.

TODO: add plain HTTP support if SPDY isnt working in the browser.
2013-05-01 12:23:21 +02:00
Joris Vink 848704f74b lots of new stuff, including processing of http requests and an attempt
to build an initial spdy response (SYN frame + header block content).
2013-05-01 08:09:04 +02:00
Joris Vink 05156c9a3a properly deflate/inflate of name/value blocks. and add ability
to get headers from them.
2013-05-01 00:35:33 +02:00
Joris Vink 071fc4100d only clear our a netbuf if retain is 0 AND it's been filled. 2013-04-29 07:15:14 +02:00
Joris Vink c8b422d29d allow us to expand receive buffers automatically so we can keep chaining data into the same netbuf. This gives us the possibility to retain the ctrl_frame by the time we reach the proper cb for the actual frame message. 2013-04-28 23:42:13 +02:00
Joris Vink 23c0ec67c6 begin with the ability to read control frames. something feels fishy with epoll() and its triggering of events. I probably got it wrong. 2013-04-28 19:11:44 +02:00