]> err.no Git - sope/commitdiff
improved HTTP version headers
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sat, 12 Mar 2005 20:43:50 +0000 (20:43 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Sat, 12 Mar 2005 20:43:50 +0000 (20:43 +0000)
properly specify charset in MIME headers

git-svn-id: http://svn.opengroupware.org/SOPE/trunk@648 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-appserver/NGObjWeb/ChangeLog
sope-appserver/NGObjWeb/Version
sope-appserver/NGObjWeb/WOHTTPConnection.m
sope-appserver/NGObjWeb/WOStats.m
sope-appserver/NGObjWeb/WebDAV/GNUmakefile
sope-appserver/NGObjWeb/WebDAV/GNUmakefile.preamble
sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m

index 34404b067ce4343f5f91213e797229d47fcee5e0..49eb91394777afd3891860c97df5272fd0f51e19 100644 (file)
@@ -1,3 +1,14 @@
+2005-03-12  Helge Hess  <helge.hess@opengroupware.org>
+
+       * v4.5.135
+       
+       * WOHTTPConnection.m: deliver proper SOPE version in 'user-agent'
+       
+       * SoWebDAVRenderer.m: deliver proper SOPE version in 'server' header
+       
+       * WOStats.m, SoWebDAVRenderer.m: explicitly specify charset of text/xml
+         result
+
 2005-03-11  Helge Hess  <helge.hess@opengroupware.org>
 
        * WebDAV/SoWebDAVRenderer.m: fixed ordering of propstat result elements
index ab606870a6f8d2d238d26a4e3100f0828251af49..442dc4609e33c1042e0e38665254baf32b53a286 100644 (file)
@@ -1,6 +1,6 @@
 # version file
 
-SUBMINOR_VERSION:=134
+SUBMINOR_VERSION:=135
 
 # v4.5.122 requires libNGExtensions v4.5.153
 # v4.5.91  requires libNGExtensions v4.5.134
index 2ab95a68fa9c20c93aef34f905993b703fb2e97f..8cdc3da0a762764bc28814a8e5b0c4b9dc361c58 100644 (file)
@@ -460,7 +460,15 @@ static BOOL logStream = NO;
     [self debugWithFormat:@"  wrote accept header ..."];
   }
   if ([_request headerForKey:@"user-agent"] == nil) {
-    if (isok) isok = [self->io writeString:@"User-Agent: SOPE/4.2\r\n"];
+    if (isok) {
+      static NSString *s = nil;
+      if (s == nil) {
+       s = [[NSString alloc] initWithFormat:@"User-Agent: SOPE/%i.%i.%i\r\n",
+                             SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION, 
+                             SOPE_SUBMINOR_VERSION];
+      }
+      isok = [self->io writeString:s];
+    }
     [self debugWithFormat:@"  wrote user-agent header ..."];
   }
   
index e13b3105886de6c64ffe51f509a0f8cfc98cd4e2..5c95c3581f4fd9d63802b84069b2c2baedcbd1a3 100644 (file)
     xslPath = nil;
   
   response = [WOResponse responseWithRequest:[self request]];
-  [response setHeader:@"text/xml" forKey:@"content-type"];
+  [response setContentEncoding:NSUTF8StringEncoding];
+  [response setHeader:@"text/xml; charset=utf-8" forKey:@"content-type"];
   
   stats = [[app statisticsStore] statistics];
   
   [response appendContentString:@"<?xml version='1.0'?>\n"];
-#if 1
   if ([xslPath length] > 0) {
     [response appendContentString:@"<?xml-stylesheet type='text/xsl' href='"];
     [response appendContentString:xslPath];
     [response appendContentString:@"'?>"];
   }
-#endif
+
   [response appendContentString:@"<application name='"];
   [response appendContentString:[app name]];
   [response appendContentString:@"'"];
index 914b4beffc4e1cc59e5f11a20a283ce1b64131ff..e1435678077778e3f357346de1da206df135843c 100644 (file)
@@ -1,6 +1,8 @@
 # GNUstep makefile
 
 -include ../../../config.make
+include ../../Version
+include ../Version
 include $(GNUSTEP_MAKEFILES)/common.make
 
 SUBPROJECT_NAME = WebDAV
index 4af3dc4ecc73fe64b140be03d0129d5ebb7696a1..d526499b45ad348ef17c85ffb357388777e2208e 100644 (file)
@@ -1,5 +1,11 @@
 # compiler flags
 
+ADDITIONAL_CPPFLAGS += \
+        -Wall -DCOMPILE_FOR_GSTEP_MAKE=1        \
+        -DSOPE_MAJOR_VERSION=$(MAJOR_VERSION)   \
+        -DSOPE_MINOR_VERSION=$(MINOR_VERSION)   \
+        -DSOPE_SUBMINOR_VERSION=$(SUBMINOR_VERSION)
+
 ADDITIONAL_INCLUDE_DIRS += \
        -I..                    \
        -I../SoObjects/         \
index 720f3c5c34b09c0e187f3e4b43e302de25a420a8..6e4ee60dc0ef9155e5008c97fd56aeea811817b6 100644 (file)
@@ -96,7 +96,15 @@ static BOOL         formatOutput = NO;
   
   if ((tmp = [_r headerForKey:@"server"]) == nil) {
     // TODO: add application name as primary name
-    [_r setHeader:@"SOPE 4.2/WebDAV" forKey:@"server"];
+    static NSString *server = nil;
+
+    if (server == nil) {
+      server = [[NSString alloc] initWithFormat:@"SOPE %i.%i.%i/WebDAV",
+                                SOPE_MAJOR_VERSION, SOPE_MINOR_VERSION,
+                                SOPE_SUBMINOR_VERSION];
+    }
+    
+    [_r setHeader:server forKey:@"server"];
   }
   
   [_r setHeader:@"close" forKey:@"connection"];
@@ -762,6 +770,8 @@ static BOOL         formatOutput = NO;
   /* generate multistatus */
    
   [r setStatus:207 /* multistatus */];
+  [r setContentEncoding:NSUTF8StringEncoding];
+  [r setHeader:@"text/xml; charset=\"utf-8\"" forKey:@"content-type"];
   [r setHeader:@"no-cache" forKey:@"pragma"];
   [r setHeader:@"no-cache" forKey:@"cache-control"];
   
@@ -842,7 +852,7 @@ static BOOL         formatOutput = NO;
   
   r = [_ctx response];
   
-  [r setStatus:200];
+  [r setStatus:200 /* OK */];
   [r setContentEncoding:NSUTF8StringEncoding];
   [r setHeader:@"text/xml; charset=\"utf-8\"" forKey:@"content-type"];
   [r setHeader:[_object stringValue]          forKey:@"lock-token"];
@@ -894,12 +904,12 @@ static BOOL         formatOutput = NO;
   notificationType  = [rq headerForKey:@"notification-type"];
   lifetime          = [rq headerForKey:@"subscription-lifetime"];
   
-  [r setStatus:200];
-  if (notificationType)
+  [r setStatus:200 /* OK */];
+  if (notificationType != nil)
     [r setHeader:notificationType forKey:@"notification-type"];
-  if (lifetime)
+  if (lifetime != nil)
     [r setHeader:lifetime         forKey:@"subscription-lifetime"];
-  if (callback)
+  if (callback != nil)
     [r setHeader:callback         forKey:@"callback"];
   [r setHeader:[self baseURLForContext:_ctx] forKey:@"content-location"];
   [r setHeader:_object forKey:@"subscription-id"];
@@ -921,6 +931,8 @@ static BOOL         formatOutput = NO;
        nsToPrefix:nsToPrefix];
   
   [r setStatus:207 /* multistatus */];
+  [r setContentEncoding:NSUTF8StringEncoding];
+  [r setHeader:@"text/xml; charset=\"utf-8\"" forKey:@"content-type"];
   [r appendContentString:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"];
   [r appendContentString:@"<D:multistatus"];
   [r appendContentString:[self nsDeclsForMap:nsToPrefix]];
@@ -1101,7 +1113,8 @@ static BOOL         formatOutput = NO;
     inactive = [_object objectForKey:@"inactive"];
     
     [r setStatus:207 /* Multi-Status */];
-    [r setHeader:@"text/xml" forKey:@"content-type"];
+    [r setContentEncoding:NSUTF8StringEncoding];
+    [r setHeader:@"text/xml; charset=\"utf-8\"" forKey:@"content-type"];
 
     [r appendContentString:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"];
     [r appendContentString:@"<D:multistatus "];
@@ -1119,7 +1132,8 @@ static BOOL         formatOutput = NO;
   }
   else if ([_object isKindOfClass:[NSArray class]]) {
     [r setStatus:207 /* Multi-Status */];
-    [r setHeader:@"text/xml" forKey:@"content-type"];
+    [r setContentEncoding:NSUTF8StringEncoding];
+    [r setHeader:@"text/xml; charset=\"utf-8\"" forKey:@"content-type"];
 
     [r appendContentString:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"];
     [r appendContentString:@"<D:multistatus "];