Ejemplo n.º 1
0
 public function build(ContainerBuilder $builder)
 {
     $builder->bind(WebDavMiddleware::class)->marked(new Middleware(1000000));
     $builder->bind(Header\DavHeader::class)->scoped(new RequestScoped())->to(function (HttpRequest $request) {
         return Header\DavHeader::fromString($request->getHeader(Header\DavHeader::getFieldName()), '');
     });
     $builder->bind(Header\DepthHeader::class)->scoped(new RequestScoped())->to(function (HttpRequest $request) {
         return Header\DepthHeader::fromString($request->getHeader(Header\DepthHeader::getFieldName()), '');
     });
     $builder->bind(Header\DestinationHeader::class)->scoped(new RequestScoped())->to(function (HttpRequest $request) {
         return Header\DestinationHeader::fromString($request->getHeader(Header\DestinationHeader::getFieldName()), '');
     });
     $builder->bind(Header\IfHeader::class)->scoped(new RequestScoped())->to(function (HttpRequest $request) {
         return Header\IfHeader::fromString($request->getHeader(Header\IfHeader::getFieldName()), '');
     });
     $builder->bind(Header\LockTokenHeader::class)->scoped(new RequestScoped())->to(function (HttpRequest $request) {
         return Header\LockTokenHeader::fromString($request->getHeader(Header\LockTokenHeader::getFieldName()), '');
     });
     $builder->bind(Header\OverwriteHeader::class)->scoped(new RequestScoped())->to(function (HttpRequest $request) {
         return Header\OverwriteHeader::fromString($request->getHeader(Header\OverwriteHeader::getFieldName()), 'F');
     });
     $builder->bind(Header\TimeoutHeader::class)->scoped(new RequestScoped())->to(function (HttpRequest $request) {
         return Header\TimeoutHeader::fromString($request->getHeader(Header\TimeoutHeader::getFieldName()), 'Infinite');
     });
 }
Ejemplo n.º 2
0
 protected function parseRequest(HttpRequest $request)
 {
     $propfind = $this->parseBody($request);
     try {
         $propfind->setDepth(DepthHeader::fromString($request->getHeader('Depth', 'infinity')));
     } catch (\Exception $e) {
         throw new BadRequestException($e);
     }
     if ($propfind->getDepth()->isDepthInfinity()) {
         throw new PropfindFiniteDepthException();
     }
     return $propfind;
 }