On Tue, Dec 27, 2011 at 04:50:26PM +0100, Nick Wellnhofer wrote:
>> How about we expose a handle_request() method on SearchServer which takes a
>> socket handle as an argument, reads the incoming request and sends a response
>> back?
>>
>> =head2 handle_request
>>
>> $search_server->handle_request($sock);
>>
>> Process a request from a socket handle which is ready for reading.
>
> That's what I had in mind.
Ah, I see that you have a process_request() method in the LUCY-205 patch
already -- and though it does not take a socket-handle/fileno as an argument,
it can be modified easily to do so.
If we make that method public and have it accept a socket-handle/fileno, then
it becomes possible to implement any number of server configurations.
> But if we want to use Net::Server, we can't use SearchServer's constructor
> in its current form.
Well, it's my understanding that it would violate Apache legal policy if we
were to distribute a subclass of Net::Server as part of Apache Lucy.
So, instead, let's do something even better! Let's give our users the freedom
to use not only Net::Server::PreFork, but lots of other options.
> So I would split SearchServer into two classes.
If you or somebody else wants to publish a CPAN distro that provides
SearchServer capabilities in conjunction with Net::Server::PreFork, that's
cool. You get to make your own call on licensing that way.
We just have to make sure that we are in compliance with this guideline:
http://www.apache.org/legal/resolved.html#optional
Optional means that the component is not required for standard use of the
product or for the product to achieve a desirable level of quality. The
question to ask yourself in this situation is:
"Will the majority of users want to use my product without adding the
optional components?
I think that means that we cannot simply delete SearchServer#serve -- though
we can improve on things by making it possible to override serve() or
otherwise avoid it.
Marvin Humphrey