bugGNUstep - Bugs: bug #14523, NSURLHandle caching problem

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #14523: NSURLHandle caching problem

Submitted by:  Sašo Kiselkov <diablos>
Submitted on:  Tue 13 Sep 2005 07:39:31 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sun 23 Oct 2005 12:14:20 PM UTC, comment #2:

I think this is working in CVS ... and does not require any extension to the API ... but perhaps I'm missing something.

Richard Frith-Macdonald <CaS>
Project Member
Tue 13 Sep 2005 08:30:29 PM UTC, comment #1:

Problem fixed. A patched version of NSURLHandle.[hm] is available at http://openspace.adlerka.sk/NSURLHandleFix.tar.gz .

In detail, I've added the method -[NSURLHandle hasUpToDateData] which subclasses should override to do any checks on whether the currently loaded version of the data is up-to-date. They can obtain the date the last fetch has been done by looking at the _loadDate ivar - it's automagically set up by NSURLHandle every time a data load is completed successfuly. (The default implementation of -hasUpToDateData always returns YES.)

When NSURLHandle's data is requested by -resourceData and the data load has been successfuly finished, it first asks itself with -hasUpToDateData whether the current version of the data is really up-to-date. If not, it loads the data resource again. The -availableResourceData doesn't perform any such checks.

The default implementation of -[NSURLHandle always returns YES, i.e. it doesn't do any checking.

GSFileURLHandle overrides -hasUpToDateData and checks the modification date of the file and acts accordingly.

That's it. :-)

Sašo Kiselkov <diablos>
Tue 13 Sep 2005 07:39:31 PM UTC, original submission:

When implementing an app that reads data from a file by using an NSURL I encountered this problem:
- I open a file.
- Edit and save it, close the document.
- Open the document again (without restarting the app), but it contains the same data as if before the edit - what the???

When investigating at lower levels in GNUstep source I found out that NSURLHandle's caching mechanism doesn't query the underlying scheme-specific subclasses (such as GSFileURLHandle) on whether the cached data is up-to-date.

I propose to fix this problem by adding some machinery to NSURLHandle that would allow it to check whether the cached data is still valid. I'll try to work something out in the mean time.

Sašo Kiselkov <diablos>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 3 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sun 23 Oct 2005 12:14:20 PM UTCCaSCategoryNone=>Base/Foundation
  StatusNone=>Fixed
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1