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

Tests for Rfc2616 parser #1593

Merged
merged 2 commits into from Dec 16, 2017
Merged

Tests for Rfc2616 parser #1593

merged 2 commits into from Dec 16, 2017

Conversation

cquiroz
Copy link
Member

@cquiroz cquiroz commented Dec 14, 2017

This PR starts from a change I want to do removing Registry from MediaRange. To do so I needed to generate MediaRange instances for scalacheck, which led me to create generators for various parts of the http spec previously untested.

This PR contains a test and the generators but there is one that is contentious and I'd like to get your comments

@cquiroz cquiroz added the RFC Design ideas that we'd like to spur discussion label Dec 14, 2017

val genText: Gen[String] = oneOf(nonEmptyListOf(oneOf(allowedText)).map(_.mkString), genLws)

val allowedQDText: List[Char] = allowedText.filterNot(c => c == '"' || c == '\\')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to spec the backslash character \ is allowed but it seems the parser cannot handle one particular case where the Generated QDText ends on \" like e.g.

"_¡1S^¼m¬Á\"
"ìÙ\"

This is certainly a border case and I couldn't figure how to make the parboiled parser handle it properly so I tweaked the generator. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly seems like we should be able to fix the parser. I don't want it to stand in the way of progress, but I'd like to leave a note so we try to fix it.

@cquiroz
Copy link
Member Author

cquiroz commented Dec 15, 2017

I added a comment and a small fix for scala 2.11. It's probably a good idea to review the generators anyway

Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to get in here and rename the implicits according to standard, but this looks like it moves the ball forward.

@cquiroz
Copy link
Member Author

cquiroz commented Dec 15, 2017

Which standard? I could rename them

@rossabaker
Copy link
Member

This is how cats names them. I've been using http4s instead of catsPackageName as a unique-enough prefix.

@cquiroz
Copy link
Member Author

cquiroz commented Dec 15, 2017

I see, I will switch the convention. Looking at the arbitraries you can see there have been many hands involved

@cquiroz
Copy link
Member Author

cquiroz commented Dec 15, 2017

Maybe it's better to do another PR with all arbitraries names fixed in on go. Shall I merge this one to get my another change as a PR?

@rossabaker rossabaker merged commit a3a74ee into http4s:master Dec 16, 2017
@rossabaker
Copy link
Member

Yes. :)

rossabaker added a commit to http4s/http4s-servlet that referenced this pull request Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFC Design ideas that we'd like to spur discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants