-
Bug
-
Resolution: Incomplete
-
None
-
1.20.12 Hotfix
-
None
-
Unconfirmed
See comment: this is only a difference between how Windows and Linux handle GET requests.
Running a BDS server on Linux Ubuntu 20.04.6 LTS, utilizing the gametest @minecraft/server-net.HttpRequest method, and noticing that headers and request payloads are not sent from BDS on Linux while they are sent from BDS on Windows. Both client and server code is the same, and I can confirm that requests are reaching the server from the BDS client on both platforms.
Running netcat on Linux shows the following:
GET /write_state HTTP/1.1 Host: 127.0.0.1:8888 Accept: */* User-Agent: libhttpclient/1.0.0.0
While running ncat on Windows shows the following:
GET /update HTTP/1.1 Connection: Keep-Alive User-Agent: libhttpclient/1.0.0.0 Content-Length: 53 Host: 127.0.0.1:8888 {"time":5000,"weather":0,"entities":{},"messages":[]}
Note the content length header and the payload (both requests should have a payload).
Code sample:
const req = new mcnet.HttpRequest(HOST + endpoint); req.setTimeout(0.5); if (body !== undefined) req.setBody(body); if (headers !== undefined) { const headerObjs: mcnet.HttpHeader[] = []; for (const [k, v] of Object.entries(headers)) { headerObjs.push(new mcnet.HttpHeader(k, v)); } req.setHeaders(headerObjs); } let res; try { res = await mcnet.http.request(req); } catch(e) { console.error('Invalid request: ', e); return; }
Let me know if there is anything that would help narrow this down. Thanks!