maximum time spent in while loop ?

simkard:
EDIT2 : ERRATUM !!! I think the problem is linked to the SD library.
-> I removed the timeout on my function and it continues to end at the same filesize transmitted.

My function actually looks this code :

while (dataFile.available()){
   TEMP_SD_READ_BYTE = dataFile.read();
   HTTP_CLIENT.print(TEMP_SD_READ_BYTE);
}

The while loop ends systematicaly and respectively on the same file size for each file i try to download :
a GIF file : 12980 bytes
a JPG file : 20304 bytes

The speed of the connexion is ~5 ko/s.

I'm wondering if the command "dataFile.available()" is not running too fast and not permitting the result to update itself and becoming, at least, more than 1.

EDIT : i tried to add a "delay(1);" at the end, before the while loop ... loops, and then, i have to exact same problem (except that the result takes longer to obtain).
-> I'm definitely thinking there must be some kind of problem with the SD library.