Skip to content

Commit

Permalink
Merge pull request #49 from hanzhumsft/master
Browse files Browse the repository at this point in the history
Azure Storage SDK for C++ v2.3 - master branch
  • Loading branch information
vinjiang committed Mar 8, 2016
2 parents 450b319 + b8e0b95 commit 4ae759a
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 49 deletions.
3 changes: 3 additions & 0 deletions BreakingChanges.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Azure Storage Client Library for C++
History of Breaking Changes

Breaking Changes in v2.3:
- Upgraded Casablanca dependency to 2.8.0

Breaking Changes in v2.2:
- Upgraded Casablanca dependency to 2.7.0
- Added Microsoft Visual C++ compiler version to user agent string if MSVC is used to compile.
Expand Down
7 changes: 7 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Azure Storage Client Library for C++
History of Changes

Changes in v2.3:
- Added the following interfaces to support programmatically configurable HTTP/HTTPS proxy
- operation_context::set_default_proxy
- operation_context::set_proxy
- Upgraded Casablanca dependency to 2.8.0
- Fixed a bug that the retry policy of a default service client request options is not used

Changes in v2.2:
- Default REST API version is 2015-04-05
- Supported account SAS
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Microsoft Azure Storage Client Library for C++"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.2.0
PROJECT_NUMBER = 2.3.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.WindowsAzure.Storage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ set(AZURESTORAGE_LIBRARIES ${AZURESTORAGE_LIBRARY} ${CASABLANCA_LIBRARIES} ${Boo

# Set version numbers centralized
set (AZURESTORAGE_VERSION_MAJOR 2)
set (AZURESTORAGE_VERSION_MINOR 2)
set (AZURESTORAGE_VERSION_MINOR 3)
set (AZURESTORAGE_VERSION_REVISION 0)

# Add sources per configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<NuGetPackageImportStamp>2c03e23f</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>wastorage</TargetName>
Expand Down Expand Up @@ -246,12 +244,12 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" />
<Import Project="..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
<Error Condition="!Exists('..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" />
<Import Project="..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
<Error Condition="!Exists('..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
</Target>
</Project>
1 change: 1 addition & 0 deletions Microsoft.WindowsAzure.Storage/includes/was/blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -2726,6 +2726,7 @@ namespace azure { namespace storage {
void initialize()
{
set_authentication_scheme(azure::storage::authentication_scheme::shared_key);
m_default_request_options.set_retry_policy(exponential_retry_policy());
m_directory_delimiter = protocol::directory_delimiter;
}

Expand Down
59 changes: 59 additions & 0 deletions Microsoft.WindowsAzure.Storage/includes/was/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,27 @@ namespace azure { namespace storage {
m_log_level = log_level;
}

/// <summary>
/// Gets the proxy.
/// </summary>
/// <returns>An <see cref="web::web_proxy" /> object indicating the proxy.</returns>
const web::web_proxy &proxy() const
{
return m_proxy;
}

/// <summary>
/// Sets the proxy.
/// </summary>
/// <param name="proxy">An <see cref="web::web_proxy" /> object indicating the proxy.</param>
/// <remarks>
/// The proxy uri should be in the format "//host[:port]"
/// </remarks>
void set_proxy(web::web_proxy proxy)
{
m_proxy = std::move(proxy);
}

/// <summary>
/// Gets the user headers provided for the request.
/// </summary>
Expand Down Expand Up @@ -1654,6 +1675,7 @@ namespace azure { namespace storage {
utility::datetime m_start_time;
utility::datetime m_end_time;
client_log_level m_log_level;
web::web_proxy m_proxy;
std::vector<request_result> m_request_results;
pplx::extensibility::critical_section_t m_request_results_lock;
#ifndef WIN32
Expand Down Expand Up @@ -1824,6 +1846,42 @@ namespace azure { namespace storage {
m_impl->set_response_received(value);
}

/// <summary>
/// Gets the default proxy to be used for subsequently created instances of the <see cref="azure::storage::operation_context" /> class.
/// </summary>
/// <returns>A value of type <see cref="web::web_proxy" /> that specifies the default proxy by instances of the <see cref="azure::storage::operation_context" />.</returns>
WASTORAGE_API static const web::web_proxy &default_proxy();

/// <summary>
/// Sets the default proxy to be used for subsequently created instances of the <see cref="azure::storage::operation_context" /> class.
/// </summary>
/// <param name="proxy">A value of type <see cref="web::proxy" /> that specifies default proxy by instances of the <see cref="azure::storage::operation_context" />.</param>
/// <remarks>
/// The proxy uri should be in the format "//host[:port]"
/// </remarks>
WASTORAGE_API static void set_default_proxy(web::web_proxy proxy);

/// <summary>
/// Gets the proxy.
/// </summary>
/// <returns>The proxy.</returns>
const web::web_proxy &proxy() const
{
return m_impl->proxy();
}

/// <summary>
/// Sets the proxy.
/// </summary>
/// <param name="proxy">The proxy.</param>
/// <remarks>
/// The proxy uri should be in the format "//host[:port]"
/// </remarks>
void set_proxy(web::web_proxy proxy)
{
m_impl->set_proxy(std::move(proxy));
}

#ifndef WIN32
/// <summary>
/// Gets the logger object on this operation context.
Expand Down Expand Up @@ -1862,6 +1920,7 @@ namespace azure { namespace storage {

std::shared_ptr<_operation_context> m_impl;
static client_log_level m_global_log_level;
static web::web_proxy m_global_proxy;
};

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions Microsoft.WindowsAzure.Storage/includes/was/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ namespace azure { namespace storage {
void initialize()
{
set_authentication_scheme(azure::storage::authentication_scheme::shared_key);
m_default_request_options.set_retry_policy(exponential_retry_policy());
}

queue_request_options get_modified_options(const queue_request_options& options) const;
Expand Down
1 change: 1 addition & 0 deletions Microsoft.WindowsAzure.Storage/includes/was/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -1939,6 +1939,7 @@ namespace azure { namespace storage {
void initialize()
{
set_authentication_scheme(azure::storage::authentication_scheme::shared_key);
m_default_request_options.set_retry_policy(exponential_retry_policy());
}

table_request_options get_modified_options(const table_request_options& options) const;
Expand Down
6 changes: 3 additions & 3 deletions Microsoft.WindowsAzure.Storage/includes/wascore/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,12 @@ namespace azure { namespace storage { namespace protocol {
// user agent
#if defined(WIN32)
#if defined(_MSC_VER)
const utility::string_t header_value_user_agent(U("Azure-Storage/2.2.0 (Native; Windows; MSC_VER ") + utility::conversions::to_string_t(std::to_string(_MSC_VER)) + U(")"));
const utility::string_t header_value_user_agent(U("Azure-Storage/2.3.0 (Native; Windows; MSC_VER ") + utility::conversions::to_string_t(std::to_string(_MSC_VER)) + U(")"));
#else
const utility::string_t header_value_user_agent(U("Azure-Storage/2.2.0 (Native; Windows)"));
const utility::string_t header_value_user_agent(U("Azure-Storage/2.3.0 (Native; Windows)"));
#endif
#else
const utility::string_t header_value_user_agent(U("Azure-Storage/2.2.0 (Native)"));
const utility::string_t header_value_user_agent(U("Azure-Storage/2.3.0 (Native)"));
#endif

}}} // namespace azure::storage::protocol
5 changes: 5 additions & 0 deletions Microsoft.WindowsAzure.Storage/includes/wascore/executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ namespace azure { namespace storage { namespace core {

// 4. Set HTTP client configuration
web::http::client::http_client_config config;
if (instance->m_context.proxy().is_specified())
{
config.set_proxy(instance->m_context.proxy());
}

config.set_timeout(instance->remaining_time());

size_t http_buffer_size = instance->m_request_options.http_buffer_size();
Expand Down
4 changes: 2 additions & 2 deletions Microsoft.WindowsAzure.Storage/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn" version="2.7.0" targetFramework="Native" />
<package id="cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn" version="2.7.0" targetFramework="native" />
<package id="cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn" version="2.8.0" targetFramework="native" />
<package id="cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn" version="2.8.0" targetFramework="native" />
</packages>
2 changes: 1 addition & 1 deletion Microsoft.WindowsAzure.Storage/src/cloud_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
namespace azure { namespace storage {

WASTORAGE_API request_options::request_options()
: m_location_mode(azure::storage::location_mode::primary_only), m_retry_policy(exponential_retry_policy()), m_http_buffer_size(protocol::default_buffer_size),\
: m_location_mode(azure::storage::location_mode::primary_only), m_http_buffer_size(protocol::default_buffer_size),\
m_maximum_execution_time(protocol::default_maximum_execution_time), m_server_timeout(protocol::default_server_timeout)
{
}
Expand Down
13 changes: 13 additions & 0 deletions Microsoft.WindowsAzure.Storage/src/operation_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ namespace azure { namespace storage {

client_log_level operation_context::m_global_log_level = client_log_level::log_level_off;

web::web_proxy operation_context::m_global_proxy;

operation_context::operation_context()
: m_impl(std::make_shared<_operation_context>())
{
set_log_level(default_log_level());
set_proxy(default_proxy());
set_client_request_id(utility::uuid_to_string(utility::new_uuid()));
}

Expand All @@ -39,4 +42,14 @@ namespace azure { namespace storage {
m_global_log_level = log_level;
}

const web::web_proxy &operation_context::default_proxy()
{
return m_global_proxy;
}

void operation_context::set_default_proxy(web::web_proxy proxy)
{
m_global_proxy = std::move(proxy);
}

}} // namespace azure::storage
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<NuGetPackageImportStamp>360346c5</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(ProjectDir)..\$(PlatformToolset)\$(Platform)\$(Configuration)\</OutDir>
Expand Down Expand Up @@ -157,12 +155,12 @@
</Target>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" />
<Import Project="..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
<Error Condition="!Exists('..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v120.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@
</Target>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" />
<Import Project="..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.7.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
<Error Condition="!Exists('..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.2.8.0\build\native\cpprestsdk.v140.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
</Target>
</Project>
Loading

0 comments on commit 4ae759a

Please sign in to comment.