-
-
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): fix SMTP body ending detection; better HTTP Multipart parsing
- Loading branch information
Showing
6 changed files
with
126 additions
and
34 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
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