diff options
author | Wolfy-J <[email protected]> | 2019-05-02 16:33:45 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2019-05-02 16:33:45 +0300 |
commit | 64f2c19b0a9a33d97bd947e805d0491e68784423 (patch) | |
tree | 238b4a3f638b85180804458f97160455fcca1aff | |
parent | cf3e341207893d62bae8a5671118401f745a8f08 (diff) | |
parent | 677004f7cb97981f0220e2c65a2e7618505d01dc (diff) |
Merge branch 'feature/updates' into pr/issue-121-rename_maxrequest_config_param
-rw-r--r-- | README.md | 39 | ||||
-rwxr-xr-x | build.sh | 3 | ||||
-rw-r--r-- | composer.json | 2 | ||||
-rw-r--r-- | qbuild/src/Builder.php | 10 | ||||
-rw-r--r-- | service/http/handler_test.go | 52 | ||||
-rw-r--r-- | service/http/parse.go | 4 | ||||
-rw-r--r-- | service/http/parse_test.go | 2 | ||||
-rw-r--r-- | src/Diactoros/ServerRequestFactory.php | 3 | ||||
-rw-r--r-- | src/Diactoros/StreamFactory.php | 3 | ||||
-rw-r--r-- | src/Diactoros/UploadedFileFactory.php | 3 | ||||
-rw-r--r-- | src/Exception/RoadRunnerException.php | 3 | ||||
-rw-r--r-- | src/Exceptions/RoadRunnerException.php | 1 | ||||
-rw-r--r-- | src/HttpClient.php | 3 | ||||
-rw-r--r-- | src/PSR7Client.php | 3 | ||||
-rw-r--r-- | src/Worker.php | 3 | ||||
-rw-r--r-- | static_pool.go | 2 |
16 files changed, 75 insertions, 61 deletions
@@ -16,41 +16,10 @@ It supports running as a service with the ability to extend its functionality on RoadRunner includes PSR-7/PSR-17 compatible HTTP and HTTP/2 server and can be used to replace classic Nginx+FPM setup with much greater performance and flexibility. -Table of Contents ------------------ -* Introduction - * [About RoadRunner](https://github.com/spiral/roadrunner/wiki/About-RoadRunner) - * [Installation](https://github.com/spiral/roadrunner/wiki/Installation) - * [Quick Builds](https://github.com/spiral/roadrunner/wiki/Quick-Builds) - * [Configuration](https://github.com/spiral/roadrunner/wiki/Configuration) - * [License](https://github.com/spiral/roadrunner/wiki/License) -* Using RoadRunner - * [Environment Configuration](https://github.com/spiral/roadrunner/wiki/Enviroment-Configuration) - * [HTTPS and HTTP/2](https://github.com/spiral/roadrunner/wiki/HTTPS-and-HTTP2) - * [**PHP Workers**](https://github.com/spiral/roadrunner/wiki/PHP-Workers) - * [Debugging](https://github.com/spiral/roadrunner/wiki/Debugging) - * [Server Commands](https://github.com/spiral/roadrunner/wiki/Server-Commands) - * [RPC Integration](https://github.com/spiral/roadrunner/wiki/RPC-Integration) - * [Restarting Workers](https://github.com/spiral/roadrunner/wiki/Restarting-Workers) - * [IDE integration](https://github.com/spiral/roadrunner/wiki/IDE-Integration) - * [Error Handling](https://github.com/spiral/roadrunner/wiki/Debug-And-Error-Handling) - * [Production Usage](https://github.com/spiral/roadrunner/wiki/Production-Usage) -* Integrations - * [Laravel Framework](https://github.com/spiral/roadrunner/wiki/Laravel-Framework) - * [Slim Framework](https://github.com/spiral/roadrunner/issues/62) - * [Symfony Framework](https://github.com/spiral/roadrunner/wiki/Symfony-Framework) (native sessions support [is not stable](https://github.com/spiral/roadrunner/issues/18)) - * [Yii2/3 Framework](https://github.com/spiral/roadrunner/issues/78) (in progress) - - [Other Examples](https://github.com/spiral/roadrunner/wiki/Other-Examples) -* Server Customization - * [Building Server](https://github.com/spiral/roadrunner/wiki/Building-Server) - * [Writing Services](https://github.com/spiral/roadrunner/wiki/Writing-Services) - * [HTTP Middlewares](https://github.com/spiral/roadrunner/wiki/Middlewares) -* Additional Notes - * [Event Listeners](https://github.com/spiral/roadrunner/wiki/Event-Listeners) - * [Standalone Usage](https://github.com/spiral/roadrunner/wiki/Standalone-usage) - * [AWS Lambda](https://github.com/spiral/roadrunner/wiki/AWS-Lambda) -* Custom Builds - * [GRPC Server](https://github.com/spiral/php-grpc) +<p align="center"> + <a href="https://roadrunner.dev/"><b>Official Website</b></a> | + <a href="https://roadrunner.dev/docs"><b>Documentation</b></a> +</p> Features: -------- @@ -1,8 +1,9 @@ #!/bin/bash cd $(dirname "${BASH_SOURCE[0]}") OD="$(pwd)" + # Pushes application version into the build information. -RR_VERSION=1.3.5 +RR_VERSION=1.3.7 # Hardcode some values to the core package LDFLAGS="$LDFLAGS -X github.com/spiral/roadrunner/cmd/rr/cmd.Version=${RR_VERSION}" diff --git a/composer.json b/composer.json index 9f25d3e7..cb08ee97 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "spiral/roadrunner", "type": "server", - "description": "High-performance PHP load balancer and process manager library for Golang", + "description": "High-performance PHP application server, load-balancer and process manager written in Golang", "license": "MIT", "authors": [ { diff --git a/qbuild/src/Builder.php b/qbuild/src/Builder.php index 5568d725..4b441094 100644 --- a/qbuild/src/Builder.php +++ b/qbuild/src/Builder.php @@ -137,14 +137,14 @@ final class Builder { $os = strtolower(PHP_OS); - if (strpos($os, 'win') !== false) { - return 'windows'; - } - if (strpos($os, 'darwin') !== false) { return 'darwin'; } + if (strpos($os, 'win') !== false) { + return 'windows'; + } + return "linux"; } @@ -234,4 +234,4 @@ final class Builder return false; } } -}
\ No newline at end of file +} diff --git a/service/http/handler_test.go b/service/http/handler_test.go index 6df0a620..6cedd4cd 100644 --- a/service/http/handler_test.go +++ b/service/http/handler_test.go @@ -510,6 +510,58 @@ func TestHandler_FormData_POST(t *testing.T) { assert.Equal(t, `{"arr":{"c":{"p":"l","z":""},"x":{"y":{"e":"f","z":"y"}}},"key":"value","name":["name1","name2","name3"]}`, string(b)) } +func TestHandler_FormData_POST_Overwrite(t *testing.T) { + h := &Handler{ + cfg: &Config{ + MaxRequest: 1024, + Uploads: &UploadsConfig{ + Dir: os.TempDir(), + Forbid: []string{}, + }, + }, + rr: roadrunner.NewServer(&roadrunner.ServerConfig{ + Command: "php ../../tests/http/client.php data pipes", + Relay: "pipes", + Pool: &roadrunner.Config{ + NumWorkers: 1, + AllocateTimeout: 10000000, + DestroyTimeout: 10000000, + }, + }), + } + + assert.NoError(t, h.rr.Start()) + defer h.rr.Stop() + + hs := &http.Server{Addr: ":8083", Handler: h} + defer hs.Shutdown(context.Background()) + + go func() { hs.ListenAndServe() }() + time.Sleep(time.Millisecond * 10) + + form := url.Values{} + + form.Add("key", "value1") + form.Add("key", "value2") + + req, err := http.NewRequest("POST", "http://localhost"+hs.Addr, strings.NewReader(form.Encode())) + assert.NoError(t, err) + + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + + r, err := http.DefaultClient.Do(req) + assert.NoError(t, err) + defer r.Body.Close() + + b, err := ioutil.ReadAll(r.Body) + assert.NoError(t, err) + + assert.NoError(t, err) + assert.Equal(t, 200, r.StatusCode) + + assert.Equal(t, `{"key":"value2","arr":{"x":{"y":null}}}`, string(b)) +} + func TestHandler_FormData_POST_Form_UrlEncoded_Charset(t *testing.T) { h := &Handler{ cfg: &Config{ diff --git a/service/http/parse.go b/service/http/parse.go index 1f90930a..9b58d328 100644 --- a/service/http/parse.go +++ b/service/http/parse.go @@ -39,8 +39,8 @@ func (d dataTree) push(k string, v []string) { // mount mounts data tree recursively. func (d dataTree) mount(i []string, v []string) { if len(i) == 1 { - // single value context - d[i[0]] = v[0] + // single value context (last element) + d[i[0]] = v[len(v)-1] return } diff --git a/service/http/parse_test.go b/service/http/parse_test.go index 34c0dc0d..f95a3f9d 100644 --- a/service/http/parse_test.go +++ b/service/http/parse_test.go @@ -50,5 +50,3 @@ func same(in, out []string) bool { return true } - -// bench diff --git a/src/Diactoros/ServerRequestFactory.php b/src/Diactoros/ServerRequestFactory.php index 4d427121..cb534577 100644 --- a/src/Diactoros/ServerRequestFactory.php +++ b/src/Diactoros/ServerRequestFactory.php @@ -1,11 +1,10 @@ <?php -declare(strict_types=1); - /** * High-performance PHP process supervisor and load balancer written in Go * * @author Wolfy-J */ +declare(strict_types=1); namespace Spiral\RoadRunner\Diactoros; diff --git a/src/Diactoros/StreamFactory.php b/src/Diactoros/StreamFactory.php index 6004ef11..1c51d911 100644 --- a/src/Diactoros/StreamFactory.php +++ b/src/Diactoros/StreamFactory.php @@ -1,11 +1,10 @@ <?php -declare(strict_types=1); - /** * High-performance PHP process supervisor and load balancer written in Go * * @author Wolfy-J */ +declare(strict_types=1); namespace Spiral\RoadRunner\Diactoros; diff --git a/src/Diactoros/UploadedFileFactory.php b/src/Diactoros/UploadedFileFactory.php index 1543a826..7de9a30f 100644 --- a/src/Diactoros/UploadedFileFactory.php +++ b/src/Diactoros/UploadedFileFactory.php @@ -1,11 +1,10 @@ <?php -declare(strict_types=1); - /** * High-performance PHP process supervisor and load balancer written in Go * * @author Wolfy-J */ +declare(strict_types=1); namespace Spiral\RoadRunner\Diactoros; diff --git a/src/Exception/RoadRunnerException.php b/src/Exception/RoadRunnerException.php index 7c5c5929..348cb106 100644 --- a/src/Exception/RoadRunnerException.php +++ b/src/Exception/RoadRunnerException.php @@ -1,11 +1,10 @@ <?php -declare(strict_types=1); - /** * High-performance PHP process supervisor and load balancer written in Go * * @author Wolfy-J */ +declare(strict_types=1); namespace Spiral\RoadRunner\Exception; diff --git a/src/Exceptions/RoadRunnerException.php b/src/Exceptions/RoadRunnerException.php index 1a5da18c..803e4e31 100644 --- a/src/Exceptions/RoadRunnerException.php +++ b/src/Exceptions/RoadRunnerException.php @@ -5,6 +5,7 @@ * @license MIT * @author Anton Titov (Wolfy-J) */ +declare(strict_types=1); namespace Spiral\RoadRunner\Exceptions; diff --git a/src/HttpClient.php b/src/HttpClient.php index e469dd30..f31a9b50 100644 --- a/src/HttpClient.php +++ b/src/HttpClient.php @@ -1,11 +1,10 @@ <?php -declare(strict_types=1); - /** * High-performance PHP process supervisor and load balancer written in Go * * @author Alex Bond */ +declare(strict_types=1); namespace Spiral\RoadRunner; diff --git a/src/PSR7Client.php b/src/PSR7Client.php index 8229b7d5..5b9425d6 100644 --- a/src/PSR7Client.php +++ b/src/PSR7Client.php @@ -1,11 +1,10 @@ <?php -declare(strict_types=1); - /** * High-performance PHP process supervisor and load balancer written in Go * * @author Wolfy-J */ +declare(strict_types=1); namespace Spiral\RoadRunner; diff --git a/src/Worker.php b/src/Worker.php index da80e461..b67ebd3b 100644 --- a/src/Worker.php +++ b/src/Worker.php @@ -1,11 +1,10 @@ <?php -declare(strict_types=1); - /** * High-performance PHP process supervisor and load balancer written in Go * * @author Wolfy-J */ +declare(strict_types=1); namespace Spiral\RoadRunner; diff --git a/static_pool.go b/static_pool.go index be1a6f3b..c9473699 100644 --- a/static_pool.go +++ b/static_pool.go @@ -152,8 +152,8 @@ func (p *StaticPool) Destroy() { atomic.AddInt32(&p.inDestroy, 1) p.tmu.Lock() - close(p.destroy) p.tasks.Wait() + close(p.destroy) p.tmu.Unlock() var wg sync.WaitGroup |