HttpRequest.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #pragma once
  17. #include <string>
  18. #include <alibabacloud/oss/Types.h>
  19. #include <alibabacloud/oss/ServiceRequest.h>
  20. #include <alibabacloud/oss/http/HttpMessage.h>
  21. #include <alibabacloud/oss/http/Url.h>
  22. namespace AlibabaCloud
  23. {
  24. namespace OSS
  25. {
  26. class ALIBABACLOUD_OSS_EXPORT HttpRequest : public HttpMessage
  27. {
  28. public:
  29. HttpRequest(Http::Method method = Http::Method::Get);
  30. ~HttpRequest();
  31. Http::Method method() const;
  32. Url url() const;
  33. void setMethod(Http::Method method);
  34. void setUrl(const Url &url);
  35. const IOStreamFactory& ResponseStreamFactory() const { return responseStreamFactory_; }
  36. void setResponseStreamFactory(const IOStreamFactory& factory) { responseStreamFactory_ = factory; }
  37. const AlibabaCloud::OSS::TransferProgress & TransferProgress() const { return transferProgress_; }
  38. void setTransferProgress(const AlibabaCloud::OSS::TransferProgress &arg) { transferProgress_ = arg;}
  39. void setCheckCrc64(bool enable) { hasCheckCrc64_ = enable; }
  40. bool hasCheckCrc64() const { return hasCheckCrc64_; }
  41. void setCrc64Result(uint64_t crc) { crc64Result_ = crc; }
  42. uint64_t Crc64Result() const { return crc64Result_; }
  43. void setTransferedBytes(int64_t value) { transferedBytes_ = value; }
  44. uint64_t TransferedBytes() const { return transferedBytes_;}
  45. void setChunkedEncoding(bool value) { chunkedEncoding_ = value; }
  46. bool chunkedEncoding() const { return chunkedEncoding_; }
  47. private:
  48. Http::Method method_;
  49. Url url_;
  50. IOStreamFactory responseStreamFactory_;
  51. AlibabaCloud::OSS::TransferProgress transferProgress_;
  52. bool hasCheckCrc64_;
  53. uint64_t crc64Result_;
  54. int64_t transferedBytes_;
  55. bool chunkedEncoding_;
  56. };
  57. }
  58. }