Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
"dev-master": "4.0-dev"
}
}
}
2 changes: 1 addition & 1 deletion src/Bridges/HttpDI/HttpExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getConfigSchema(): Nette\Schema\Schema
'csp' => Expect::arrayOf('array|scalar|null'), // Content-Security-Policy
'cspReportOnly' => Expect::arrayOf('array|scalar|null'), // Content-Security-Policy-Report-Only
'featurePolicy' => Expect::arrayOf('array|scalar|null'), // Feature-Policy
'cookieSecure' => Expect::anyOf(null, true, false, 'auto'), // true|false|auto Whether the cookie is available only through HTTPS
'cookieSecure' => Expect::anyOf(null, true, false, 'auto')->default('auto'), // true|false|auto Whether the cookie is available only through HTTPS
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Http/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getName(): string
*/
public function getSanitizedName(): string
{
return trim(Nette\Utils\Strings::webalize($this->name, '.', false), '.-');
return trim(str_replace('-.', '.', Nette\Utils\Strings::webalize($this->name, '.', false)), '.-');
}


Expand Down
47 changes: 34 additions & 13 deletions src/Http/IResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,9 @@

/**
* HTTP response interface.
* @method self deleteHeader(string $name)
*/
interface IResponse
{
/** @deprecated */
public const PERMANENT = 2116333333;

/** @deprecated */
public const BROWSER = 0;

/** HTTP 1.1 response code */
public const
S100_CONTINUE = 100,
Expand Down Expand Up @@ -147,6 +140,17 @@ interface IResponse
511 => 'Network Authentication Required',
];

/**
* Sets HTTP protocol version.
* @return static
*/
function setProtocolVersion(string $version);

/**
* Returns HTTP protocol version.
*/
function getProtocolVersion(): string;

/**
* Sets HTTP response code.
* @return static
Expand All @@ -158,6 +162,11 @@ function setCode(int $code, string $reason = null);
*/
function getCode(): int;

/**
* Returns HTTP reason phrase.
*/
function getReasonPhrase(): string;

/**
* Sends a HTTP header and replaces a previous one.
* @return static
Expand All @@ -170,6 +179,11 @@ function setHeader(string $name, string $value);
*/
function addHeader(string $name, string $value);

/**
* @return static
*/
function deleteHeader(string $name);

/**
* Sends a Content-type HTTP header.
* @return static
Expand All @@ -187,18 +201,14 @@ function redirect(string $url, int $code = self::S302_FOUND): void;
*/
function setExpiration(?string $expire);

/**
* Checks if headers have been sent.
*/
function isSent(): bool;

/**
* Returns value of an HTTP header.
*/
function getHeader(string $header): ?string;

/**
* Returns a associative array of headers to sent.
* @return string[][]
*/
function getHeaders(): array;

Expand All @@ -207,10 +217,21 @@ function getHeaders(): array;
* @param string|int|\DateTimeInterface $expire time, value 0 means "until the browser is closed"
* @return static
*/
function setCookie(string $name, string $value, $expire, string $path = null, string $domain = null, bool $secure = null, bool $httpOnly = null);
function setCookie(string $name, string $value, $expire, string $path = null, string $domain = null, bool $secure = null, bool $httpOnly = null, string $sameSite = null);

/**
* Deletes a cookie.
*/
function deleteCookie(string $name, string $path = null, string $domain = null, bool $secure = null);

/**
* @param string|\Closure $body
* @return static
*/
function setBody($body);

/**
* @return string|\Closure
*/
function getBody();
}
10 changes: 0 additions & 10 deletions src/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ public function getQuery(string $key = null)
{
if (func_num_args() === 0) {
return $this->url->getQueryParameters();
} elseif (func_num_args() > 1) {
trigger_error(__METHOD__ . '() parameter $default is deprecated, use operator ??', E_USER_DEPRECATED);
}
return $this->url->getQueryParameter($key);
}
Expand All @@ -122,8 +120,6 @@ public function getPost(string $key = null)
{
if (func_num_args() === 0) {
return $this->post;
} elseif (func_num_args() > 1) {
trigger_error(__METHOD__ . '() parameter $default is deprecated, use operator ??', E_USER_DEPRECATED);
}
return $this->post[$key] ?? null;
}
Expand Down Expand Up @@ -154,9 +150,6 @@ public function getFiles(): array
*/
public function getCookie(string $key)
{
if (func_num_args() > 1) {
trigger_error(__METHOD__ . '() parameter $default is deprecated, use operator ??', E_USER_DEPRECATED);
}
return $this->cookies[$key] ?? null;
}

Expand Down Expand Up @@ -197,9 +190,6 @@ public function isMethod(string $method): bool
*/
public function getHeader(string $header): ?string
{
if (func_num_args() > 1) {
trigger_error(__METHOD__ . '() parameter $default is deprecated, use operator ??', E_USER_DEPRECATED);
}
$header = strtolower($header);
return $this->headers[$header] ?? null;
}
Expand Down
Loading