| 52 | }; |
| 53 | |
| 54 | static void VerifyCallback(void* context, const dmHttpCache::EntryInfo* entry_info) |
| 55 | { |
| 56 | VerifyContext* verify_context = (VerifyContext*) context; |
| 57 | if (verify_context->m_Result != dmHttpClient::RESULT_OK) |
| 58 | return; |
| 59 | |
| 60 | if (entry_info->m_LastAccessed + verify_context->m_MaxAge >= verify_context->m_CurrentTime) |
| 61 | { |
| 62 | // Young enough |
| 63 | |
| 64 | // #path + space + #etag + \n |
| 65 | verify_context->m_BytesWritten += strlen(entry_info->m_URI) + 1 + strlen(entry_info->m_ETag) + 1; |
| 66 | if (!verify_context->m_DryRun) |
| 67 | { |
| 68 | dmHttpClient::Result r; |
| 69 | r = Write(verify_context->m_Response, entry_info->m_URI, strlen(entry_info->m_URI)); |
| 70 | if (r != dmHttpClient::RESULT_OK) |
| 71 | { |
| 72 | verify_context->m_Result = r; |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | r = Write(verify_context->m_Response, " ", 1); |
| 77 | if (r != dmHttpClient::RESULT_OK) |
| 78 | { |
| 79 | verify_context->m_Result = r; |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | r = Write(verify_context->m_Response, entry_info->m_ETag, strlen(entry_info->m_ETag)); |
| 84 | if (r != dmHttpClient::RESULT_OK) |
| 85 | { |
| 86 | verify_context->m_Result = r; |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | r = Write(verify_context->m_Response, "\n", 1); |
| 91 | if (r != dmHttpClient::RESULT_OK) |
| 92 | { |
| 93 | verify_context->m_Result = r; |
| 94 | return; |
| 95 | } |
| 96 | } |
| 97 | else |
| 98 | { |
| 99 | // Dry run |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | static uint32_t HttpSendContentLength(dmHttpClient::HResponse response, void* user_data) |
| 105 | { |