ObjFW  Diff

Differences From Artifact [0c9c549df6]:

To Artifact [0971f78b90]:

  • File src/OFHTTPServer.m — part of check-in [3d16a30f41] at 2013-06-22 12:12:36 on branch trunk — Rework exceptions.

    This mostly removes the argument for the class in which the exception
    occurred. As backtraces were recently added for all platforms, the
    passed class does not give any extra information on where the exception
    occurred anymore.

    This also removes a few other arguments which were not too helpful. In
    the past, the idea was to pass as many arguments as possible so that it
    is easier to find the origin of the exception. However, as backtraces
    are a much better way to find the origin, those are not useful anymore
    and just make the exception more cumbersome to use. The rule is now to
    only pass arguments that might help in recovering from the exception or
    provide information that is otherwise not easily accessible. (user: js, size: 15499) [annotate] [blame] [check-ins using]


141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
	char *cString = strdup([key UTF8String]);
	uint8_t *tmp = (uint8_t*)cString;
	bool firstLetter = true;

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

	while (*tmp != '\0') {
		if (!isalnum(*tmp)) {
			firstLetter = true;
			tmp++;
			continue;
		}







<
|







141
142
143
144
145
146
147

148
149
150
151
152
153
154
155
{
	char *cString = strdup([key UTF8String]);
	uint8_t *tmp = (uint8_t*)cString;
	bool firstLetter = true;

	if (cString == NULL)
		@throw [OFOutOfMemoryException

		    exceptionWithRequestedSize: strlen([key UTF8String])];

	while (*tmp != '\0') {
		if (!isalnum(*tmp)) {
			firstLetter = true;
			tmp++;
			continue;
		}
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
{
	OF_GETTER(_name, true)
}

- (void)start
{
	if (_host == nil || _port == 0)
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];

	if (_listeningSocket != nil)
		@throw [OFAlreadyConnectedException
		    exceptionWithClass: [self class]
				socket: _listeningSocket];

	_listeningSocket = [[OFTCPSocket alloc] init];
	[_listeningSocket bindToHost: _host
				port: _port];
	[_listeningSocket listen];

	[_listeningSocket asyncAcceptWithTarget: self







|
<
<


|
<
<







685
686
687
688
689
690
691
692


693
694
695


696
697
698
699
700
701
702
{
	OF_GETTER(_name, true)
}

- (void)start
{
	if (_host == nil || _port == 0)
		@throw [OFInvalidArgumentException exception];



	if (_listeningSocket != nil)
		@throw [OFAlreadyConnectedException exception];



	_listeningSocket = [[OFTCPSocket alloc] init];
	[_listeningSocket bindToHost: _host
				port: _port];
	[_listeningSocket listen];

	[_listeningSocket asyncAcceptWithTarget: self