The little things give you away... A collection of various small helper stuff
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

22 lignes
926 B

  1. #!/bin/bash
  2. # The first group of sizes covers the range around where the terminating CRLFCRLF gets truncated.
  3. # The second group covers the range around the internal buffer size.
  4. for s in {1048470..1048490} {1048570..1048580}; do
  5. for meta in '' '--meta'; do
  6. expectedHash="$({ if [[ "${meta}" ]]; then printf 'https://example.org/ %d\n' "$s"; fi; yes | tr -d '\n' | head -c "$s"; printf '\n'; } | sha1sum)"
  7. actualHash="$(
  8. {
  9. printf '%s\r\n' 'WARC/1.0' 'Content-Length: '"$s" 'WARC-Type: response' 'WARC-Target-URI: https://example.org/' ''
  10. yes | tr -d '\n' | head -c "$s"
  11. printf '\r\n\r\n'
  12. } | "$(dirname "$0")"/warc-dump-responses ${meta} | sha1sum
  13. )"
  14. if [[ "${expectedHash}" != "${actualHash}" ]]; then
  15. printf 'Error: output mismatch on size %q, meta %q\n' "${s}" "${meta}"
  16. printf 'Expected hash: %q\n' "${expectedHash}"
  17. printf 'Actual hash: %q\n' "${actualHash}"
  18. exit 1
  19. fi
  20. done
  21. done