Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Severe file size limitation and (obsolete) folded headers #26

Open
ghaecker opened this issue Mar 8, 2021 · 1 comment
Open

Severe file size limitation and (obsolete) folded headers #26

ghaecker opened this issue Mar 8, 2021 · 1 comment

Comments

@ghaecker
Copy link

ghaecker commented Mar 8, 2021

Thank you for your work on this library.

Are you open to a pull request to address a couple of issues I've found?

File Size Limitation

This library is being tested at work for receiving large file transfers from a business partner. Some of the files are nearly 50M. Everything works fine on small files. In my set of 24 test files, the largest successful transfer with the unmodified library was 174K. The next size up is 545K. It failed, as did all the other larger files.

I've identified the cause for the failure in 2 key methods: Utils::parseMessage (called by MimePart::fromString) and MimePart::setBody. In both cases, the culprit seems to be an inability of preg_match and preg_split to handle large subject arguments. They silently fail to return matches that succeed with the same patterns used with smaller strings.

I've rewritten both methods using strpos() to solve this limitation. It succeeds now with a 46M test file.

Obsolete Header Folding

AS2 messages from our business partner at work arrive with long header values folded to the next line with a leading horizontal tab. Even though they're POSTing via HTTP 1.1 and shouldn't be using obs-fold we still have to preserve them, because they are in the decrypted content and are included in MIC calculation.

I have an ugly kludge in place now in CryptoHelper, but I'm working on a more elegant solution in parseMessage.

Anyway, I appreciate the work you've done. It's been helpful. I'd like to contribute some of what I've found and solved if you're open to it.

--Glenn

@tiamo
Copy link
Owner

tiamo commented Mar 16, 2021

Hi @ghaecker, thanks for your interest in my library!
Yes of course I am open to pull requests.

@robsonala robsonala mentioned this issue Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants