michaelrsweet / pappl

PAPPL - Printer Application Framework
https://www.msweet.org/pappl
Apache License 2.0
309 stars 49 forks source link

"Missing Required Attributes" while making IPP request to PAPPL as server #229

Closed vermamohit13 closed 1 year ago

vermamohit13 commented 1 year ago

Describe the bug I have been trying to use the new IPP operations added in #214. Every time I make an IPP request , the returned IPP response shows "status-message = Missing required Attributes". I had provided all the necessary attributes as mentioned in IPP-EXTENSIONS.md.

To Reproduce Steps to reproduce the behaviour: Just make the IPP request as shown below -

         request = ippNewRequest(IPP_OP_PAPPL_FIND_DEVICES);
         ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, "utf-8");
         ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, "en-GB");
         ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "system-uri", NULL, "ipp://localhost/ipp/system");
         ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
         response = cupsDoRequest(http, request, "/ipp/system");

Additional context I have found the root cause of this problem. Kindly see - https://github.com/michaelrsweet/pappl/blob/dcb17ee1573c3fb3143ccbc99493b400fc7371c1/pappl/client-ipp.c#L153-L159

The op = IPP_OP_PAPPL_FIND_DEVICES or op = IPP_OP_PAPPL_FIND_DRIVERS will not work.

michaelrsweet commented 1 year ago

This is part of the unit tests in testpappl for the "-t client" mode, and it works. Can you provide a debug log showing the request?

vermamohit13 commented 1 year ago

Sorry for the late reply. How can I generate a debug log?

michaelrsweet commented 1 year ago

So the test suite creates one called "testpappl.log". For any other printer application based on PAPPL, adding "-L debug -l filename.log" to the server sub-command will send a debug log to the specified filename.