76bfa120ee
Fix CPU pin if clients don't shutdown() their socket properly.
...
If we haven't read any bytes yet, then we try a few times a few ms apart
to see if we get anything. If not, treat it as an EOF. Otherwise, read
bytes until we get an EOF or EAGAIN. EAGAIN after a consistent read of
bytes is treaded as an EOF immediately.
2023-03-12 15:08:50 +00:00
3037f12907
Add tt and http-debug-server tools.
2023-03-10 18:48:52 +00:00
2d9b706f38
Fix I/O in JsonConsumeWhitespace() and UtilStreamCopy().
...
These functions previously operated on the assumption that fgetc() would
block; however it will not block on HttpServer streams because those are
non-blocking. They now check error conditions properly before failing
prematurely.
2023-03-10 18:46:03 +00:00
76413f834e
Make json use ^ for removing fields, instead of !
...
Room IDs start with '!', we want to be able to access these.
2023-03-08 22:47:07 +00:00
7b22fb02a2
Implement pretty-printing option in Json.
...
Telodendria itself doesn't use it, but the json CLI tool does.
2023-03-08 17:15:43 +00:00
f1e565ef7b
Update Json man page.
2023-03-06 22:21:56 +00:00
7703405c70
Fix bugs in Json API.
2023-02-26 15:07:46 +00:00
b60cac53e5
Make JsonValueString() call StrDuplicate(); refactor code to behave properly.
2023-02-24 00:17:56 +00:00
8c96fd8d7d
Begin the great StrDuplicate() refactor.
2023-02-23 23:19:23 +00:00
9e9b5c9cda
Fix a write-out-of-bounds error in Json.
2023-02-23 03:46:05 +00:00
fa88fc3323
Format source code.
2023-02-17 03:23:25 +00:00
72405a94f6
Add JsonGet(), JsonSet(), and JsonCreate() for convenience.
2023-02-16 18:49:19 +00:00
9358264add
Fix some invalid write errors.
2023-01-09 15:18:59 +00:00
30c3690287
Renamed String.h to Str.h because Windows is dumb.
2023-01-08 04:38:06 +00:00
0a29aa7f5a
Move string related functions to a new String API.
...
I think we have accumulated enough string functions that they should
have their own API. This shortens the function names a bit too.
2023-01-07 04:33:32 +00:00
7bda319f39
Format code
2023-01-06 21:18:44 +00:00
1282371680
Fix "bad pointer" warnings.
2023-01-06 18:50:31 +00:00
8e2399e648
Fix bug on some platforms that use unsigned characters.
2023-01-02 18:22:04 +00:00
3c8d89a52e
Update copyright year
2022-12-26 15:52:52 +00:00
708a840ec0
Fix memory leak when attempting to parse something that isn't JSON.
2022-12-14 14:54:06 +00:00
d0c81a8136
Fix potential memory leak if duplicate keys exist in a JSON object.
2022-12-06 21:26:33 +00:00
399939654a
Fix a few areas where obscure compilers sometimes choke
2022-11-23 17:31:57 +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
fd50fd83fb
Misc changes throughout the codebase during testing.
2022-10-31 08:12:42 -04:00
8cb86e8f67
Use new Memory API for all memory allocations.
2022-10-13 12:18:42 -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
76937a57a4
Check return value of fgets() in Json.c
2022-08-09 20:18:13 -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
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
c991d93444
Add license headers to all source files.
2022-07-28 11:15:04 -04:00
c143136097
Implement JsonFree(), make string handling UTF-8 aware.
2022-07-27 17:27:34 -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
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