Commit graph

50 commits

Author SHA1 Message Date
2441f07848 Add support for spinning up multiple HTTP servers.
This is useful for having a TLS and a non-TLS version port, like Synapse.
I verified that the multiple-servers does in fact work as intended,
although the TLS server part is broken; I must be doing something
incorrectly with LibreSSL in setting up the server.
2023-03-23 02:12:45 +00:00
9ec330f40a Log once we get the response status, not right when we get the request. 2023-03-22 18:13:59 +00:00
8782aa046d Fix compile error in Tls, work on getting certs and keys into HttpServer. 2023-03-22 02:18:31 +00:00
b58ca7d22e Start working on adding TLS support to HttpServer. 2023-03-22 01:46:24 +00:00
5289c16e2b Convert all code to new Stream API.
Also made a number of improvmements to tt, making it compatible with more
shells.
2023-03-18 14:32:09 +00:00
65f4c90df3 Rename HttpStream() to HttpServerStream() to match HttpClientStream() 2023-03-16 02:17:48 +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
313f0e2e73 Add HttpClient API 2023-03-07 23:10:06 +00:00
e7d1c0d951 Cross-platform code improvements. 2023-03-01 01:55:26 +00:00
8c96fd8d7d Begin the great StrDuplicate() refactor. 2023-02-23 23:19:23 +00:00
dc972385ea Don't shadow variables. 2023-02-05 14:19:07 +00:00
90a74c3b0a Don't accept connections if the connection queue is full. 2023-01-09 17:44:12 +00:00
1d9ed5dcbf Fix invalid read in HttpParamDecode(). 2023-01-09 15:48:56 +00:00
3c8d89a52e Update copyright year 2022-12-26 15:52:52 +00:00
e37e6f1bb8 Fix some memory bugs. 2022-12-14 18:19:20 +00:00
6900d0649e Begin working on Util man page 2022-11-25 21:54:57 +00:00
399939654a Fix a few areas where obscure compilers sometimes choke 2022-11-23 17:31:57 +00:00
efbbf42a6e Fix memory and connection closing errors. 2022-11-08 01:05:28 +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
82d460da6f Fix some sneaky memory bugs and resource leaks. 2022-11-01 09:04:15 -04:00
63dbf9ae35 Fix a few more memory bugs. Still have some to tackle. 2022-10-31 19:52:37 -04:00
fd50fd83fb Misc changes throughout the codebase during testing. 2022-10-31 08:12:42 -04:00
5ca5ec7dd4 Complete parameter parsing 2022-10-15 19:17:49 -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
65dad27902 Fix some server context memory leaks. 2022-10-13 12:34:17 -04:00
8cb86e8f67 Use new Memory API for all memory allocations. 2022-10-13 12:18:42 -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
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
275d06c127 Begin prototyping the HttpServer API 2022-08-26 11:07:54 -04:00
9378a4d369 Implement basic thread pool with dummy 500 messages. 2022-08-24 19:31:28 -04:00
de00c3cb37 Fix fdopen() file mode. 2022-08-24 16:28:50 -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
315589cd1b Accept #29 2022-08-21 12:35:16 -04:00
538412d1c2 Apply #26 2022-08-12 21:30:03 -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