From: watanaby <> Date: Thu, 26 Oct 2006 04:48:20 +0000 (+0000) Subject: Ver.1.4.5: Add function to indicate disable clients for http/java watch. X-Git-Url: http://git.osdn.net/view?p=opengate%2Fopengate.git;a=commitdiff_plain;h=8925f55db3717ec864014163c813db135804a8cd Ver.1.4.5: Add function to indicate disable clients for http/java watch. --- diff --git a/opengate/conf/opengatesrv.conf.sample b/opengate/conf/opengatesrv.conf.sample index aa8033a..740efa2 100644 --- a/opengate/conf/opengatesrv.conf.sample +++ b/opengate/conf/opengatesrv.conf.sample @@ -1,5 +1,5 @@ - + @@ -55,9 +55,23 @@ 5400 - - - 50 + + + + + 50 + + + + Safari/4 + + + + + + + + diff --git a/opengate/doc/Changes.html b/opengate/doc/Changes.html index ed17ac1..b230285 100644 --- a/opengate/doc/Changes.html +++ b/opengate/doc/Changes.html @@ -503,6 +503,11 @@ Ver.1.4.4 at 2006.10.25
Add automatic start of java applet at failing http keep-alive. Modify http-get format. Add session-id. Fix read bug.
+
+Ver.1.4.5 at 2006.10.26
+
+Add function to indicate disable clients for http/java watch. +
Please see CVS in SourceForge.net to check the file difference between versions. diff --git a/opengate/opengatesrv/comm-cgi.c b/opengate/opengatesrv/comm-cgi.c index 4dbfb90..000867b 100644 --- a/opengate/opengatesrv/comm-cgi.c +++ b/opengate/opengatesrv/comm-cgi.c @@ -32,6 +32,8 @@ Modified by Katsuhiko Eguchi /* convert two-char-hex "aa" to one-number 0Xaa */ #define hex2num(x) ((x)>='A' ? ((x) & 0XDF) - 'A' +10 : ((x) - '0')) +int isHttpWatchEnableClient(void); +int isJavaWatchEnableClient(void); void split(char content[], char *name[], char *value[], char *next[]); void decode(char *string); @@ -276,17 +278,24 @@ void putClientAccept(char *userid, char *sessionId, int port, int pid, char *cli /* HTTP watch mode */ case 'H': - /* HTTP Keep-Alive is not standard in http/1.0 */ - if(strcmp(getenv("SERVER_PROTOCOL"),"HTTP/1.0")!=0){ + if(isHttpWatchEnableClient()){ acceptDoc=GetConfValue("AcceptDocHttp"); - } else { + }else if(isJavaWatchEnableClient()){ acceptDoc=GetConfValue("AcceptDocJava"); + }else{ + acceptDoc=GetConfValue("AcceptDocTime"); } break; /* JAVA watch mode */ case 'J': - acceptDoc=GetConfValue("AcceptDocJava"); + if(isJavaWatchEnableClient()){ + acceptDoc=GetConfValue("AcceptDocJava"); + }else if(isHttpWatchEnableClient()){ + acceptDoc=GetConfValue("AcceptDocHttp"); + }else{ + acceptDoc=GetConfValue("AcceptDocTime"); + } break; /* TIMEOUT watch mode */ @@ -359,6 +368,33 @@ void putClientAccept(char *userid, char *sessionId, int port, int pid, char *cli return; } +/*****************************************************/ +/* is the client enable to keep long http connection */ +/*****************************************************/ +int isHttpWatchEnableClient(void) +{ + /* HTTP Keep-Alive is not standard in http/1.0 */ + if(strcmp(getenv("SERVER_PROTOCOL"),"HTTP/1.0")==0) return FALSE; + + /* some user agent does not support long HTTP Keep-Alive */ + if(RegExMatch(getenv("HTTP_USER_AGENT"), + GetConfValue("HttpWatch/SkipAgentPattern"))) return FALSE; + + return TRUE; +} + +/********************************************/ +/* is the client enable to load Java Applet */ +/********************************************/ +int isJavaWatchEnableClient(void) +{ + /* some user agent does not support Java Applet */ + if(RegExMatch(getenv("HTTP_USER_AGENT"), + GetConfValue("JavaWatch/SkipAgentPattern"))) return FALSE; + + return TRUE; +} + /************************************/ /* split value for indicated name */ /* in content "name=value&..." */ diff --git a/opengate/opengatesrv/get-param.c b/opengate/opengatesrv/get-param.c index 2d7a453..4ba0f80 100644 --- a/opengate/opengatesrv/get-param.c +++ b/opengate/opengatesrv/get-param.c @@ -28,7 +28,7 @@ Programmed by Yoshiaki WATANABE #include "opengatesrv.h" #include "../ezxml/ezxml.h" -#define CONFFILE_VERSION "1.4.3" +#define CONFFILE_VERSION "1.4.5" #define SEPARATOR "/" int debug=0; @@ -38,7 +38,6 @@ static ezxml_t xmlExtraSet=NULL; char *getConfValueExtra(char *name); char *getConfValue(char *name); char *convertToFacilityRaw(char *pValue); -int RegExMatch(const char *inStr, const char *regEx); /**************************************************/ /* Prepare Conf file to use */ diff --git a/opengate/opengatesrv/opengatesrv.h b/opengate/opengatesrv/opengatesrv.h index 2153ae2..1989dcf 100644 --- a/opengate/opengatesrv/opengatesrv.h +++ b/opengate/opengatesrv/opengatesrv.h @@ -212,6 +212,7 @@ void CloseConfFile(void); void SetupConfExtra(char *userId, char *extraId); char *GetConfValue(char *name); void InitConf(); +int RegExMatch(const char *inStr, const char *regEx); int AddAlarm(char *name, int timeout, int preceding, Sigfunc *func); int RemoveAlarm(char *name); diff --git a/opengate/opengatesrv/watch-client.c b/opengate/opengatesrv/watch-client.c index 3fdfa18..dcca335 100644 --- a/opengate/opengatesrv/watch-client.c +++ b/opengate/opengatesrv/watch-client.c @@ -702,7 +702,7 @@ void sendHttpKeepPage(char *userid, char *sessionId, char *language, int port) GetConfValue("OpengateServerName"), port); /* create httphello interval [50] */ - snprintf(httpHelloInterval, WORDMAXLN, "%s", GetConfValue("HttpHelloInterval")); + snprintf(httpHelloInterval, WORDMAXLN, "%s", GetConfValue("HttpWatch/HelloInterval")); /* create httpkeep.js url[http:///opengate/httpkeep.js] */ snprintf(httpkeepJsUrl, BUFFMAXLN, "http://%s%s/%s",