weboob.browser.browsers: write new HAR entries without rewriting the full file
HAR file was rewritten on every request, because JSON libs don't allow inserting data in an existing JSON without rewriting the whole file. However, if we put request/response entries at the end of the HAR data, only a fixed suffix exists after the entries. Then we can seek near the file end to a computed position, write the new entry (which overwrites terminators), and we can rewrite the overwritten terminators right after. Not only can we write only the new data, but we do not need to keep track of the shifted bytes. If the HAR wasn't written with the exact same options, we won't seek accurately though.
parent
eb6b68e4
Please register or sign in to comment