1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
puma--puma/lib/puma
Chris LaRose 64c0153cd0
Remove use of json gem (#2479)
* Add basic JSON serializer

For now, it only handles Arrays of Integers, but we'll extend it to
support all of the common types

* Serialize Strings

* Escape quotes in Strings

* Escape backslashes in Strings

* Serialize Hashes with String keys

* Extract method for serializing Strings

* Add test coverage for non-Hash non-Array JSON serialization

* Add test for unexpected key types

* Serialize Hashes with Symbol keys

* Raise on unexpected value types

* Serialize boolean values

* Serialize Floats

* Add module comment to Puma::JSON

* Update integration test to use fully-qualfied JSON module reference

* Remove json gem dependency from /stats status server response

Fixes a bug where requesting `/stats` from the status server would cause
subsequent phased restarts to fail when upgrading/downgrading the json
gem.

* Run gc_stats tests on JRuby

These were disabled at some point on JRuby, but they seem to run fine.
Importantly, this test ensures that a call to `/gc-stats` returns
well-formed JSON on JRuby, where the value of `GC.stat` contains nested
structures.

* Remove json gem dependency from /gc-stats status server response

Fixes a bug where requesting `/gc-stats` from the status server would cause
subsequent phased restarts to fail when upgrading/downgrading the json
gem.

* Remove json gem from /thread-backtraces status server response

Fixes a bug where requesting `/thread-backtraces` from the status server
would cause subsequent phased restarts to fail when
upgrading/downgrading the json gem.

* Remove json gem dependency from Puma.stats

Fixes a bug where accessing `Puma.stats` would cause subsequent phased
restarts to fail when upgrading/downgrading the json gem.

* Fix test name in json test

Co-authored-by: rmacklin <1863540+rmacklin@users.noreply.github.com>

* Add History entry

* Add test for exceptions on values of unexpected types

* Update test name for additional clarity

* Reorder cases to match order in ECMA-404

* Allow all serializable inputs in Puma::JSON::serialize

The pervious implementation was based on and older JSON standard which
defined JSON texts to be either objects or arrays. Modern JSON standands
allow all JSON values to be valid JSON texts.

* Update JSON tests to test value types directly

* Reorder tests to roughly match source order

* Add test for serializing integers as JSON

* Serialize nil as null

* Use block form of gsub instead of hash form

* Escape control characters as required by ECMA-404

* Collapse handling of Symbol and String into one case

* Extract constants used in string serialization

* Remove superflous else case

* Use stringio for incremental JSON construction

* Extract test helper for testing JSON serialization

* Assert that strings generated by Puma::JSON roundtrip when using ::JSON

* Use a recent version of the json gem in tests

`::JSON.parse` doesn't handle JSON texts other than objects and arrays
in old versions

* Handle default expected_roundtrip more explicitly for clarity

Co-authored-by: rmacklin <1863540+rmacklin@users.noreply.github.com>
2020-11-10 10:16:42 -07:00
..
app Remove use of json gem (#2479) 2020-11-10 10:16:42 -07:00
cluster Remove use of json gem from WorkerHandle#ping! (#2473) 2020-11-01 15:09:31 -07:00
minissl Adjust code for compiling without SSL (MRI & JRuby), add SSL detection 2020-09-14 12:20:00 -05:00
plugin Test cleanup and parallelization (#1846) 2019-07-16 18:53:28 -04:00
rack Remove daemonization (#2170) 2020-03-10 12:08:34 -06:00
binder.rb Remove accept_nonblock.rb, add test_integration_ssl.rb (#2448) 2020-10-25 16:15:20 -06:00
cli.rb Fix a bunch of test warnings 2020-05-11 13:21:24 +09:00
client.rb Close idle connections immediately on shutdown (#2460) 2020-10-27 07:51:26 -06:00
cluster.rb Ignore forksafe threads for warning (#2475) 2020-11-02 12:37:55 -07:00
commonlogger.rb fix: Update links to use TLS/SSL [ci skip] [changelog skip] 2020-08-14 00:20:07 +05:30
configuration.rb Log puma config if the env variable LOG_CONFIG exists (#2472) 2020-11-02 08:32:37 -07:00
const.rb 5.0.4 2020-10-27 08:04:18 -06:00
control_cli.rb Refactor control_cli.rb - add CMD_PATH_SIG_MAP (#2451) 2020-10-28 07:09:37 -06:00
detect.rb Documentation - add version info, misc fixes [ci skip] (#2368) 2020-09-17 09:15:19 -06:00
dsl.rb Improve docs around preload_app! and phased restart (#2481) 2020-11-09 10:18:25 -07:00
error_logger.rb Fix error backtrace debug logging && Do not log request dump if it is not parsed (#2376) 2020-09-22 09:35:04 -06:00
events.rb Add systemd notify and watchdog support (#2438) 2020-10-26 16:02:31 -06:00
io_buffer.rb IOBuffer back to Ruby (#1980) 2020-02-27 13:50:34 -06:00
jruby_restart.rb Remove daemonization (#2170) 2020-03-10 12:08:34 -06:00
json.rb Remove use of json gem (#2479) 2020-11-10 10:16:42 -07:00
launcher.rb Log puma config if the env variable LOG_CONFIG exists (#2472) 2020-11-02 08:32:37 -07:00
minissl.rb Add more @!attribute tags [skip ci] (#2385) 2020-09-25 12:50:57 -06:00
null_io.rb improved rubocop config (#2152) 2020-03-07 08:15:43 -06:00
plugin.rb Nitpicks 2020-04-22 08:35:28 +09:00
queue_close.rb queue_close.rb - fix 'warning: instance variable @closed not initialized' on Ruby 2.2 2020-10-25 17:07:43 -05:00
rack_default.rb Test cleanup and parallelization (#1846) 2019-07-16 18:53:28 -04:00
reactor.rb reactor.rb - register the io, not the client, rename parameters (#2458) 2020-10-27 07:38:34 -06:00
request.rb Ignore illegal response header (#2439) 2020-10-26 16:02:13 -06:00
runner.rb Server - Consolidate option handling, small refactors, doc changes (#2389) 2020-09-29 07:12:47 -06:00
server.rb Revert "Revert "Adds configuration option to set max_fast_inline (#2406)"" 2020-10-26 15:59:30 -06:00
single.rb Server run thread safety fix [changelog skip] (#2435) 2020-10-20 07:26:16 -06:00
state_file.rb Minor: Add running_from to state_file 2020-05-23 19:27:51 +02:00
systemd.rb Add systemd notify and watchdog support (#2438) 2020-10-26 16:02:31 -06:00
thread_pool.rb Add more @!attribute tags [skip ci] (#2385) 2020-09-25 12:50:57 -06:00
util.rb Refactor: extract worker process into separate class [changelog skip] (#2374) 2020-09-29 07:21:52 -06:00