Am Thursday 07 March 2013 schrieb Darshit Shah:
> Okay, these are certain points that do not come instantly to me.
> However, I never intended to break these. The above functionality would
> remain for backward compatibility with old scripts.
> I am simply debating on how to implement this as a new feature.

So, wget just needs one new option --method=<DELETE|...>.
It replaces POST method by DELETE in the request.
That is, --method comes (or maybe not, see below) together with either --post-
data or --post-file.

Regarding the one option to aggregate --post-file and --post-data, I agree 
with the others: Wget must know (and not guess) if the user addresses a file 
or data. Everything else could cause havoc.


BTW:
How can Wget create a POST without any data (without Content-Type and Content-
Length) ? Curl can...

"curl --request DELETE 'http://localhost:8000/xxx'" sends:
POST /xxx HTTP/1.1
User-Agent: curl/7.29.0
Host: localhost:8000
Accept: */*


There is another Wget issue: If the file given by --post-file does not exist, 
wget still sends a request... that could cause havoc and IMHO should be fixed.
At least with --method=DELETE it is definitely dangerous.

$ wget --post-file xxxxxx 'http://localhost:8000/xxx'
--2013-03-07 09:30:02--  http://localhost:8000/xxx
POST data file 'xxxxxx' missing: No such file or directory
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response...

resulting request:
POST /xxx HTTP/1.1
User-Agent: Wget/1.14 (linux-gnu)
Accept: */*
Host: localhost:8000
Connection: Keep-Alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 0


OT (I just see it): Why does Wget send 'Connection: Keep-Alive' here ?
It is not needed and causes unecessary impact on the server...


Regards, Tim

Reply via email to