ravinet/mahimahi — pull request #69 by anirudhSK (2014-07-22 05:14:24+00:00)
Title: Loadurl fixes

Hey Ravi,

A few comments. The length fields must be fixed-width and hence encoded in binary, not ASCII (as to_string does).

My suggestion for the next step would be to:
0. Replace HTTPConsoleStore with HTTPMemoryStore in url_loader.cc.
1. Write a HTTPMemoryStore::persist() method to persist the HTTPMemoryStore's contents to a file on disk.
2. persist() should call serialize_to_string() and then write the returned value into a file (say F).
3. Write an OFFLINE parser (./bulk-response-parser) to parse F. You can use the pattern @keithw used in colette here: https://github.com/keithw/colette/blob/a89a6cde2ceb17b51b8f23a52b61cdee1c841b83/packet.cc#L28 (That piece of code takes a wire representation and makes a struct out of it).
4. Then, encapsulate the bulk-response-parser logic into its own class BulkResponseParser and make sure it can operate in a streaming fashion where bytes arrive one at a time (in the worst case).
5. Then, write the bulk response from the remote server to the client.
6. Parse it using the BulkResponseParser class within the client.