@@ -438,35 +438,70 @@ As real Vuforia does, the mock returns a 401 response with the
438438server keys but which names any other database, including one named by its
439439name rather than by its ID.
440440
441- Real Vuforia returns a presigned URL for cloud storage.
442- The mock returns a URL served by the mock itself, without the query
443- parameters of a presigned URL, so the mock's URL never expires where a real
444- one expires after just under seven days.
441+ Real Vuforia returns a presigned URL for cloud storage, of this form:
442+
443+ .. code-block :: text
444+
445+ https://guacamole-targetstore-production-targets.s3.us-west-1.amazonaws.com/reports/{database_id}/{file_name}.csv
446+ ?X-Amz-Security-Token=...
447+ &X-Amz-Algorithm=AWS4-HMAC-SHA256
448+ &X-Amz-Date=20260808T210052Z
449+ &X-Amz-SignedHeaders=host
450+ &X-Amz-Credential=.../20260808/us-west-1/s3/aws4_request
451+ &X-Amz-Expires=604799
452+ &X-Amz-Signature=...
453+
454+ The mock returns a URL with the same path and the same query parameters,
455+ served by the mock itself rather than by cloud storage.
445456The URL returned by the Flask and Docker mock is built from the
446457:envvar: `VWS_BASE_URL ` environment variable.
447- The report takes :paramref: ` ~mock_vws.MockVWS.processing_time_seconds `
448- seconds to generate in the mock .
449- The documentation says a real report takes between a few seconds and one
450- hour, but a report for a database with no recognitions has been observed
451- ready within seconds .
458+ The credential, the security token and the signature are placeholders of
459+ the right shape .
460+ The mock does not check the signature, so a URL whose signature or file name
461+ has been changed, which real Vuforia refuses with a `` SignatureDoesNotMatch ``
462+ error document, is served by the mock as if it were signed .
452463
453464Real Vuforia names the report file after the requested month, and does so
454465differently for each of the two months it accepts.
455- A report for the current month is named for the date and the hour, such as
466+ A report for the current month is named for the UTC date and hour, such as
456467``2026-08-08-21.csv ``, and a report for the previous month is named for the
457468month, such as ``2026-07.csv ``.
458- The mock names every report after an opaque report identifier, so the
459- requested month cannot be recovered from the mock's URL, and two requests for
460- the same month never give the same URL.
461-
462- The mock's URL returns a 404 response until the report is ready, and requires
463- no authorization.
464- The lack of authorization matches real Vuforia, whose URL carries its own
465- signature.
466-
467- .. admonition :: Unverified assumption
468-
469- :ref: `unverified-reco-counts-report-not-ready `
469+ The mock does the same, so two requests for the same month in the same hour
470+ name the same file, and two requests for the previous month always do.
471+ Real Vuforia does not generate the report again for such a request: the URL
472+ which the second request returns serves the file which the first request
473+ generated, unchanged.
474+ The mock does the same, so recognition counts set between the two requests
475+ are not in the report which the second URL serves.
476+
477+ The URL expires ``X-Amz-Expires `` seconds after its ``X-Amz-Date ``, which
478+ is one second under seven days.
479+ Real Vuforia's storage checks that the URL is in date before it checks the
480+ signature, so a URL whose ``X-Amz-Date `` or ``X-Amz-Expires `` has been
481+ edited to put it out of date gives the same 403 response as a URL which has
482+ expired, even though the edit invalidates the signature.
483+ The mock honors those two parameters in the same way, so code which handles
484+ a stale URL can be tested by editing them.
485+ The 403 response is the XML ``AccessDenied `` error document which Amazon S3
486+ gives, with a ``Request has expired `` message, the expiry time and the
487+ server time.
488+ A URL without those parameters gives the ``AccessDenied `` error document
489+ with an ``Access Denied `` message, as it does on real Vuforia.
490+
491+ Until the report is ready, the URL gives a 404 response with the XML
492+ ``NoSuchKey `` error document which Amazon S3 gives, naming the file's key.
493+ The mock does the same, and the mock gives the same response for a file
494+ which no request generated.
495+ The mock's error documents carry random request identifiers where Amazon's
496+ carry its own.
497+ The report takes :paramref: `~mock_vws.MockVWS.processing_time_seconds `
498+ seconds to generate in the mock.
499+ The documentation says a real report takes between a few seconds and one
500+ hour, but a real report has been observed ready within a second of the
501+ request, and the 404 response has been observed by fetching the URL straight
502+ after the request.
503+ The download requires no authorization beyond the query parameters of the
504+ URL, as on real Vuforia.
470505
471506Paths which the mock does not serve
472507-----------------------------------
0 commit comments