Archived
1
0

Merge pull request #177 from cathugger/master

srnd: saner default max message size
This commit is contained in:
Jeff 2019-04-06 15:13:41 -04:00 committed by GitHub
commit afb98efb2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,8 +26,17 @@ import (
var ErrOversizedMessage = errors.New("oversized message") var ErrOversizedMessage = errors.New("oversized message")
// ~ 10 MB unbased64'd // (cathugger)
const DefaultMaxMessageSize = 1024 * 1024 * 10 // my test showed that 8MiB of attachments split in 5 parts
// plus some text produce something close to typhical big message
// resulted in 11483923 bytes.
// that's consistent with rough size calculation mentioned in
// <https://en.wikipedia.org/wiki/Base64#MIME>
// ((origlen * 1.37) + 814)
// which resulted in 11493206 bytes for 8MiB of data.
// previous default of 10MiB (10485760) was too low in practice.
// use 11MiB (11534336) to leave some space for longer than usual texts.
const DefaultMaxMessageSize = 11 * 1024 * 1024
// HARD max message size // HARD max message size
const MaxMessageSize = 1024 * 1024 * 1024 const MaxMessageSize = 1024 * 1024 * 1024