fix:更新已知bug,优化代码

This commit is contained in:
Ying
2022-11-28 19:11:12 +08:00
parent f6aee95cfc
commit 9445b206a2
1378 changed files with 53759 additions and 20789 deletions

View File

@@ -191,7 +191,6 @@ final class AppendStream implements StreamInterface
$progressToNext = false;
while ($remaining > 0) {
// Progress to the next stream if needed.
if ($progressToNext || $this->streams[$this->current]->eof()) {
$progressToNext = false;

View File

@@ -62,7 +62,7 @@ final class Header
}
/**
* Splits a HTTP header defined to contain comma-separated list into
* Splits a HTTP header defined to contain a comma-separated list into
* each individual value. Empty values will be removed.
*
* Example headers include 'accept', 'cache-control' and 'if-none-match'.

View File

@@ -67,6 +67,7 @@ final class Message
return null;
}
$body->rewind();
$summary = $body->read($truncateAt);
$body->rewind();

View File

@@ -34,7 +34,7 @@ final class MultipartStream implements StreamInterface
*/
public function __construct(array $elements = [], string $boundary = null)
{
$this->boundary = $boundary ?: sha1(uniqid('', true));
$this->boundary = $boundary ?: bin2hex(random_bytes(20));
$this->stream = $this->createStream($elements);
}

View File

@@ -172,10 +172,14 @@ class Uri implements UriInterface, \JsonSerializable
$uri .= $scheme . ':';
}
if ($authority != ''|| $scheme === 'file') {
if ($authority != '' || $scheme === 'file') {
$uri .= '//' . $authority;
}
if ($authority != '' && $path != '' && $path[0] != '/') {
$path = '/' . $path;
}
$uri .= $path;
if ($query != '') {
@@ -731,8 +735,6 @@ class Uri implements UriInterface, \JsonSerializable
if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) {
throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon');
}
} elseif (isset($this->path[0]) && $this->path[0] !== '/') {
throw new MalformedUriException('The path of a URI with an authority must start with a slash "/" or be empty');
}
}
}