}
else
{
- ipp_tag_t group; /* Current group tag */
-
cupsdLogPrinter(printer, CUPSD_LOG_ERROR, "PPD creation failed: %s", cupsGetErrorString());
/* Force printer to timeout and be deleted */
cupsRWUnlock(&printer->lock);
send_ipp_status(con, IPP_STATUS_ERROR_DEVICE, _("Unable to create PPD: %s"), cupsGetErrorString());
+ goto finish_response;
+ }
+
+ /*
+ * Respond to the client...
+ */
+
+ send_ipp_status(con, IPP_STATUS_OK, _("Local printer created."));
+
+ ippAddBoolean(con->response, IPP_TAG_PRINTER, "printer-is-accepting-jobs", (char)printer->accepting);
+ ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", (int)printer->state);
+ add_printer_state_reasons(con, printer);
+
+ httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), httpIsEncrypted(con->http) ? "ipps" : "ipp", NULL, con->clientname, con->clientport, "/printers/%s", printer->name);
+ ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI, "printer-uri-supported", NULL, uri);
+
+ finish_response:
+
+ if (ippGetStatusCode(con->response) >= IPP_STATUS_ERROR_BAD_REQUEST && response)
+ {
+ ipp_tag_t group; /* Current group tag */
cupsdLogClient(con, CUPSD_LOG_DEBUG, "Printer attributes:");
}
cupsdLogClient(con, CUPSD_LOG_DEBUG, "end-of-attributes-tag");
-
- goto finish_response;
}
- /*
- * Respond to the client...
- */
-
- send_ipp_status(con, IPP_STATUS_OK, _("Local printer created."));
-
- ippAddBoolean(con->response, IPP_TAG_PRINTER, "printer-is-accepting-jobs", (char)printer->accepting);
- ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", (int)printer->state);
- add_printer_state_reasons(con, printer);
-
- httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), httpIsEncrypted(con->http) ? "ipps" : "ipp", NULL, con->clientname, con->clientport, "/printers/%s", printer->name);
- ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI, "printer-uri-supported", NULL, uri);
-
- finish_response:
-
ippDelete(response);
send_response(con);
p->filetypes = mimeGetFilterTypes(MimeDatabase, p->filetype, NULL);
- if ((type = mimeType(MimeDatabase, "application", "pdf")) != NULL && cupsArrayFind(p->filetypes, type))
- preferred = "application/pdf";
-
/*
* Add the file formats that can be filtered...
*/
- cupsdLogPrinter(p, CUPSD_LOG_DEBUG2, "add_printer_formats: %d supported types", cupsArrayCount(p->filetypes) + 1);
+ if ((type = mimeType(MimeDatabase, "application", "octet-stream")) != NULL && !cupsArrayFind(p->filetypes, type))
+ i = 1;
+ else
+ i = 0;
+
+ cupsdLogPrinter(p, CUPSD_LOG_DEBUG2, "add_printer_formats: %d supported types", cupsArrayCount(p->filetypes) + i);
- if ((attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_MIMETYPE, "document-format-supported", cupsArrayCount(p->filetypes) + 1, NULL, NULL)) == NULL)
+ if ((attr = ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_MIMETYPE, "document-format-supported", cupsArrayCount(p->filetypes) + i, NULL, NULL)) == NULL)
{
cupsdLogPrinter(p, CUPSD_LOG_ERROR, "Unable to create document-format-supported attribute.");
return;
}
- attr->values[0].string.text = _cupsStrAlloc("application/octet-stream");
- cupsdLogPrinter(p, CUPSD_LOG_DEBUG2, "add_printer_formats: document-format-supported[0]='application/octet-stream'");
+ if (i)
+ {
+ attr->values[0].string.text = _cupsStrAlloc("application/octet-stream");
+ cupsdLogPrinter(p, CUPSD_LOG_DEBUG2, "add_printer_formats: document-format-supported[0]='application/octet-stream'");
+ }
- for (i = 1, type = (mime_type_t *)cupsArrayFirst(p->filetypes); type; i ++, type = (mime_type_t *)cupsArrayNext(p->filetypes))
+ for (type = (mime_type_t *)cupsArrayFirst(p->filetypes); type; i ++, type = (mime_type_t *)cupsArrayNext(p->filetypes))
{
snprintf(mimetype, sizeof(mimetype), "%s/%s", type->super, type->type);
attr->values[i].string.text = _cupsStrAlloc(mimetype);
cupsdLogPrinter(p, CUPSD_LOG_DEBUG2, "add_printer_formats: document-format-supported[%d]='%s'", i, mimetype);
+
+ if (!strcmp(mimetype, "application/pdf"))
+ preferred = "application/pdf";
}
ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_MIMETYPE), "document-format-preferred", NULL, preferred);