I’m handling an incoming request via app.HandleURL which is working great and I return the data via response.Write. All was going well until some of the incoming requests are taking longer to build, thus, stopping any further incoming requests to be processed until previous ones are completed.
Is there a way to ‘response.Write’ from within a session? That way I can offload the processing to the session, freeing up .app to handle more incoming requests.
Usually the way web servers handle this is to immediately return a status of 202 (Accepted) and then start a thread to do the processing. Maybe in your case, to write the data to a file. The client is then expected to make later calls to see if processing of their request is done through a HEAD request (just requesting headers). From there, a response of 204 (no content) or 206 (partial content) or 200 (OK) are used to indicate the progress of the request. Once the 200 response is received, the client does a full GET request to download the full content.
If the content is still too big, consider having Apache return the file so it doesn’t tie up your app using a location response header.