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 
17 #pragma once
18 
19 #include <string>
20 #include <alibabacloud/oss/Types.h>
21 #include <alibabacloud/oss/ServiceRequest.h>
22 #include <alibabacloud/oss/http/HttpMessage.h>
23 #include <alibabacloud/oss/http/Url.h>
24 
25 namespace AlibabaCloud
26 {
27 namespace OSS
28 {
29 
30     class ALIBABACLOUD_OSS_EXPORT HttpRequest : public HttpMessage
31     {
32         public:
33             HttpRequest(Http::Method method = Http::Method::Get);
34             ~HttpRequest();
35 
36             Http::Method method() const;
37             Url url() const;
38             void setMethod(Http::Method method);
39             void setUrl(const Url &url);
40 
ResponseStreamFactory()41             const IOStreamFactory& ResponseStreamFactory() const { return responseStreamFactory_; }
setResponseStreamFactory(const IOStreamFactory & factory)42             void setResponseStreamFactory(const IOStreamFactory& factory) { responseStreamFactory_ = factory; }
43 
TransferProgress()44             const AlibabaCloud::OSS::TransferProgress & TransferProgress() const {  return transferProgress_; }
setTransferProgress(const AlibabaCloud::OSS::TransferProgress & arg)45             void setTransferProgress(const AlibabaCloud::OSS::TransferProgress &arg) { transferProgress_ = arg;}
46 
setCheckCrc64(bool enable)47             void setCheckCrc64(bool enable) { hasCheckCrc64_ = enable; }
hasCheckCrc64()48             bool hasCheckCrc64() const { return hasCheckCrc64_; }
setCrc64Result(uint64_t crc)49             void setCrc64Result(uint64_t crc) { crc64Result_ = crc; }
Crc64Result()50             uint64_t Crc64Result() const { return crc64Result_; }
51 
setTransferedBytes(int64_t value)52             void setTransferedBytes(int64_t value) { transferedBytes_ = value; }
TransferedBytes()53             uint64_t TransferedBytes() const { return transferedBytes_;}
54 
55         private:
56             Http::Method method_;
57             Url url_;
58             IOStreamFactory responseStreamFactory_;
59             AlibabaCloud::OSS::TransferProgress transferProgress_;
60             bool hasCheckCrc64_;
61             uint64_t crc64Result_;
62             int64_t transferedBytes_;
63     };
64 }
65 }
66