Kitz Forum

Chat => Tech Chat => Topic started by: Weaver on August 13, 2022, 02:12:04 AM

Title: http services in operating systems
Post by: Weaver on August 13, 2022, 02:12:04 AM
In operating systems such as iOS, when an application calls a routine to perform an http(s) operation, does the application get the benefit of some web caching that’s managed by the o/s ? (The alternative being that web browsers might have to write content caching logic themselves as a layer over the http protocol io operations.)

This would mean that one web browser would or would not get the benefit of seeing the cache entries stored by another browser. Or not.

The reason I ask is that I’m seeing some occasional really weird behaviour in a Shortcuts program that calls http services. Sometimes it seems to come up with bogus results that do seem as if they might be coming from bogus data. The bogus results are not utter garbage, so this leads my thoughts in a certain particular direction. When I immediately run the program a second time, the bogus results go away, so I asked myself if it is possible that the results are simply old, and could I be seeing a caching effect ? Hence the speculation about caching in the o/s. I need to get rid of the caching effect to fix this, setting the cache lifetime to zero somehow.
Title: Re: http services in operating systems
Post by: Alex Atkin UK on August 13, 2022, 03:32:28 AM
I believe the answer is no, you create a cache object(s) for your app specifically.  I'm not sure, with them mentioning "shared" cache.
https://developer.apple.com/documentation/foundation/url_loading_system/accessing_cached_data
Title: Re: http services in operating systems
Post by: Weaver on August 13, 2022, 09:03:14 AM
I’m glad about that. But it doesn’t help me with my weird bug. Maybe a Shortcuts bug or something wrong in the webserver settings.
Title: Re: http services in operating systems
Post by: Chrysalis on August 13, 2022, 08:33:19 PM
A way round it perhaps would be no-cache and 0 ttl headers on the server side, one would expect a http client to honour it.
Title: Re: http services in operating systems
Post by: Weaver on August 13, 2022, 09:26:22 PM
Ah, of course, I remember now; I need to tell the client, the browser, to behave itself. I’ve used the relevant cache-control fields before, many years ago. I think I need to talk to our friend Mr Johnson about it and see what he says.

I need some help in working out whether it really is a caching effect that I’m seeing and not some other buggy thing, but I can’t see how it can be a fault in my code, as I run the program, see the badness, then run the program again, and second time of execution all is well. And my code has no persistent storage in it; no file io, for example. Do you agree with my logic in this argument ? Alternatively, it could be some very weird bug in Shortcuts itself, so actually I might just ignore it until iOS 16 comes out, just in case there is a relevant known Shortcuts bug that gets fixed, and then I won’t have wasted anyone’s time debugging.
Title: Re: http services in operating systems
Post by: Chrysalis on August 14, 2022, 08:51:04 PM
I dont know, normally my means of debugging is to hit the f12 key to use dev mode in the browser, this then tells me the headers, and how the client behaves, or perhaps to use a diagnostic tool.

But you are debugging a LAN based http service using code written on top of ios shortcuts?  So these kind of means of diagnosing are not available to you.