]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Changed CGI code to send IPP_PORT environment variable in addition to
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 25 Jun 1999 12:53:01 +0000 (12:53 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Fri, 25 Jun 1999 12:53:01 +0000 (12:53 +0000)
SERVER_PORT to match recent change in ippPort() function.

Changed AddClass() and AddPrinter() code to set URI, and SetPrinterAttrs()
to use the URI as provided (this should fix remote printing).

Changed DEBUG_printf() to LogMessage(LOG_DEBUG, ...) in AddPrinterFilter().

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@469 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/classes.c
scheduler/client.c
scheduler/printers.c

index 15c49e4b2c7df482097f1c840b44976a00c3d4a9..31e602a927f6c75078b529a55b087018fa689a13 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: classes.c,v 1.8 1999/06/25 12:35:32 mike Exp $"
+ * "$Id: classes.c,v 1.9 1999/06/25 12:53:00 mike Exp $"
  *
  *   Printer class routines for the Common UNIX Printing System (CUPS).
  *
@@ -56,7 +56,12 @@ AddClass(char *name)         /* I - Name of class */
   */
 
   if ((c = AddPrinter(name)) != NULL)
+  {
     c->type = CUPS_PRINTER_CLASS;
+    sprintf(c->uri, "ipp://%s:%d/classes/%s", ServerName,
+            ntohs(Listeners[0].address.sin_port), name);
+    SetPrinterAttrs(c);
+  }
 
   return (c);
 }
@@ -509,5 +514,5 @@ SaveAllClasses(void)
 
 
 /*
- * End of "$Id: classes.c,v 1.8 1999/06/25 12:35:32 mike Exp $".
+ * End of "$Id: classes.c,v 1.9 1999/06/25 12:53:00 mike Exp $".
  */
index 94f07c0fbfa99aaf0ef51d2ffec386eec8a8df2e..9933fcaa0b45e83d909668e22e566cce9315a776 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: client.c,v 1.25 1999/06/21 19:43:48 mike Exp $"
+ * "$Id: client.c,v 1.26 1999/06/25 12:53:00 mike Exp $"
  *
  *   Client routines for the Common UNIX Printing System (CUPS) scheduler.
  *
@@ -1334,6 +1334,7 @@ pipe_command(client_t *con,       /* I - Client connection */
   static char  lang[1024];             /* LANG env variable */
   static char  content_length[1024];   /* CONTENT_LENGTH env variable */
   static char  content_type[1024];     /* CONTENT_TYPE env variable */
+  static char  ipp_port[1024];         /* Default listen port */
   static char  server_port[1024];      /* Default listen port */
   static char  server_name[1024];      /* Default listen hostname */
   static char  remote_host[1024];      /* REMOTE_HOST env variable */
@@ -1396,6 +1397,7 @@ pipe_command(client_t *con,       /* I - Client connection */
   gethostname(hostname, sizeof(hostname) - 1);
 
   sprintf(lang, "LANG=%s", con->language ? con->language->language : "C");
+  sprintf(ipp_port, "IPP_PORT=%d", ntohs(con->http.hostaddr.sin_port));
   sprintf(server_port, "SERVER_PORT=%d", ntohs(con->http.hostaddr.sin_port));
   sprintf(server_name, "SERVER_NAME=%s", hostname);
   sprintf(remote_host, "REMOTE_HOST=%s", con->http.hostname);
@@ -1406,18 +1408,19 @@ pipe_command(client_t *con,     /* I - Client connection */
   envp[1]  = "SERVER_SOFTWARE=CUPS/1.0";
   envp[2]  = "GATEWAY_INTERFACE=CGI/1.1";
   envp[3]  = "SERVER_PROTOCOL=HTTP/1.1";
-  envp[4]  = server_name;
-  envp[5]  = server_port;
-  envp[6]  = remote_host;
-  envp[7]  = remote_user;
-  envp[8]  = lang;
-  envp[9]  = "TZ=GMT";
-  envp[10] = tmpdir;
+  envp[4]  = ipp_port;
+  envp[5]  = server_name;
+  envp[6]  = server_port;
+  envp[7]  = remote_host;
+  envp[8]  = remote_user;
+  envp[9]  = lang;
+  envp[10] = "TZ=GMT";
+  envp[11] = tmpdir;
 
   if (con->operation == HTTP_GET)
   {
-    envp[11] = "REQUEST_METHOD=GET";
-    envp[12] = NULL;
+    envp[12] = "REQUEST_METHOD=GET";
+    envp[13] = NULL;
   }
   else
   {
@@ -1425,10 +1428,10 @@ pipe_command(client_t *con,     /* I - Client connection */
     sprintf(content_type, "CONTENT_TYPE=%s",
             con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
 
-    envp[11] = "REQUEST_METHOD=POST";
-    envp[12] = content_length;
-    envp[13] = content_type;
-    envp[14] = NULL;
+    envp[12] = "REQUEST_METHOD=POST";
+    envp[13] = content_length;
+    envp[14] = content_type;
+    envp[15] = NULL;
   }
 
  /*
@@ -1497,5 +1500,5 @@ pipe_command(client_t *con,       /* I - Client connection */
 
 
 /*
- * End of "$Id: client.c,v 1.25 1999/06/21 19:43:48 mike Exp $".
+ * End of "$Id: client.c,v 1.26 1999/06/25 12:53:00 mike Exp $".
  */
index 9546ecb16c3467a406ebf19ef332144f9a56cdf4..bc84ab3f8807809b80938bd05244058d0d46edbc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: printers.c,v 1.29 1999/06/25 12:30:47 mike Exp $"
+ * "$Id: printers.c,v 1.30 1999/06/25 12:53:01 mike Exp $"
  *
  *   Printer routines for the Common UNIX Printing System (CUPS).
  *
@@ -71,6 +71,9 @@ AddPrinter(char *name)                /* I - Name of printer */
 
   strcpy(p->name, name);
   strcpy(p->hostname, ServerName);
+  sprintf(p->uri, "ipp://%s:%d/printers/%s", ServerName,
+          ntohs(Listeners[0].address.sin_port), name);
+
   p->state     = IPP_PRINTER_STOPPED;
   p->accepting = 0;
   p->filetype  = mimeAddType(MimeDatabase, "printer", name);
@@ -152,9 +155,10 @@ AddPrinterFilter(printer_t *p,             /* I - Printer to add to */
     if ((super[0] == '*' || strcmp((*temptype)->super, super) == 0) &&
         (type[0] == '*' || strcmp((*temptype)->type, type) == 0))
     {
-      DEBUG_printf(("Adding filter %s/%s %s/%s %d %s\n", (*temptype)->super,
-                    (*temptype)->type, p->filetype->super, p->filetype->type,
-                    cost, program));
+      LogMessage(LOG_DEBUG, "Adding filter %s/%s %s/%s %d %s",
+                 (*temptype)->super, (*temptype)->type,
+                p->filetype->super, p->filetype->type,
+                 cost, program);
       mimeAddFilter(MimeDatabase, *temptype, p->filetype, cost, program);
     }
 }
@@ -656,12 +660,6 @@ SetPrinterAttrs(printer_t *p)      /* I - Printer to setup */
 
   p->attrs = ippNew();
 
-  if (p->type & CUPS_PRINTER_CLASS)
-    sprintf(p->uri, "ipp://%s:%d/classes/%s", ServerName,
-            ntohs(Listeners[0].address.sin_port), p->name);
-  else
-    sprintf(p->uri, "ipp://%s:%d/printers/%s", ServerName,
-            ntohs(Listeners[0].address.sin_port), p->name);
   ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "printer-uri-supported",
                NULL, p->uri);
   ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
@@ -1010,5 +1008,5 @@ StopPrinter(printer_t *p) /* I - Printer to stop */
 
 
 /*
- * End of "$Id: printers.c,v 1.29 1999/06/25 12:30:47 mike Exp $".
+ * End of "$Id: printers.c,v 1.30 1999/06/25 12:53:01 mike Exp $".
  */