Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipptool: Add predicate to do an HTTP GET of a URI #22

Closed
wifiprintguy opened this issue Aug 17, 2022 · 4 comments
Closed

ipptool: Add predicate to do an HTTP GET of a URI #22

wifiprintguy opened this issue Aug 17, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request priority-medium
Milestone

Comments

@wifiprintguy
Copy link

It would be useful if tools such as ipptool could do an HTTP GET on a resource at a URL provided by IPP attributes that supply URLs, such as "printer-icons" or "printer-icc-profiles" or "printer-strings-uri". This would allow ipptool to implement tests where the content pointed to by the URL could be validated for reachability and other aspects. While it could be that ipptool supports this using libcurl or something, it could also be supported by libcups.

@michaelrsweet michaelrsweet self-assigned this Aug 17, 2022
@michaelrsweet michaelrsweet added enhancement New feature or request priority-medium labels Aug 17, 2022
@michaelrsweet michaelrsweet added this to the v3.0 milestone Aug 17, 2022
@michaelrsweet michaelrsweet changed the title Add API ability to do an HTTP GET ipptool: Add predicate to do an HTTP GET of a URI Aug 18, 2022
@michaelrsweet
Copy link
Member

michaelrsweet commented Aug 18, 2022

Proposed change:

EXPECT some-attribute OF-TYPE uri WITH-CONTENT "spec"
EXPECT some-attribute OF-TYPE uri WITH-MIME-TYPE "foo/bar[,...,fooN/barN]"

where "spec" is one of the following keywords:

  • available to confirm accessibility (a GET succeeds for http/https URIs and a HEAD succeeds for ipp/ipps URIs)
  • valid to confirm accessibility and perform simple format validation/encoding checks
  • valid-icon to confirm accessibility, proper format, proper dimensions, and the presence of an alpha channel or transparent pixel in PNG icon images

The tests will apply to all URI values (effectively WITH-ALL-CONTENT/WITH-ALL-MIME-TYPES) since there seems little point in just checking one value in this case.

@michaelrsweet
Copy link
Member

Maybe also a SAVE-CONTENT "filename" predicate to save the content to a file?

@wifiprintguy
Copy link
Author

Proposed change:

EXPECT some-attribute OF-TYPE uri WITH-CONTENT "spec"
EXPECT some-attribute OF-TYPE uri WITH-MIME-TYPE "foo/bar[,...,fooN/barN]"

where "spec" is one of the following keywords:

  • available to confirm accessibility (a GET succeeds for http/https URIs and a HEAD succeeds for ipp/ipps URIs)
  • valid to confirm accessibility and perform simple format validation/encoding checks
  • valid-icon to confirm accessibility, proper format, proper dimensions, and the presence of an alpha channel or transparent pixel in PNG icon images

The tests will apply to all URI values (effectively WITH-ALL-CONTENT/WITH-ALL-MIME-TYPES) since there seems little point in just checking one value in this case.

That all sounds good. If the semantics of 'WITH-CONTENT' is 'WITH-ALL-CONTENT' then why not be explicit and use 'WITH-ALL-CONTENT' and 'WITH-ALL-MIME-TYPES'?

Maybe also a SAVE-CONTENT "filename" predicate to save the content to a file?

That looks good - if the "filename" bit is optional then use the filename of the resource pointed to by the URL?

@michaelrsweet
Copy link
Member

@wifiprintguy WRT the filename for SAVE-CONTENT, it can't be optional but we could define it as "directory or filename" where the directory gets the base name from the URL added for the full filename, and/or some substitution sequences to insert the full filename, the filename without the extension, and the extension, something like:

SAVE-ALL-CONTENT "/path/to/test-%basename%-%index%.%ext%"

to save files named as "test-basename-N.ext".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-medium
Projects
Development

No branches or pull requests

2 participants