Are the parameters for URLConnection.SendingProgressed named sanely?

The parameters are BytesSent and BytesLeft. The documentation describes them as you’d expect: the bytes sent and the bytes left to send. So it would stand to reason that the total number of bytes would be BytesSent + BytesLeft.

In my testing, bytesLeft really should be named totalBytes:

12:25:33 AM : bytesSent = 2.00 MiB; bytesLeft = 18.97 MiB
12:25:34 AM : bytesSent = 3.00 MiB; bytesLeft = 18.97 MiB
12:25:35 AM : bytesSent = 4.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 5.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 6.00 MiB; bytesLeft = 18.97 MiB
12:25:36 AM : bytesSent = 7.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 8.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 9.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 10.00 MiB; bytesLeft = 18.97 MiB
12:25:37 AM : bytesSent = 11.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 12.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 13.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 14.00 MiB; bytesLeft = 18.97 MiB
12:25:38 AM : bytesSent = 15.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 16.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 17.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 18.00 MiB; bytesLeft = 18.97 MiB
              bytesSent = 18.97 MiB; bytesLeft = 18.97 MiB

So bug report time: <https://xojo.com/issue/63950>

2 Likes