bug #37581 [Mime] Fix compat with HTTP requests (fabpot)
This PR was merged into the 4.4 branch.
Discussion
----------
[Mime] Fix compat with HTTP requests
| Q | A
| ------------- | ---
| Branch? | 4.4 <!-- see below -->
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix #37500, Fix #36738, Fix #35443
| License | MIT
| Doc PR | n/a
Commits
-------
52e7d7cf17
[Mime] Fix compat with HTTP requests
This commit is contained in:
commit
f617380af5
@ -158,7 +158,8 @@ final class ParameterizedHeader extends UnstructuredHeader
|
|||||||
*/
|
*/
|
||||||
private function getEndOfParameterValue(string $value, bool $encoded = false, bool $firstLine = false): string
|
private function getEndOfParameterValue(string $value, bool $encoded = false, bool $firstLine = false): string
|
||||||
{
|
{
|
||||||
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
|
$forceHttpQuoting = 'content-disposition' === strtolower($this->getName()) && 'form-data' === $this->getValue();
|
||||||
|
if ($forceHttpQuoting || !preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
|
||||||
$value = '"'.$value.'"';
|
$value = '"'.$value.'"';
|
||||||
}
|
}
|
||||||
$prepend = '=';
|
$prepend = '=';
|
||||||
|
@ -129,7 +129,7 @@ class TextPart extends AbstractPart
|
|||||||
if ($this->charset) {
|
if ($this->charset) {
|
||||||
$headers->setHeaderParameter('Content-Type', 'charset', $this->charset);
|
$headers->setHeaderParameter('Content-Type', 'charset', $this->charset);
|
||||||
}
|
}
|
||||||
if ($this->name) {
|
if ($this->name && 'form-data' !== $this->disposition) {
|
||||||
$headers->setHeaderParameter('Content-Type', 'name', $this->name);
|
$headers->setHeaderParameter('Content-Type', 'name', $this->name);
|
||||||
}
|
}
|
||||||
$headers->setHeaderBody('Text', 'Content-Transfer-Encoding', $this->encoding);
|
$headers->setHeaderBody('Text', 'Content-Transfer-Encoding', $this->encoding);
|
||||||
|
Reference in New Issue
Block a user