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

Providing an empty string to --post-data makes wpull send GET instead of POST requests #454

Open
jodizzle opened this issue May 27, 2020 · 0 comments

Comments

@jodizzle
Copy link

What I wanted: To send a body-less (Content-Length of zero) POST request.

What I expect: wpull with --post-data "" makes POST requests without any data.

What happened: wpull with --post-data "" makes GET requests.

The command or website causes the problem: wpull --post-data "" https://httpbin.org/post

Operating system: Ubuntu 16.04.4 x64

Python version: 3.5.2

Wpull version: 2.0.3 (specifically, the current develop branch HEAD)

Log/Output:

INFO Fetching ‘https://httpbin.org/post’.
  100.0% [=========================] 178.0 B 0:00:00 -- B/s
INFO Fetched ‘https://httpbin.org/post’: 405 METHOD NOT ALLOWED. Length: 178 [text/html].
INFO FINISHED.
INFO Duration: 0:00:00. Speed: -- B/s.
INFO Downloaded: 0 files, 0.0 B.

The log doesn't directly show it, but writing WARC request records verifies that the request method being used is GET.

For comparison, here's the result of wget --post-data "" https://httpbin.org/post:

Resolving httpbin.org (httpbin.org)... 52.202.132.122, 34.198.151.234
Connecting to httpbin.org (httpbin.org)|52.202.132.122|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 454 [application/json]
Saving to: ‘post’

I'm pretty sure that this function is the culprit:

if args.post_data:

Note that bool("") is False.

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

1 participant