Author: rfm
Date: Thu May 4 15:44:15 2017
New Revision: 40496
URL: http://svn.gna.org/viewcvs/gnustep?rev=40496&view=rev
Log:
Update WebServerFrameOptions when a new connection is made
Modified:
libs/webserver/trunk/Internal.h
libs/webserver/trunk/WebServer.m
libs/webserver/trunk/WebServerConnection.m
Modified: libs/webserver/trunk/Internal.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/Internal.h?rev=40496&r1=40495&r2=40496&view=diff
==============================================================================
--- libs/webserver/trunk/Internal.h (original)
+++ libs/webserver/trunk/Internal.h Thu May 4 15:44:15 2017
@@ -100,7 +100,6 @@
NSUInteger maxConnectionRequests;
NSTimeInterval maxConnectionDuration;
NSSet *permittedMethods;
- NSString *frameOptions;
}
@end
@@ -185,6 +184,7 @@
BOOL chunked; // Stream in chunks?
uint32_t incremental; // Incremental parsing of request?
NSMutableData *outBuffer;
+ NSString *frameOpts;
@public
NSTimeInterval ticked;
NSTimeInterval extended;
Modified: libs/webserver/trunk/WebServer.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/WebServer.m?rev=40496&r1=40495&r2=40496&view=diff
==============================================================================
--- libs/webserver/trunk/WebServer.m (original)
+++ libs/webserver/trunk/WebServer.m Thu May 4 15:44:15 2017
@@ -2615,8 +2615,6 @@
- (void) _setup
{
- NSString *s;
-
_reserved = 0;
_nc = [[NSNotificationCenter defaultCenter] retain];
_connectionTimeout = 30.0;
@@ -2636,14 +2634,6 @@
_conf->maxConnectionDuration = 10.0;
_conf->maxBodySize = 4*1024*1024;
_conf->maxRequestSize = 8*1024;
- if (nil == (s = [_defs stringForKey: @"WebServerFrameOptions"]))
- {
- _conf->frameOptions = @"DENY";
- }
- else if ([s length] > 0)
- {
- _conf->frameOptions = [s copy];
- }
_maxPerHost = 32;
_maxConnections = 128;
_substitutionLimit = 4;
@@ -2710,7 +2700,6 @@
- (void) dealloc
{
[permittedMethods release];
- [frameOptions release];
[super dealloc];
}
@end
Modified: libs/webserver/trunk/WebServerConnection.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/webserver/trunk/WebServerConnection.m?rev=40496&r1=40495&r2=40496&view=diff
==============================================================================
--- libs/webserver/trunk/WebServerConnection.m (original)
+++ libs/webserver/trunk/WebServerConnection.m Thu May 4 15:44:15 2017
@@ -28,6 +28,7 @@
#import <Foundation/NSLock.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSThread.h>
+#import <Foundation/NSUserDefaults.h>
#define WEBSERVERINTERNAL 1
@@ -460,6 +461,7 @@
{
[handle closeFile];
DESTROY(ioThread);
+ DESTROY(frameOpts);
DESTROY(handle);
DESTROY(excess);
DESTROY(address);
@@ -629,6 +631,18 @@
if ((self = [super init]) != nil)
{
+ NSString *o;
+
+ if (nil == (o = [[NSUserDefaults standardUserDefaults]
+ stringForKey: @"WebServerFrameOptions"]))
+ {
+ frameOpts = @"DENY";
+ }
+ else if ([o length] > 0)
+ {
+ frameOpts = [o copy];
+ }
+
nc = [[NSNotificationCenter defaultCenter] retain];
server = svr;
identity = ++connectionIdentity;
@@ -1098,10 +1112,10 @@
value: value
parameters: nil];
}
- if (nil != conf->frameOptions)
+ if (nil != frameOpts)
{
[response setHeader: @"X-Frame-Options"
- value: conf->frameOptions
+ value: frameOpts
parameters: nil];
}
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs