Closed slaff closed 7 years ago
@igrr How about merging this PR?
Apologies, this went under my radar. I'll check this first thing tomorrow...
@slaff Do you recall which server you have tested this implementation of max_fragment_length extension against? I am testing against GnuTLS and it seems to disagree on the formatting of the extension data. It seems that the extension data is one byte, with values 1/2/3/4 corresponding to 512/1024/2048/4096 fragment sizes. This also matches the wording of the RFC.
See e.g. https://gitlab.com/gnutls/gnutls/blob/master/lib/ext/max_record.c#L154-155.
This also matches the wording of the RFC.
@igrr I might have misread the RFC https://tools.ietf.org/html/rfc6066#page-8. And I am a bit confused because I cannot find the sentence saying that the value should be one byte. But if that is the case I can submit a PR for it.
The presentation is explained in the parent RFC, https://tools.ietf.org/html/rfc5246#section-4.5, i.e. An enumerated occupies as much space in the byte stream as would its maximal defined ordinal value.
@igrr You are right. Thanks for pointing that out. The following PR #55 should fix this.
Refactored the code to support more SSL extensions in the future.