From 46c924b9d2edd84bc6ecb5367ba52fcff82804fa Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Tue, 18 Feb 2020 16:21:07 +0100 Subject: [HICN-528] Add progress bar to higet. Change-Id: I645ef2b8834f4310933793fb1f59e8f37e3d6aef Signed-off-by: Mauro Sardara --- .../src/hicn/transport/http/client_connection.h | 26 ++++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'libtransport/src/hicn/transport/http/client_connection.h') diff --git a/libtransport/src/hicn/transport/http/client_connection.h b/libtransport/src/hicn/transport/http/client_connection.h index e001653ab..e93a37111 100644 --- a/libtransport/src/hicn/transport/http/client_connection.h +++ b/libtransport/src/hicn/transport/http/client_connection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Copyright (c) 2017-2020 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -20,7 +20,6 @@ #include #include #include -#include #include #include @@ -48,18 +47,18 @@ class HTTPClientConnection : public ConsumerSocket::ReadCallback { HTTPClientConnection(); RC get(const std::string &url, HTTPHeaders headers = {}, - HTTPPayload payload = {}, + HTTPPayload &&payload = nullptr, std::shared_ptr response = nullptr, ReadBytesCallback *callback = nullptr, std::string ipv6_first_word = "b001"); RC sendRequest(const std::string &url, HTTPMethod method, - HTTPHeaders headers = {}, HTTPPayload payload = {}, + HTTPHeaders headers = {}, HTTPPayload &&payload = nullptr, std::shared_ptr response = nullptr, ReadBytesCallback *callback = nullptr, std::string ipv6_first_word = "b001"); - HTTPResponse response(); + std::shared_ptr response(); HTTPClientConnection &stop(); @@ -69,23 +68,14 @@ class HTTPClientConnection : public ConsumerSocket::ReadCallback { HTTPClientConnection &setCertificate(const std::string &cert_path); - void verifyPacketSignature(bool verify); - private: - void sendRequestGetReply(const HTTPRequest &request, - std::shared_ptr &response, - std::string &ipv6_first_word); + void sendRequestGetReply(std::string &ipv6_first_word); bool verifyData(interface::ConsumerSocket &c, const core::ContentObject &contentObject); void processLeavingInterest(interface::ConsumerSocket &c, - const core::Interest &interest, - std::string &payload); - - VerificationPolicy onSignatureVerificationFailed( - ConsumerSocket &consumer, const core::ContentObject &content_object, - std::error_code reason); + const core::Interest &interest); // Read callback bool isBufferMovable() noexcept override { return true; } @@ -106,7 +96,7 @@ class HTTPClientConnection : public ConsumerSocket::ReadCallback { // The current hICN name used for downloading std::stringstream name_; // Function to be called when the read is successful - std::function(std::size_t)> success_callback_; + std::function success_callback_; // Return code for current download RC return_code_; @@ -115,6 +105,8 @@ class HTTPClientConnection : public ConsumerSocket::ReadCallback { // any byte internally. ReadBytesCallback *read_bytes_callback_; + HTTPRequest request_; + // Internal read buffer and HTTP response, to be used if the application does // not provide any read_bytes_callback std::unique_ptr read_buffer_; -- cgit 1.2.3-korg