File xpp-1.5-domain_socket.patch of Package xpp

--- xpp-1.5/cupshelper.cxx.orig	2002-05-28 17:49:45.000000000 +0200
+++ xpp-1.5/cupshelper.cxx	2006-11-27 14:25:24.000000000 +0100
@@ -152,7 +152,10 @@
 	int	  value(-1);
 
 	request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
-	sprintf(str,"ipp://%s:%d/printers/%s",host(),port(),name);
+	if  (host()[0] == '/') // unix domain socket
+		sprintf(str,"ipp://localhost:%d/printers/%s",port(),name);
+	else
+		sprintf(str,"ipp://%s:%d/printers/%s",host(),port(),name);
 	ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,str);
 	//sprintf(str,"/printers/%s",name);
 	sprintf(str,"/printers/");
--- xpp-1.5/xpp.cxx.orig	2006-11-27 14:23:40.000000000 +0100
+++ xpp-1.5/xpp.cxx	2006-11-27 14:29:52.000000000 +0100
@@ -288,8 +288,12 @@
 
     ipp_t *request = CupsHelper::newIppRequest();
     char buf[1024], *state, *type, *location, *comment;
-    sprintf(buf,"ipp://%s:%d/printers/%s",CupsHelper::host(),
-            CupsHelper::port(),dests[i].name);
+    if (CupsHelper::host()[0] == '/') // unix domain socket
+	    sprintf(buf,"ipp://localhost:%d/printers/%s",CupsHelper::port(),
+		    dests[i].name);
+    else
+	    sprintf(buf,"ipp://%s:%d/printers/%s",CupsHelper::host(),
+		    CupsHelper::port(),dests[i].name);
     ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,buf);
     request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
     request = CupsHelper::processRequest(request,"/printers/");
@@ -716,8 +720,12 @@
   ipp_t *request = CupsHelper::newIppRequest();
   char buffer[1024], *t;
   const char *s, *u;
-  sprintf(buffer,"ipp://%s:%d/printers/%s",CupsHelper::host(),
-          CupsHelper::port(),dests[dest_pos].name);
+  if (CupsHelper::host()[0] == '/')
+    sprintf(buffer,"ipp://localhost:%d/printers/%s", CupsHelper::port(),
+	    dests[dest_pos].name);
+  else
+    sprintf(buffer,"ipp://%s:%d/printers/%s",CupsHelper::host(),
+	    CupsHelper::port(),dests[dest_pos].name);
   ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,
                "printer-uri",NULL,buffer);
   request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
@@ -791,8 +799,12 @@
   ipp_t *request = CupsHelper::newIppRequest();
   char buffer[1024]; 
   const char *s, *t, *u;
-  sprintf(buffer,"ipp://%s:%d/printers/%s",CupsHelper::host(),
-          CupsHelper::port(),dests[dest_pos].name);
+  if (CupsHelper::host()[0] == '/') // unix domain socket
+    sprintf(buffer,"ipp://localhost:%d/printers/%s",CupsHelper::port(),
+            dests[dest_pos].name);
+  else
+    sprintf(buffer,"ipp://%s:%d/printers/%s",CupsHelper::host(),
+            CupsHelper::port(),dests[dest_pos].name);
   ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,
                "printer-uri",NULL,buffer);
   request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
openSUSE Build Service is sponsored by