Skip to content

Commit

Permalink
feat(http-kernel): remove debug http request handler (#516)
Browse files Browse the repository at this point in the history
it is probably no longer necessary
  • Loading branch information
k911 authored May 10, 2021
1 parent cf99be9 commit da33c81
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 120 deletions.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Symfony integration with [Swoole](https://www.swoole.co.uk/) to speed up your ap

## Build Matrix

| CI Job | Branch [`master`](https://github.com/k911/swoole-bundle/tree/develop) | Branch [`develop`](https://github.com/k911/swoole-bundle/tree/master) |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Circle | [![CircleCI](https://circleci.com/gh/k911/swoole-bundle/tree/master.svg?style=svg)](https://circleci.com/gh/k911/swoole-bundle/tree/master) | [![CircleCI](https://circleci.com/gh/k911/swoole-bundle/tree/develop.svg?style=svg)](https://circleci.com/gh/k911/swoole-bundle/tree/develop) |
| CodeCov | [![codecov](https://codecov.io/gh/k911/swoole-bundle/branch/master/graph/badge.svg)](https://codecov.io/gh/k911/swoole-bundle) | [![codecov](https://codecov.io/gh/k911/swoole-bundle/branch/develop/graph/badge.svg)](https://codecov.io/gh/k911/swoole-bundle) |
| Travis | [![Build Status](https://travis-ci.org/k911/swoole-bundle.svg?branch=master)](https://travis-ci.org/k911/swoole-bundle) | [![Build Status](https://travis-ci.org/k911/swoole-bundle.svg?branch=develop)](https://travis-ci.org/k911/swoole-bundle) |
| CI Job | Branch [`master`](https://github.com/k911/swoole-bundle/tree/develop) | Branch [`develop`](https://github.com/k911/swoole-bundle/tree/master) |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Circle | [![CircleCI](https://circleci.com/gh/k911/swoole-bundle/tree/master.svg?style=svg)](https://circleci.com/gh/k911/swoole-bundle/tree/master) | [![CircleCI](https://circleci.com/gh/k911/swoole-bundle/tree/develop.svg?style=svg)](https://circleci.com/gh/k911/swoole-bundle/tree/develop) |
| CodeCov | [![codecov](https://codecov.io/gh/k911/swoole-bundle/branch/master/graph/badge.svg)](https://codecov.io/gh/k911/swoole-bundle) | [![codecov](https://codecov.io/gh/k911/swoole-bundle/branch/develop/graph/badge.svg)](https://codecov.io/gh/k911/swoole-bundle) |
| Travis | [![Build Status](https://travis-ci.org/k911/swoole-bundle.svg?branch=master)](https://travis-ci.org/k911/swoole-bundle) | [![Build Status](https://travis-ci.org/k911/swoole-bundle.svg?branch=develop)](https://travis-ci.org/k911/swoole-bundle) |

## Table of Contents

Expand All @@ -25,8 +25,8 @@ Symfony integration with [Swoole](https://www.swoole.co.uk/) to speed up your ap
- [Quick start guide](#quick-start-guide)
- [Features](#features)
- [Requirements](#requirements)
- [Current (`0.8.x`)](#current-08x)
- [Future](#future)
- [Current version](#current-version)
- [Future versions](#future-versions)
- [Swoole](#swoole)
- [Version check](#version-check)
- [Installation](#installation)
Expand Down Expand Up @@ -70,48 +70,48 @@ Symfony integration with [Swoole](https://www.swoole.co.uk/) to speed up your ap

## Features

- Built-in API Server
- Built-in API Server

Swoole Bundle API Server allows managing Swoole HTTP Server in real-time.

- Reload worker processes
- Shutdown server
- Access metrics and settings
- Reload worker processes
- Shutdown server
- Access metrics and settings

- Improved static files serving
- Improved static files serving

Swoole HTTP Server provides a default static files handler, but it lacks supporting many `Content-Types`. To overcome this issue, there is a configurable Advanced Static Files Server. Static files serving remains enabled by default in the development environment. Static files directory defaults to `%kernel.project_dir%/public`. To configure your custom mime types check [configuration reference](docs/configuration-reference.md) (key `swoole.http_server.static.mime_types`).

- Symfony Messenger integration
- Symfony Messenger integration

*Available since version: `0.6`*
_Available since version: `0.6`_

Swoole Server Task Transport has been integrated into this bundle to allow easy execution of asynchronous actions. Documentation of this feature is available [here](docs/swoole-task-symfony-messenger-transport.md).

- Hot Module Reload (HMR) for development **ALPHA**
- Hot Module Reload (HMR) for development **ALPHA**

Since Swoole HTTP Server runs in Event Loop and does not flush memory between requests, to keep DX equal with normal servers, this bundle uses code replacement technique, using `inotify` PHP Extension to allow continuous development. It is enabled by default (when the extension is found) and requires no additional configuration. You can turn it off in bundle configuration.

*Remarks: This feature currently works only on a Linux host machine. It probably won't work with Docker, and it is possible that it works only with configuration: `swoole.http_server.running_mode: process` (default).*
_Remarks: This feature currently works only on a Linux host machine. It probably won't work with Docker, and it is possible that it works only with configuration: `swoole.http_server.running_mode: process` (default)._
## Requirements
### Current (`0.8.x`)
### Current version
- PHP version `>= 7.4`
- Swoole PHP Extension `>= 4.5.10`
- Symfony `>= 4.3.1`
- PHP version `>= 7.4`
- Swoole PHP Extension `>= 4.5.10`
- Symfony `>= 4.4.0`
### Future
### Future versions
- PHP version `>= 8.0`
- Swoole PHP Extension `>= 4.6`
- Symfony `>= 5.0`
- PHP version `>= 8.0`
- Swoole PHP Extension `>= 4.6`
- Symfony `>= 5.0`
Additional requirements to enable specific features:
- [Inotify PHP Extension](https://pecl.php.net/package/inotify) `^2.0.0` to use Hot Module Reload (HMR)
- When using PHP 8, inotify version `^3.0.0` is required
- [Inotify PHP Extension](https://pecl.php.net/package/inotify) `^2.0.0` to use Hot Module Reload (HMR)
- When using PHP 8, inotify version `^3.0.0` is required
### Swoole
Expand Down
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"ext-json": "*",
"ext-swoole": "^4.5.10",
"beberlei/assert": "^3.0",
"symfony/config": "^4.3.1|^5.0",
"symfony/console": "^4.3.1|^5.0",
"symfony/dependency-injection": "^4.3.1|^5.0",
"symfony/http-foundation": "^4.3.1|^5.0",
"symfony/http-kernel": "^4.3.1|^5.0",
"symfony/process": "^4.3.1|^5.0"
"symfony/config": "^4.4.0|^5.0",
"symfony/console": "^4.4.0|^5.0",
"symfony/dependency-injection": "^4.4.0|^5.0",
"symfony/http-foundation": "^4.4.0|^5.0",
"symfony/http-kernel": "^4.4.0|^5.0",
"symfony/process": "^4.4.0|^5.0"
},
"require-dev": {
"doctrine/annotations": "^1.6",
Expand All @@ -45,15 +45,15 @@
"phpunit/phpunit": "^9.1.3",
"swoole/ide-helper": "^4.5.10",
"symfony/debug-pack": "^1.0",
"symfony/error-handler": "^4.3.1|^5.0",
"symfony/framework-bundle": "^4.3.1|^5.0",
"symfony/messenger": "^4.3.1|^5.0",
"symfony/monolog-bridge": "^4.3.1|^5.0",
"symfony/error-handler": "^4.4.0|^5.0",
"symfony/framework-bundle": "^4.4.0|^5.0",
"symfony/messenger": "^4.4.0|^5.0",
"symfony/monolog-bridge": "^4.4.0|^5.0",
"symfony/monolog-bundle": "^3.3",
"symfony/profiler-pack": "^1.0",
"symfony/twig-bundle": "^4.3.1|^5.0",
"symfony/var-dumper": "^4.3.1|^5.0",
"symfony/yaml": "^4.3.1|^5.0",
"symfony/twig-bundle": "^4.4.0|^5.0",
"symfony/var-dumper": "^4.4.0|^5.0",
"symfony/yaml": "^4.4.0|^5.0",
"upscale/swoole-blackfire": "^3.0"
},
"suggest": {
Expand Down
26 changes: 13 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions docs/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ swoole:

# additional swoole symfony bundle services
services:
# see: \K911\Swoole\Bridge\Symfony\HttpKernel\DebugHttpKernelRequestHandler
debug_handler: true

# see: \K911\Swoole\Bridge\Symfony\HttpFoundation\TrustAllProxiesRequestHandler
trust_all_proxies_handler: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ public function getConfigTreeBuilder(): TreeBuilder
->children()
->booleanNode('debug_handler')
->defaultNull()
->setDeprecated(
'k911/swoole-bundle',
'0.11',
'The "%node%" option is deprecated. It is no longer needed to provide debug http kernel.'
)
->end()
->booleanNode('trust_all_proxies_handler')
->defaultFalse()
Expand Down
11 changes: 0 additions & 11 deletions src/Bridge/Symfony/Bundle/DependencyInjection/SwooleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use K911\Swoole\Bridge\Symfony\HttpFoundation\RequestFactoryInterface;
use K911\Swoole\Bridge\Symfony\HttpFoundation\Session\SetSessionCookieEventListener;
use K911\Swoole\Bridge\Symfony\HttpFoundation\TrustAllProxiesRequestHandler;
use K911\Swoole\Bridge\Symfony\HttpKernel\DebugHttpKernelRequestHandler;
use K911\Swoole\Bridge\Symfony\Messenger\SwooleServerTaskTransportFactory;
use K911\Swoole\Bridge\Symfony\Messenger\SwooleServerTaskTransportHandler;
use K911\Swoole\Bridge\Upscale\Blackfire\WithProfiler;
Expand Down Expand Up @@ -305,16 +304,6 @@ private function registerHttpServerServices(array $config, ContainerBuilder $con
;
}

if ($config['debug_handler'] || (null === $config['debug_handler'] && $this->isDebug($container))) {
$container->register(DebugHttpKernelRequestHandler::class)
->addArgument(new Reference(DebugHttpKernelRequestHandler::class.'.inner'))
->setAutowired(true)
->setAutoconfigured(true)
->setPublic(false)
->setDecoratedService(RequestHandlerInterface::class, null, -50)
;
}

if ($config['session_cookie_event_listener']) {
$container->register(SetSessionCookieEventListener::class)
->setAutowired(true)
Expand Down
55 changes: 0 additions & 55 deletions src/Bridge/Symfony/HttpKernel/DebugHttpKernelRequestHandler.php

This file was deleted.

Binary file added tests/Fixtures/Symfony/app/public/favicon.ico
Binary file not shown.

0 comments on commit da33c81

Please sign in to comment.