Fixes #5964 Adds -Resume switch to Invoke-WebRequest and Invoke-RestMethod -Resume requires -OutFile Enables the ability to resume downloading a partially or incompletely downloaded file. File Size is the only indicator of local and remote file parity. If the local file is smaller than the remote file and the remote endpoint supports resume, the local file will be appended with the remaining bytes. If the local file is larger than the remote file, the local file will be overwritten If the remote server does not support resume, the local file will be overwritten If the local file is the same size as the remote file, the remote endpoint will return a 416 status code. This response is special-cased as a success in this instance. The local file remains untouched and it is assumed the file was already successfully downloaded previously. If the local file does not exist it will be created and the entire remote file will be requested. Added tests for all code new code paths (I'm pretty sure anyway) Added /Resume Controller to WebListener Documented /Resume Controller Updated .spelling to reflect terms in WebListener docs Note: I had to change the way GetResponse() tracks the current URI as we now have 3 places where the call is taking place. I don't foresee this causing any regressions. This area needs some refactoring. especially if we want to implement a retry mechanism
17 lines
614 B
C#
17 lines
614 B
C#
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
using System;
|
|
|
|
namespace mvc.Controllers
|
|
{
|
|
internal static class Constants
|
|
{
|
|
public const string HeaderSeparator = ", ";
|
|
public const string ApplicationJson = "application/json";
|
|
public const string LinkUriTemplate = "<{0}?maxlinks={1}&linknumber={2}&type={3}>; rel=\"{4}\"";
|
|
public const string MalformedUrlLinkHeader = "{url}; foo";
|
|
public const string NoRelLinkHeader = "<url>; foo=\"bar\"";
|
|
public const string NoUrlLinkHeader = "<>; rel=\"next\"";
|
|
|
|
}
|
|
}
|