FFFTPのソースコードです。
Révision | 4bb821a9b2a937ec3c984f6378fa553b074c89b7 (tree) |
---|---|
l'heure | 2016-03-24 00:08:21 |
Auteur | s_kawamoto <s_kawamoto@user...> |
Commiter | s_kawamoto |
Fix bugs of automatic software update.
@@ -81,7 +81,7 @@ | ||
81 | 81 | // ソフトウェア自動更新 |
82 | 82 | // リリースバージョンはリリース予定年(10進数4桁)+月(2桁)+日(2桁)+通し番号(0スタート2桁)とする |
83 | 83 | // 2014年7月31日中の30個目のリリースは2014073129 |
84 | -#define RELEASE_VERSION_NUM 2016032300 /* リリースバージョン */ | |
84 | +#define RELEASE_VERSION_NUM 2016032400 /* リリースバージョン */ | |
85 | 85 | |
86 | 86 | |
87 | 87 | // SourceForge.JPによるフォーク |
@@ -50,32 +50,37 @@ BOOL ReadFileViaHTTPW(void* pOut, DWORD Length, DWORD* pLength, LPCWSTR UserAgen | ||
50 | 50 | { |
51 | 51 | BOOL bResult; |
52 | 52 | HINTERNET hSession; |
53 | + DWORD Buffer; | |
53 | 54 | HINTERNET hConnect; |
54 | 55 | HINTERNET hRequest; |
55 | 56 | bResult = FALSE; |
56 | 57 | if(hSession = WinHttpOpen(UserAgent, WINHTTP_ACCESS_TYPE_NO_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0)) |
57 | 58 | { |
58 | - if(hConnect = WinHttpConnect(hSession, ServerName, INTERNET_DEFAULT_HTTP_PORT, 0)) | |
59 | + Buffer = WINHTTP_OPTION_REDIRECT_POLICY_ALWAYS; | |
60 | + if(WinHttpSetOption(hSession, WINHTTP_OPTION_REDIRECT_POLICY, &Buffer, sizeof(DWORD))) | |
59 | 61 | { |
60 | - if(hRequest = WinHttpOpenRequest(hConnect, L"GET", ObjectName, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0)) | |
62 | + if(hConnect = WinHttpConnect(hSession, ServerName, INTERNET_DEFAULT_HTTP_PORT, 0)) | |
61 | 63 | { |
62 | - if(WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) | |
64 | + if(hRequest = WinHttpOpenRequest(hConnect, L"GET", ObjectName, NULL, WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0)) | |
63 | 65 | { |
64 | - if(WinHttpReceiveResponse(hRequest, NULL)) | |
66 | + if(WinHttpSendRequest(hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0)) | |
65 | 67 | { |
66 | - if(WinHttpQueryDataAvailable(hRequest, pLength)) | |
68 | + if(WinHttpReceiveResponse(hRequest, NULL)) | |
67 | 69 | { |
68 | - if(*pLength <= Length) | |
70 | + if(WinHttpQueryDataAvailable(hRequest, pLength)) | |
69 | 71 | { |
70 | - if(WinHttpReadData(hRequest, pOut, Length, pLength)) | |
71 | - bResult = TRUE; | |
72 | + if(*pLength <= Length) | |
73 | + { | |
74 | + if(WinHttpReadData(hRequest, pOut, Length, pLength)) | |
75 | + bResult = TRUE; | |
76 | + } | |
72 | 77 | } |
73 | 78 | } |
74 | 79 | } |
80 | + WinHttpCloseHandle(hRequest); | |
75 | 81 | } |
76 | - WinHttpCloseHandle(hRequest); | |
82 | + WinHttpCloseHandle(hConnect); | |
77 | 83 | } |
78 | - WinHttpCloseHandle(hConnect); | |
79 | 84 | } |
80 | 85 | WinHttpCloseHandle(hSession); |
81 | 86 | } |