/*
- * "$Id: admin.c,v 1.22.2.21 2003/03/21 17:09:50 mike Exp $"
+ * "$Id: admin.c,v 1.22.2.22 2003/04/08 03:48:02 mike Exp $"
*
* Administration CGI for the Common UNIX Printing System (CUPS).
*
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
*/
if (oldinfo)
- ippSetCGIVars(oldinfo, NULL, NULL, NULL);
+ ippSetCGIVars(oldinfo, NULL, NULL, NULL, 0);
cgiCopyTemplateLang(stdout, TEMPLATES, "modify-printer.tmpl", getenv("LANG"));
}
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
strlcpy(make, var, sizeof(make));
- ippSetCGIVars(response, "ppd-make", make, NULL);
+ ippSetCGIVars(response, "ppd-make", make, NULL, 0);
cgiCopyTemplateLang(stdout, TEMPLATES, "choose-model.tmpl",
getenv("LANG"));
}
/*
- * End of "$Id: admin.c,v 1.22.2.21 2003/03/21 17:09:50 mike Exp $".
+ * End of "$Id: admin.c,v 1.22.2.22 2003/04/08 03:48:02 mike Exp $".
*/
/*
- * "$Id: classes.c,v 1.18.2.7 2003/03/21 17:09:50 mike Exp $"
+ * "$Id: classes.c,v 1.18.2.8 2003/04/08 03:48:03 mike Exp $"
*
* Class status CGI for the Common UNIX Printing System (CUPS).
*
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
CUPS_DATADIR "/data/testprint.ps")) != NULL)
{
status = response->request.status.status_code;
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
/*
- * End of "$Id: classes.c,v 1.18.2.7 2003/03/21 17:09:50 mike Exp $".
+ * End of "$Id: classes.c,v 1.18.2.8 2003/04/08 03:48:03 mike Exp $".
*/
/*
- * "$Id: ipp-var.c,v 1.23.2.9 2003/03/21 17:09:50 mike Exp $"
+ * "$Id: ipp-var.c,v 1.23.2.10 2003/04/08 03:48:03 mike Exp $"
*
* IPP variable routines for the Common UNIX Printing System (CUPS).
*
ippSetCGIVars(ipp_t *response, /* I - Response data to be copied... */
const char *filter_name, /* I - Filter name */
const char *filter_value, /* I - Filter value */
- const char *prefix) /* I - Prefix for name or NULL */
+ const char *prefix, /* I - Prefix for name or NULL */
+ int parent_el) /* I - Parent element number */
{
int element; /* Element in CGI array */
ipp_attribute_t *attr, /* Attribute in response... */
struct tm *date; /* Date information */
+ DEBUG_printf(("<P>ippSetCGIVars(response=%p, filter_name=\"%s\", filter_value=\"%s\", prefix=\"%s\")\n",
+ response, filter_name, filter_value, prefix));
+
/*
* Set common CGI template variables...
*/
- ippSetServerVersion();
+ if (!prefix)
+ ippSetServerVersion();
/*
* Get the server name associated with the client interface as well as
* Loop through the attributes and set them for the template...
*/
- for (attr = response->attrs;
- attr && attr->group_tag == IPP_TAG_OPERATION;
- attr = attr->next);
+ attr = response->attrs;
- for (element = 0; attr != NULL; attr = attr->next, element ++)
+ if (!prefix)
+ while (attr && attr->group_tag == IPP_TAG_OPERATION)
+ attr = attr->next;
+
+ for (element = parent_el; attr != NULL; attr = attr->next, element ++)
{
/*
* Copy attributes to a separator...
case IPP_TAG_KEYWORD :
case IPP_TAG_CHARSET :
case IPP_TAG_LANGUAGE :
+ case IPP_TAG_MIMETYPE :
strlcat(valptr, attr->values[i].string.text,
sizeof(value) - (valptr - value));
break;
case IPP_TAG_BEGIN_COLLECTION :
+ snprintf(value, sizeof(value), "%s%d", name, i + 1);
ippSetCGIVars(attr->values[i].collection, filter_name,
- filter_value, name);
+ filter_value, value, element);
break;
default :
*/
if (attr->value_tag != IPP_TAG_BEGIN_COLLECTION)
+ {
cgiSetArray(name, element, value);
-/* fprintf(stderr, "DEBUG: %s[%d]=\"%s\"\n", name, element, value);*/
+ DEBUG_printf(("<P>%s[%d]=\"%s\"\n", name, element, value));
+ }
}
if (attr == NULL)
break;
}
+
+ DEBUG_puts("<P>Leaving ippSetCGIVars()...");
}
/*
- * End of "$Id: ipp-var.c,v 1.23.2.9 2003/03/21 17:09:50 mike Exp $".
+ * End of "$Id: ipp-var.c,v 1.23.2.10 2003/04/08 03:48:03 mike Exp $".
*/
/*
- * "$Id: ipp-var.h,v 1.5.2.3 2003/03/21 17:09:51 mike Exp $"
+ * "$Id: ipp-var.h,v 1.5.2.4 2003/04/08 03:48:03 mike Exp $"
*
* IPP variable definitions for the Common UNIX Printing System (CUPS).
*
extern char *ippGetTemplateDir(void);
extern void ippSetServerVersion(void);
-extern void ippSetCGIVars(ipp_t *, const char *, const char *, const char *);
+extern void ippSetCGIVars(ipp_t *, const char *, const char *,
+ const char *, int);
/*
- * End of "$Id: ipp-var.h,v 1.5.2.3 2003/03/21 17:09:51 mike Exp $".
+ * End of "$Id: ipp-var.h,v 1.5.2.4 2003/04/08 03:48:03 mike Exp $".
*/
/*
- * "$Id: jobs.c,v 1.15.2.9 2003/03/21 17:09:51 mike Exp $"
+ * "$Id: jobs.c,v 1.15.2.10 2003/04/08 03:48:03 mike Exp $"
*
* Job status CGI for the Common UNIX Printing System (CUPS).
*
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
/*
- * End of "$Id: jobs.c,v 1.15.2.9 2003/03/21 17:09:51 mike Exp $".
+ * End of "$Id: jobs.c,v 1.15.2.10 2003/04/08 03:48:03 mike Exp $".
*/
/*
- * "$Id: printers.c,v 1.21.2.8 2003/03/21 17:09:51 mike Exp $"
+ * "$Id: printers.c,v 1.21.2.9 2003/04/08 03:48:03 mike Exp $"
*
* Printer status CGI for the Common UNIX Printing System (CUPS).
*
const char *op; /* Operation to perform, if any */
+ setbuf(stdout, NULL);
+
/*
* Get any form variables...
*/
* Tell the client to expect HTML...
*/
- printf("Content-Type: text/html;charset=%s\n\n", cupsLangEncoding(language));
+ printf("Content-Type: text/html;charset=%s\r\n\r\n",
+ cupsLangEncoding(language));
/*
* See if we need to show a list of printers or the status of a
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
+ else if (printer)
+ fprintf(stderr, "ERROR: Get-Printer-Attributes request failed - %s (%x)\n",
+ ippErrorString(cupsLastError()), cupsLastError());
+ else
+ fprintf(stderr, "ERROR: CUPS-Get-Printers request failed - %s (%x)\n",
+ ippErrorString(cupsLastError()), cupsLastError());
/*
* Write the report...
if ((response = cupsDoRequest(http, request, "/")) != NULL)
{
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
cgiCopyTemplateLang(stdout, TEMPLATES, "jobs.tmpl", getenv("LANG"));
}
+ else
+ fprintf(stderr, "ERROR: Get-Jobs request failed - %s (%x)\n",
+ ippErrorString(cupsLastError()), cupsLastError());
}
}
else
CUPS_DATADIR "/data/testprint.ps")) != NULL)
{
status = response->request.status.status_code;
- ippSetCGIVars(response, NULL, NULL, NULL);
+ ippSetCGIVars(response, NULL, NULL, NULL, 0);
ippDelete(response);
}
/*
- * End of "$Id: printers.c,v 1.21.2.8 2003/03/21 17:09:51 mike Exp $".
+ * End of "$Id: printers.c,v 1.21.2.9 2003/04/08 03:48:03 mike Exp $".
*/
/*
- * "$Id: http.c,v 1.82.2.30 2003/03/31 19:20:11 mike Exp $"
+ * "$Id: http.c,v 1.82.2.31 2003/04/08 03:48:04 mike Exp $"
*
* HTTP routines for the Common UNIX Printing System (CUPS).
*
char buffer[8192]; /* Junk buffer */
- while (httpRead(http, buffer, sizeof(buffer)) > 0);
+ if (http->state != HTTP_WAITING)
+ {
+ while (httpRead(http, buffer, sizeof(buffer)) > 0);
+ }
}
case HTTP_POST_RECV :
case HTTP_PUT :
http->state ++;
+ case HTTP_POST_SEND :
break;
default :
int /* O - Content length */
httpGetLength(http_t *http) /* I - HTTP data */
{
- DEBUG_printf(("httpGetLength(%p)\n", http));
+ DEBUG_printf(("httpGetLength(%p), state = %d\n", http, http->state));
if (strcasecmp(http->fields[HTTP_FIELD_TRANSFER_ENCODING], "chunked") == 0)
{
/*
- * End of "$Id: http.c,v 1.82.2.30 2003/03/31 19:20:11 mike Exp $".
+ * End of "$Id: http.c,v 1.82.2.31 2003/04/08 03:48:04 mike Exp $".
*/
/*
- * "$Id: ipp.c,v 1.55.2.33 2003/03/26 20:31:56 mike Exp $"
+ * "$Id: ipp.c,v 1.55.2.34 2003/04/08 03:48:05 mike Exp $"
*
* Internet Printing Protocol support functions for the Common UNIX
* Printing System (CUPS).
ippRead(http_t *http, /* I - HTTP connection */
ipp_t *ipp) /* I - IPP data */
{
- DEBUG_printf(("ippRead(%p, %p)\n", http, ipp));
+ DEBUG_printf(("ippRead(http=%p, ipp=%p), data_remaining=%d\n", http, ipp,
+ http ? http->data_remaining : -1));
if (http == NULL)
return (IPP_ERROR);
+ DEBUG_printf(("http->state = %d\n", http->state));
+
return (ippReadIO(http, (ipp_iocb_t)ipp_read_http,
http->blocking || http->used != 0, NULL, ipp));
}
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
if ((*cb)(src, buffer, 4) < 4)
+ {
+ DEBUG_puts("ippReadIO: Unable to read integer value!");
return (IPP_ERROR);
+ }
n = (((((buffer[0] << 8) | buffer[1]) << 8) | buffer[2]) << 8) |
buffer[3];
break;
case IPP_TAG_BOOLEAN :
if ((*cb)(src, buffer, 1) < 1)
+ {
+ DEBUG_puts("ippReadIO: Unable to read boolean value!");
return (IPP_ERROR);
+ }
value->boolean = buffer[0];
break;
value->string.text = calloc(n + 1, 1);
if ((*cb)(src, (ipp_uchar_t *)value->string.text, n) < n)
+ {
+ DEBUG_puts("ippReadIO: Unable to read string value!");
return (IPP_ERROR);
+ }
DEBUG_printf(("ippReadIO: value = \'%s\'\n",
value->string.text));
break;
case IPP_TAG_DATE :
if ((*cb)(src, value->date, 11) < 11)
+ {
+ DEBUG_puts("ippReadIO: Unable to date integer value!");
return (IPP_ERROR);
+ }
break;
case IPP_TAG_RESOLUTION :
if ((*cb)(src, buffer, 9) < 9)
+ {
+ DEBUG_puts("ippReadIO: Unable to read resolution value!");
return (IPP_ERROR);
+ }
value->resolution.xres =
(((((buffer[0] << 8) | buffer[1]) << 8) | buffer[2]) << 8) |
break;
case IPP_TAG_RANGE :
if ((*cb)(src, buffer, 8) < 8)
+ {
+ DEBUG_puts("ippReadIO: Unable to read range value!");
return (IPP_ERROR);
+ }
value->range.lower =
(((((buffer[0] << 8) | buffer[1]) << 8) | buffer[2]) << 8) |
}
if ((*cb)(src, buffer, n) < n)
+ {
+ DEBUG_puts("ippReadIO: Unable to read string w/language value!");
return (IPP_ERROR);
+ }
bufptr = buffer;
value->collection = ippNew();
if (n > 0)
+ {
+ DEBUG_puts("ippReadIO: begCollection tag with value length > 0!");
return (IPP_ERROR);
+ }
if (ippReadIO(src, cb, 1, ipp, value->collection) == IPP_ERROR)
+ {
+ DEBUG_puts("ippReadIO: Unable to read collection value!");
return (IPP_ERROR);
+ }
break;
case IPP_TAG_END_COLLECTION :
if (n > 0)
+ {
+ DEBUG_puts("ippReadIO: endCollection tag with value length > 0!");
return (IPP_ERROR);
+ }
+
+ DEBUG_puts("ippReadIO: endCollection tag...");
return (ipp->state = IPP_DATA);
attr->name = calloc(n + 1, 1);
if ((*cb)(src, (ipp_uchar_t *)attr->name, n) < n)
+ {
+ DEBUG_puts("ippReadIO: Unable to read member name value!");
return (IPP_ERROR);
+ }
+
+ DEBUG_printf(("ippReadIO: member name = \"%s\"\n", attr->name));
break;
default : /* Other unsupported values */
{
value->unknown.data = malloc(n);
if ((*cb)(src, value->unknown.data, n) < n)
+ {
+ DEBUG_puts("ippReadIO: Unable to read unsupported value!");
return (IPP_ERROR);
+ }
}
else
value->unknown.data = NULL;
bytes += 2 * attr->num_values; /* Name lengths */
bytes += 2 * attr->num_values; /* Value lengths */
+ if (collection)
+ bytes += 5; /* Add membername overhead */
+
switch (attr->value_tag & ~IPP_TAG_COPY)
{
case IPP_TAG_INTEGER :
i < attr->num_values;
i ++, value ++)
{
- bytes += 5; /* Overhead of begCollection */
+/* bytes += 5;*/ /* Overhead of begCollection */
bytes += ipp_length(attr->values[i].collection, 1);
- bytes += 5; /* Overhead of endCollection */
+/* bytes += 5;*/ /* Overhead of endCollection */
}
break;
}
/*
- * Finally, add 1 byte for the "end of attributes" tag and return...
+ * Finally, add 1 byte for the "end of attributes" tag or 5 bytes
+ * for the "end of collection" tag and return...
*/
- if (!collection)
+ if (collection)
+ bytes += 5;
+ else
bytes ++;
DEBUG_printf(("bytes = %d\n", bytes));
char len[32]; /* Length string */
+ DEBUG_printf(("ipp_read_http(http=%p, buffer=%p, length=%d)\n",
+ http, buffer, length));
+
/*
* Loop until all bytes are read...
*/
for (tbytes = 0, bytes = 0; tbytes < length; tbytes += bytes, buffer += bytes)
{
- if (http->used > 0)
+ DEBUG_printf(("tbytes = %d, http->state = %d\n", tbytes, http->state));
+
+ if (http->state == HTTP_WAITING)
+ break;
+
+ if (http->used > 0 && http->data_encoding == HTTP_ENCODE_LENGTH)
{
/*
* Do "fast read" from HTTP buffer directly...
bytes = -1;
break;
}
- else if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) <= 0)
+ else if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) < 0)
break;
}
}
if (tbytes == 0 && bytes < 0)
tbytes = -1;
+ DEBUG_printf(("returning %d bytes...\n", tbytes));
+
return (tbytes);
}
/*
- * End of "$Id: ipp.c,v 1.55.2.33 2003/03/26 20:31:56 mike Exp $".
+ * End of "$Id: ipp.c,v 1.55.2.34 2003/04/08 03:48:05 mike Exp $".
*/
/*
- * "$Id: testipp.c,v 1.1.2.2 2003/03/26 20:31:57 mike Exp $"
+ * "$Id: testipp.c,v 1.1.2.3 2003/04/08 03:48:06 mike Exp $"
*
* IPP test program for the Common UNIX Printing System (CUPS).
*
0x01, 0x01, /* IPP version */
0x00, 0x02, /* Print-Job operation */
0x00, 0x00, 0x00, 0x01, /* Request ID */
+ IPP_TAG_OPERATION,
+ IPP_TAG_CHARSET,
+ 0x00, 0x12, /* Name length + name */
+ 'a','t','t','r','i','b','u','t','e','s','-',
+ 'c','h','a','r','s','e','t',
+ 0x00, 0x05, /* Value length + value */
+ 'u','t','f','-','8',
+ IPP_TAG_LANGUAGE,
+ 0x00, 0x1b, /* Name length + name */
+ 'a','t','t','r','i','b','u','t','e','s','-',
+ 'n','a','t','u','r','a','l','-','l','a','n',
+ 'g','u','a','g','e',
+ 0x00, 0x02, /* Value length + value */
+ 'e','n',
+ IPP_TAG_URI,
+ 0x00, 0x0b, /* Name length + name */
+ 'p','r','i','n','t','e','r','-','u','r','i',
+ 0x00, 0x1c, /* Value length + value */
+ 'i','p','p',':','/','/','l','o','c','a','l',
+ 'h','o','s','t','/','p','r','i','n','t','e',
+ 'r','s','/','f','o','o',
IPP_TAG_JOB, /* job group tag */
IPP_TAG_BEGIN_COLLECTION, /* begCollection tag */
0x00, 0x09, /* Name length + name */
request->request.op.operation_id = IPP_PRINT_JOB;
request->request.op.request_id = 1;
+ 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");
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
+ "printer-uri", NULL, "ipp://localhost/printers/foo");
+
col = ippNew();
ippAddString(col, IPP_TAG_JOB, IPP_TAG_KEYWORD, "media-color", NULL, "blue");
ippAddCollection(request, IPP_TAG_JOB, "media-col", col);
/*
- * End of "$Id: testipp.c,v 1.1.2.2 2003/03/26 20:31:57 mike Exp $".
+ * End of "$Id: testipp.c,v 1.1.2.3 2003/04/08 03:48:06 mike Exp $".
*/
/*
- * "$Id: util.c,v 1.81.2.22 2003/01/24 20:45:15 mike Exp $"
+ * "$Id: util.c,v 1.81.2.23 2003/04/08 03:48:06 mike Exp $"
*
* Printing utilities for the Common UNIX Printing System (CUPS).
*
if (!cups_connect(name, printer, hostname))
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (0);
}
char prompt[1024]; /* Prompt string */
+ DEBUG_printf(("cupsDoFileRequest(%p, %p, \'%s\', \'%s\')\n",
+ http, request, resource ? resource : "(null)",
+ filename ? filename : "(null)"));
+
if (http == NULL || request == NULL || resource == NULL)
{
if (request != NULL)
return (NULL);
}
- DEBUG_printf(("cupsDoFileRequest(%p, %p, \'%s\', \'%s\')\n",
- http, request, resource, filename ? filename : "(null)"));
-
/*
* See if we have a file to send...
*/
* Delete the response...
*/
+ DEBUG_puts("IPP read error!");
ippDelete(response);
response = NULL;
else if (status == HTTP_UNAUTHORIZED)
last_error = IPP_NOT_AUTHORIZED;
else if (status != HTTP_OK)
+ {
+ DEBUG_printf(("HTTP error %d mapped to IPP_SERVICE_UNAVAILABLE!\n",
+ status));
last_error = IPP_SERVICE_UNAVAILABLE;
+ }
return (response);
}
if (!cups_connect("default", NULL, NULL))
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (0);
}
if (!cups_connect("default", NULL, NULL))
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (NULL);
}
if (!cups_connect("default", NULL, NULL))
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (0);
}
if (!cups_connect(name, printer, hostname))
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (NULL);
}
if ((cups_server = httpConnectEncrypt(hostname, ippPort(),
cupsEncryption())) == NULL)
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (NULL);
}
last_error = IPP_NOT_FOUND;
break;
case HTTP_ERROR :
+ DEBUG_puts("Mapping HTTP error to IPP_SERVICE_UNAVAILABLE");
last_error = IPP_SERVICE_UNAVAILABLE;
break;
case HTTP_UNAUTHORIZED :
if (!cups_connect("default", NULL, NULL))
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (0);
}
{
DEBUG_printf(("cupsPrintFile: Unable to open connection - %s.\n",
strerror(errno)));
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (0);
}
if ((cups_server = httpConnectEncrypt(hostname, ippPort(),
cupsEncryption())) == NULL)
{
+ DEBUG_puts("Unable to connect to server!");
last_error = IPP_SERVICE_UNAVAILABLE;
return (NULL);
}
/*
- * End of "$Id: util.c,v 1.81.2.22 2003/01/24 20:45:15 mike Exp $".
+ * End of "$Id: util.c,v 1.81.2.23 2003/04/08 03:48:06 mike Exp $".
*/
/*
- * "$Id: client.c,v 1.91.2.56 2003/03/30 21:49:15 mike Exp $"
+ * "$Id: client.c,v 1.91.2.57 2003/04/08 03:48:07 mike Exp $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
ipp_port[1024], /* IPP_PORT environment variable */
lang[1024], /* LANG environment variable */
ld_library_path[1024], /* LD_LIBRARY_PATH environment variable */
+ ld_preload[1024], /* LD_PRELOAD environment variable */
+ dyld_library_path[1024],/* DYLD_LIBRARY_PATH environment variable */
+ shlib_path[1024], /* SHLIB_PATH environment variable */
nlspath[1024], /* NLSPATH environment variable */
query_string[10240], /* QUERY_STRING env variable */
remote_addr[1024], /* REMOTE_ADDR environment variable */
getenv("LD_LIBRARY_PATH"));
envp[envc ++] = ld_library_path;
}
- else if (getenv("DYLD_LIBRARY_PATH") != NULL)
+
+ if (getenv("LD_PRELOAD") != NULL)
+ {
+ snprintf(ld_preload, sizeof(ld_preload), "LD_PRELOAD=%s",
+ getenv("LD_PRELOAD"));
+ envp[envc ++] = ld_preload;
+ }
+
+ if (getenv("DYLD_LIBRARY_PATH") != NULL)
{
- snprintf(ld_library_path, sizeof(ld_library_path), "DYLD_LIBRARY_PATH=%s",
+ snprintf(dyld_library_path, sizeof(dyld_library_path), "DYLD_LIBRARY_PATH=%s",
getenv("DYLD_LIBRARY_PATH"));
- envp[envc ++] = ld_library_path;
+ envp[envc ++] = dyld_library_path;
}
- else if (getenv("SHLIB_PATH") != NULL)
+
+ if (getenv("SHLIB_PATH") != NULL)
{
- snprintf(ld_library_path, sizeof(ld_library_path), "SHLIB_PATH=%s",
+ snprintf(shlib_path, sizeof(shlib_path), "SHLIB_PATH=%s",
getenv("SHLIB_PATH"));
- envp[envc ++] = ld_library_path;
+ envp[envc ++] = shlib_path;
}
if (getenv("NLSPATH") != NULL)
/*
- * End of "$Id: client.c,v 1.91.2.56 2003/03/30 21:49:15 mike Exp $".
+ * End of "$Id: client.c,v 1.91.2.57 2003/04/08 03:48:07 mike Exp $".
*/
/*
- * "$Id: ipp.c,v 1.127.2.57 2003/04/01 22:14:31 mike Exp $"
+ * "$Id: ipp.c,v 1.127.2.58 2003/04/08 03:48:08 mike Exp $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
if (SendHeader(con, HTTP_OK, "application/ipp"))
{
- con->http.data_encoding = HTTP_ENCODE_LENGTH;
- con->http.data_remaining = ippLength(con->response);
+#if 0
+ if (con->http.version == HTTP_1_1)
+ {
+ con->http.data_encoding = HTTP_ENCODE_CHUNKED;
+
+ httpPrintf(HTTP(con), "Transfer-Encoding: chunked\r\n\r\n");
+ }
+ else
+#endif /* 0 */
+ {
+ con->http.data_encoding = HTTP_ENCODE_LENGTH;
+ con->http.data_remaining = ippLength(con->response);
- httpPrintf(HTTP(con), "Content-Length: %d\r\n\r\n",
- con->http.data_remaining);
+ httpPrintf(HTTP(con), "Content-Length: %d\r\n\r\n",
+ con->http.data_remaining);
+ }
LogMessage(L_DEBUG2, "ProcessIPPRequest: Adding fd %d to OutputSet...",
con->http.fd);
/*
- * End of "$Id: ipp.c,v 1.127.2.57 2003/04/01 22:14:31 mike Exp $".
+ * End of "$Id: ipp.c,v 1.127.2.58 2003/04/08 03:48:08 mike Exp $".
*/
/*
- * "$Id: job.c,v 1.124.2.62 2003/04/03 03:33:40 mike Exp $"
+ * "$Id: job.c,v 1.124.2.63 2003/04/08 03:48:13 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
*/
void
-StartJob(int id, /* I - Job ID */
- printer_t *printer) /* I - Printer to print job */
+StartJob(int id, /* I - Job ID */
+ printer_t *printer) /* I - Printer to print job */
{
- job_t *current; /* Current job */
- int i; /* Looping var */
- int slot; /* Pipe slot */
- int num_filters; /* Number of filters for job */
- mime_filter_t *filters; /* Filters for job */
- char method[255], /* Method for output */
- *optptr; /* Pointer to options */
- ipp_attribute_t *attr; /* Current attribute */
- int pid; /* Process ID of new filter process */
- int banner_page; /* 1 if banner page, 0 otherwise */
- int statusfds[2], /* Pipes used between the filters and scheduler */
- filterfds[2][2];/* Pipes used between the filters */
- char *argv[8], /* Filter command-line arguments */
- filename[1024], /* Job filename */
- command[1024], /* Full path to filter/backend command */
- jobid[255], /* Job ID string */
- title[IPP_MAX_NAME],
- /* Job title string */
- copies[255], /* # copies string */
- *envp[21], /* Environment variables */
+ job_t *current; /* Current job */
+ int i; /* Looping var */
+ int slot; /* Pipe slot */
+ int num_filters; /* Number of filters for job */
+ mime_filter_t *filters; /* Filters for job */
+ char method[255], /* Method for output */
+ *optptr; /* Pointer to options */
+ ipp_attribute_t *attr; /* Current attribute */
+ int pid; /* Process ID of new filter process */
+ int banner_page; /* 1 if banner page, 0 otherwise */
+ int statusfds[2], /* Pipes used between the filters and scheduler */
+ filterfds[2][2]; /* Pipes used between the filters */
+ int envc; /* Number of environment variables */
+ char *argv[8], /* Filter command-line arguments */
+ filename[1024], /* Job filename */
+ command[1024], /* Full path to filter/backend command */
+ jobid[255], /* Job ID string */
+ title[IPP_MAX_NAME], /* Job title string */
+ copies[255], /* # copies string */
+ *envp[100], /* Environment variables */
#ifdef __APPLE__
- processPath[1050],
- /* CFProcessPath environment variable */
+ processPath[1050], /* CFProcessPath environment variable */
#endif /* __APPLE__ */
- path[1024], /* PATH environment variable */
- language[255], /* LANG environment variable */
- charset[255], /* CHARSET environment variable */
- classification[1024],
- /* CLASSIFICATION environment variable */
- content_type[1024],
- /* CONTENT_TYPE environment variable */
- device_uri[1024],
- /* DEVICE_URI environment variable */
- ppd[1024], /* PPD environment variable */
- class_name[255],
- /* CLASS environment variable */
- printer_name[255],
- /* PRINTER environment variable */
- root[1024], /* CUPS_SERVERROOT environment variable */
- cache[255], /* RIP_MAX_CACHE environment variable */
- tmpdir[1024], /* TMPDIR environment variable */
- ldpath[1024], /* LD_LIBRARY_PATH environment variable */
- nlspath[1024], /* NLSPATH environment variable */
- datadir[1024], /* CUPS_DATADIR environment variable */
- fontpath[1050]; /* CUPS_FONTPATH environment variable */
- static char *options = NULL;/* Full list of options */
- static int optlength = 0; /* Length of option buffer */
+ path[1024], /* PATH environment variable */
+ language[255], /* LANG environment variable */
+ charset[255], /* CHARSET environment variable */
+ classification[1024], /* CLASSIFICATION environment variable */
+ content_type[1024], /* CONTENT_TYPE environment variable */
+ device_uri[1024], /* DEVICE_URI environment variable */
+ ppd[1024], /* PPD environment variable */
+ class_name[255], /* CLASS environment variable */
+ printer_name[255], /* PRINTER environment variable */
+ root[1024], /* CUPS_SERVERROOT environment variable */
+ cache[255], /* RIP_MAX_CACHE environment variable */
+ tmpdir[1024], /* TMPDIR environment variable */
+ ld_library_path[1024], /* LD_LIBRARY_PATH environment variable */
+ ld_preload[1024], /* LD_PRELOAD environment variable */
+ dyld_library_path[1024],/* DYLD_LIBRARY_PATH environment variable */
+ shlib_path[1024], /* SHLIB_PATH environment variable */
+ nlspath[1024], /* NLSPATH environment variable */
+ datadir[1024], /* CUPS_DATADIR environment variable */
+ fontpath[1050]; /* CUPS_FONTPATH environment variable */
+ static char *options = NULL; /* Full list of options */
+ static int optlength = 0; /* Length of option buffer */
LogMessage(L_DEBUG, "StartJob(%d, %p)", id, printer);
snprintf(datadir, sizeof(datadir), "CUPS_DATADIR=%s", DataDir);
snprintf(fontpath, sizeof(fontpath), "CUPS_FONTPATH=%s", FontPath);
- if (current->dtype & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
- snprintf(class_name, sizeof(class_name), "CLASS=%s", current->dest);
- else
- class_name[0] = '\0';
+ envc = 0;
+
+ envp[envc ++] = path;
+ envp[envc ++] = "SOFTWARE=CUPS/1.1";
+ envp[envc ++] = "USER=root";
+ envp[envc ++] = charset;
+ envp[envc ++] = language;
+ envp[envc ++] = TZ;
+ envp[envc ++] = ppd;
+ envp[envc ++] = root;
+ envp[envc ++] = cache;
+ envp[envc ++] = tmpdir;
+ envp[envc ++] = content_type;
+ envp[envc ++] = device_uri;
+ envp[envc ++] = printer_name;
+ envp[envc ++] = datadir;
+ envp[envc ++] = fontpath;
+
+ if (getenv("LD_LIBRARY_PATH") != NULL)
+ {
+ snprintf(ld_library_path, sizeof(ld_library_path), "LD_LIBRARY_PATH=%s",
+ getenv("LD_LIBRARY_PATH"));
+ envp[envc ++] = ld_library_path;
+ }
+
+ if (getenv("LD_PRELOAD") != NULL)
+ {
+ snprintf(ld_preload, sizeof(ld_preload), "LD_PRELOAD=%s",
+ getenv("LD_PRELOAD"));
+ envp[envc ++] = ld_preload;
+ }
+
+ if (getenv("DYLD_LIBRARY_PATH") != NULL)
+ {
+ snprintf(dyld_library_path, sizeof(dyld_library_path), "DYLD_LIBRARY_PATH=%s",
+ getenv("DYLD_LIBRARY_PATH"));
+ envp[envc ++] = dyld_library_path;
+ }
+
+ if (getenv("SHLIB_PATH") != NULL)
+ {
+ snprintf(shlib_path, sizeof(shlib_path), "SHLIB_PATH=%s",
+ getenv("SHLIB_PATH"));
+ envp[envc ++] = shlib_path;
+ }
+
+ if (getenv("NLSPATH") != NULL)
+ {
+ snprintf(nlspath, sizeof(nlspath), "NLSPATH=%s", getenv("NLSPATH"));
+ envp[envc ++] = nlspath;
+ }
if (Classification && !banner_page)
{
else
snprintf(classification, sizeof(classification), "CLASSIFICATION=%s",
attr->values[0].string.text);
+
+ envp[envc ++] = classification;
}
- else
- classification[0] = '\0';
- if (getenv("LD_LIBRARY_PATH") != NULL)
- snprintf(ldpath, sizeof(ldpath), "LD_LIBRARY_PATH=%s",
- getenv("LD_LIBRARY_PATH"));
- else if (getenv("DYLD_LIBRARY_PATH") != NULL)
- snprintf(ldpath, sizeof(ldpath), "DYLD_LIBRARY_PATH=%s",
- getenv("DYLD_LIBRARY_PATH"));
- else if (getenv("SHLIB_PATH") != NULL)
- snprintf(ldpath, sizeof(ldpath), "SHLIB_PATH=%s",
- getenv("SHLIB_PATH"));
- else
- ldpath[0] = '\0';
+ if (current->dtype & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT))
+ {
+ snprintf(class_name, sizeof(class_name), "CLASS=%s", current->dest);
+ envp[envc ++] = class_name;
+ }
- if (getenv("NLSPATH") != NULL)
- snprintf(nlspath, sizeof(nlspath), "NLSPATH=%s", getenv("NLSPATH"));
- else
- nlspath[0] = '\0';
-
- envp[0] = path;
- envp[1] = "SOFTWARE=CUPS/1.1";
- envp[2] = "USER=root";
- envp[3] = charset;
- envp[4] = language;
- envp[5] = TZ;
- envp[6] = ppd;
- envp[7] = root;
- envp[8] = cache;
- envp[9] = tmpdir;
- envp[10] = content_type;
- envp[11] = device_uri;
- envp[12] = printer_name;
- envp[13] = datadir;
- envp[14] = fontpath;
- envp[15] = ldpath;
- envp[16] = nlspath;
- envp[17] = classification;
- envp[18] = class_name;
#ifdef __APPLE__
- envp[19] = processPath;
- envp[20] = NULL;
-#else
- envp[19] = NULL;
+ envp[envc ++] = processPath;
#endif /* __APPLE__ */
- LogMessage(L_DEBUG, "StartJob: envp = \"%s\",\"%s\",\"%s\",\"%s\","
- "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\","
- "\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\"",
- envp[0], envp[1], envp[2], envp[3], envp[4],
- envp[5], envp[6], envp[7], envp[8], envp[9],
- envp[10], envp[11], envp[12], envp[13], envp[14],
- envp[15], envp[16], envp[17], envp[18]);
+ envp[envc ++] = NULL;
+
+ for (i = 0; i < envc; i ++)
+ LogMessage(L_DEBUG, "StartJob: envp[%d]=\"%s\"", i, envp[i]);
current->current_file ++;
/*
- * End of "$Id: job.c,v 1.124.2.62 2003/04/03 03:33:40 mike Exp $".
+ * End of "$Id: job.c,v 1.124.2.63 2003/04/08 03:48:13 mike Exp $".
*/
{#printer_name=0?No printers:
-<P><B>Default Destination:</B> <A HREF="{default_uri}">{default_name}</A>
+<P><B>Default Destination:</B> {default_name?<A HREF="{default_uri}">{default_name}</A>:none}
<P><TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="100%">
{[printer_name]
<TR>
Printer State: {printer_state=3?idle:{printer_state=4?processing:stopped}},
{printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}.
{?printer_state_message=?:<BR><I>"{printer_state_message}"</I>}
+ {?printer_state_history2.printer_state_message=?:<BR><I>"{printer_state_history2.printer_state_message}"</I>}
+ {?printer_state_history3.printer_state_message=?:<BR><I>"{printer_state_history3.printer_state_message}"</I>}
+ {?printer_state_history4.printer_state_message=?:<BR><I>"{printer_state_history4.printer_state_message}"</I>}
+ {?printer_state_history5.printer_state_message=?:<BR><I>"{printer_state_history5.printer_state_message}"</I>}
{?device_uri=?:<BR>Device URI: {device_uri}}
<P>
<A HREF="{printer_uri_supported}?op=print-test-page">
#!/bin/sh
#
-# "$Id: run-stp-tests.sh,v 1.4.2.12 2003/03/07 19:25:51 mike Exp $"
+# "$Id: run-stp-tests.sh,v 1.4.2.13 2003/04/08 03:48:16 mike Exp $"
#
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
AccessLog /tmp/$user/log/access_log
ErrorLog /tmp/$user/log/error_log
PageLog /tmp/$user/log/page_log
-LogLevel debug
+LogLevel debug2
PreserveJobHistory Yes
<Location />
Order deny,allow
echo "Starting scheduler..."
-../scheduler/cupsd -c /tmp/$user/cupsd.conf -f &
+../scheduler/cupsd -c /tmp/$user/cupsd.conf -f >/tmp/$user/log/debug_log &
cupsd=$!
#if test -x /usr/bin/strace; then
echo ""
#
-# End of "$Id: run-stp-tests.sh,v 1.4.2.12 2003/03/07 19:25:51 mike Exp $"
+# End of "$Id: run-stp-tests.sh,v 1.4.2.13 2003/04/08 03:48:16 mike Exp $"
#