MCPcopy Create free account
hub / github.com/defold/defold / VerifyCache

Function VerifyCache

engine/dlib/src/dlib/http_cache_verify.cpp:175–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173 }
174
175 Result VerifyCache(dmHttpCache::HCache cache, dmURI::Parts* uri, uint64_t max_age)
176 {
177 VerifyContext context(max_age * 1000000);
178 context.m_HttpCache = cache;
179
180 dmHttpClient::NewParams params;
181 params.m_HttpSendContentLength = HttpSendContentLength;
182 params.m_HttpWrite = HttpWrite;
183 params.m_HttpContent = HttpContent;
184 params.m_Userdata = &context;
185 dmHttpClient::HClient client = dmHttpClient::New(&params, uri);
186 if (client == 0)
187 {
188 return RESULT_OUT_OF_RESOURCES;
189 }
190
191 context.m_Client = client;
192 dmHttpClient::Result verify_result = Post(client, "/__verify_etags__");
193 dmHttpClient::Delete(client);
194
195 if (verify_result == dmHttpClient::RESULT_OK)
196 {
197 return RESULT_OK;
198 }
199 else if (verify_result == dmHttpClient::RESULT_NOT_200_OK)
200 {
201 if (context.m_HttpStatus == 404)
202 {
203 return RESULT_UNSUPPORTED;
204 }
205 else
206 {
207 return RESULT_UNKNOWN_ERROR;
208 }
209 }
210 else
211 {
212 return RESULT_NETWORK_ERROR;
213 }
214 }
215
216}

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
PostFunction · 0.70
DeleteFunction · 0.70

Tested by

no test coverage detected