+/*
+ * 'finish_document()' - Finish receiving a document file and start processing.
+ */
+
+static void
+finish_document(ippeve_client_t *client,/* I - Client */
+ ippeve_job_t *job) /* I - Job */
+{
+ char filename[1024], /* Filename buffer */
+ buffer[4096]; /* Copy buffer */
+ ssize_t bytes; /* Bytes read */
+ cups_array_t *ra; /* Attributes to send in response */
+ _cups_thread_t t; /* Thread */
+
+
+ /*
+ * Create a file for the request data...
+ *
+ * TODO: Update code to support piping large raster data to the print command.
+ */
+
+ if ((job->fd = create_job_file(client->printer, job, filename, sizeof(filename), NULL)) < 0)
+ {
+ job->state = IPP_JSTATE_ABORTED;
+
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to create print file: %s", strerror(errno));
+ return;
+ }
+
+ if (Verbosity)
+ fprintf(stderr, "Created job file \"%s\", format \"%s\".\n", filename, job->format);
+
+ while ((bytes = httpRead2(client->http, buffer, sizeof(buffer))) > 0)
+ {
+ if (write(job->fd, buffer, (size_t)bytes) < bytes)
+ {
+ int error = errno; /* Write error */
+
+ job->state = IPP_JSTATE_ABORTED;
+
+ close(job->fd);
+ job->fd = -1;
+
+ unlink(filename);
+
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s", strerror(error));
+ return;
+ }
+ }
+
+ if (bytes < 0)
+ {
+ /*
+ * Got an error while reading the print data, so abort this job.
+ */
+
+ job->state = IPP_JSTATE_ABORTED;
+
+ close(job->fd);
+ job->fd = -1;
+
+ unlink(filename);
+
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to read print file.");
+ return;
+ }
+
+ if (close(job->fd))
+ {
+ int error = errno; /* Write error */
+
+ job->state = IPP_JSTATE_ABORTED;
+ job->fd = -1;
+
+ unlink(filename);
+
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s", strerror(error));
+ return;
+ }
+
+ job->fd = -1;
+ job->filename = strdup(filename);
+ job->state = IPP_JSTATE_PENDING;
+
+ /*
+ * Process the job...
+ */
+
+ t = _cupsThreadCreate((_cups_thread_func_t)process_job, job);
+
+ if (t)
+ {
+ _cupsThreadDetach(t);
+ }
+ else
+ {
+ job->state = IPP_JSTATE_ABORTED;
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to process job.");
+ return;
+ }
+
+ /*
+ * Return the job info...
+ */
+
+ respond_ipp(client, IPP_STATUS_OK, NULL);
+
+ ra = cupsArrayNew((cups_array_func_t)strcmp, NULL);
+ cupsArrayAdd(ra, "job-id");
+ cupsArrayAdd(ra, "job-state");
+ cupsArrayAdd(ra, "job-state-message");
+ cupsArrayAdd(ra, "job-state-reasons");
+ cupsArrayAdd(ra, "job-uri");
+
+ copy_job_attributes(client, job, ra);
+ cupsArrayDelete(ra);
+}
+
+
+/*
+ * 'finish_uri()' - Finish fetching a document URI and start processing.
+ */
+
+static void
+finish_uri(ippeve_client_t *client, /* I - Client */
+ ippeve_job_t *job) /* I - Job */
+{
+}
+
+