diff -up --recursive gtk+-2.10.13.orig/modules/printbackends/cups/gtkcupsutils.c gtk+-2.10.13/modules/printbackends/cups/gtkcupsutils.c
--- gtk+-2.10.13.orig/modules/printbackends/cups/gtkcupsutils.c	2007-06-12 20:10:08.000000000 -0700
+++ gtk+-2.10.13/modules/printbackends/cups/gtkcupsutils.c	2007-07-10 11:36:48.000000000 -0700
@@ -106,6 +106,7 @@ gtk_cups_request_new (http_t *connection
                       const char *server,
                       const char *resource)
 {
+  static gint id=1;
   GtkCupsRequest *request;
   cups_lang_t *language;
   
@@ -173,6 +174,10 @@ gtk_cups_request_new (http_t *connection
   
   cupsLangFree (language);
 
+  request->id = id++;
+  /* If id wraps around, re-set to 1 */
+  if (id == 0) id = 1;
+
   return request;
 }
 
@@ -208,6 +213,12 @@ gtk_cups_request_free (GtkCupsRequest *r
 gboolean 
 gtk_cups_request_read_write (GtkCupsRequest *request)
 {
+  if (!request->own_http && request->http_id) {
+    if (*(request->http_id) && (*(request->http_id) != request->id)) {
+      return FALSE;
+    }
+    *(request->http_id) = request->id;
+  }
   if (request->type == GTK_CUPS_POST)
     post_states[request->state](request);
   else if (request->type == GTK_CUPS_GET)
@@ -229,6 +240,9 @@ gtk_cups_request_read_write (GtkCupsRequ
     
   if (request->state == GTK_CUPS_REQUEST_DONE)
     {
+      if (!request->own_http && request->http_id)
+	*(request->http_id) = 0;
+
       request->poll_state = GTK_CUPS_HTTP_IDLE;
       return TRUE;
     }
@@ -580,9 +594,16 @@ _connect (GtkCupsRequest *request)
 {
   request->poll_state = GTK_CUPS_HTTP_IDLE;
 
-  if (request->http == NULL)
+  if ((request->http == NULL) || (request->reconnect == TRUE))
     {
-      request->http = httpConnectEncrypt (request->server, ippPort(), cupsEncryption());
+      http_t *newhttp;
+
+      newhttp = httpConnectEncrypt (request->server, ippPort(), cupsEncryption());
+
+      if (request->http)
+	memcpy(request->http,newhttp,sizeof(http_t));
+      else
+	request->http = newhttp;
 
       if (request->http == NULL)
         request->attempts++;
@@ -590,7 +611,6 @@ _connect (GtkCupsRequest *request)
       if (request->http)
         httpBlocking (request->http, 0);
         
-      request->own_http = TRUE;
     }
   else
     {
@@ -840,10 +860,11 @@ _post_check (GtkCupsRequest *request)
           return;
         }
     }
-/* TODO: detect ssl in configure.ac */
-#if HAVE_SSL
   else if (http_status == HTTP_UPGRADE_REQUIRED)
     {
+      cupsSetEncryption (HTTP_ENCRYPT_REQUIRED);
+      request->state = GTK_CUPS_POST_CONNECT;
+      
       /* Flush any error message... */
       httpFlush (request->http);
 
@@ -856,7 +877,6 @@ _post_check (GtkCupsRequest *request)
       request->attempts++;
       goto again;
     }
-#endif 
   else if (http_status != HTTP_OK)
     {
       int http_errno;
@@ -886,7 +906,7 @@ _post_check (GtkCupsRequest *request)
       
       request->last_status = HTTP_CONTINUE;
       httpClose (request->http);
-      request->http = NULL;
+      request->reconnect = TRUE;
       return;  
     }
   else
@@ -1028,10 +1048,10 @@ _get_check (GtkCupsRequest *request)
                                  "Can't prompt for authorization");
       return;
     }
-/* TODO: detect ssl in configure.ac */
-#if HAVE_SSL
   else if (http_status == HTTP_UPGRADE_REQUIRED)
     {
+      cupsSetEncryption (HTTP_ENCRYPT_REQUIRED);
+      request->state = GTK_CUPS_GET_CONNECT;
       /* Flush any error message... */
       httpFlush (request->http);
 
@@ -1044,7 +1064,6 @@ _get_check (GtkCupsRequest *request)
       request->attempts++;
       goto again;
     }
-#endif
   else if (http_status != HTTP_OK)
     {
       int http_errno;
@@ -1072,7 +1091,7 @@ _get_check (GtkCupsRequest *request)
       httpFlush (request->http);
       httpClose (request->http);
       request->last_status = HTTP_CONTINUE;
-      request->http = NULL;
+      request->reconnect = TRUE;
       return;
 
     }
Only in gtk+-2.10.13/modules/printbackends/cups: gtkcupsutils.c.orig
diff -up --recursive gtk+-2.10.13.orig/modules/printbackends/cups/gtkcupsutils.h gtk+-2.10.13/modules/printbackends/cups/gtkcupsutils.h
--- gtk+-2.10.13.orig/modules/printbackends/cups/gtkcupsutils.h	2007-06-12 20:10:08.000000000 -0700
+++ gtk+-2.10.13/modules/printbackends/cups/gtkcupsutils.h	2007-07-10 11:36:48.000000000 -0700
@@ -78,6 +78,9 @@ struct _GtkCupsRequest 
   GtkCupsPollState poll_state;
 
   gint own_http : 1; 
+  gint *http_id;
+  gint id;
+  gint reconnect;
 };
 
 #define GTK_CUPS_REQUEST_START 0
Only in gtk+-2.10.13/modules/printbackends/cups: gtkcupsutils.h.orig
diff -up --recursive gtk+-2.10.13.orig/modules/printbackends/cups/gtkprintbackendcups.c gtk+-2.10.13/modules/printbackends/cups/gtkprintbackendcups.c
--- gtk+-2.10.13.orig/modules/printbackends/cups/gtkprintbackendcups.c	2007-06-12 20:10:08.000000000 -0700
+++ gtk+-2.10.13/modules/printbackends/cups/gtkprintbackendcups.c	2007-07-10 11:35:29.000000000 -0700
@@ -106,6 +106,8 @@ struct _GtkPrintBackendCups
   guint list_printers_poll;
   guint list_printers_pending : 1;
   guint got_default_printer   : 1;
+  http_t *http;
+  gint http_id;
 };
 
 static GObjectClass *backend_parent_class;
@@ -160,6 +162,7 @@ static cairo_surface_t *    cups_printer
 								    gdouble                            width,
 								    gdouble                            height,
 								    GIOChannel                        *cache_io);
+static void cache_http (GtkPrintBackendCups *backend, GtkCupsRequest *request);
 
 
 static void
@@ -419,12 +422,13 @@ gtk_print_backend_cups_print_stream (Gtk
   cups_printer = GTK_PRINTER_CUPS (gtk_print_job_get_printer (job));
   settings = gtk_print_job_get_settings (job);
 
-  request = gtk_cups_request_new (NULL,
+  request = gtk_cups_request_new (GTK_PRINT_BACKEND_CUPS(print_backend)->http,
                                   GTK_CUPS_POST,
                                   IPP_PRINT_JOB,
 				  data_io,
 				  NULL,
 				  cups_printer->device_uri);
+  cache_http(GTK_PRINT_BACKEND_CUPS(print_backend),request);
 
   gtk_cups_request_ipp_add_string (request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
                                    NULL, cups_printer->printer_uri);
@@ -756,12 +760,13 @@ cups_request_printer_info (GtkPrintBacke
       "queued-job-count"
     };
 
-  request = gtk_cups_request_new (NULL,
+  request = gtk_cups_request_new (GTK_PRINT_BACKEND_CUPS(print_backend)->http,
                                   GTK_CUPS_POST,
                                   IPP_GET_PRINTER_ATTRIBUTES,
 				  NULL,
 				  NULL,
 				  NULL);
+  cache_http(print_backend,request);
 
   printer_uri = g_strdup_printf ("ipp://localhost/printers/%s",
                                   printer_name);
@@ -1219,12 +1224,13 @@ cups_request_printer_list (GtkPrintBacke
 
   cups_backend->list_printers_pending = TRUE;
 
-  request = gtk_cups_request_new (NULL,
+  request = gtk_cups_request_new (cups_backend->http,
                                   GTK_CUPS_POST,
                                   CUPS_GET_PRINTERS,
 				  NULL,
 				  NULL,
 				  NULL);
+  cache_http(cups_backend,request);
 
   gtk_cups_request_ipp_add_strings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
 				    "requested-attributes", G_N_ELEMENTS (pattrs),
@@ -1447,12 +1453,13 @@ cups_request_default_printer (GtkPrintBa
       return;
     }
   
-  request = gtk_cups_request_new (NULL,
+  request = gtk_cups_request_new (GTK_PRINT_BACKEND_CUPS(print_backend)->http,
                                   GTK_CUPS_POST,
                                   CUPS_GET_DEFAULT,
 				  NULL,
 				  NULL,
 				  NULL);
+  cache_http(print_backend,request);
   
   cups_request_execute (print_backend,
                         request,
@@ -2887,3 +2894,9 @@ cups_printer_get_capabilities (GtkPrinte
     GTK_PRINT_CAPABILITY_COLLATE |
     GTK_PRINT_CAPABILITY_REVERSE;
 }
+
+static void cache_http (GtkPrintBackendCups *backend, GtkCupsRequest *request) {
+  backend->http = request->http;
+  request->own_http = FALSE;
+  request->http_id = &(backend->http_id);
+}
