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

Improve line folding algorithm #31

Open
emersion opened this issue May 28, 2020 · 4 comments
Open

Improve line folding algorithm #31

emersion opened this issue May 28, 2020 · 4 comments

Comments

@emersion
Copy link
Owner

With #29 we no longer generate broken signatures with FWS where they shouldn't be. However we could still improve our folding algorithm. Given these constraints:

We may want to fix these:

  • We still don't properly fold h= params if they are very long
  • We fold b= params at 75 chars, but we don't need to
@ludusrusso
Copy link
Contributor

I can work on it on the next days! :D
My idea is to write two simple functions, one to fold h and one for b (that we already have).

@emersion
Copy link
Owner Author

Nice!

I think to fold h, it'll probably be simpler to do it before turning the list into a string, ie. in formatTagList:

func formatTagList(l []string) string {

@ludusrusso
Copy link
Contributor

ludusrusso commented May 28, 2020

Nice!

I think to fold h, it'll probably be simpler to do it before turning the list into a string, ie. in formatTagList:

func formatTagList(l []string) string {

Thats right, but I then need to change some piece of code in the middle, I thinks that it would be simpler by just use Strings.split in

func formatHeaderParams(headerFieldName string, params map[string]string) string {

@wjywbs
Copy link

wjywbs commented May 29, 2020

By the way, #30 fixed the h= wrapping as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants