You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The RFCs mention that PRECIS profiles may further restrict valid characters beyond what is specified in the underlying string class (RFC 8264 §6.2):
An application protocol that uses a profile MAY specify particular
code points that are not allowed in relevant slots within that
application protocol, above and beyond those excluded by the string
class or profile.
Currently this has to be done outside of the precis package, eg. by scanning the string for invalid characters after applying the profile, or by creating a new profile which matches one of the internally defined ones and adding a Disallow rule.
To make this easier and less fragile, I would like to add a new profile constructor which either specifically sets the disallow option, or a more generic constructor that lets you build a profile by overriding options on an existing profile. I'm leaning towards the first one to avoid profile proliferation (we probably don't want to encourage authors to make up their own profiles if possible, the existing ones are generally preferable):
// NewRestrictedProfile creates a new PRECIS profile based on an existing// profile but with an additional set of runes disallowed.// If the existing profile already had the Disallow option set, the new rule// overrides the parents rule.funcNewRestrictedProfile(parent*Profile, disallowed runes.Set) *Profile { /* … */ }
// NewProfile creates a new PRECIS profile based on an existing profile.// Any options provided override options from the parent profile.funcNewProfile(parent*Profile, opts...Option) *Profile { /* … */ }
I'll go ahead and make a CL then and ping you both on it. If it turns out that this isn't something MPVL wants then I can do the other one or abandon the CL.
This is a followup to CL 113816. That CL added identical new code to
enforce10.0.0_test.go and enforce9.0.0_test.go, but didn't import new
packages in the latter file. This CL fixes that. As a result, package
tests now pass in Go 1.9.
Updates golang/go#24885.
Change-Id: I0286d873b7f3239bce1a151570c4f9c7ac0219c1
Reviewed-on: https://go-review.googlesource.com/121359
Reviewed-by: Sam Whited <sam@samwhited.com>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
The RFCs mention that PRECIS profiles may further restrict valid characters beyond what is specified in the underlying string class (RFC 8264 §6.2):
Currently this has to be done outside of the
precis
package, eg. by scanning the string for invalid characters after applying the profile, or by creating a new profile which matches one of the internally defined ones and adding aDisallow
rule.To make this easier and less fragile, I would like to add a new profile constructor which either specifically sets the disallow option, or a more generic constructor that lets you build a profile by overriding options on an existing profile. I'm leaning towards the first one to avoid profile proliferation (we probably don't want to encourage authors to make up their own profiles if possible, the existing ones are generally preferable):
For example:
/cc @mpvl, @nigeltao
The text was updated successfully, but these errors were encountered: