pycups icon indicating copy to clipboard operation
pycups copied to clipboard

Accept queue keyword arg in Connection_getJobs

Open guilhermgonzaga opened this issue 2 years ago • 0 comments

Hello.

This PR is based on the proposal #4, but I thought a better approach to it would be to use the string library rather than regex. Still, there are some technicalities to discuss.

First is queue name length. In the very unlikely case that the limit (998 bytes) is reached, trimming the queue name should be worse than failing, since it may still be a valid request, but not the intended one.

Second, I found that RFC 3986 section 3.3 specifies a few more valid characters in the path component, depending on the rule used. Since all IPP URIs are absolute (RFC 3510 section 4.1), the following should be valid:

Char Rule/Category
ALPHA unreserved
DIGIT unreserved
- unreserved
. unreserved
_ unreserved
~ unreserved
! sub-delims
$ sub-delims
& sub-delims
' sub-delims
( sub-delims
) sub-delims
* sub-delims
+ sub-delims
, sub-delims
; sub-delims
= sub-delims
:
@

I did create a few dummy printers in Ubuntu using all of those chars, except ', which lp rejected, and I was able to send jobs and query them with getJobs in Python.

Close #4.

guilhermgonzaga avatar Feb 13 '23 23:02 guilhermgonzaga