View Issue Details

IDProjectCategoryView StatusLast Update
0005724Talertwisterpublic2019-12-20 19:12
ReporterMarcello Stanisci Assigned ToMarcello Stanisci  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Versiongit (master) 
Target Version0.6Fixed in Version0.6 
Summary0005724: code repetition and conflicting parameters.
DescriptionThe Twister has some code repetition where both the POST and the PUT cases set the CURLOPT_INFILESIZE option. And more, this option sounds like conflicting -- or doing "the same thing" -- as CURLOPT_POSTFIELDSIZE.

We should either not repeat the code, or cut entirely off the CURLOPT_INFILESIZE paths.
TagsNo tags attached.

Activities

Marcello Stanisci

2019-06-03 20:27

reporter   ~0014502

As per manpage, CURLOPT_POSTFIELDSIZE should be used when the payload size should
NOT be calculated by libcurl; for example, when binary files are being sent. That's due to the
fact that libcurl uses strlen() to calculate that size.

Marcello Stanisci

2019-06-03 20:33

reporter   ~0014503

CURLOPT_INFILESIZE, OTOH, sounds like to be used when uploading *files*, that we also never do with the Twister.

So in short, the two options look not important for the Twister.

Agree?

Marcello Stanisci

2019-06-03 21:17

reporter   ~0014504

Last edited: 2019-06-03 21:22

Well, testing confirms that POSTs want CURLOPT_POSTFIELDSIZE and PUTs want CURLOPT_INFILESIZE.

The real optimization was to set all the options (including read/write callbacks) but the method on the easy handle *before* even checking which method we are going to perform, and set the method as a last step. This is not breaking, since if a method doesn't need a callback/option, it will ignore it.

The gain is that all the common options set by the *three* methods (GET/POST/PUT) are mentioned in *one* place in the code, instead of three.

Tested against the Twister testcase itself, and on exchange's and merchant's twisted tests.

Issue History

Date Modified Username Field Change
2019-05-15 16:58 Marcello Stanisci New Issue
2019-05-15 16:58 Marcello Stanisci Status new => assigned
2019-05-15 16:58 Marcello Stanisci Assigned To => Marcello Stanisci
2019-06-03 20:27 Marcello Stanisci Note Added: 0014502
2019-06-03 20:33 Marcello Stanisci Note Added: 0014503
2019-06-03 21:17 Marcello Stanisci Note Added: 0014504
2019-06-03 21:18 Marcello Stanisci Note Edited: 0014504
2019-06-03 21:18 Marcello Stanisci Note Edited: 0014504
2019-06-03 21:22 Marcello Stanisci Note Edited: 0014504
2019-06-03 21:22 Marcello Stanisci Note Edited: 0014504
2019-06-03 22:16 Marcello Stanisci Status assigned => resolved
2019-06-03 22:16 Marcello Stanisci Resolution open => fixed
2019-06-05 21:28 Christian Grothoff Product Version => git (master)
2019-06-05 21:28 Christian Grothoff Fixed in Version => 0.6
2019-06-05 21:28 Christian Grothoff Target Version => 0.6
2019-12-20 19:12 Christian Grothoff Status resolved => closed