Skip to content

Commit

Permalink
Use a HAR-file
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Dec 12, 2023
1 parent 5565aef commit 8e437a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/offlinepi/offlinepi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#

projectroot=$(realpath "$(dirname "$0")")
responsefile=$projectroot/responses.dat
responsefile=$projectroot/responses.har

mode=$1
shift
Expand Down
10 changes: 6 additions & 4 deletions scripts/offlinepi/offlinepi-record
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ if [ -n "$*" ]; then
exit 1
fi

# Remove the file before starting
rm "$path" 2> /dev/null

# N.B. Additional options must be added _before_ the filter string
exec mitmdump \
-w "$path" \
--set stream_large_bodies=1000m \
--set hardump="$path" \
"~d pypi.org|files.pythonhosted.org|mitm.it"

# stream_large_bodies: must be set to a large value or large responses will not be recorded
# resulting in an unexpected file endings during replays
# hardump: we use a HAR file instead of the binary format (-w <path>) so it the output is
# human readable
# ~d: only interactions with package index domains should be recorded
# we also allow `mitm.it` so healthchecks succeed when replaying

# Helpful notes for development
# --flow-detail <0-4> can be used to adjust the amount information displayed about traffic
1 change: 1 addition & 0 deletions scripts/offlinepi/offlinepi-replay
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if [ -n "$*" ]; then
fi

exec mitmdump --server-replay "$path" \
--flow-detail 3 \
--server-replay-extra 500 \
--set connection_strategy=lazy

Expand Down

0 comments on commit 8e437a9

Please sign in to comment.