[cups.bugs] [LOW] STR #2132: If-Modified-Since logic ends up wasting time

twaugh.redhat twaugh at redhat.com
Tue Nov 28 09:18:32 PST 2006


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

[STR New]

[1.2.7] ref rhbz#217556

Running this small piece of Python code on Fedora Core 6 (you can easily
see what it does) causes a 10 second delay after entering the password:

#!usr/bin/python
import cups
cups.setUser('root')
cups.setServer('localhost')
cups.setEncryption(cups.HTTP_ENCRYPT_NEVER)
c=cups.Connection()
c.adminGetServerSettings()
c.adminGetServerSettings()

It is caused by the If-Modified-Since header being added in the second
call to _cupsAdminGetServerSettings().

This patch makes the problem go away:

--- cups-1.2.7/cups/http.c~     2006-11-28 16:50:35.000000000 +0000
+++ cups-1.2.7/cups/http.c      2006-11-28 17:14:57.000000000 +0000
@@ -502,7 +502,8 @@
   * Read any data we can...
   */
 
-  while (httpRead2(http, buffer, sizeof(buffer)) > 0);
+  if (http->status != HTTP_NOT_MODIFIED)
+    while (httpRead2(http, buffer, sizeof(buffer)) > 0);
 
  /*
   * Restore blocking and reset the connection if we didn't get all of

...but it doesn't feel like the right fix.

Link: http://www.cups.org/str.php?L2132
Version: 1.2.6





More information about the cups mailing list