koush / AndroidAsync

Asynchronous socket, http(s) (client+server) and websocket library for android. Based on nio, not threads.
Other
7.51k stars 1.56k forks source link

Reponse header disordered after request sometimes #691

Open flyinmind opened 3 years ago

flyinmind commented 3 years ago

Following codes, run many times, the response header disordered.

        public void onRequest(AsyncHttpServerRequest req, final AsyncHttpServerResponse resp) {

... pool.execute(new Runnable() { @Override public void run() { .... resp.send(fm.contentType(), fm.read()); resp.end(); } }); }

Expected is: // { "framework": "Vue"}

/**/ (function(modules) { // webpackBootstrap /**/ // The module cache /**/ var installedModules = {};

Exactly response is:(Header is in body, and lost some content of the file)

HTTP/1.1 200 OK Connection: Keep-Alive Content-Length: 24589 Content-Type: application/javascript; charset=utf-8

bb94-450a7ea35ac1 Host: 127.0.0.1:8080 Accept-Encoding: gzip, deflate, br Connection: keep-alive

__(moduleId) { /**/ /**/ // Check if module is in cache /**/ if(installedModules[moduleId]) {