ipwb icon indicating copy to clipboard operation
ipwb copied to clipboard

Support using Prefer to obtain the raw memento

Open machawk1 opened this issue 5 years ago • 2 comments

RewritingRerouting is currently performed via JS using Reconstructive. The replay system still adds script tags to cause JS to be injected on the client side. We should allow client to obtain the raw mementos' contents.

I believe pywb has implemented this. We should investigate that project's approach to evaluate current support in replay system(s).

http://ws-dl.blogspot.com/2016/08/2016-08-15-mementos-in-raw-take-two.html

/cc @shawnmjones

machawk1 avatar Jul 11 '18 14:07 machawk1

There may be a potential caveat in using request.headers.get('headerName') from flask if multiple Prefers are used. For example:

curl -H "Prefer: radon" -H "Prefer: dukes" http://localhost:5000/memento/20130202100000/memento.us/

when printing request.headers.get('Prefer') for the request. The type of this value is <type 'unicode'>.

Q: In Flask, for multiple instances of the same request header, how does one obtain all instances?

Iterating through all headers would be an effective yet inelegant solution.

Also see https://github.com/pallets/flask/issues/850

machawk1 avatar Aug 07 '18 03:08 machawk1

request.headers.getlist('prefer') even seems to only return one value ([u'dukes']) despite two being specified in the above curl command.

machawk1 avatar Aug 07 '18 03:08 machawk1