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

Some --verbose text printed to stdout #142

Open
mielliott opened this issue Mar 3, 2022 · 2 comments
Open

Some --verbose text printed to stdout #142

mielliott opened this issue Mar 3, 2022 · 2 comments

Comments

@mielliott
Copy link

Here's the output for sending a request to google.com:

$ awscurl http://google.com 2> /dev/null
<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="http://www.google.com/">here</A>.
</BODY></HTML>

Then add the verbose flag but suppress stderr:

$ awscurl -v http://google.com 2> /dev/null
{'Location': 'http://www.google.com/', 'Content-Type': 'text/html; charset=UTF-8', 'Date': 'Thu, 03 Mar 2022 15:13:27 GMT', 'Expires': 'Sat, 02 Apr 2022 15:13:27 GMT', 'Cache-Control': 'public, max-age=2592000', 'Server': 'gws', 'Content-Length': '219', 'X-XSS-Protection': '0', 'X-Frame-Options': 'SAMEORIGIN'}

<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="http://www.google.com/">here</A>.
</BODY></HTML>

Looks like the response headers are being printed to stdout instead of stderr (where all the other verbose text is sent).

PS - thanks for this tool! As you might be aware, new versions of curl add an --aws-sig4 option to handle signing for AWS requests, but I've been unable to get it working for some specific API calls. awscurl has been working much more consistently :)

@mielliott
Copy link
Author

mielliott commented Mar 3, 2022

Ah, I see:

awscurl/awscurl/awscurl.py

Lines 511 to 512 in ea2a9b1

if args.include or IS_VERBOSE:
print(response.headers, end='\n\n')

This is different from curl, where -i and -v do not overlap: -i prints response headers to stdout, whereas -v prints response headers (and everything else) to stderr. This separation can be very useful

@okigan
Copy link
Owner

okigan commented Mar 3, 2022 via email

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

2 participants