mirror of
https://github.com/sogou/workflow.git
synced 2026-02-08 01:33:17 +08:00
Remove 'WFHttpServerTask.h' (#1653)
This commit is contained in:
1
BUILD
1
BUILD
@@ -93,7 +93,6 @@ cc_library(
|
||||
'src/protocol/HttpMessage.h',
|
||||
'src/protocol/HttpUtil.h',
|
||||
'src/protocol/http_parser.h',
|
||||
'src/factory/WFHttpServerTask.h',
|
||||
'src/server/WFHttpServer.h',
|
||||
],
|
||||
includes = [
|
||||
|
||||
@@ -89,7 +89,6 @@ set(INCLUDE_HEADERS
|
||||
src/factory/WFOperator.h
|
||||
src/factory/WFResourcePool.h
|
||||
src/factory/WFMessageQueue.h
|
||||
src/factory/WFHttpServerTask.h
|
||||
src/factory/RedisTaskImpl.inl
|
||||
src/nameservice/WFNameService.h
|
||||
src/nameservice/WFDnsResolver.h
|
||||
|
||||
@@ -911,6 +911,29 @@ WFHttpTask *WFTaskFactory::create_http_task(const ParsedURI& uri,
|
||||
|
||||
/**********Server**********/
|
||||
|
||||
class WFHttpServerTask : public WFServerTask<protocol::HttpRequest,
|
||||
protocol::HttpResponse>
|
||||
{
|
||||
private:
|
||||
using TASK = WFNetworkTask<protocol::HttpRequest, protocol::HttpResponse>;
|
||||
|
||||
public:
|
||||
WFHttpServerTask(CommService *service, std::function<void (TASK *)>& proc) :
|
||||
WFServerTask(service, WFGlobal::get_scheduler(), proc),
|
||||
req_is_alive_(false),
|
||||
req_has_keep_alive_header_(false)
|
||||
{}
|
||||
|
||||
protected:
|
||||
virtual void handle(int state, int error);
|
||||
virtual CommMessageOut *message_out();
|
||||
|
||||
protected:
|
||||
bool req_is_alive_;
|
||||
bool req_has_keep_alive_header_;
|
||||
std::string req_keep_alive_;
|
||||
};
|
||||
|
||||
void WFHttpServerTask::handle(int state, int error)
|
||||
{
|
||||
if (state == WFT_STATE_TOREPLY)
|
||||
@@ -1044,3 +1067,11 @@ CommMessageOut *WFHttpServerTask::message_out()
|
||||
return this->WFServerTask::message_out();
|
||||
}
|
||||
|
||||
/**********Server Factory**********/
|
||||
|
||||
WFHttpTask *WFServerTaskFactory::create_http_task(CommService *service,
|
||||
std::function<void (WFHttpTask *)>& process)
|
||||
{
|
||||
return new WFHttpServerTask(service, process);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2023 Sogou, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Authors: Xie Han (xiehan@sogou-inc.com)
|
||||
*/
|
||||
|
||||
#ifndef _WFHTTPSERVERTASK_H_
|
||||
#define _WFHTTPSERVERTASK_H_
|
||||
|
||||
#include "HttpMessage.h"
|
||||
#include "WFTask.h"
|
||||
#include "WFGlobal.h"
|
||||
|
||||
class WFHttpServerTask : public WFServerTask<protocol::HttpRequest,
|
||||
protocol::HttpResponse>
|
||||
{
|
||||
private:
|
||||
using TASK = WFNetworkTask<protocol::HttpRequest, protocol::HttpResponse>;
|
||||
|
||||
public:
|
||||
WFHttpServerTask(CommService *service, std::function<void (TASK *)>& proc) :
|
||||
WFServerTask(service, WFGlobal::get_scheduler(), proc),
|
||||
req_is_alive_(false),
|
||||
req_has_keep_alive_header_(false)
|
||||
{}
|
||||
|
||||
protected:
|
||||
virtual void handle(int state, int error);
|
||||
virtual CommMessageOut *message_out();
|
||||
|
||||
protected:
|
||||
bool req_is_alive_;
|
||||
bool req_has_keep_alive_header_;
|
||||
std::string req_keep_alive_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include "WFTaskError.h"
|
||||
#include "EndpointParams.h"
|
||||
#include "WFNameService.h"
|
||||
#include "WFHttpServerTask.h"
|
||||
|
||||
class __WFDynamicTask : public WFDynamicTask
|
||||
{
|
||||
@@ -576,9 +575,9 @@ WFNetworkTaskFactory<REQ, RESP>::create_client_task(enum TransportType type,
|
||||
template<class REQ, class RESP>
|
||||
WFNetworkTask<REQ, RESP> *
|
||||
WFNetworkTaskFactory<REQ, RESP>::create_server_task(CommService *service,
|
||||
std::function<void (WFNetworkTask<REQ, RESP> *)>& proc)
|
||||
std::function<void (WFNetworkTask<REQ, RESP> *)>& process)
|
||||
{
|
||||
return new WFServerTask<REQ, RESP>(service, WFGlobal::get_scheduler(), proc);
|
||||
return new WFServerTask<REQ, RESP>(service, WFGlobal::get_scheduler(), process);
|
||||
}
|
||||
|
||||
/**********Server Factory**********/
|
||||
@@ -587,16 +586,13 @@ class WFServerTaskFactory
|
||||
{
|
||||
public:
|
||||
static WFDnsTask *create_dns_task(CommService *service,
|
||||
std::function<void (WFDnsTask *)>& proc);
|
||||
std::function<void (WFDnsTask *)>& process);
|
||||
|
||||
static WFHttpTask *create_http_task(CommService *service,
|
||||
std::function<void (WFHttpTask *)>& proc)
|
||||
{
|
||||
return new WFHttpServerTask(service, proc);
|
||||
}
|
||||
std::function<void (WFHttpTask *)>& process);
|
||||
|
||||
static WFMySQLTask *create_mysql_task(CommService *service,
|
||||
std::function<void (WFMySQLTask *)>& proc);
|
||||
std::function<void (WFMySQLTask *)>& process);
|
||||
};
|
||||
|
||||
/************Go Task Factory************/
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../factory/WFHttpServerTask.h
|
||||
Reference in New Issue
Block a user