01a6d71101
Remove Constants.h
2022-11-30 18:30:39 +00:00
5771e615d7
Document CanonicalJson
2022-11-30 18:23:25 +00:00
439e14a410
Format header
2022-11-30 17:59:19 +00:00
5610cafe46
Document Json
2022-11-30 17:54:10 +00:00
6900d0649e
Begin working on Util man page
2022-11-25 21:54:57 +00:00
8045c583ba
Write man page for Log
2022-11-25 16:40:47 +00:00
70bdf81df7
Fix references to old LOG_ constants
2022-11-24 18:51:07 +00:00
399939654a
Fix a few areas where obscure compilers sometimes choke
2022-11-23 17:31:57 +00:00
7544a97c7d
Format source code, add .exrc
2022-11-23 14:56:31 +00:00
84f311ae09
Don't make assumptions about where the config file is.
2022-11-23 14:31:05 +00:00
520b062dbb
Should probably make sure this succeeds.
2022-11-23 00:44:29 +00:00
b155d0dbe4
ftruncate() technically lives in unistd.h
...
It should be included to prevent warnings on some compilers.
2022-11-22 22:31:36 +00:00
7f883fc92e
Remove debugging statements... whoops!
...
I'm usually pretty good about this.
2022-11-21 21:09:05 +00:00
973e826e57
Fix bug in floating objects to mostRecent
2022-11-21 21:07:40 +00:00
40e5c1ef2a
Fix some bugs in DbCreate() regarding UtilMkdir()
2022-11-21 20:59:22 +00:00
789baf33a1
Make Db interfaces take varargs.
...
This makes it much more flexible, at the expense of making it a little
more fragile. I can think of a number of scenarios where we'll have
paths that have variables in multiple spots, and I don't want to do
sprintf() magic every time I need to access an object at one of those
paths.
2022-11-21 20:31:37 +00:00
a0304f4062
Move where we open the database
2022-11-21 16:39:38 +00:00
0c6c1e5b19
Notify the user about the minimum max-cache instead of silently setting it.
2022-11-21 16:22:50 +00:00
cd584c1e93
Lock objects on disk if they're locked in memory.
...
This requires hanging onto an open file handle, and doesn't require
explicit unlocking, because POSIX says files are unlocked when their
descriptors are closed.
2022-11-21 16:13:11 +00:00
0fa2da8177
Don't chroot() on OpenBSD (pledge() causes it to trap here)
2022-11-20 13:19:56 +00:00
07f4ecd2d7
Make a number of improvements to cache handling.
...
- Items that are too big for the cache are now no longer immediately
evicted; everything else is. This is probably not desirable, but it is
not unexpected.
- Multithreading now should work as expected; DbRefs are locked before
they are updated from the disk, and they are not evicted from the cache
if they are locked by another thread.
- The cache may be no smaller than 1024 bytes. Previously the caller of
DbOpen() could choose to disable the cache, and provisions were made in
the code to support this, but this is now no longer possible because
without the cache, there would be no way to know what files were open,
which could lead to a race condition if two threads open the same file.
2022-11-18 22:17:56 +00:00
045c6d8644
Cache eviction
2022-11-18 20:42:08 +00:00
e7ad166877
Fix some memory leaks in Db
2022-11-18 19:36:15 +00:00
f6851de75f
Fix a few bugs in JsonDecode(). It should now properly decode objects.
2022-11-18 14:51:44 +00:00
2e6c129263
Fix a mutex bug in Db and some memory errors in Json
2022-11-17 23:51:45 +00:00
d26fad4619
Add UtilMkdir() to recursively make directories
2022-11-17 22:57:29 +00:00
9597894356
Fix some warnings on GCC.
...
These aren't really anything to be concerned about, but making GCC feel good
about my code makes me feel better about my code.
2022-11-17 19:33:59 +00:00
46cc1df385
Do some Db work
2022-11-15 18:20:05 +00:00
a356403cfd
Finish DbComputeSize()
2022-11-12 18:26:31 +00:00
8e71cc833c
Change behavior of "id" configuration directive.
2022-11-08 17:53:01 +00:00
efbbf42a6e
Fix memory and connection closing errors.
2022-11-08 01:05:28 +00:00
37ee7700f4
Start writing a function to compute the in-memory size of an object.
2022-11-06 00:47:17 +00:00
0a4c9f3751
Apply part of #32 (Thanks LDA <lda@devhonk.tk)
2022-11-05 01:29:20 +00:00
84abff7fb8
Tune the memory table size a little bit.
...
No idea if this hurts or helps, actually, but now we have a tunable
constant, instead of a magic number.
2022-11-02 16:46:22 +00:00
a8beded518
Fix occasional "Bad Request" response by waiting for data to be sent.
...
This also makes UtilGetDelim() and UtilGetLine() thread safe in that it
isn't setting a global errno. Of course, errno should be thread safe
already, but this makes it much less ambiguous.
2022-11-02 16:21:03 +00:00
92cc2206a1
Fix a few things to make Telodendria compile and run on Cygwin.
2022-11-02 15:20:37 +00:00
6992f36c86
Fix segfault in fclose() on Linux.
2022-11-02 00:35:05 +00:00
5af229a86e
Apply #31
2022-11-02 00:18:13 +00:00
757938b293
Fix segvault if no config file was specified.
2022-11-01 09:47:25 -04:00
82d460da6f
Fix some sneaky memory bugs and resource leaks.
2022-11-01 09:04:15 -04:00
bbee9dcea6
Fix some more bugs.
2022-10-31 20:41:50 -04:00
63dbf9ae35
Fix a few more memory bugs. Still have some to tackle.
2022-10-31 19:52:37 -04:00
ead65e7334
Fixed some misc bugs I found while debugging a memory error.
2022-10-31 11:07:32 -04:00
fd50fd83fb
Misc changes throughout the codebase during testing.
2022-10-31 08:12:42 -04:00
b24ab05e8b
Revert revision 1.4: Memory in O(1) time.
...
This has some bugs in it that I don't have time to work out right
now. Best to revert to a known working version as the project gains
attention until I can address this properly.
2022-10-31 08:08:32 -04:00
bcff59bacb
Store memory info in the allocated block, not as a separate block.
...
This will eventually enable us to get memory information in O(1) time.
Right now, we're still O(n) because MemoryInfoGet() still has to check to
see if the allocation is known or not.
2022-10-28 14:07:44 -04:00
f90b987218
Add a Db to the matrixArgs so that routes can access it.
2022-10-24 14:36:48 -04:00
624b080d47
Add max-cache option to the config file
2022-10-24 13:40:21 -04:00
e009536065
Begin prototyping persistent storage API
2022-10-24 12:44:29 -04:00
5ca5ec7dd4
Complete parameter parsing
2022-10-15 19:17:49 -04:00
52abd18324
First revision of param parsing
2022-10-15 18:54:34 -04:00
b645a0b2c1
Hook param parsing into the request logic.
2022-10-15 16:28:32 -04:00
648ce5c4cc
Remove NonPosix.h; it seems to be causing more trouble than it's worth.
2022-10-15 11:45:23 -04:00
887c4e4d5b
Fix some warnings generated by Cygwin's GCC.
2022-10-15 10:28:03 -04:00
4707f0f4c8
Clean up some NonPosix.h stuff so we can build on Linux.
...
It appears that SOCK_NONBLOCK is not actually POSIX. According to the
OpenBSD man page, it will be soon, and according to the Linux man page,
it is a Linux extension. However, fcntl() with O_NONBLOCK seems to be
portable across both systems.
2022-10-15 10:08:52 -04:00
bb93cae99a
Remove non-standard __FUNCTION__ use.
...
This cripples the Memory API just a little bit, but I'm sure we'll still
get useful enough information.
2022-10-15 09:34:47 -04:00
0c03c71081
Allow logging to the syslog
2022-10-14 20:55:15 -04:00
31719c2cd6
Tell exactly where the leaked pointer is, so it can be grepped.
2022-10-13 12:46:41 -04:00
65dad27902
Fix some server context memory leaks.
2022-10-13 12:34:17 -04:00
80366fc294
Fix a few more calls to free()
2022-10-13 12:27:24 -04:00
8cb86e8f67
Use new Memory API for all memory allocations.
2022-10-13 12:18:42 -04:00
945acd1adf
Format source code
2022-10-13 09:09:26 -04:00
2df0cd9d26
Begin integrating new Memory API
2022-10-13 09:08:05 -04:00
8ae86b18fe
Add hook functionality so we can log allocations and deallocations.
2022-10-13 08:50:27 -04:00
2d49ac78b8
Add custom memory management code.
...
This will be helpful in detecting leaks among other things, and may help
with controlling the cache size as well.
2022-10-12 21:29:05 -04:00
1353fa6429
Remove chroot option; log into the data directory automatically.
2022-10-11 12:00:36 -04:00
5d9b0df0bf
Remove the redundant chroot option. This simplifies the config a bit.
2022-10-11 11:38:34 -04:00
414b8d47be
Add HashMapFunctionSet() to allow custom hash functions.
2022-10-11 09:27:34 -04:00
744f38784c
Finish HashMap documentation
2022-10-10 15:08:19 -04:00
79fc20314f
Format source code.
2022-10-10 13:14:52 -04:00
6b57fc45a2
Implement param encoding, clean up warnings in decoding function.
2022-10-03 13:40:29 -04:00
cfcef45c00
Make the log file message more visible.
2022-09-30 13:13:27 -04:00
271cdd8ff0
Abstract the data structure out of the path handling logic.
2022-09-30 12:48:45 -04:00
90166882b0
Remove an unnecessary variable.
2022-09-30 12:48:33 -04:00
45324ce77a
Implement /_matrix/client/versions and /.well-known/matrix/client
2022-09-29 13:41:26 -04:00
0ec976d1dd
Fix HttpUrlDecode memory issue; write pathParts array
2022-09-28 14:45:45 -04:00
acffd82b48
Move Base64 documentation to man page.
2022-09-27 16:13:59 -04:00
5ecb810a88
Move Array documentation to man page.
2022-09-24 21:35:52 -04:00
b5d538f2ce
Cleaned up argument parsing to match what was in the docs
2022-09-24 19:41:39 -04:00
55967c2d75
Start work on routing
2022-09-23 08:06:24 -04:00
3ba80eea64
Remove header.txt
2022-09-23 08:05:45 -04:00
8bd7e27de1
Fix bug in QueuePop()
2022-09-17 15:59:47 -04:00
21894489cb
Rename MatrixCreateError() to MatrixErrorCreate()
2022-09-16 11:49:48 -04:00
d7a1f7411d
Send M_UNKNOWN on all requests for now.
2022-09-16 11:49:21 -04:00
d0fb926f2a
Add error generation logic.
2022-09-16 11:27:34 -04:00
13763eb77b
Format code
2022-09-14 17:15:39 -04:00
184866532a
Spec: Implement CORS
2022-09-14 17:15:05 -04:00
1d0c48ce32
Add constants
2022-09-14 16:57:19 -04:00
685b7c016d
Start work on param parsing.
2022-09-08 21:09:47 -04:00
485941e8a8
Fix bug in JsonEncodeString() where characters get printed to stdout.
...
Thanks @costava:matrix.org for pointing this one out.
2022-09-06 20:53:30 -04:00
c607ba05a9
Implement URL encoding and decoding.
2022-09-06 20:48:27 -04:00
c0474982a6
Fix compile warnings and errors on Linux
2022-08-28 16:05:11 -04:00
7cc08e67fc
Begin Matrix-specific work.
2022-08-28 15:55:48 -04:00
47338fd001
Initialize the server response code
2022-08-28 15:48:58 -04:00
4cd24a6e97
Finally getting into Matrix territory
2022-08-28 15:45:24 -04:00
d7d960b77d
Parse HTTP requests and invoke the request handler.
2022-08-28 14:30:15 -04:00
d3e8886b69
Add some functions.
2022-08-26 21:02:53 -04:00
43c46fd45c
Fix compile and runtime errors
2022-08-26 20:15:27 -04:00
1dc4261f6f
Add Http.c
2022-08-26 11:11:15 -04:00
275d06c127
Begin prototyping the HttpServer API
2022-08-26 11:07:54 -04:00
d8a89c4750
Free server when we're done with it.
...
This frees up a lot of memory, and closes the server socket so that the
operating system doesn't have to do it, because the operating system may
take a while to actually close the socket.
2022-08-24 19:36:29 -04:00
9378a4d369
Implement basic thread pool with dummy 500 messages.
2022-08-24 19:31:28 -04:00
f950233dbc
Add UtilSleepMillis() function.
2022-08-24 19:30:20 -04:00
8657008e94
Format code.
2022-08-24 16:29:00 -04:00
de00c3cb37
Fix fdopen() file mode.
2022-08-24 16:28:50 -04:00
640e127ce5
Fix chroot() logic on non-OpenBSD platforms.
2022-08-24 16:10:34 -04:00
55a49e418f
Fix logic error relating to the initial call to QueuePush()
2022-08-24 14:41:42 -04:00
665da9d33e
Fix port binding error.
2022-08-24 14:37:32 -04:00
8801afaeb2
Properly initialize and destroy the mutex
2022-08-24 11:25:16 -04:00
be001fb17a
Make HttpServer utilize Queue.
2022-08-24 10:06:14 -04:00
ab4afe1587
Add basic Queue implementation.
2022-08-24 09:06:27 -04:00
315589cd1b
Accept #29
2022-08-21 12:35:16 -04:00
538412d1c2
Apply #26
2022-08-12 21:30:03 -04:00
30ae6586b2
Accept #28 , with modifications.
2022-08-12 19:32:06 -04:00
af03988db7
Poll the socket for data events.
2022-08-11 21:19:52 -04:00
d9c944871a
Abstract socket creation and binding behind the HttpServer API.
2022-08-11 20:13:10 -04:00
e94212b080
Bind to socket; HTTP server event thread; signal handling.
2022-08-11 19:40:13 -04:00
9cf2266ece
Make TelodendriaConfigParse() actually validate the listenPort.
...
I want to already have a valid port number by the time we need to bind
to it.
2022-08-11 11:50:35 -04:00
4304a28302
TelodendriaConfigParse() doesn't modify the LogConfig.
...
Also pledge() and unveil() as soon as possible, to avoid the log file
breaking out.
2022-08-10 21:13:05 -04:00
9ae05e84f2
Implement user validation.
2022-08-10 11:58:39 -04:00
2324d9982f
Format code.
2022-08-09 21:05:10 -04:00
d9e355edb9
Relocate free() in HashMap to a sensible location.
2022-08-09 21:02:57 -04:00
560624ba98
Fix memory leak in HashMap
2022-08-09 20:23:25 -04:00
76937a57a4
Check return value of fgets() in Json.c
2022-08-09 20:18:13 -04:00
a24d9b6c29
Fix memory error?
2022-08-09 20:10:45 -04:00
cdd7808642
Prototype the configuration file parser.
...
Right now there's a nasty memory bug I need to fix. Will have to run this
through valgrind.
2022-08-09 20:05:41 -04:00
9d496c29ac
Finish initial draft of JSON parser.
2022-08-09 13:19:14 -04:00
7630294cb7
Basic implementation of JsonTokenSeek()
2022-08-02 21:47:27 -04:00
f48f7c088c
Begin prototyping JsonDecode
2022-08-02 16:58:15 -04:00
fa0bd9a7c6
Apply #14
2022-07-29 15:36:21 -04:00
8e8ac04505
Start documenting the headers.
2022-07-29 12:32:52 -04:00
1087069416
Fix some invalid structures.
2022-07-29 12:32:46 -04:00
787a891cb8
JsonValueFree() should take care of strings too.
2022-07-28 22:21:49 -04:00
b3e71c32fd
Update license text.
2022-07-28 12:00:52 -04:00
e519621d25
recipe_format now updates source code headers.
...
Note that it does depend on new source code files *having* a header,
even if it's just a blank block comment.
2022-07-28 11:46:57 -04:00
c991d93444
Add license headers to all source files.
2022-07-28 11:15:04 -04:00
6b8d0f6d5f
Add canonical Json implementation.
2022-07-27 17:28:05 -04:00
c143136097
Implement JsonFree(), make string handling UTF-8 aware.
2022-07-27 17:27:34 -04:00
39af3c2194
Add ArraySort()
2022-07-27 15:31:34 -04:00
4c7ec4af56
Add UtilUtf8Encode() and UtilServerTs()
2022-07-27 13:47:20 -04:00
987b1653f1
Add UtilUtf8Encode() and UtilServerTs()
...
Also updated Json.c to use UtilUtf8Encode() when decoding JSON strings.
2022-07-27 13:47:12 -04:00
90ed321caa
Fix typo in Json.c
2022-07-27 11:30:46 -04:00
bf0eb4543e
Fix error in Log.c where we were comparing different types.
2022-07-27 09:53:53 -04:00
bc849819d9
Make HashMap and Json conform to C89.
...
Clang on OpenBSD didn't catch this, but GCC on Linux did.
2022-07-27 09:47:22 -04:00
4e0543b028
Add proper JSON string encoding and decoding.
2022-07-26 13:08:46 -04:00
644733c74e
Add a static JsonEncodeString() method.
...
Right now it just calls fprintf(), but in the future, it will
properly encode a string for JSON output.
2022-07-26 09:10:17 -04:00
8689c95b68
Begin work on Json library. Have a working JsonEncode()
2022-07-25 22:56:14 -04:00
90c4709823
Fix HashMapIterate not resetting the iterator at the right place.
2022-07-25 22:55:22 -04:00
ace2682dec
Rework HashMapIterate to be more flexible.
...
We now get the keys, and we don't have to operate within the confines
of a callback function.
2022-07-25 21:31:09 -04:00
580b036d26
Add key to bucket, make iteratorFunc in HashMapIterate take it.
2022-07-25 16:26:30 -04:00
3437c5db2c
Format headers as well.
...
indent(1) does a weird thing with prototype functions, but it's good
enough for me, as long as it's consistent.
2022-07-25 15:25:06 -04:00
aabb2a0203
Run indent(1) on all C source files.
2022-07-25 15:18:35 -04:00
768430f614
Update link in log header.
2022-07-23 00:50:12 -04:00
d102ba8676
Initial revision
2022-07-22 20:19:12 -04:00