Skip to content

Commit 60e8849

Browse files
committed
Merge branch 'ui/server-icon' of https://github.com/MegaRedHand/network-simulator into ui/server-icon
2 parents 09079cd + b55490a commit 60e8849

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/programs/http_client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ const RESOURCE_MAP_SIZES = new Map([
2323

2424
function generateResource(size: number): Uint8Array {
2525
const resource = new Uint8Array(size);
26+
const characters =
27+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
2628
for (let i = 0; i < size; i++) {
27-
resource[i] = Math.floor(Math.random() * 256);
29+
resource[i] = characters.charCodeAt(
30+
Math.floor(Math.random() * characters.length),
31+
);
2832
}
2933
return resource;
3034
}
@@ -79,7 +83,7 @@ export class HttpClient extends ProgramBase {
7983
// Encode HTTP request
8084
// NOTE: For now, as hosts have just one interface, destination ip is hardcoded
8185
const httpRequest = getContentRequest(
82-
this.runner.interfaces[0].toString(),
86+
this.runner.interfaces[0].ip.toString(),
8387
this.resource,
8488
);
8589

0 commit comments

Comments
 (0)