Skip to content

Commit

Permalink
Fix some spdy/http2 hidden bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlst committed Jun 30, 2015
1 parent 8d57c87 commit 4054803
Show file tree
Hide file tree
Showing 58 changed files with 953 additions and 925 deletions.
22 changes: 12 additions & 10 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1458,10 +1458,8 @@ Optional Features:
--enable-adminssl=[yes/no]
Enable HTTPS for admin console (modify adminssl.conf
before installation) [default=yes]
--enable-spdy Enable SPDY and http2 over HTTPS (Spdy and http2 are
disabled by default)
--enable-http2 Enable SPDY and http2 over HTTPS (Spdy and http2 are
disabled by default)
--enable-spdy=[yes/no] Enable SPDY and http2 over HTTPS [default=yes]
--enable-http2=[yes/no] Enable SPDY and http2 over HTTPS [default=yes]
--enable-redis Enable redis for cache module (Using redis is
disabled by default)
--enable-debug Enable debugging symbols (Debug is disabled by
Expand Down Expand Up @@ -15667,21 +15665,25 @@ fi



OPENLSWS_HTTP2="?"
# Check whether --enable-spdy was given.
if test "${enable_spdy+set}" = set; then :
enableval=$enable_spdy;
$as_echo "#define LS_ENABLE_SPDY 1" >>confdefs.h

echo "SPDY/http2 enabled!!!"
enableval=$enable_spdy; OPENLSWS_HTTP2="$enableval"
fi


# Check whether --enable-http2 was given.
if test "${enable_http2+set}" = set; then :
enableval=$enable_http2;
enableval=$enable_http2; OPENLSWS_HTTP2="$enableval"
fi

if test "$OPENLSWS_HTTP2" = "no" ; then
echo "SPDY/http2 disabled!!!"
else

$as_echo "#define LS_ENABLE_SPDY 1" >>confdefs.h

echo "SPDY/http2 enabled!!!"
echo "SPDY/http2 enabled!!!"
fi


Expand Down
24 changes: 15 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,23 @@ AC_ARG_ENABLE([adminssl],
[OPENLSWS_ADMINSSL="$enableval"], [OPENLSWS_ADMINSSL=yes])
AC_SUBST([OPENLSWS_ADMINSSL])

OPENLSWS_HTTP2="?"
AC_ARG_ENABLE([spdy],
[AC_HELP_STRING([--enable-spdy],
[Enable SPDY and http2 over HTTPS (Spdy and http2 are disabled by default)])],
[ AC_DEFINE([LS_ENABLE_SPDY], [1], [Define if need spdy/http2 feature])
echo "SPDY/http2 enabled!!!" ], [])

[AC_HELP_STRING([--enable-spdy=@<:@yes/no@:>@],
[Enable SPDY and http2 over HTTPS @<:@default=yes@:>@])],
[OPENLSWS_HTTP2="$enableval"], [])

AC_ARG_ENABLE([http2],
[AC_HELP_STRING([--enable-http2],
[Enable SPDY and http2 over HTTPS (Spdy and http2 are disabled by default)])],
[ AC_DEFINE([LS_ENABLE_SPDY], [1], [Define if need spdy/http2 feature])
echo "SPDY/http2 enabled!!!" ], [])
[AC_HELP_STRING([--enable-http2=@<:@yes/no@:>@],
[Enable SPDY and http2 over HTTPS @<:@default=yes@:>@])],
[OPENLSWS_HTTP2="$enableval"], [])
if test "$OPENLSWS_HTTP2" = "no" ; then
echo "SPDY/http2 disabled!!!"
else
AC_DEFINE([LS_ENABLE_SPDY], [1], [Define if need spdy/http2 feature])
echo "SPDY/http2 enabled!!!"
fi


AC_ARG_ENABLE([cacheredis],
[AC_HELP_STRING([--enable-redis],
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/cgi/cgidworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ int CgidWorker::s_iCgidWorkerPid = -1;


CgidWorker::CgidWorker(const char *pName)
: m_pid(-1)
: ExtWorker(HandlerType::HT_CGI)
, m_pid(-1)
, m_fdCgid(-1)
, m_lve(1)
{
Expand Down
5 changes: 3 additions & 2 deletions src/extensions/extworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@
#include <unistd.h>


ExtWorker::ExtWorker()
: m_pConfig(NULL)
ExtWorker::ExtWorker(int type)
: HttpHandler(type)
, m_pConfig(NULL)
, m_iRole(EXTAPP_RESPONDER)
, m_iMultiplexConns(0)
, m_iWantManagementInfo(1)
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/extworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ExtWorker : public HttpHandler
ST_GOOD
};

ExtWorker();
explicit ExtWorker(int type);
virtual ~ExtWorker();
ConnPool &getConnPool() { return m_connPool; }

Expand Down
4 changes: 3 additions & 1 deletion src/extensions/fcgi/fcgiapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "fcgiapp.h"
#include "fcgiappconfig.h"
#include "fcgiconnection.h"
#include <http/handlertype.h>
#include <lsr/ls_time.h>

#include <signal.h>
Expand All @@ -27,7 +28,8 @@


FcgiApp::FcgiApp(const char *pName)
: m_iMaxConns(10)
: LocalWorker(HandlerType::HT_FASTCGI)
, m_iMaxConns(10)
, m_iMaxReqs(10)
{
setConfigPointer(new FcgiAppConfig(pName));
Expand Down
2 changes: 2 additions & 0 deletions src/extensions/jk/jworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
#include "jworker.h"
#include "jworkerconfig.h"
#include "jconn.h"
#include <http/handlertype.h>

JWorker::JWorker(const char *pName)
: ExtWorker(HandlerType::HT_SERVLET)
{
setConfigPointer(new JWorkerConfig(pName));
}
Expand Down
9 changes: 3 additions & 6 deletions src/extensions/loadbalancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
*****************************************************************************/
#include "loadbalancer.h"
#include <extensions/extrequest.h>

LoadBalancer::LoadBalancer()
: m_lastWorker(0)
{
}
#include <http/handlertype.h>


LoadBalancer::LoadBalancer(const char *pName)
: m_lastWorker(0)
: ExtWorker(HandlerType::HT_LOADBALANCER)
, m_lastWorker(0)
{
setConfigPointer(new ExtWorkerConfig(pName));
}
Expand Down
3 changes: 1 addition & 2 deletions src/extensions/loadbalancer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class LoadBalancer: public ExtWorker
int workerLoadCompare(ExtWorker *pWorker, ExtWorker *pSelect);

public:
LoadBalancer(const char *pName);
LoadBalancer();
explicit LoadBalancer(const char *pName);

~LoadBalancer();
ExtWorker *selectWorker(HttpSession *pSession, ExtRequest *pExtReq);
Expand Down
5 changes: 3 additions & 2 deletions src/extensions/localworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
#define GRACE_TIMEOUT 20
#define KILL_TIMEOUT 25

LocalWorker::LocalWorker()
: m_fdApp(-1)
LocalWorker::LocalWorker(int type)
: ExtWorker(type)
, m_fdApp(-1)
, m_sigGraceStop(SIGTERM)
, m_pidList(NULL)
, m_pidListStop(NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/localworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class LocalWorker : public ExtWorker

void moveToStopList();
public:
LocalWorker();
explicit LocalWorker(int type);

~LocalWorker();

Expand Down
2 changes: 2 additions & 0 deletions src/extensions/lsapi/lsapiworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
#include "lsapiworker.h"
#include "lsapiconfig.h"
#include "lsapiconn.h"
#include <http/handlertype.h>


LsapiWorker::LsapiWorker(const char *pName)
: LocalWorker(HandlerType::HT_LSAPI)
{
setConfigPointer(new LsapiConfig(pName));
}
Expand Down
2 changes: 2 additions & 0 deletions src/extensions/proxy/proxyworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include "proxyworker.h"
#include "proxyconfig.h"
#include "proxyconn.h"
#include <http/handlertype.h>
ProxyWorker::ProxyWorker(const char *pName)
: ExtWorker(HandlerType::HT_PROXY)
{
setConfigPointer(new ProxyConfig(pName));
}
Expand Down
2 changes: 0 additions & 2 deletions src/extensions/registry/extappregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ static ExtWorker *newWorker(int type, const char *pName)
default:
return NULL;
}
if (pWorker)
pWorker->setHandlerType(type + HandlerType::HT_CGI);
return pWorker;
}

Expand Down
2 changes: 1 addition & 1 deletion src/http/awstats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ void Awstats::config(HttpVHost *pVHost, int val, char *achBuf,
"AWStats CGI-BIN directory");

if (pVHost->getRootContext().determineMime("pl",
NULL)->getHandler()->getHandlerType())
NULL)->getHandler()->getType())
handlerType = HandlerType::HT_NULL;
else
handlerType = HandlerType::HT_CGI;
Expand Down
12 changes: 4 additions & 8 deletions src/http/hiohandlerfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,21 @@
#include <spdy/h2connection.h>
#include <spdy/spdyconnection.h>

HioHandler *HioHandlerFactory::getHioHandler(HiosProtocol ver)
HioHandler *HioHandlerFactory::getHioHandler(HiosProtocol proto)
{
HioHandler *pHioHandler;
switch (ver)
switch (proto)
{
case HIOS_PROTO_HTTP:
pHioHandler = HttpResourceManager::getInstance().getConnection();
return pHioHandler;
case HIOS_PROTO_HTTP2:
pHioHandler = (HioHandler *)(new H2Connection());
pHioHandler = H2Connection::get();
break;
default:
pHioHandler = (HioHandler *)(new SpdyConnection());
pHioHandler = SpdyConnection::get( proto );
break;
}

if (!pHioHandler)
return NULL;

pHioHandler->init(ver);
return pHioHandler;
}
7 changes: 7 additions & 0 deletions src/http/hiostream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,10 @@ HioHandler::~HioHandler()

}


int HioHandler::h2cUpgrade(HioHandler *pOld)
{
return LS_FAIL;
}


Loading

0 comments on commit 4054803

Please sign in to comment.