ipp backend does not set compression for Send-Document operation #4181

Closed
michaelrsweet opened this Issue Sep 7, 2012 · 3 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Sep 7, 2012

Version: 1.5.4
CUPS.org User: krumboeck

Whenever the ipp backend uses "Create-Job" instead of "Print-Job", the parameter "compression" leads to printing problems (because the remote side does not decompress the data). The backend does not set the operation attribute "compression" for "Send-Document" operation.

Please check the attached patch and correct it, if necessary.

regards,
Bernd

Collaborator

michaelrsweet commented Sep 15, 2012

CUPS.org User: mike

Fixed in Subversion repository.

Collaborator

michaelrsweet commented Sep 15, 2012

"cups-1.5.4-ipp-comp.patch":

--- backend/ipp.c.orig 2012-09-07 07:40:49.000000000 +0200
+++ backend/ipp.c 2012-09-07 11:34:59.000000000 +0200
@@ -99,6 +99,7 @@
/* Password tries /
static const char * const pattrs[] = /
Printer attributes we want */
{

  • "compression-supported",
    "copies-supported",
    "cups-version",
    "document-format-supported",
    @@ -229,6 +230,7 @@
    int job_id; /* job-id value /
    ipp_attribute_t *job_sheets; /
    job-media-sheets-completed /
    ipp_attribute_t *job_state; /
    job-state */

  • ipp_attribute_t compression_sup; / compression-supported /
    ipp_attribute_t *copies_sup; /
    copies-supported /
    ipp_attribute_t *cups_version; /
    cups-version /
    ipp_attribute_t *format_sup; /
    document-format-supported /
    @@ -245,7 +247,8 @@
    copies_remaining; /
    Number of copies remaining /
    const char *content_type, /
    CONTENT_TYPE environment variable /
    *final_content_type, /
    FINAL_CONTENT_TYPE environment var */

  •   _document_format;   /_ document-format value */
    
  •   _document_format,   /_ document-format value */
    
  •   *compression_format;    /* compression-format value */
    

    int fd; /* File descriptor /
    off_t bytes = 0; /
    Bytes copied /
    char buffer[16384]; /
    Copy buffer */
    @@ -794,6 +797,7 @@

    • copies...
      */
  • compression_sup = NULL;
    copies_sup = NULL;
    cups_version = NULL;
    format_sup = NULL;
    @@ -986,6 +990,16 @@

  • Check for supported attributes...
    */

  • if ((compression_sup = ippFindAttribute(supported, "compression-supported",

  •                                 IPP_TAG_KEYWORD)) != NULL)
    
  • {

  •  fprintf(stderr, "DEBUG: compression-supported (%d values)\n",
    
  •     compression_sup->num_values);
    
  •  for (i = 0; i < compression_sup->num_values; i ++)
    
  • fprintf(stderr, "DEBUG: [%d] = "%s"\n", i,

  •       compression_sup->values[i].string.text);
    
  • }

if ((copies_sup = ippFindAttribute(supported, "copies-supported",
IPP_TAG_RANGE)) != NULL)
{
@@ -1202,8 +1216,26 @@
}
}

  • fprintf(stderr, "DEBUG: final_content_type="%s", document_format="%s"\n",
  •      final_content_type, document_format ? document_format : "(null)");
    
  • compression_format = NULL;
  • if (compression_sup != NULL)
  • {
  • for (i = 0; i < compression_sup->num_values; i ++)
  •  if (!_cups_strcasecmp(compression,
    
  •                        compression_sup->values[i].string.text))
    
  •  {
    
  •    compression_format = compression;
    
  • break;
  •  }
    
  • }
  • if (!compression_format)
  • {
  • perror("DEBUG: Requested compression not supported");
  • return (CUPS_BACKEND_FAILED);
  • }
  • fprintf(stderr, "DEBUG: final_content_type="%s", document_format="%s", compression="%s"\n",

  •      final_content_type, document_format ? document_format : "(null)", compression_format ? compression_format : "none");
    

    /*

    • If the printer does not support HTTP/1.1 (which IPP requires), copy stdin
      @@ -1284,7 +1316,7 @@
      while (!job_canceled && validate_job)
      {
      request = new_request(IPP_VALIDATE_JOB, version, uri, argv[2],
  •                      monitor.job_name, num_options, options, compression,
    
  •                      monitor.job_name, num_options, options, compression_format,
          copies_sup ? copies : 1, document_format, pc,
          media_col_sup, doc_handling_sup);
    

@@ -1357,7 +1389,7 @@
request = new_request((num_files > 1 || create_job) ? IPP_CREATE_JOB :
IPP_PRINT_JOB,
version, uri, argv[2], monitor.job_name, num_options,

  •         options, compression, copies_sup ? copies : 1,
    
  •         options, compression_format, copies_sup ? copies : 1,
          document_format, pc, media_col_sup, doc_handling_sup);
    

    /*
    @@ -1568,6 +1600,10 @@
    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
    "document-format", NULL, document_format);

  • if (compression_format)

  • ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
    
  •          "compression", NULL, compression_format);
    

    fprintf(stderr, "DEBUG: Sending file %d using chunking...\n", i + 1);
    http_status = cupsSendRequest(http, request, resource, 0);
    if (http_status == HTTP_CONTINUE && request->state == IPP_DATA)

Collaborator

michaelrsweet commented Sep 15, 2012

"str4181.patch":

Index: backend/ipp.c

--- backend/ipp.c (revision 10596)
+++ backend/ipp.c (working copy)
@@ -1578,6 +1578,10 @@
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, document_format);

  •    if (compression)
    
  • ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
    
  •          "compression", NULL, compression);
    
    fprintf(stderr, "DEBUG: Sending file %d using chunking...\n", i + 1);
    http_status = cupsSendRequest(http, request, resource, 0);
    if (http_status == HTTP_CONTINUE && request->state == IPP_DATA)

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment