setHeader( 'DAV', ( $version === null ? '1' : $version ) ); } /** * Validates the headers set in this response. * * This method is called by {@link ezcWebdavServer} after the response * object has been created by an {@link ezcWebdavBackend}. It validates all * headers, specific to this response, for existance of required headers * and validity of all headers used. The call of the parent method is * *mandatory* to have common WebDAV and HTTP headers validated, too. * * @return void * * @throws ezcWebdavMissingHeaderException * if a required header is missing. * @throws ezcWebdavInvalidHeaderException * if a header is present, but its content does not validate. */ public function validateHeaders() { if ( isset( $this->headers['DAV'] ) === false ) { throw new ezcWebdavMissingHeaderException( 'DAV' ); } $dav = array_map( 'trim', explode( ',', $this->headers['DAV'] ) ); foreach ( $dav as $number ) { if ( $number !== self::VERSION_ONE && $number !== self::VERSION_TWO && $number !== self::VERSION_ONE_EXTENDED ) { throw new ezcWebdavInvalidHeaderException( 'DAV', $this->headers['DAV'], 'Components must be ezcWebdavOptionsResponse::VERSION_ONE, ezcWebdavOptionsResponse::VERSION_TWO or ezcWebdavOptionsResponse::VERSION_ONE_EXTENDED' ); } } // Unified spaces $this->headers['DAV'] = implode( ', ', $dav ); // Validate common HTTP/WebDAV headers parent::validateHeaders(); } } ?>