Commit Graph

102 Commits

Author SHA1 Message Date
Přemysl Eric Janouch 6927d022fb
WebSocket: send a User-Agent header 2020-10-15 04:30:48 +02:00
Přemysl Eric Janouch 75b2094cdd
json-rpc-test-server: add a simple co-process mode
A disgusting copy-paste but it will have to do for now.

Closes #6
2020-10-15 03:20:20 +02:00
Přemysl Eric Janouch 4236a4943a
WebSocket: adapt to common "await" infrastructure 2020-10-14 13:37:10 +02:00
Přemysl Eric Janouch 23c728e535
Add a backend for co-processes
Targets language servers.

In this first stage, we don't need to support bi-directionality,
although it's a requirement for finishing this task.

Updates #4
2020-10-14 13:37:08 +02:00
Přemysl Eric Janouch dfe814316f
This software is no longer simple 2020-10-14 13:36:35 +02:00
Přemysl Eric Janouch efc663a178
WebSocket: some clean-up 2020-10-14 12:25:22 +02:00
Přemysl Eric Janouch 2b8f52ac72
Split out a http-parser wrapper 2020-10-14 12:25:22 +02:00
Přemysl Eric Janouch bb7ffe1da2
Simplify the FAIL macro 2020-10-14 12:25:21 +02:00
Přemysl Eric Janouch ad1aba9d22
WebSocket: fix upgrade processing
When http-parser sets the upgrade field, it checks for status code 101
and even resolves our TODO about checking the entire Connection header.
2020-10-14 09:44:46 +02:00
Přemysl Eric Janouch 01767198f2
WebSockets -> WebSocket
This is the correct name of the protocol, usage of the word
"WebSockets" should be limited.
2020-10-14 00:03:34 +02:00
Přemysl Eric Janouch 5854ed1b32
Support reading OpenRPC documents from a file
Bump liberty, it generated incorrect help messages.
2020-10-13 21:48:24 +02:00
Přemysl Eric Janouch 63c8a79479
Factor out init_backend()
The main() function is still way too long.
2020-10-13 21:07:40 +02:00
Přemysl Eric Janouch c87869bef7
Cleanup
Prevent the last fuck-up from happening again.
2020-10-13 20:30:33 +02:00
Přemysl Eric Janouch fcf65f8377
Add libedit autocompletion back in
I've mistakenly removed it in the M-Enter change.
2020-10-13 20:19:19 +02:00
Přemysl Eric Janouch b458fc1f99
libedit: bind M-Enter to newline-insert as well 2020-10-13 15:55:37 +02:00
Přemysl Eric Janouch 2221828763
OpenRPC: avoid eating HTTP/transport errors 2020-10-13 04:35:32 +02:00
Přemysl Eric Janouch 2b18ebf314
Implement tab completion under libedit
I haven't tested it with real wide characters but it will have to do.
I wasn't even sure if this piece of crap could be coerced into doing
this at first, so it's a win for me.

It uses a variation of the code in degesch where we /don't/ want to
print the list of candidates on partial failure.

Updates #1
2020-10-13 03:58:26 +02:00
Přemysl Eric Janouch 160d23018a
Bump liberty
resolve_relative_runtime_unique_filename() used to have a bug.
2020-10-10 05:09:11 +02:00
Přemysl Eric Janouch fed2892ee1
Readline: add trivial OpenRPC support
So far hidden under a switch and only for this frontend.
2020-10-10 05:09:10 +02:00
Přemysl Eric Janouch 667b01cb73
Reorder help message entries a bit
Should be both more useful and more alphabetic this way.
2020-10-10 02:57:14 +02:00
Přemysl Eric Janouch 20c8578084
Fix use of possibly uninitialised memory 2020-10-10 02:57:14 +02:00
Přemysl Eric Janouch 57a3b4e990
Split make_json_rpc_call() in half 2020-10-10 02:57:13 +02:00
Přemysl Eric Janouch e4d1529b4d
Slightly refactor make_json_rpc_call() 2020-10-10 02:57:13 +02:00
Přemysl Eric Janouch 897a263ee7
Readline: make M-Enter insert a newline
Before, it was only possible with C-v C-j but it's too useful
to require such an awkward method.

There is a precedent in, e.g., zsh and fish for the new binding.
2020-10-09 20:41:37 +02:00
Přemysl Eric Janouch 84702fa47d
Fix handling terminal resizes while the terminal is suspended
GNU Readline has a misfeature.
2020-10-09 20:21:52 +02:00
Přemysl Eric Janouch b315892249
Readline: fix a dormant bug in prompt changes
For details, see a similar change in degesch from uirc3.
2020-10-09 20:17:17 +02:00
Přemysl Eric Janouch 984e5b4e7f
Use saner defaults
So that most of the time users won't need to use any switches.

--pretty-print has been inverted into jq's --compact-output,
and --auto-id has been replaced with barely, if-at-all useful
--null-as-id.
2020-09-05 06:07:45 +02:00
Přemysl Eric Janouch 2962a644da
Write a nice new man page in AsciiDoc
Taking some preliminary steps for inclusion in Linux distributions.

The help message has been slightly improved and the README extended,
with part of it now residing in the man page.

One less GNU dependency, for what it's worth.
2020-09-05 03:51:36 +02:00
Přemysl Eric Janouch 6f5ef30293
Move "connecting..." messages to the debug mode
So that the --verbose option does only one thing.
2020-09-05 03:50:14 +02:00
Přemysl Eric Janouch b7b1198be7
Fix libedit a bit more and discourage from using it 2020-09-02 01:08:09 +02:00
Přemysl Eric Janouch f4d178b3f6
Update copyright years 2020-09-01 21:03:53 +02:00
Přemysl Eric Janouch f6225ac6cc
Warn on unexpected "id" fields 2020-09-01 20:54:23 +02:00
Přemysl Eric Janouch 16ec8261dc
Make the verbose mode also show the raw input
To make it more useful for debugging.  We might also tie this
to the --debug option, though that would be a bit chaotic.
2020-09-01 20:37:08 +02:00
Přemysl Eric Janouch e49ff84b74
Strip trailing newlines from editor output 2020-09-01 19:26:37 +02:00
Přemysl Eric Janouch b7c9bfd9f5
Fix libedit crash
Again, I have no idea why it started to happen, it just occured
to me to try to change the call, and it turns out out it works.
2020-09-01 19:02:41 +02:00
Přemysl Eric Janouch f6165164ee
Fix prompt attributes under libedit
I can only guess why this works, and I'm not sure I want to /know/.
2020-09-01 19:02:41 +02:00
Přemysl Eric Janouch 3a445c2db2
Name change 2020-09-01 19:02:41 +02:00
Přemysl Eric Janouch 90b5364b29
Fix running helper programs
A bug was introduced in 5c38087.
2019-09-23 23:07:04 +02:00
Přemysl Eric Janouch 7c978fe50f
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 04:16:27 +02:00
Přemysl Eric Janouch 8d40122372
Display unexpected messages, too 2018-05-11 23:40:26 +02:00
Přemysl Eric Janouch 19e10aaf3e
Fix UTF-8 validation 2018-05-11 22:34:19 +02:00
Přemysl Eric Janouch 2e1127e371
Fix sent close code when failing the connection 2018-05-11 22:34:06 +02:00
Přemysl Eric Janouch 5c380878d5
Better fix for EOF handling with WebSockets
Used to spin.
2018-04-16 22:26:18 +02:00
Přemysl Eric Janouch 3002fb32b0
Fix EOF handling with WebSockets 2018-04-16 16:26:00 +02:00
Přemysl Eric Janouch d8fcb22daf
Bump liberty, fix GNUC detection, update README 2018-04-16 16:25:44 +02:00
Přemysl Eric Janouch 989825f7eb
Cleanup 2017-02-07 03:28:15 +01:00
Přemysl Eric Janouch c03af00e30
WebSockets are no longer experimental
Now that I've made it work at all, at least in some cases.
2017-02-06 21:28:40 +01:00
Přemysl Eric Janouch 9531f2b518
WebSocket: fix connection timeout 2017-02-06 21:28:40 +01:00
Přemysl Eric Janouch 06e066a491
WebSocket: avoid closing an invalid FD 2017-02-06 21:12:12 +01:00
Přemysl Eric Janouch 1be02128e3
WebSocket: fix reconnection 2017-02-06 21:11:17 +01:00