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

Should parse fail when a parameter has non-decodable field? #14

Closed
alexstrat opened this issue Mar 24, 2017 · 5 comments
Closed

Should parse fail when a parameter has non-decodable field? #14

alexstrat opened this issue Mar 24, 2017 · 5 comments
Assignees
Labels

Comments

@alexstrat
Copy link
Contributor

alexstrat commented Mar 24, 2017

Related to #13

Should parse fail when content-disposition header contains a parameter which field is not decodable ?
Today it fails. Shouldn't it only ignore the parameter and move on ?

  • what specifically would be considered a recoverable parse failure vs an unrecoverable failure ?
  • what should be returned when various different recoverable failures occur ?
  • how can we keep intact a strict mode for any users who would want a complete failure ?
  • what, if any, guidance does the RFC have on this ?
@dougwilson
Copy link
Contributor

Hi @alexstrat would you be willing to fill in your answers? My answers to those questions have already been codified into this module; they were more questions I was hoping you could answer to help me understand the request you're making.

@alexstrat
Copy link
Contributor Author

Ah sorry, did not get the extent of your questions. As far as I was concerned, I only used the library to make the difference between a download (attachment) and regular web-pages: I think it's a pretty limited use-case and is not representative of what one can extensively expect from this module.

Though:

what specifically would be considered a recoverable parse failure vs an unrecoverable failure ?

For my specific use case, I was only interested in the type. I don't care about the parameters, if they are stripped away, I would not have cared.

what should be returned when various different recoverable failures occur ?

The result of parse, only. Can probably have an option to let parse returns the result with the parse errors.

how can we keep intact a strict mode for any users who would want a complete failure ?

An option of parse I guess.

what, if any, guidance does the RFC have on this?

No idea. While it can be a good enlightenment, I don't think parse should strictly follow the RFC. I'd rather expect from it to be able to parse the best it can a Content Disposition header, whatever this one is RFC-compliant or not.

@dougwilson
Copy link
Contributor

Hi @alexstrat after reading you responses, I'm not sure you really understanding the workings of the header to really give answers, no offense :) Especially if you are suggesting to not even follow the RFC. If we don't follow it, what are we following? If you can provide a spec, perhaps some complete ABNF grammar to how the parse should function in this non-strict mode, that would work, but from what your use-case is, it seems simpler for you to just header.split(';')[0].trim()

@dougwilson dougwilson self-assigned this Mar 28, 2017
@alexstrat
Copy link
Contributor Author

Oh I'm sorry to see you disappointed by my answers :(

I think the question is still open though.

@dougwilson
Copy link
Contributor

Sure, but there isn't really a description to program against. For example, a regular expression either returns a result or not, so "The result of parse, only" would always be no result on a failure, probably not what you're looking for. If we don't follow the RFC, what are we following? If you can provide a spec, perhaps some complete ABNF grammar to how the parse should function in this non-strict mode, that would work.

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

No branches or pull requests

2 participants