ObjWebServer  Diff

Differences From Artifact [1eb8b41163]:

To Artifact [110f6395ae]:


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

- (void)parseConfig: (OFXMLElement *)config
{
	OFMutableDictionary OF_GENERIC(OFString *, OFString *) *MIMETypes;

	_root = [[config elementForName: @"root"].stringValue copy];
	if (_root == nil) {
		[of_stderr writeString:
		    @"Error parsing config: No <root/> element!"];
		[OFApplication terminateWithStatus: 1];
	}

	MIMETypes = [OFMutableDictionary dictionary];
	for (OFXMLElement *MIMEType in [config elementsForName: @"mime-type"]) {
		OFString *extension =
		    [MIMEType attributeForName: @"extension"].stringValue;
		OFString *type =
		    [MIMEType attributeForName: @"type"].stringValue;

		if (extension == nil) {
			[of_stderr writeString:
			    @"Error parsing config: "
			    @"<mime-type/> has no extension attribute!"];
			[OFApplication terminateWithStatus: 1];
		}
		if (type == nil) {
			[of_stderr writeString:
			    @"Error parsing config: "
			    @"<mime-type/> has no type attribute!"];
			[OFApplication terminateWithStatus: 1];
		}

		[MIMETypes setObject: type
			      forKey: extension];







|












|





|







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

- (void)parseConfig: (OFXMLElement *)config
{
	OFMutableDictionary OF_GENERIC(OFString *, OFString *) *MIMETypes;

	_root = [[config elementForName: @"root"].stringValue copy];
	if (_root == nil) {
		[OFStdErr writeString:
		    @"Error parsing config: No <root/> element!"];
		[OFApplication terminateWithStatus: 1];
	}

	MIMETypes = [OFMutableDictionary dictionary];
	for (OFXMLElement *MIMEType in [config elementsForName: @"mime-type"]) {
		OFString *extension =
		    [MIMEType attributeForName: @"extension"].stringValue;
		OFString *type =
		    [MIMEType attributeForName: @"type"].stringValue;

		if (extension == nil) {
			[OFStdErr writeString:
			    @"Error parsing config: "
			    @"<mime-type/> has no extension attribute!"];
			[OFApplication terminateWithStatus: 1];
		}
		if (type == nil) {
			[OFStdErr writeString:
			    @"Error parsing config: "
			    @"<mime-type/> has no type attribute!"];
			[OFApplication terminateWithStatus: 1];
		}

		[MIMETypes setObject: type
			      forKey: extension];
185
186
187
188
189
190
191
192
193
194
195
	[response asyncWriteData: readData(fileSender->_file)];

	return true;
}
@end

StaticModule *
init_plugin(void)
{
	return [[[StaticModule alloc] init] autorelease];
}







|



185
186
187
188
189
190
191
192
193
194
195
	[response asyncWriteData: readData(fileSender->_file)];

	return true;
}
@end

StaticModule *
OFPluginInit(void)
{
	return [[[StaticModule alloc] init] autorelease];
}