cupsPrintFile() has no streaming equivalent?

mike dizaemon at hotmail.com
Fri Feb 23 11:22:45 PST 2007


> > mike wrote:

[snip]

> > If you look at the cupsDoFileRequest code in cups/request.c, you'll
> > see how to use the lower-level HTTP and IPP APIs to stream your
> > content to the CUPS server.
>
> well, i've got a completely working implementation that is completely
> broken.
>
> i don't know the length beforehand, so i don't call httpSetLength;
> this completely breaks everything.  if i call httpSetLength and set it
> to the actual length of the input, everything works great.  however,
> this is suboptimal.

[snip]

> basically, it appears that the client and server deadlock as the
> client waits for the server to send it a response and the server waits
> for the client to send it more data.
>
> i don't think there's a way around it without explicitly setting the
> Content-Length header.  i don't know enough about the internals (and
> i've learned a lot over the past 24 hours) to be able to say.  if
> there was some type of chunked/segmented file transfer method where
> set blocks of the file are transferred at a time, then perhaps the
> streaming method would work.  is there such support in cups?
> transferring 4K blocks of the file at a time through multiple HTTP
> requests in a single connection?  Content-Length: 4096,
> Content-Length: 4096, Content-Length: 4096, etc...

i should have done this earlier; i'm now reading RFC 2910.  in section 4
"Encoding of Transport Layer", the RFC says:

    HTTP/1.1 [RFC2616] is the transport layer for this protocol.  The
    operation layer has been designed with the assumption that the
    transport layer contains the following information:

       -  the URI of the target job or printer operation
       -  the total length of the data in the operation layer, either as
          a single length or as a sequence of chunks each with a length.

so it would appear that transmitting the data as a sequence of chunks is
possible, according to the RFC.  i'm still reading, but i thought i'd
mention it in case anyone has any insight into how CUPS implements
chunked IPP_PRINT_JOB requests.

-mike





More information about the cups-devel mailing list