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

Diagnostic code matching does not seem to be right #22

Open
rklec opened this issue Sep 25, 2024 · 1 comment
Open

Diagnostic code matching does not seem to be right #22

rklec opened this issue Sep 25, 2024 · 1 comment

Comments

@rklec
Copy link
Contributor

rklec commented Sep 25, 2024

Take this diagnostic code in a mail:

Diagnostic-Code: smtp; 550 5.1.1 <[email protected]> User doesn't
    exist: [email protected] 

As per it's RegEx defined in the source.

["Diagnostic-Code"] = R(@"(.+);\s*([0-9\-\.]+)?\s*(.*)"),

https://regex101.com/r/pKmRdj/1

This results in two groups being matched and then also listed:

Here the relevant sepc part: https://www.rfc-editor.org/rfc/rfc3464#section-2.3.6

The diagnostic-type is `smtp´ in this case, but could be something different - it is just skipped for some reason? (Note I also don't get what valöues it should contain it talks about some IANA specification in https://www.rfc-editor.org/rfc/rfc3464#page-32 and https://www.rfc-editor.org/rfc/rfc3464#section-2.1.2, but well maybe it also doe snot matter.)

As per spec, then a semicolon follows and some arbitrary text:

diagnostic-code-field = "Diagnostic-Code" ":" diagnostic-type ";" *text

So I don't quite see the sense, why the regex splits it up again?
In my case, the status is again reported and I am not sure what 550 is supposed to mean. In any case, it's no new type?

So maybe just output the whole thing as a string instead? The parsing seems to make no sense?
Or do I miss some spec here that clearly defines that there are numbers in there?

@rklec
Copy link
Contributor Author

rklec commented Sep 25, 2024

Okay the -typethings are usual stuff in the spec, maybe it is not wrong. But is the value dns. Apparently it is always dns: https://www.rfc-editor.org/rfc/rfc3461#section-9.3 Likewise the smtp for Diagnostic code: https://www.rfc-editor.org/rfc/rfc3461#section-9.2

So maybe splitting that away is okay, but anyway the part afterwards is strange to me...

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

No branches or pull requests

1 participant