Re: Bug: Polipo always revalidates resources with Content-Length >= CHUNK_SIZE
"Will Manley" <[email protected]>
| Newsgroups | gmane.comp.web.polipo.user |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jan 5, 2012, at 16:15, Will Manley wrote:
> The tests that I added to my branch[1] fail because Polipo seems to try
> to revalidate all it's resources when the size of the resource
> (Content-Length) >= CHUNK_SIZE.
>
> If the cache is flushed to disk between the first and second requests
> polipo will behave correctly and not try to revalidate the resource.
So it turned out to be a bug in `objectHasData`. The function takes a
bytes range as a parameter or from=0 to=-1 if all of the data is to be
fetched. "to" is corrected later in the function to be the expected
length of the data, but before this the index of the last chunk of this
data is calculated (i.e. to % CHUNK_SIZE, e.g. -1 % CHUNK_SIZE == 0).
This is the correct index for data that fits in 1 chunk, but is
incorrect otherwise. This is why this bug would only exhibit when
(Content-Length < CHUNK_SIZE).
This bug would cause the function to then check if the same data was
available on disk which would succeed if it had already been flushed out
of the memory cache.
The fix is on a branch on github. Try:
git pull git://github.com/wmanley/polipo.git
fix-unconditional-revalidation
All the tests in my test branch pass with this patch applied.
Thanks
Will
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox