Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot print to Xerox Phaser 8200 via IPP #716

Closed
michaelrsweet opened this issue May 12, 2004 · 4 comments
Closed

Cannot print to Xerox Phaser 8200 via IPP #716

michaelrsweet opened this issue May 12, 2004 · 4 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.1.20
CUPS.org User: twaugh.redhat

See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=122352.

The Xerox Phaser 8200 IPP implementation uses Spyglass_MicroServer/2.01FC1, which has odd (but compliant) behaviour regarding HTTP/1.1 100 Continue result codes. You can see a libpcap-style traffic capture log at the Bugzilla report showing this in detail.

A 100 result code is always sent by this IPP implementation after it has received the HTTP headers, but slowly enough that it is not received until after the first write from the job file.

The code (cups/util.c:cupsDoFileRequest) goes:

    rewind(file);

    while ((bytes = fread(buffer, 1, sizeof(buffer), file)) > 0)
    {
      if (httpCheck(http))
        break;

      if (httpWrite(http, buffer, bytes) < bytes)
        break;
    }

[...]

while ((status = httpUpdate(http)) == HTTP_CONTINUE);

Since there is no final result code to read we end up stuck in recv().

Here is a patch to handle mid-request Continue result codes.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Please try the attached patch instead, which avoids using goto...

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in CVS - the anonymous CVS repository will be updated at midnight EST.

@michaelrsweet
Copy link
Collaborator Author

"cups-continue.patch":

--- cups-1.1.20/cups/util.c.continue 2004-05-11 17:52:08.000000000 +0100
+++ cups-1.1.20/cups/util.c 2004-05-11 17:57:48.000000000 +0100
@@ -293,7 +293,11 @@
while ((bytes = fread(buffer, 1, sizeof(buffer), file)) > 0)
{
if (httpCheck(http))

  •   break;
    
  • {
    
  •   status = httpUpdate (http);
    
  •   if (status != HTTP_CONTINUE)
    
  •     goto check_status;
    
  • }
    

    if (httpWrite(http, buffer, bytes) < bytes)
    break;
    @@ -308,6 +312,7 @@

    while ((status = httpUpdate(http)) == HTTP_CONTINUE);

  • check_status:
    DEBUG_printf(("cupsDoFileRequest: status = %d\n", status));

    if (status == HTTP_UNAUTHORIZED)

@michaelrsweet
Copy link
Collaborator Author

"str716.patch":

Index: util.c

RCS file: /development/cvs/cups/cups/util.c,v
retrieving revision 1.117
diff -u -r1.117 util.c
--- util.c 25 Feb 2004 20:14:51 -0000 1.117
+++ util.c 13 May 2004 13:45:25 -0000
@@ -278,6 +278,8 @@
DEBUG_puts("cupsDoFileRequest: ipp write...");

 request->state = IPP_IDLE;
  • status = HTTP_CONTINUE;

if (ippWrite(http, request) != IPP_ERROR)
if (filename != NULL)
{
@@ -292,7 +294,10 @@
while ((bytes = fread(buffer, 1, sizeof(buffer), file)) > 0)
{
if (httpCheck(http))

  •   break;
    
  • {
    
  •   if ((status = httpUpdate(http)) != HTTP_CONTINUE)
    
  •     break;
    
  •      }
    

    if (httpWrite(http, buffer, bytes) < bytes)
    break;
    @@ -305,7 +310,8 @@

    DEBUG_puts("cupsDoFileRequest: update...");

  • while ((status = httpUpdate(http)) == HTTP_CONTINUE);

  • while (status == HTTP_CONTINUE)

  •  status = httpUpdate(http);
    

    DEBUG_printf(("cupsDoFileRequest: status = %d\n", status));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant