aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r--packages/taler-util/src/MerchantApiClient.ts5
-rw-r--r--packages/taler-util/src/http-common.ts5
-rw-r--r--packages/taler-util/src/http-impl.node.ts6
-rw-r--r--packages/taler-util/src/http-impl.qtart.ts6
4 files changed, 11 insertions, 11 deletions
diff --git a/packages/taler-util/src/MerchantApiClient.ts b/packages/taler-util/src/MerchantApiClient.ts
index cf4788d9e..cbdcb9fdf 100644
--- a/packages/taler-util/src/MerchantApiClient.ts
+++ b/packages/taler-util/src/MerchantApiClient.ts
@@ -138,10 +138,7 @@ export class MerchantApiClient {
};
}
- httpClient = createPlatformHttpLib({
- allowHttp: true,
- enableThrottling: false,
- });
+ httpClient = createPlatformHttpLib();
async changeAuth(auth: MerchantAuthConfiguration): Promise<void> {
const url = new URL("private/auth", this.baseUrl);
diff --git a/packages/taler-util/src/http-common.ts b/packages/taler-util/src/http-common.ts
index 93cf9bba0..02ec8ce72 100644
--- a/packages/taler-util/src/http-common.ts
+++ b/packages/taler-util/src/http-common.ts
@@ -436,7 +436,10 @@ export function getExpiry(
export interface HttpLibArgs {
enableThrottling?: boolean;
- allowHttp?: boolean;
+ /**
+ * Only allow HTTPS connections, not plain http.
+ */
+ requireTls?: boolean;
}
export function encodeBody(body: any): ArrayBuffer {
diff --git a/packages/taler-util/src/http-impl.node.ts b/packages/taler-util/src/http-impl.node.ts
index 07648a28d..528d303be 100644
--- a/packages/taler-util/src/http-impl.node.ts
+++ b/packages/taler-util/src/http-impl.node.ts
@@ -63,11 +63,11 @@ const textDecoder = new TextDecoder();
export class HttpLibImpl implements HttpRequestLibrary {
private throttle = new RequestThrottler();
private throttlingEnabled = true;
- private allowHttp = false;
+ private requireTls = false;
constructor(args?: HttpLibArgs) {
this.throttlingEnabled = args?.enableThrottling ?? false;
- this.allowHttp = args?.allowHttp ?? false;
+ this.requireTls = args?.requireTls ?? false;
}
/**
@@ -94,7 +94,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
`request to origin ${parsedUrl.origin} was throttled`,
);
}
- if (!this.allowHttp && parsedUrl.protocol !== "https:") {
+ if (this.requireTls && parsedUrl.protocol !== "https:") {
throw TalerError.fromDetail(
TalerErrorCode.WALLET_NETWORK_ERROR,
{
diff --git a/packages/taler-util/src/http-impl.qtart.ts b/packages/taler-util/src/http-impl.qtart.ts
index 3e076e96d..fb642ac89 100644
--- a/packages/taler-util/src/http-impl.qtart.ts
+++ b/packages/taler-util/src/http-impl.qtart.ts
@@ -41,11 +41,11 @@ const textDecoder = new TextDecoder();
export class HttpLibImpl implements HttpRequestLibrary {
private throttle = new RequestThrottler();
private throttlingEnabled = true;
- private allowHttp = false;
+ private requireTls = false;
constructor(args?: HttpLibArgs) {
this.throttlingEnabled = args?.enableThrottling ?? false;
- this.allowHttp = args?.allowHttp ?? false;
+ this.requireTls = args?.requireTls ?? false;
}
/**
@@ -72,7 +72,7 @@ export class HttpLibImpl implements HttpRequestLibrary {
`request to origin ${parsedUrl.origin} was throttled`,
);
}
- if (!this.allowHttp && parsedUrl.protocol !== "https:") {
+ if (this.requireTls && parsedUrl.protocol !== "https:") {
throw TalerError.fromDetail(
TalerErrorCode.WALLET_NETWORK_ERROR,
{