ObjFW  Check-in [e0c2d4af24]

Overview
Comment:OFHTTPServer: Small fixes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e0c2d4af249906603f511fd0af5a4a45126dcbac14a468b1559335afa831d914
User & Date: js on 2012-12-11 12:32:40
Other Links: manifest | tags
Context
2012-12-11
12:44
Update Xcode project. check-in: 7ef87b5ee2 user: js tags: trunk
12:32
OFHTTPServer: Small fixes. check-in: e0c2d4af24 user: js tags: trunk
12:27
OFHTTPClient: Small fixes. check-in: 634a1461f8 user: js tags: trunk
Changes

Modified src/OFHTTPServer.h from [a5be6ab75a] to [551f28751a].

21
22
23
24
25
26
27
28




29
30
31
32
33
34
35
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38







-
+
+
+
+







@class OFHTTPRequestResult;
@class OFTCPSocket;
@class OFException;

/*!
 * @brief A delegate for OFHTTPServer.
 */
@protocol OFHTTPServerDelegate <OFObject>
@protocol OFHTTPServerDelegate
#ifndef OF_HTTP_SERVER_M
    <OFObject>
#endif
/*!
 * @brief This method is called when the HTTP server received a request from a
 *	  client.
 *
 * @param server The HTTP server which received the request
 * @param request The request the HTTP server received
 * @return The result the HTTP server should send to the client

Modified src/OFHTTPServer.m from [019519d771] to [bee61430ab].

12
13
14
15
16
17
18


19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27







+
+







 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#define OF_HTTP_SERVER_M

#include <string.h>
#include <ctype.h>

#import "OFHTTPServer.h"
#import "OFDataArray.h"
#import "OFDate.h"
#import "OFDictionary.h"
136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152







-
+







	}
}

static OF_INLINE OFString*
normalized_key(OFString *key)
{
	char *cString = strdup([key UTF8String]);
	char *tmp = cString;
	uint8_t *tmp = (uint8_t*)cString;
	BOOL firstLetter = YES;

	if (cString == NULL)
		@throw [OFOutOfMemoryException
		    exceptionWithClass: nil
			 requestedSize: strlen([key UTF8String])];

461
462
463
464
465
466
467
468

469
470
471
472
473
474
475
463
464
465
466
467
468
469

470
471
472
473
474
475
476
477







-
+








	reply = [[server delegate] server: server
			didReceiveRequest: request];

	if (reply == nil) {
		[self sendErrorAndClose: 500];
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [[server delegate] class]
		    exceptionWithClass: [(id)[server delegate] class]
			      selector: @selector(server:didReceiveRequest:)];
	}

	replyHeaders = [reply headers];
	replyData = [reply data];

	[sock writeFormat: @"HTTP/1.1 %d %s\r\n"