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

cli: convert unix line-endings before parsing request #72

Merged
merged 2 commits into from
Oct 25, 2016
Merged

Conversation

olorin
Copy link
Contributor

@olorin olorin commented Oct 25, 2016

Just a convenience - it's difficult to manually construct valid HTTP requests using the usual UNIX tools without passing it through unix2dos or similar first. Add an option to the CLI so we don't have to do that.

Fixes #70.

! @charleso

(will follow up a more curl-friendly interface in #71)

lineEndingsP = flag CRLF LF $
short 'u'
<> long "unix-line-endings"
<> help "Convert UNIX line-endings into CRLF in the provided HTTP request."
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose it would be dodgy to try and detect the line endings rather than manually specifying it this way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so. The spec for the CLI was that it accepts a valid HTTP request on stdin and spits out a valid authenticated request on stdout; silently munging an invalid HTTP request (LF line endings) to make it valid without being told seems a bit broken IMO.

@charleso
Copy link
Contributor

👍

@olorin olorin merged commit 894c78f into master Oct 25, 2016
@olorin olorin deleted the topic/crlf branch October 25, 2016 23:41
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.

2 participants