[Bug-wget] [bug #56808] wget uses HEAD method when both --spider and --post-data options are used

2019-08-26 Thread Darshit Shah
Follow-up Comment #2, bug #56808 (project wget):

`--post-data` works by setting `opt.method` and `opt.body_data` while
`--spider` works by setting `opt.method`, albeit indirectly.

Now, I believe that it makes absolutely no sense to set both of those in
contradicting ways. Especially with something like `POST` or `PUT` which
requires a Request body. Since a request body is not allowed with a HEAD
request.

My suggestion here would be to add a check that prevents _any_ change to
`opt.method` if `--spider` is also passed.

This prevents not only `--post-data`, but also `--method` from setting
something funny that makes no sense.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[Bug-wget] [bug #56808] wget uses HEAD method when both --spider and --post-data options are used

2019-08-26 Thread Tim Ruehsen
Follow-up Comment #1, bug #56808 (project wget):

You are right. The combination of both options doesn't make much sense.

Using a POST request with --spider seems to be dangerous as it leads to
unexpected data / state on the server side. So this i not an option.

Silently doing a GET request is also not what someone would expect.

But not allowing the combination removes some degree of user's freedom of
choice. I am split.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[Bug-wget] [bug #56808] wget uses HEAD method when both --spider and --post-data options are used

2019-08-26 Thread anonymous
URL:
  

 Summary: wget uses HEAD method when both --spider and
--post-data options are used
 Project: GNU Wget
Submitted by: None
Submitted on: Mon 26 Aug 2019 10:27:59 AM UTC
Category: Program Logic
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Privacy: Public
 Assigned to: None
 Originator Name: 
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Release: 1.19.4
Operating System: GNU/Linux
 Reproducibility: Every Time
   Fixed Release: None
 Planned Release: None
  Regression: None
   Work Required: None
  Patch Included: No

___

Details:

HEAD request should return the same result as of GET request, except that the
response body is empty.

https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

So if both --spider and --post-data options are used, I think wget should use
POST method. If wget sends HEAD request, then the response header would be
that of GET request, not POST request.

Or perhaps it should be forbidden to use the two options at the same time, as
is the case of --method and --post-data.

I'm not sure if this is a bug or a feature. Please ignore this if you think
this is not a bug. Who would use that two options at the same time for normal
use?

Thanks.





___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/