Archived Forum Post

Index of archived forum posts

Question:

HTTP Session Log to Memory Instead of File?

May 23 '16 at 10:44

Is there any way that the entire session log could be stored in memory instead of having the overhead of file I/O?


Answer

The decision to log to a file and not memory (if the Http.SessionLogFilename property is set) is for two reasons:

  1. The session data can potentially be very large if uploading or downloading large amounts of data.
  2. The session data is likely to be binary because of compressed content, chunked transfers, or binary MIME payloads. Therefore, even if it was in memory, it would need to be as a byte array.

One alternative is to set the Http.KeepResponseBody property equal to True. Then after each HTTP request/response, your application could add the contents of the Http.LastStatus, Http.LastResponseHeader, and Http.LastResponseBody to an in-memory log. The LastResponseBody is a string property, and therefore would only make sense if the HTTP response was text.