-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(smtp): better HTTP Multipart parsing; fix SMTP body ending detection
- Loading branch information
Showing
4 changed files
with
106 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Buggregator\Trap\Traffic\Parser; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
enum MultipartType: string | ||
{ | ||
case Mixed = 'mixed'; | ||
case Alternative = 'alternative'; | ||
case Digest = 'digest'; | ||
case Parallel = 'parallel'; | ||
case FormData = 'form-data'; | ||
case Report = 'report'; | ||
case Signed = 'signed'; | ||
case Encrypted = 'encrypted'; | ||
case Related = 'related'; | ||
case Other = 'other'; | ||
|
||
public static function fromHeaderLine(string $headerLine): self | ||
{ | ||
$type = \explode(';', $headerLine, 2)[0]; | ||
return match ($type) { | ||
'multipart/mixed' => self::Mixed, | ||
'multipart/alternative' => self::Alternative, | ||
'multipart/digest' => self::Digest, | ||
'multipart/parallel' => self::Parallel, | ||
'multipart/form-data' => self::FormData, | ||
'multipart/report' => self::Report, | ||
'multipart/signed' => self::Signed, | ||
'multipart/encrypted' => self::Encrypted, | ||
'multipart/related' => self::Related, | ||
default => self::Other, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters