Compare commits

..

80 Commits

Author SHA1 Message Date
df38bcf775
Merge in a JSON-RPC 2.0 test server 2018-10-18 07:49:36 +02:00
1c52f9e37e
demo-json-rpc-server -> json-rpc-test-server 2018-10-18 07:27:55 +02:00
6e152ae37c
More debugging information for static file serving 2018-10-18 07:17:06 +02:00
8d66435568
Remember to set the server context in SCGI requests 2018-10-18 06:41:12 +02:00
d883f4cc71
Finish the FastCGI backend
Bump liberty, also fixing SCGI.
2018-10-18 06:35:29 +02:00
62945cceb3
Finish the WebSocket backend
Of course, everything so far hasn't been tested much.
2018-10-18 04:44:40 +02:00
580f0a0c59
Synthesize EOF events in SCGI 2018-10-18 04:44:39 +02:00
253e35e1e4
Wrap request::write_cb in a function 2018-10-17 23:34:59 +02:00
cf56921c4e
Allow WebSockets to micromanage shutdowns
They have their reasons, mostly event-related.
2018-10-17 23:26:54 +02:00
a3ec0942f8
Implement basic connection teardown
I finally understand the codebase again.  It's rather complicated.
2018-10-17 22:59:40 +02:00
efd500ca3c
Accelerated daemon quitting 2018-10-17 06:08:11 +02:00
13892fcd0e
Clean up client de/allocation 2018-10-17 05:16:17 +02:00
1d638c9170
Say "finalize" instead of "destroy" where appropriate
- _make() returns a struct directly
 - _init() initializes over a pointer
 - _free() deinitializes over a pointer
 - _new() is like _init() but also allocates
 - _destroy() is like _free() but also deallocates

Finalization is a matching concept in garbage-collected languages.
2018-10-17 03:53:07 +02:00
83363e6383
FastCGI: make it work at least in theory 2018-10-17 03:50:39 +02:00
272145ace2
Clarify EOF behaviour 2018-10-17 02:21:19 +02:00
4c54bc42b9
Clean up and better document client_vtable 2018-10-16 04:45:36 +02:00
7d922352ea
Rename client_vtable::destroy to finalize
Matches a similar concept from garbage-collected languages.
2018-10-16 04:34:00 +02:00
7f6db9d39f
Improve WebSocket shutdown 2018-10-16 04:33:59 +02:00
7cefdd496f
Cleanup 2018-10-16 04:05:42 +02:00
e9530f450e
Call ws_handler_start() 2018-10-16 01:47:51 +02:00
dda22c2cd5
Eliminate unnecessary user_data pointers
The CONTAINER_OF macro can find the parent structure just as well.
2018-10-16 01:47:50 +02:00
7aff9c3475
Improve documentation 2018-10-16 01:47:50 +02:00
a14edb72e9
Make Doxygen a bit more useful 2018-10-15 05:07:57 +02:00
267a9a561b
Eliminate some warnings 2018-10-15 03:28:09 +02:00
441c89f654
Handle FastCGI null request IDs better 2018-10-15 03:04:39 +02:00
14ded260a0
Clarify and degrade FastCGI multiplexing
No need to support more than 255 concurrent requests on one connection.
2018-10-15 03:02:49 +02:00
8b334e9c91
Fix fcgi_muxer_send()
Outgoing records were missing padding and the reserved field.
2018-10-13 04:08:43 +02:00
fd17b4e504
Update code comments 2018-10-13 04:07:45 +02:00
d182bcef3b
More transient errors 2018-10-12 20:02:42 +02:00
329fc9b88f
Bump liberty
Eliminates some fall-through warnings.
2018-10-11 21:03:34 +02:00
711d73f481
Fix text message UTF-8 validation 2018-06-24 06:12:16 +02:00
df340c13ed
Add the missing Date header 2018-06-24 06:12:16 +02:00
8e986a6040
Remove .travis.yml
We don't depend on any proprietary services no longer.  I'll have to
make my own replacements with blackjack and hookers.  Until then,
the file stays in the commit log as an example.
2018-06-24 06:12:16 +02:00
131debe985
Bump liberty 2018-06-24 06:12:16 +02:00
b312c022ae
Update README 2018-06-24 00:42:59 +02:00
4078c8845c
Relicense to 0BSD, update mail address
I've come to the conclusion that copyright mostly just stands in the way
of software development.  In my jurisdiction I cannot give up my own
copyright and 0BSD seems to be the closest thing to public domain.

The updated mail address, also used in my author/committer lines,
is shorter and looks nicer.  People rarely interact anyway.
2018-06-24 00:21:10 +02:00
333efdc70f
CMakeLists.txt: fix variable name 2018-06-24 00:15:53 +02:00
5e88608286
Bump liberty and http-parser 2017-06-20 14:04:40 +02:00
ca90e9df83
Fix teardown 2017-06-20 14:01:23 +02:00
419147beec
Update README 2017-06-20 14:01:10 +02:00
b85d1d74a4
Don't respond to notifications 2017-02-06 20:48:14 +01:00
d35e733c6e
Bump liberty
Fixing a bug in the WebSocket frame parser.
2017-02-06 19:47:24 +01:00
e6f9e53229
Fix segfault in WebSocket parsing 2017-02-06 18:51:52 +01:00
2986f6cda0
Fix segfault on client destruction etc. 2017-02-06 18:30:02 +01:00
c4ebf2ccd5
Fix segfault on missing Sec-WebSocket-Key 2017-02-06 18:28:53 +01:00
a785dc9670
WebSocket: fix header parsing 2017-02-06 18:28:40 +01:00
2b7d455471
Fix quitting 2017-02-06 17:18:24 +01:00
0ec0685714
Bump liberty 2017-02-05 22:44:01 +01:00
733451cf2a
Fix and update LICENSE 2017-02-03 22:43:09 +01:00
369f94f5ab
Travis CI: brevify notifications 2017-02-03 22:38:56 +01:00
7b94a03e8c Update IRC server address 2016-03-14 21:18:27 +01:00
8b66a3f074 Bump liberty 2016-01-17 04:48:17 +01:00
f273151447 Overall revision after a year
Use something closer to inheritance for clients
2016-01-17 04:48:00 +01:00
a95867dbee Fix daemonization 2016-01-16 22:33:57 +01:00
5298d802bb Fix compiler warning 2016-01-16 22:16:01 +01:00
af3cb3aaba Bump liberty 2016-01-16 06:41:31 +01:00
0f62ef26f5 Fix FindLibMagic.cmake 2016-01-16 06:37:56 +01:00
3c7b57bba9 Convert README to AsciiDoc 2015-09-27 02:11:38 +02:00
98bbea72d2 Fix README 2015-09-27 02:10:19 +02:00
df5b7ad71a Update README 2015-05-07 20:28:24 +02:00
6785d3a9ed Implement shutdown 2015-04-10 02:44:13 +02:00
1944f9f17d Travis CI: Change IRC notification address 2015-04-10 01:46:05 +02:00
4dbdc849d9 Steady progress
On the WebSocket service.

It's not too far from being finished now.  I just have to make some
sense of the code again and make sure it's correct.

Now that json-rpc-shell should be able to run against this, I can
also finally test if both of them work as they should.
2015-04-10 01:42:41 +02:00
db6dff4216 Move a lot of stuff to liberty 2015-03-29 03:14:20 +02:00
8aa232d32e Add and fix some preliminary tests 2015-03-23 20:12:53 +01:00
6e9109df4c Don't allow whitespace in base64 2015-03-23 20:12:02 +01:00
987eae5661 Steady progress
Renamed some constants, added basic UTF-8 validation.
2015-03-23 16:47:21 +01:00
9b7dd630e3 WebSockets improvements
- validate more HTTP stuff, use the newer RFC
 - validate the base64 key
2015-03-22 22:35:58 +01:00
c87d684154 Steady progress
Started parsing Content-Type properly after studying the HTTP RFC
for a significant period of time.

Some further WebSockets stuff.
2015-03-15 04:32:04 +01:00
23eb4cca38 Steady progress
Still in a state of total chaos, it appears.
2015-03-14 19:37:00 +01:00
4337038819 Try to lock a PID file 2015-03-11 23:57:25 +01:00
012a57b357 Steady progress
Some further refactoring, added a few comments, etc.

It's not about adding huge chunks of code anymore, and I'm slowly
moving towards getting the details right.

There's still a ton of TODO items, though.
2015-03-11 00:25:46 +01:00
3c0e48a429 Refactoring 2015-03-10 20:48:25 +01:00
5885d1aa69 Some intial WebSockets code 2015-03-09 23:32:01 +01:00
931fc441f6 Steady progress
Added static content serving with sane content type detection.

Started working on WebSockets (meanwhile neither SCGI or FastCGI is
finished and almost nothing has been tested).
2015-03-08 09:41:10 +01:00
9e0c9dd6d8 Steady progress
Still trying to figure out FastCGI.

At least I've finally implemented the JSON-RPC handler.
2015-03-08 05:51:51 +01:00
2733ead30f Figuring out how to close the connection 2015-03-06 19:49:33 +01:00
0b0d64124b Steady progress 2015-03-05 08:47:20 +01:00
a54230bddb Steady progress
I'm trying to figure out everything at once, i.e. the entire structure
of the application from top to bottom, trying to converge on a workable
design while refactoring still doesn't hurt as much as it would once
it's established.
2015-03-02 23:11:29 +01:00
8a3241d5c4 Initial commit
Not even the demo is able to compile yet.

I'm just tracking my progress.
2015-03-02 19:14:37 +01:00
6 changed files with 2956 additions and 2 deletions

View File

@ -70,6 +70,16 @@ include_directories (${PROJECT_BINARY_DIR})
add_executable (${PROJECT_NAME} ${PROJECT_NAME}.c http-parser/http_parser.c) add_executable (${PROJECT_NAME} ${PROJECT_NAME}.c http-parser/http_parser.c)
target_link_libraries (${PROJECT_NAME} ${project_libraries}) target_link_libraries (${PROJECT_NAME} ${project_libraries})
# Development tools
find_package (LibMagic)
if (LIBMAGIC_FOUND)
include_directories (${LIBMAGIC_INCLUDE_DIRS})
add_executable (json-rpc-test-server
json-rpc-test-server.c http-parser/http_parser.c)
target_link_libraries (json-rpc-test-server
${project_libraries} ${LIBMAGIC_LIBRARIES})
endif ()
# The files to be installed # The files to be installed
include (GNUInstallDirs) include (GNUInstallDirs)
install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -1,4 +1,4 @@
Copyright (c) 2014 - 2016, Přemysl Janouch <p@janouch.name> Copyright (c) 2014 - 2018, Přemysl Janouch <p@janouch.name>
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted. purpose with or without fee is hereby granted.

View File

@ -67,6 +67,12 @@ Note that for versions of CMake before 2.8.9, you need to prefix `cpack` with
Run the program with `--help` to obtain usage information. Run the program with `--help` to obtain usage information.
Test server
-----------
If you install development packages for libmagic, an included test server will
be built but not installed which provides a trivial JSON-RPC 2.0 service with
FastCGI, SCGI, and WebSocket interfaces. It responds to the `ping` method.
Contributing and Support Contributing and Support
------------------------ ------------------------
Use https://git.janouch.name/p/json-rpc-shell to report bugs, request features, Use https://git.janouch.name/p/json-rpc-shell to report bugs, request features,

10
cmake/FindLibMagic.cmake Normal file
View File

@ -0,0 +1,10 @@
# Public Domain
find_library (LIBMAGIC_LIBRARIES magic)
find_path (LIBMAGIC_INCLUDE_DIRS magic.h)
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (LibMagic DEFAULT_MSG
LIBMAGIC_LIBRARIES LIBMAGIC_INCLUDE_DIRS)
mark_as_advanced (LIBMAGIC_LIBRARIES LIBMAGIC_INCLUDE_DIRS)

2928
json-rpc-test-server.c Normal file

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
Subproject commit bb30c7d86ef7b165c5e00cc8e0ad2e3e85b9e617 Subproject commit bca7167d037d857448cb18243425d7c61de3bdd5