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

Describe the elements of Error_Protocol's three-tuple #460

Merged

Conversation

exarkun
Copy link
Contributor

@exarkun exarkun commented Aug 22, 2023

I was writing automated tests for some error handling cases in library that uses Network.TLS and found it unclear what all of the fields in this tuple (especially the Bool) meant. Here's an attempt at describing them.

@kazu-yamamoto kazu-yamamoto self-requested a review August 23, 2023 00:55
@kazu-yamamoto
Copy link
Collaborator

I agree that this tuple is not well-documented.
What about replacing Bool with AlertLevel?

@exarkun
Copy link
Contributor Author

exarkun commented Aug 23, 2023

I agree that this tuple is not well-documented. What about replacing Bool with AlertLevel?

That sounds reasonable to me. Happy to give it a try and see what happens.

@exarkun
Copy link
Contributor Author

exarkun commented Aug 23, 2023

@kazu-yamamoto I pushed some more changes. I left the new haddock since it still seems more or less appropriate, but let me know what you think.

One thing I noticed while making this change is that there is exactly one use of Error_Protocol with AlertLevel_Warning against over a hundred uses with AlertLevel_Fatal. I wonder if it would make more sense to remove the AlertLevel from the Error_Protocol tuple entirely and replace the single AlertLevel_Warning use with a new TLSError constructor - Error_Warning or something. I haven't studied the implementation closely enough to know whether this is a quite simple change or if it would end up being more involved, though.

@kazu-yamamoto
Copy link
Collaborator

@exarkun I agree with you. Would you introduce Error_Protocol_Warning?
I think the Protocol name is important because this is a protocol level error resulting in sending an alert message.

@exarkun
Copy link
Contributor Author

exarkun commented Aug 25, 2023

@kazu-yamamoto I added Error_Protocol_Warning and made the other necessary changes. I think it's ready for you to have another look. Thanks.

@kazu-yamamoto
Copy link
Collaborator

May I ask one more thing?

| Error_Protocol (String, AlertDescription)

I don't know why a tuple is used here. Would you try the following definition?

| Error_Protocol String AlertDescription

We should check Error_Protocol_Warning, too.

@exarkun
Copy link
Contributor Author

exarkun commented Aug 28, 2023

May I ask one more thing?

| Error_Protocol (String, AlertDescription)

I don't know why a tuple is used here. Would you try the following definition?

| Error_Protocol String AlertDescription

We should check Error_Protocol_Warning, too.

I also don't know why these are tuples. This change seems reasonable (though, uggg, updating all those call sites again...).

@exarkun
Copy link
Contributor Author

exarkun commented Aug 28, 2023

@kazu-yamamoto Pushed those changes (fwiw, I tried retrie for this one and it worked pretty well, doing almost all of the work for me).

@kazu-yamamoto
Copy link
Collaborator

The previous breaking change (#457) effected:

  • http-client-tls
  • http2-tls
  • quic

But this breaking change effects only quic, which I can control.
I'm going to merge this PR.

@kazu-yamamoto kazu-yamamoto merged commit f917442 into haskell-tls:master Aug 29, 2023
@kazu-yamamoto
Copy link
Collaborator

Merged.
Thank you for your contribution!

How soon do you want to have version 1.9.0?
If you can wait, I play around this for about a week and then upload 1.9.0 on Hackage.

@exarkun exarkun deleted the document-error_protocol-field branch August 29, 2023 16:45
@exarkun
Copy link
Contributor Author

exarkun commented Aug 29, 2023

Merged. Thank you for your contribution!

How soon do you want to have version 1.9.0? If you can wait, I play around this for about a week and then upload 1.9.0 on Hackage.

Thanks! I have no problem waiting - this was mostly a good excuse to try contributing a real (if minor) improvement to some project in my stack for the practice and to try to give some small bit back to the ecosystem. Thank you for guiding me through the process.

@kazu-yamamoto
Copy link
Collaborator

As you may know, a new version has been released.

-- elements of the tuple give (freeform text description, structured
-- error description).
| Error_Protocol_Warning String AlertDescription
-- ^ A non-fatal error condition was encountered at a low level at a low
Copy link

Choose a reason for hiding this comment

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

at a low level at a low level.

Probably one low level to much ;)

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

Successfully merging this pull request may close these issues.

None yet

3 participants