| OLD | NEW |
| (Empty) |
| 1 // Copyright 2008-2009 Google Inc. | |
| 2 // | |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 // you may not use this file except in compliance with the License. | |
| 5 // You may obtain a copy of the License at | |
| 6 // | |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 // | |
| 9 // Unless required by applicable law or agreed to in writing, software | |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 12 // See the License for the specific language governing permissions and | |
| 13 // limitations under the License. | |
| 14 // ======================================================================== | |
| 15 | |
| 16 | |
| 17 #include "omaha/tools/omahacompatibility/httpserver/download_handler.h" | |
| 18 #include "omaha/common/debug.h" | |
| 19 #include "omaha/common/logging.h" | |
| 20 #include "omaha/common/path.h" | |
| 21 | |
| 22 namespace omaha { | |
| 23 | |
| 24 HRESULT DownloadHandler::HandleRequest(const HttpRequest& request, | |
| 25 HttpResponse* response) { | |
| 26 CORE_LOG(L1, (_T("[DownloadHandler::HandleRequest]"))); | |
| 27 ASSERT1(response); | |
| 28 | |
| 29 for (size_t i = 0; i < responses_.size(); ++i) { | |
| 30 CString requested_file = GetFileFromPath(request.path()); | |
| 31 if (GetFileFromPath(responses_[i].local_file_name) == requested_file) { | |
| 32 // We know about the file that was asked for. | |
| 33 response->set_size(responses_[i].size); | |
| 34 response->set_file_name(responses_[i].local_file_name); | |
| 35 return S_OK; | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 return S_OK; | |
| 40 } | |
| 41 | |
| 42 HRESULT DownloadHandler::AddDownloadFile(const ConfigResponse& response) { | |
| 43 CORE_LOG(L1, (_T("[DownloadHandler::AddDownloadFile]"))); | |
| 44 responses_.push_back(response); | |
| 45 return S_OK; | |
| 46 } | |
| 47 | |
| 48 } // namespace omaha | |
| OLD | NEW |