The HttpKernelInterface is a lie (london)

A4b95be2145cc46f891707b6db9dd82d?s=47 Igor Wiedler
September 20, 2013

The HttpKernelInterface is a lie (london)

A4b95be2145cc46f891707b6db9dd82d?s=128

Igor Wiedler

September 20, 2013
Tweet

Transcript

  1. 3.
  2. 7.

    hi!

  3. 8.
  4. 12.
  5. 14.
  6. 15.
  7. 16.
  8. 17.
  9. 19.
  10. 21.
  11. 24.

    find src -name '*.php' | grep -iv tests | cut

    -f2- -d/ | cut -f1 -d\. | awk '{ print length, $0 }' | sort -n | tr / \\ ;
  12. 26.
  13. 27.

    nc

  14. 28.

    /\_/\ / 0 0 \ ====v==== \ W / |

    | _ / ___ \ / / / \ \ | (((-----)))-' / ( ___ \__.=|___E /
  15. 29.
  16. 31.
  17. 32.
  18. 33.

    /etc/xinet.d/<service> service <service> { disable = no socket_type = stream

    protocol = tcp user = <user> wait = no server = /usr/local/bin/<program> }
  19. 34.

    /etc/xinet.d/fortune service fortune { disable = no socket_type = stream

    protocol = tcp user = xinetd wait = no server = /usr/local/bin/fortune }
  20. 37.

    $ nc <host> 7777 ______________________________________ < Eat right, stay fit,

    and die anyway. > -------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
  21. 38.

    /etc/xinet.d/cowsay service cowsay { disable = no socket_type = stream

    protocol = tcp user = xinetd wait = no server = /usr/games/cowsay }
  22. 40.

    $ echo 'moo' | nc <host> 7778 _____ < moo

    > ----- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || ||
  23. 42.

    cgi

  24. 43.

    The Common Gateway Interface (CGI) [22] allows an HTTP [1],

    [4] server and a CGI script to share responsibility for responding to client requests. RFC 3875
  25. 47.

    GET / HTTP/1.1 Host: igor.io Accept: */* REQUEST_METHOD = GET

    PATH_INFO = / HTTP_HOST = igor.io HTTP_ACCEPT = */* SERVER_NAME = igor.io
  26. 49.
  27. 50.
  28. 53.

    • 1997: Java Servlet • 2003: Python WSGI • 2007:

    Ruby Rack • 2009: Perl PSGI • 2011: Symfony2 HttpKernelInterface
  29. 54.
  30. 56.
  31. 60.
  32. 62.
  33. 73.
  34. 79.

    class Logger implements HttpKernelInterface { private $app; private $logger; public

    function __construct(HttpKernelInterface $app, LoggerInterface $logger) { $this->app = $app; $this->logger = $logger; } public function handle(Request $request, ...) { $response = $this->app->handle($request, $type, $catch); $this->log($request, $response); return $response; } private function log(Request $request, Response $response) { ... } }
  35. 84.
  36. 87.

    class Foo implements HttpKernelInterface { private $app; public function __construct(HttpKernelInterface

    $app) { $this->app = $app; } public function handle(Request $request, ...) { $response = $this->app->handle($request, $type, $catch); return $response; } } 1 2 3
  37. 88.

    UrlMap $blog = new Silex\Application(); $blog->get('/', function () { return

    'This is the blog!'; }); $app = new Stack\UrlMap($app, [ '/blog' => $blog, ]);
  38. 90.

    OAuth $app = new Igorw\Stack\OAuth($app, [ 'key' => 'foo', 'secret'

    => 'bar', 'callback_url' => 'http://localhost:8080/auth/verify', 'success_url' => '/', 'failure_url' => '/auth', ]); $app = new Stack\Session($app);
  39. 96.

    • Authentication • Debug toolbar • Injected routes • Signed

    cookies • Asset management • Force SSL • Error handling
  40. 97.

    ( )