rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: mWaltari on March 26, 2007, 06:14:37 PM

Title: Negative File size...
Post by: mWaltari on March 26, 2007, 06:14:37 PM
Hello,

I have situation where coming file is marked :

1 941 903 702 / -1 206 321 567 received .. -16:-19:-51 (Time left)

Maybe overflow of some kind???

-Tommi Prami-

[attachment deleted by admin]
Title: Re: Negative File size...
Post by: rejetto on March 27, 2007, 01:38:45 AM
hi tommi
i currently use 64bit for that thing, so it should never overflow (but maybe it does somewhere in operations).
can you tell me the HFS version your using?
Title: Re: Negative File size...
Post by: mWaltari on March 27, 2007, 04:18:53 PM
hi tommi
i currently use 64bit for that thing, so it should never overflow (but maybe it does somewhere in operations).
can you tell me the HFS version your using?

I am using build 088

The it should not Overflow, on real world files :)

Person who send me those files, thought that it might be related that he send two 1gb+ files simultaneously. Just an hunch...

-Tommi-
Title: Re: Negative File size...
Post by: rejetto on March 27, 2007, 08:49:37 PM
the time left is negative because of the negative total, for sure.

here is where i get that value
Code: [Select]
  try post.length:=strToInt64(getHeader('Content-Length'))
  except end;

strToInt64 is a standard delphi function.
as you can see (google tells me you are a programmer), the bug is probably in the browser, furnishing a negative value in "content-length".

i could put a workaround: if a negative value is read, add 2GB.
what do you think of it?
Title: Re: Negative File size...
Post by: rejetto on March 27, 2007, 09:08:36 PM
actually, this is the workaround i just added
Code: [Select]
    if post.length < 0 then inc(post.length, int64(2) shl 31);
Title: Re: Negative File size...
Post by: mWaltari on March 28, 2007, 04:17:04 PM
That might do...

Do you use some Socket component(s) like Indy?? or raw sockets "by hand" :)

-TP-
Title: Re: Negative File size...
Post by: rejetto on March 29, 2007, 12:56:11 AM
i use ICS,
very different from indy because it uses an asynchronous paradigm.