[cups.bugs] [MOD] STR #3791: CUPS ipp backend doesn't handle printers that don't send 100-continue

Duncan McEwan duncan at ecs.vuw.ac.nz
Mon Feb 7 23:03:42 PST 2011


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

> 7) Eventually the entire first buffered response is consumed and so 
>    the next response is read.  I'm not 100% sure what happens that is
>    different this time ...

OK - I think I've figured this bit out now.

The Get-Printer-Attributes is repeated eight times, with the 2nd through
6th attempts failing due to attempting to interpret portions of 
the printer's first IPP response stored in http->buffer as the start of 
an HTTP header.

The data read by each of these attempts is:

....
23:46:19.268 _httpUpdate: Bad response line "2a7"!
....
23:46:29.269 _httpUpdate: Bad response line "\001"!
....
23:46:39.277 _httpUpdate: Bad response line "image/tiffI"!
....
3:46:49.285 _httpUpdate: Bad response line "image/jpegI"!
....
23:46:59.294 _httpUpdate: Bad response line "image/jpeg\""!
....
23:47:09.302 _httpUpdate: Bad response line "0"!

The "0" read by the 7th attempt is the "end of chunked encoding"
indication sent by the printer, which leaves a final "\r\n" in
http->buffer.

So for the eighth attempt, the _httpUpdate() called by 
cupsSendRequest() returns a blank line, which is not interpreted as 
an HTTP error but which also doesn't contain "HTTP/1.1 200 OK", so
http->status remains set to 100.  Now cupsGetResponse() is called, and the
loop there calls httpUpdate().  This reads and consumes the entire HTTP
header of the *2nd* printer attributes response sent by the printer.  The
log looks like:

  23:47:19.311 cupsGetResponse(http=0xbb531000, resource="/ipp")
  23:47:19.311 cupsGetResponse: Update loop, http->status=100...
  23:47:19.311 httpUpdate(http=0xbb531000), state=HTTP_POST_SEND
  23:47:19.311 _httpUpdate(http=0xbb531000, status=0xbfbe8fec),
state=HTTP_POST_SEND
  23:47:19.311 httpGets(line=0xbfbe0fb8, length=32768, http=0xbb531000)
  23:47:19.316 httpGets: read 158 bytes...
  23:47:19.316 httpGets: Returning "HTTP/1.1 200 OK"
  23:47:19.316 _httpUpdate: Got "HTTP/1.1 200 OK"
  23:47:19.316 _httpUpdate(http=0xbb531000, status=0xbfbe8fec),
state=HTTP_POST_SEND
  23:47:19.316 httpGets(line=0xbfbe0fb8, length=32768, http=0xbb531000)
  23:47:19.316 httpGets: Returning "Cache-Control: no-cache"
  23:47:19.316 _httpUpdate: Got "Cache-Control: no-cache"
  23:47:19.316 _httpUpdate: unknown field Cache-Control seen!
  23:47:19.316 _httpUpdate(http=0xbb531000, status=0xbfbe8fec),
state=HTTP_POST_SEND
  23:47:19.316 httpGets(line=0xbfbe0fb8, length=32768, http=0xbb531000)
  23:47:19.316 httpGets: Returning "Date: Mon, 07 Feb 2011 23:47:16 GMT"
  23:47:19.316 _httpUpdate: Got "Date: Mon, 07 Feb 2011 23:47:16 GMT"
  23:47:19.316 _httpUpdate(http=0xbb531000, status=0xbfbe8fec),
state=HTTP_POST_SEND
  23:47:19.316 httpGets(line=0xbfbe0fb8, length=32768, http=0xbb531000)
  23:47:19.316 httpGets: Returning "Pragma: no-cache"
  23:47:19.316 _httpUpdate: Got "Pragma: no-cache"
  23:47:19.316 _httpUpdate: unknown field Pragma seen!
  23:47:19.316 _httpUpdate(http=0xbb531000, status=0xbfbe8fec),
state=HTTP_POST_SEND
  23:47:19.316 httpGets(line=0xbfbe0fb8, length=32768, http=0xbb531000)
  23:47:19.316 httpGets: Returning "Transfer-Encoding: chunked"
  23:47:19.316 _httpUpdate: Got "Transfer-Encoding: chunked"
  23:47:19.316 _httpUpdate(http=0xbb531000, status=0xbfbe8fec),
state=HTTP_POST_SEND
  23:47:19.316 httpGets(line=0xbfbe0fb8, length=32768, http=0xbb531000)
  23:47:19.316 httpGets: Returning "Content-Type: application/ipp"
  23:47:19.316 _httpUpdate: Got "Content-Type: application/ipp"
  23:47:19.316 _httpUpdate(http=0xbb531000, status=0xbfbe8fec),
state=HTTP_POST_SEND
  23:47:19.316 httpGets(line=0xbfbe0fb8, length=32768, http=0xbb531000)
  23:47:19.316 httpGets: Returning ""
  23:47:19.316 _httpUpdate: Got ""
  23:47:19.316 httpGetLength2(http=0xbb531000), state=HTTP_POST_SEND
  23:47:19.316 httpGetLength2: chunked request!
  23:47:19.316 cupsGetResponse: status=200

So now we are back in sync, with http->buffer containing just the IPP
Get-Printer-Attributes response and http->status = 200.

Link: http://www.cups.org/str.php?L3791
Version: 1.4-current





More information about the cups mailing list