Hi Giuseppe, while I agree that your patch makes the code more readable and it is > good to apply it, I don't see how the previous version was broken. What > compiler have you used? >
This occurs when compiling on gcc 4.8.0. The following output ensues: Setting --method (method) to head DEBUG output created by Wget 1.14.43-cf74-dirty on linux-gnu. URI encoding = ‘UTF-8’ --2013-05-05 07:56:19-- http://www.example.com/ Resolving www.example.com (www.example.com)... 192.0.43.10, 2001:500:88:200::10 Caching www.example.com => 192.0.43.10 2001:500:88:200::10 Connecting to www.example.com (www.example.com)|192.0.43.10|:80... connected. Created socket 3. Releasing 0x0000000001271410 (new refcount 1). ---request begin--- EAD / HTTP/1.1 User-Agent: Wget/1.14.43-cf74-dirty (linux-gnu) Accept: */* Host: www.example.com Connection: Keep-Alive See how the request has the first character missing? And since --post-data is also handled internally through this, it breaks all scripts that use wget to send POST headers. While on the topic of compilation issues, the linker flag, D_FORTIFY_SOURCE throws a couple of warnings. Would we be interested in looking into those and sorting them out? > > Good catch! Maybe we should handle --method=HEAD as opt.spider? > That makes sense. I also think some more explicit sanity checks are needed in the code. Like sending data with a HEAD request makes absolutely no sense (does it?).
