ObjFW  Check-in [692fe63730]

Overview
Comment:OFHTTPClient: Better checking for invalid reply
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 692fe63730f4972646fe6da17bb5a37de3c6a40093dec64b135915e243cb8ffa
User & Date: js on 2015-05-24 16:19:07
Other Links: manifest | tags
Context
2015-05-24
19:16
OFTLSSocket: Improved API for easier verification check-in: 94affb5b29 user: js tags: trunk
16:19
OFHTTPClient: Better checking for invalid reply check-in: 692fe63730 user: js tags: trunk
10:58
utils/ofhttp: Add verbose mode check-in: 33760dee1a user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [d946419431] to [10e2ede1ff].

487
488
489
490
491
492
493
494

495
496
497
498
499
500
501
		@try {
			line = [socket readLine];
		} @catch (OFInvalidEncodingException *e) {
			@throw [OFInvalidServerReplyException exception];
		}
	}

	if (![line hasPrefix: @"HTTP/"] || [line characterAtIndex: 8] != ' ')

		@throw [OFInvalidServerReplyException exception];

	version = [line substringWithRange: of_range(5, 3)];
	if (![version isEqual: @"1.0"] && ![version isEqual: @"1.1"])
		@throw [OFUnsupportedVersionException
		    exceptionWithVersion: version];








|
>







487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
		@try {
			line = [socket readLine];
		} @catch (OFInvalidEncodingException *e) {
			@throw [OFInvalidServerReplyException exception];
		}
	}

	if (![line hasPrefix: @"HTTP/"] || [line length] < 9 ||
	    [line characterAtIndex: 8] != ' ')
		@throw [OFInvalidServerReplyException exception];

	version = [line substringWithRange: of_range(5, 3)];
	if (![version isEqual: @"1.0"] && ![version isEqual: @"1.1"])
		@throw [OFUnsupportedVersionException
		    exceptionWithVersion: version];