Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/storage/storage-blob/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Bugs Fixed

- Fixed a hang issue in BlobClient.downloadToBuffer when encountering transient network failure.
- Refined URL parsing method to let it be able to correctly parse URLs with account name in path.

## 12.11.0 (2022-07-08)

Expand Down
25 changes: 25 additions & 0 deletions sdk/storage/storage-blob/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,28 @@ export const StorageBlobLoggingAllowedQueryParameters = [
export const BlobUsesCustomerSpecifiedEncryptionMsg = "BlobUsesCustomerSpecifiedEncryption";
export const BlobDoesNotUseCustomerSpecifiedEncryption =
"BlobDoesNotUseCustomerSpecifiedEncryption";

/// List of ports used for path style addressing.
/// Path style addressing means that storage account is put in URI's Path segment in instead of in host.
export const PathStylePorts = [
"10000",
"10001",
"10002",
"10003",
"10004",
"10100",
"10101",
"10102",
"10103",
"10104",
"11000",
"11001",
"11002",
"11003",
"11004",
"11100",
"11101",
"11102",
"11103",
"11104",
];
14 changes: 11 additions & 3 deletions sdk/storage/storage-blob/src/utils/utils.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ import {
ClearRange,
BlobPropertiesInternal,
} from "../generated/src/models";
import { DevelopmentConnectionString, HeaderConstants, URLConstants } from "./constants";
import {
DevelopmentConnectionString,
HeaderConstants,
PathStylePorts,
URLConstants,
} from "./constants";
import {
Tags,
ObjectReplicationPolicy,
Expand Down Expand Up @@ -603,8 +608,11 @@ export function isIpEndpointStyle(parsedUrl: URLBuilder): boolean {
// Case 2: localhost(:port), use broad regex to match port part.
// Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
// For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
return /^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
return (
/^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
) ||
(parsedUrl.getPort() !== undefined && PathStylePorts.includes(parsedUrl.getPort()!))
);
}

Expand Down
1 change: 1 addition & 0 deletions sdk/storage/storage-file-datalake/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Bugs Fixed

- Correted permission string parsing in DataLakePathClient.setPermissions() and DataLakePathClient.getAccessControl().
- Refined URL parsing method to let it be able to correctly parse URLs with account name in path.

## 12.10.0 (2022-07-08)

Expand Down
25 changes: 25 additions & 0 deletions sdk/storage/storage-file-datalake/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,28 @@ export const PathResultTypeConstants = {
FileResourceType: "file",
DirectoryResourceType: "directory",
};

/// List of ports used for path style addressing.
/// Path style addressing means that storage account is put in URI's Path segment in instead of in host.
export const PathStylePorts = [
"10000",
"10001",
"10002",
"10003",
"10004",
"10100",
"10101",
"10102",
"10103",
"10104",
"11000",
"11001",
"11002",
"11003",
"11004",
"11100",
"11101",
"11102",
"11103",
"11104",
];
8 changes: 6 additions & 2 deletions sdk/storage/storage-file-datalake/src/utils/utils.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
DevelopmentConnectionString,
EncryptionAlgorithmAES25,
HeaderConstants,
PathStylePorts,
UrlConstants,
} from "./constants";

Expand Down Expand Up @@ -571,8 +572,11 @@ export function isIpEndpointStyle(parsedUrl: URLBuilder): boolean {
// Case 2: localhost(:port), use broad regex to match port part.
// Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
// For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
return /^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
return (
/^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
) ||
(parsedUrl.getPort() !== undefined && PathStylePorts.includes(parsedUrl.getPort()!))
);
}

Expand Down
1 change: 1 addition & 0 deletions sdk/storage/storage-file-share/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Bugs Fixed

- Fixed a hang issue in ShareFileClient.downloadToBuffer when encountering transient network failure.
- Refined URL parsing method to let it be able to correctly parse URLs with account name in path.

### Other Changes

Expand Down
25 changes: 25 additions & 0 deletions sdk/storage/storage-file-share/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,28 @@ export const StorageFileLoggingAllowedQueryParameters = [
"copyid",
"restype",
];

/// List of ports used for path style addressing.
/// Path style addressing means that storage account is put in URI's Path segment in instead of in host.
export const PathStylePorts = [
"10000",
"10001",
"10002",
"10003",
"10004",
"10100",
"10101",
"10102",
"10103",
"10104",
"11000",
"11001",
"11002",
"11003",
"11004",
"11100",
"11101",
"11102",
"11103",
"11104",
];
9 changes: 6 additions & 3 deletions sdk/storage/storage-file-share/src/utils/utils.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { AbortSignalLike } from "@azure/abort-controller";
import { HttpHeaders, isNode, URLBuilder } from "@azure/core-http";
import { HttpAuthorization } from "../models";
import { HeaderConstants, URLConstants } from "./constants";
import { HeaderConstants, PathStylePorts, URLConstants } from "./constants";

/**
* Reserved URL characters must be properly escaped for Storage services like Blob or File.
Expand Down Expand Up @@ -442,8 +442,11 @@ export function isIpEndpointStyle(parsedUrl: URLBuilder): boolean {
// Case 2: localhost(:port), use broad regex to match port part.
// Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
// For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
return /^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
return (
/^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
) ||
(parsedUrl.getPort() !== undefined && PathStylePorts.includes(parsedUrl.getPort()!))
);
}

Expand Down
2 changes: 2 additions & 0 deletions sdk/storage/storage-queue/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- Refined URL parsing method to let it be able to correctly parse URLs with account name in path.

### Other Changes

## 12.10.0 (2022-07-08)
Expand Down
25 changes: 25 additions & 0 deletions sdk/storage/storage-queue/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,28 @@ export const StorageQueueLoggingAllowedQueryParameters = [
"popreceipt",
"visibilitytimeout",
];

/// List of ports used for path style addressing.
/// Path style addressing means that storage account is put in URI's Path segment in instead of in host.
export const PathStylePorts = [
"10000",
"10001",
"10002",
"10003",
"10004",
"10100",
"10101",
"10102",
"10103",
"10104",
"11000",
"11001",
"11002",
"11003",
"11004",
"11100",
"11101",
"11102",
"11103",
"11104",
];
14 changes: 11 additions & 3 deletions sdk/storage/storage-queue/src/utils/utils.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
// Licensed under the MIT license.
import { AbortSignalLike } from "@azure/abort-controller";
import { HttpHeaders, URLBuilder } from "@azure/core-http";
import { HeaderConstants, URLConstants, DevelopmentConnectionString } from "./constants";
import {
HeaderConstants,
URLConstants,
DevelopmentConnectionString,
PathStylePorts,
} from "./constants";
import { StorageClientContext } from "../generated/src/storageClientContext";
import { Pipeline } from "../Pipeline";

Expand Down Expand Up @@ -370,8 +375,11 @@ export function isIpEndpointStyle(parsedUrl: URLBuilder): boolean {
// Case 2: localhost(:port), use broad regex to match port part.
// Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
// For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
return /^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
return (
/^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(
host
) ||
(parsedUrl.getPort() !== undefined && PathStylePorts.includes(parsedUrl.getPort()!))
);
}

Expand Down