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

Trim trailing empty lines from CLI output #1547

Open
1 task done
olatoft opened this issue Dec 21, 2023 · 1 comment
Open
1 task done

Trim trailing empty lines from CLI output #1547

olatoft opened this issue Dec 21, 2023 · 1 comment
Labels
enhancement New feature or enhancement new Needs triage. Comments are welcome!

Comments

@olatoft
Copy link

olatoft commented Dec 21, 2023

Checklist

  • I've searched for similar feature requests.

Enhancement request

The output from the CLI seems to always include 2 trailing empty lines. Could they be removed?

Example command: $ https google.com

Current output:

HTTP/1.1 301 Moved Permanently
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control: private, max-age=2592000
Content-Length: 220
Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-qWBSXxuQK80KB3NcDHBMJw' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
Content-Type: text/html; charset=UTF-8
Date: Thu, 21 Dec 2023 11:01:33 GMT
Expires: Thu, 21 Dec 2023 11:01:33 GMT
Location: https://www.google.com/
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server: gws
Set-Cookie: CONSENT=PENDING+017; expires=Sat, 20-Dec-2025 11:01:33 GMT; path=/; domain=.google.com; Secure
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>


The output I would like:

HTTP/1.1 301 Moved Permanently
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Cache-Control: private, max-age=2592000
Content-Length: 220
Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-qWBSXxuQK80KB3NcDHBMJw' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
Content-Type: text/html; charset=UTF-8
Date: Thu, 21 Dec 2023 11:01:33 GMT
Expires: Thu, 21 Dec 2023 11:01:33 GMT
Location: https://www.google.com/
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server: gws
Set-Cookie: CONSENT=PENDING+017; expires=Sat, 20-Dec-2025 11:01:33 GMT; path=/; domain=.google.com; Secure
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 0

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>

So exactly the same, and still with an empty line for padding between sections like headers and body, but without the 2 trailing empty lines.


Problem it solves

Would give a shorter output. This means there would be a shorter distance to scroll up to some output, and in some cases there would be no need to scroll at all, since more actual output could fit in the window.


Additional information, screenshots, or code examples

Version: 3.2.1
OS: Ubuntu 23.10

@olatoft olatoft added enhancement New feature or enhancement new Needs triage. Comments are welcome! labels Dec 21, 2023
@vivekthedev
Copy link

MESSAGE_SEPARATOR = '\n\n'
MESSAGE_SEPARATOR_BYTES = MESSAGE_SEPARATOR.encode()

These lines append two newlines at the end of the output. I also thinks that it should append only a single newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement new Needs triage. Comments are welcome!
Projects
None yet
Development

No branches or pull requests

2 participants