From 94d603ac662063438576f19913657aa59f119f0e Mon Sep 17 00:00:00 2001 From: Ciprian Dorin Craciun Date: Fri, 26 Aug 2022 16:25:08 +0300 Subject: [PATCH] [archiver] Add with/without slash redirects as part of the archive. --- examples/hello-world.cdb | Bin 4259 -> 9370 bytes examples/hello-world.cdb-dump | 293 ++++++++++++++++-- examples/hello-world/_redirects.txt | 12 + .../tests/redirects/_redirects.txt | 5 + scripts/examples.z-run | 5 +- sources/cmd/archiver/archiver.go | 96 ++++++ 6 files changed, 387 insertions(+), 24 deletions(-) create mode 100644 examples/hello-world/_redirects.txt create mode 100644 examples/hello-world/tests/redirects/_redirects.txt diff --git a/examples/hello-world.cdb b/examples/hello-world.cdb index 62d7f77242251c81872eea676486e4f068b30d8f..884365d988d69a885bee1e2c2533f692c104a599 100644 GIT binary patch literal 9370 zcmc&2TZ~;*by`sHRsnfxp^;0vjijx780BjWf&DnAGi4q)_hL(H z5fp+}Kod2}#F&uy2!oH{hhk0S!$fov6Qn$}1pQDj^s6Ebp@O*9y=&jI@0mNpZK=AO z+cj&ib@qDf^*U$q;*ri;1h^jlS|WTHi2MiWxn+9pL?E7Xh@Kw?BL89H9|j`-G2&kf zB41+^{)6?ugeZ68C`#>zxIaFMyK6(_n;7lh-*$qN1a}hLLvTOAMS@EJaUsNW4gkb; zG9jM3Jc_5D7{uofjpEb)Ux<1f9z`wQ8pLysjp8YTA<`S0JLIQoq%m2Ul#HQn?}A^@ zb!#y*Ge5d(eqqLMZUmcVdN!rRCu%m4jtL_jkJBb5Vw;pU9`sK*m$~v@m6^6F^QAY! zm%MOZC~sKdnM$-bnQ>VuGM*Y)mda?UQMXoQlh`{}%(WM$i`Ll0r}mD`nb~4&Vr+WO z7rQTO?{1G>GSLX9~bt(|Z78>Ap*P%n>5C!Nr;hJ%*|@C*CLp?#jJoFzyo4_b;69zlA>@9?iegLrc70-T$*?zA);YZ za_>{H!CR?yr2X!xcKhbmM6`+$SJ9k2Gh_&f+%l0l1M!hK<{%f1kp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HJb@S52NwzF zhBKCBIib$l+}DcYszrfhW}3<2N%$7=f27@P&o `%s`\n", _alternateQualified, _target) + } + { + _dataMeta := map[string]string { + "!Status" : fmt.Sprintf ("%d", 308), + "Location" : _target, + } + if _context.includeCache { + _dataMeta["Cache-Control"] = "public, immutable, max-age=3600" + } + if _, _, _error := archiveReferenceAndDataWithMeta (_context, NamespaceRedirectsContent, _alternateQualified, []byte (""), _dataMeta); _error != nil { + AbortError (_error, "[27a5dabe] failed writing archive!") + } + } + } + } + + sort.Strings (_context.storedFilePaths) + sort.Strings (_context.storedFolderPaths) + sort.Strings (_context.storedRedirectPaths) + if _includePathsIndex { _buffer := make ([]byte, 0, 1024 * 1024) for _, _path := range _context.storedFilePaths {