MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / HandleCallback

Method HandleCallback

Sources/Shared/IO/WebRequest.cpp:1862–1896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1860 }
1861
1862 void WebRequestWinHTTP::HandleCallback(DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
1863 {
1864 switch (dwInternetStatus) {
1865 case WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE: {
1866 WriteData();
1867 break;
1868 }
1869 case WINHTTP_CALLBACK_STATUS_READ_COMPLETE: {
1870 if (dwStatusInformationLength > 0) {
1871 _response->ReportDataReceived(dwStatusInformationLength);
1872 if (!_response->ReadData() && !WasCancelled()) {
1873 SetFailedWithLastError("Reading data"_s);
1874 }
1875 } else {
1876 SetFinalStateFromStatus();
1877 }
1878 break;
1879 }
1880 case WINHTTP_CALLBACK_STATUS_WRITE_COMPLETE: {
1881 DWORD bytesWritten = *(reinterpret_cast<LPDWORD>(lpvStatusInformation));
1882 _dataWritten += bytesWritten;
1883 WriteData();
1884 break;
1885 }
1886 case WINHTTP_CALLBACK_STATUS_REQUEST_ERROR: {
1887 LPWINHTTP_ASYNC_RESULT asyncResult = reinterpret_cast<LPWINHTTP_ASYNC_RESULT>(lpvStatusInformation);
1888 if (asyncResult->dwError == ERROR_WINHTTP_OPERATION_CANCELLED && WasCancelled()) {
1889 SetState(WebRequest::State::Cancelled);
1890 } else {
1891 SetFailed("Async request"_s, asyncResult->dwError);
1892 }
1893 break;
1894 }
1895 }
1896 }
1897
1898 void WebRequestWinHTTP::WriteData()
1899 {

Callers 1

RequestStatusCallbackFunction · 0.80

Calls 2

ReportDataReceivedMethod · 0.80
ReadDataMethod · 0.80

Tested by

no test coverage detected