| 79 | } |
| 80 | |
| 81 | static bool CalculateSha256(const char *pAbsoluteFilename, SHA256_DIGEST *pSha256) |
| 82 | { |
| 83 | IOHANDLE File = io_open(pAbsoluteFilename, IOFLAG_READ); |
| 84 | if(!File) |
| 85 | { |
| 86 | return false; |
| 87 | } |
| 88 | SHA256_CTX Sha256Ctxt; |
| 89 | sha256_init(&Sha256Ctxt); |
| 90 | unsigned char aBuffer[64 * 1024]; |
| 91 | while(true) |
| 92 | { |
| 93 | unsigned Bytes = io_read(File, aBuffer, sizeof(aBuffer)); |
| 94 | if(Bytes == 0) |
| 95 | break; |
| 96 | sha256_update(&Sha256Ctxt, aBuffer, Bytes); |
| 97 | } |
| 98 | io_close(File); |
| 99 | *pSha256 = sha256_finish(&Sha256Ctxt); |
| 100 | return true; |
| 101 | } |
| 102 | |
| 103 | bool CHttpRequest::ShouldSkipRequest() |
| 104 | { |
no test coverage detected