Skip to content

Commit

Permalink
Fix various Content-Lenght's
Browse files Browse the repository at this point in the history
  • Loading branch information
NuSkooler committed Feb 1, 2023
1 parent a829905 commit 98d37e9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/http_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function postJson(url, json, options, cb) {

function _makeRequest(url, options, cb) {
if (options.body) {
options.headers['Content-Length'] = options.body.length;
options.headers['Content-Length'] = Buffer(options.body).length;

if (options?.sign?.headers?.includes('digest')) {
options.headers['Digest'] =
Expand Down
6 changes: 3 additions & 3 deletions core/servers/content/web_handlers/activitypub.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ exports.getModule = class ActivityPubWebHandler extends WebHandlerModule {
const body = JSON.stringify(collection);
const headers = {
'Content-Type': ActivityStreamMediaType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};

resp.writeHead(200, headers);
Expand Down Expand Up @@ -715,7 +715,7 @@ exports.getModule = class ActivityPubWebHandler extends WebHandlerModule {

const headers = {
'Content-Type': ActivityStreamMediaType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};

resp.writeHead(200, headers);
Expand Down Expand Up @@ -746,7 +746,7 @@ exports.getModule = class ActivityPubWebHandler extends WebHandlerModule {

const headers = {
'Content-Type': contentType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};

resp.writeHead(200, headers);
Expand Down
2 changes: 1 addition & 1 deletion core/servers/content/web_handlers/nodeinfo2.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ exports.getModule = class NodeInfo2WebHadnler extends WebHandlerModule {
const body = JSON.stringify(nodeInfo);
const headers = {
'Content-Type': 'application/json',
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};

resp.writeHead(200, headers);
Expand Down
4 changes: 2 additions & 2 deletions core/servers/content/web_handlers/webfinger.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ exports.getModule = class WebFingerWebHandler extends WebHandlerModule {

const headers = {
'Content-Type': contentType,
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};

resp.writeHead(200, headers);
Expand Down Expand Up @@ -176,7 +176,7 @@ exports.getModule = class WebFingerWebHandler extends WebHandlerModule {

const headers = {
'Content-Type': 'application/jrd+json',
'Content-Length': body.length,
'Content-Length': Buffer(body).length,
};

resp.writeHead(200, headers);
Expand Down

0 comments on commit 98d37e9

Please sign in to comment.