HTTPConnection delegate methods are defined wrongly


#1

First of all, I enjoyed reading the book.

When I use the HTTPConnetion delegation methods, I found strangely the two methods are defined in a category of HTTPConnection class:

@interface HTTPConnection (HTTPConnectionDelegateMethods)
- (void)HTTPConnection:(HTTPConnection *)conn didReceiveRequest:(HTTPServerRequest *)mess;
- (void)HTTPConnection:(HTTPConnection *)conn didSendResponse:(HTTPServerRequest *)mess;
// The "didReceiveRequest:" is the most interesting -- 
// tells the delegate when a new request comes in.
@end

Though there is no problem to write code based on this. But the pattern is wrong, the methods are defined for HTTPConnection but not implemented in HTTPServer.m file (and of course they should not be implemented in HTTPConnection class).

The methods should be declared in protocol, aren’t they?

@protocol HTTPConnectionDelegate <NSObject>
@optional
- (void)HTTPConnection:(HTTPConnection *)conn didReceiveRequest:(HTTPServerRequest *)mess;
- (void)HTTPConnection:(HTTPConnection *)conn didSendResponse:(HTTPServerRequest *)mess;
@end