Skip to content

curl: avoid styled output with binary output#2774

Closed
JunpeiAnzai wants to merge 1 commit into
curl:masterfrom
JunpeiAnzai:avoid-styled-binary-output
Closed

curl: avoid styled output with binary output#2774
JunpeiAnzai wants to merge 1 commit into
curl:masterfrom
JunpeiAnzai:avoid-styled-binary-output

Conversation

@JunpeiAnzai
Copy link
Copy Markdown

Description

For the purpose of binary output, The curl program should output as is
without styled code.

Observed behaviour

before

Expected behaviour

after

For the purpose of binary output, The curl program should output as is
without styled code.

Reported-by: Jumpei Anzai
Suggested-by: cvmat(Tadashi MATSUO)
@bagder
Copy link
Copy Markdown
Member

bagder commented Jul 22, 2018

Why?

@bagder
Copy link
Copy Markdown
Member

bagder commented Jul 22, 2018

The bold issue #2736 was fixed with #2738 in commit a82372e

@cvmat
Copy link
Copy Markdown

cvmat commented Jul 23, 2018

@bagder @JunpeiAnzai I am sorry that the original problem in hayamiz/twittering-mode#149 may be caused by my code in http://github.com/hayamiz/twittering-mode . I had written a code that implicitly used a pty for communicating with an asynchronously invoked curl.

However, I think that this pull request may improve the behavior of curl. The "problem" mentioned in this request is decoration of headers in the case where options explicitly allows binary body, not the lack of BOLDOFF sequence. The latest version of curl outputs decorated headers even if curl is invoked with the option --output - discussed in #1512. I think that a user may want raw headers when he or she explicitly allows binary body.

@bagder
Copy link
Copy Markdown
Member

bagder commented Aug 1, 2018

The latest version of curl outputs decorated headers even if curl is invoked with the option --output -

Sure, but the header decoration is there because you use --include and send the headers to a terminal. I think the direction of the output with --output - to the terminal is a different action and it feels wrong to tie them together and switch off the bold headers just because of this.

I think that a user may want raw headers when he or she explicitly allows binary body.

Why? Allowing a binary body on the terminal is a way to make sure curl doesn't wrongly prohibit the body because the user knows better that it can be shown fine. It says nothing about the headers in the response!

I think you should rather explicitly disable the header decoration with --no-styled-output if you send them to the terminal but don't want that enabled!

Alternatively, you can pipe the output through cat and thereby "trick" curl to not know it sends the data to terminal:

curl http://example.com --include --output - | cat

@bagder bagder closed this Aug 8, 2018
@lock lock Bot locked as resolved and limited conversation to collaborators Nov 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants