ObjWebServer  Diff

Differences From Artifact [46101b0094]:

To Artifact [ddb184ed8d]:


49
50
51
52
53
54
55




56
57
58
59
60
61
62


63
64
65
66
67
68
69
}

- (instancetype)initWithConfigPath: (OFString *)configPath
{
	self = [super init];

	@try {




		OFXMLElement *config = [[OFXMLElement alloc]
		    initWithFile: configPath];
		@try {
			[self _parseConfig: config];
		} @finally {
			[config release];
		}


	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}







>
>
>
>

|





>
>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
}

- (instancetype)initWithConfigPath: (OFString *)configPath
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		OFFile *configFile = [OFFile fileWithPath: configPath
						     mode: @"r"];

		OFXMLElement *config = [[OFXMLElement alloc]
		    initWithStream: configFile];
		@try {
			[self _parseConfig: config];
		} @finally {
			[config release];
		}

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
		if (portString == nil)
			[self _invalidConfig:
			    @"<listen/> is missing port attribute"];

		listenConfig.host = host;

		@try {
			intmax_t port = portString.decimalValue;
			if (port < 0 || port > 65535)
				@throw [OFInvalidFormatException exception];

			listenConfig.port = port;
		} @catch (OFInvalidFormatException *e) {
			[self _invalidConfig: @"<listen/> has invalid port"];
		}







|







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
		if (portString == nil)
			[self _invalidConfig:
			    @"<listen/> is missing port attribute"];

		listenConfig.host = host;

		@try {
			long long port = portString.longLongValue;
			if (port < 0 || port > 65535)
				@throw [OFInvalidFormatException exception];

			listenConfig.port = port;
		} @catch (OFInvalidFormatException *e) {
			[self _invalidConfig: @"<listen/> has invalid port"];
		}
165
166
167
168
169
170
171
172
173
174
175

	[modules makeImmutable];
	_modules = [modules copy];
}

- (void)_invalidConfig: (OFString *)message
{
	[of_stderr writeFormat: @"Error parsing config: %@", message];
	[OFApplication terminateWithStatus: 1];
}
@end







|



171
172
173
174
175
176
177
178
179
180
181

	[modules makeImmutable];
	_modules = [modules copy];
}

- (void)_invalidConfig: (OFString *)message
{
	[OFStdErr writeFormat: @"Error parsing config: %@", message];
	[OFApplication terminateWithStatus: 1];
}
@end