ます’s Blog - どうでもいい記事100選

どうでもいい記事100選

mod_datetimelimit(1.3系統用)

指定した期間内でのみアクセスを許可するApacheモジュールです。
期間外でアクセスしてきた場合、指定したURLへ遷移させます。

以下はhttpd.confで設定できる内容です。
各環境用にURLを定義しないと動作しません(要するにURLは全て定義しておいてね、って事です)。
年月日(*Date)と時分秒(*Time)で定義が分かれていますが、どちらか一方だけの定義でも動作します。

<IfModule mod_datetimelimit.c>
  # /TEST1/以下は2007年10月17日から動作させるコンテンツを置く
  <Location /TEST1/>
    # 2007年10月17日に満たない場合は指定したURLへ遷移
    DateTimeLimitLocationStartURL_PC       http://www.example.com/start.html
    DateTimeLimitLocationStartURL_DOCOMO   http://www.example.com/i/start.html
    DateTimeLimitLocationStartURL_EZWEB    http://www.example.com/ez/start.html
    DateTimeLimitLocationStartURL_SOFTBANK http://www.example.com/sb/start.html
    DateTimeLimitStartDate                 20071017
  </Location>

  # /TEST2/以下は毎日10時00分00秒から動作させるコンテンツを置く
  <Location /TEST2/>
    # 毎日10時00分00秒に満たない場合は指定したURLへ遷移
    DateTimeLimitLocationStartURL_PC       http://www.example.com/start.html
    DateTimeLimitLocationStartURL_DOCOMO   http://www.example.com/i/start.html
    DateTimeLimitLocationStartURL_EZWEB    http://www.example.com/ez/start.html
    DateTimeLimitLocationStartURL_SOFTBANK http://www.example.com/sb/start.html
    DateTimeLimitStartTime                 100000
  </Location>

  # /TEST3/以下は2007年10月17日10時00分00秒から動作させるコンテンツを置く
  <Location /TEST3/>
    # /2007年10月17日10時00分00秒に満たない場合は指定したURLへ遷移
    DateTimeLimitLocationStartURL_PC       http://www.example.com/start.html
    DateTimeLimitLocationStartURL_DOCOMO   http://www.example.com/i/start.html
    DateTimeLimitLocationStartURL_EZWEB    http://www.example.com/ez/start.html
    DateTimeLimitLocationStartURL_SOFTBANK http://www.example.com/sb/start.html
    DateTimeLimitStartDate                 20071017
    DateTimeLimitStartTime                 100000
  </Location>

  # /TEST4/以下のディレクトリは2007年10月31日までの間、動作させるコンテンツを置く
  <Location /TEST4/>
    # 2007年10月31日を過ぎている場合は指定したURLへ遷移
    DateTimeLimitLocationEndURL_PC         http://www.example.com/end.html
    DateTimeLimitLocationEndURL_DOCOMO     http://www.example.com/i/end.html
    DateTimeLimitLocationEndURL_EZWEB      http://www.example.com/ez/end.html
    DateTimeLimitLocationEndURL_SOFTBANK   http://www.example.com/sb/end.html
    DateTimeLimitEndDate                   20071031
  </Location>

  # /TEST5/以下のディレクトリは毎日23時00分00秒までの間、動作させるコンテンツを置く
  <Location /TEST5/>
    # 毎日23時00分00秒を過ぎている場合は指定したURLへ遷移
    DateTimeLimitLocationEndURL_PC         http://www.example.com/end.html
    DateTimeLimitLocationEndURL_DOCOMO     http://www.example.com/i/end.html
    DateTimeLimitLocationEndURL_EZWEB      http://www.example.com/ez/end.html
    DateTimeLimitLocationEndURL_SOFTBANK   http://www.example.com/sb/end.html
    DateTimeLimitEndTime                   230000
  </Location>

  # /TEST6/以下のディレクトリは2007年10月31日23時00分00秒までの間、動作させるコンテンツを置く
  <Location /TEST6/>
    # 2007年10月31日23時00分00秒を過ぎている場合は指定したURLへ遷移
    DateTimeLimitLocationEndURL_PC         http://www.example.com/end.html
    DateTimeLimitLocationEndURL_DOCOMO     http://www.example.com/i/end.html
    DateTimeLimitLocationEndURL_EZWEB      http://www.example.com/ez/end.html
    DateTimeLimitLocationEndURL_SOFTBANK   http://www.example.com/sb/end.html
    DateTimeLimitEndDate                   20071031
    DateTimeLimitEndTime                   230000
  </Location>

  # /TEST7/以下のディレクトリは2007年10月17日から2007年10月31日までの間、動作させるコンテンツを置く
  <Location /TEST7/>
    # 2007年10月17日に満たない場合は指定したURLへ遷移
    DateTimeLimitLocationStartURL_PC       http://www.example.com/start.html
    DateTimeLimitLocationStartURL_DOCOMO   http://www.example.com/i/start.html
    DateTimeLimitLocationStartURL_EZWEB    http://www.example.com/ez/start.html
    DateTimeLimitLocationStartURL_SOFTBANK http://www.example.com/sb/start.html
    DateTimeLimitStartDate                 20071017

    # 2007年10月31日を過ぎている場合は指定したURLへ遷移
    DateTimeLimitLocationEndURL_PC         http://www.example.com/end.html
    DateTimeLimitLocationEndURL_DOCOMO     http://www.example.com/i/end.html
    DateTimeLimitLocationEndURL_EZWEB      http://www.example.com/ez/end.html
    DateTimeLimitLocationEndURL_SOFTBANK   http://www.example.com/sb/end.html
    DateTimeLimitEndDate                   20071031
  </Location>

  # /TEST8/以下のディレクトリは毎日10時00分00秒から毎日23時00分00秒までの間、動作させるコンテンツを置く
  <Location /TEST8/>
    # 毎日10時00分00秒に満たない場合は指定したURLへ遷移
    DateTimeLimitLocationStartURL_PC       http://www.example.com/start.html
    DateTimeLimitLocationStartURL_DOCOMO   http://www.example.com/i/start.html
    DateTimeLimitLocationStartURL_EZWEB    http://www.example.com/ez/start.html
    DateTimeLimitLocationStartURL_SOFTBANK http://www.example.com/sb/start.html
    DateTimeLimitStartTime                 100000

    # 毎日23時00分00秒を過ぎている場合は指定したURLへ遷移
    DateTimeLimitLocationEndURL_PC         http://www.example.com/end.html
    DateTimeLimitLocationEndURL_DOCOMO     http://www.example.com/i/end.html
    DateTimeLimitLocationEndURL_EZWEB      http://www.example.com/ez/end.html
    DateTimeLimitLocationEndURL_SOFTBANK   http://www.example.com/sb/end.html
    DateTimeLimitEndTime                   230000
  </Location>

  # /TEST9/以下のディレクトリは2007年10月17日10時00分00秒から2007年10月31日23時00分00秒までの間、動作させるコンテンツを置く
  <Location /TEST9/>
    # /2007年10月17日10時00分00秒に満たない場合は指定したURLへ遷移
    DateTimeLimitLocationStartURL_PC       http://www.example.com/start.html
    DateTimeLimitLocationStartURL_DOCOMO   http://www.example.com/i/start.html
    DateTimeLimitLocationStartURL_EZWEB    http://www.example.com/ez/start.html
    DateTimeLimitLocationStartURL_SOFTBANK http://www.example.com/sb/start.html
    DateTimeLimitStartDate                 20071017
    DateTimeLimitStartTime                 100000

    # 2007年10月31日23時00分00秒を過ぎている場合は指定したURLへ遷移
    DateTimeLimitLocationEndURL_PC         http://www.example.com/end.html
    DateTimeLimitLocationEndURL_DOCOMO     http://www.example.com/i/end.html
    DateTimeLimitLocationEndURL_EZWEB      http://www.example.com/ez/end.html
    DateTimeLimitLocationEndURL_SOFTBANK   http://www.example.com/sb/end.html
    DateTimeLimitEndDate                   20071031
    DateTimeLimitEndTime                   230000
  </Location>
</IfModule>

ビルドの仕方は(説明するまでもありませんが)makeファイルとプログラムファイルを同一の場所に配置して、make && make installを実行します。
以下はmakeファイルの内容です。APXSとAPACHECTLのパスは適切な場所を定義してください。
Makefile」として保存するか、別名にする時はmakeコマンドの-fオプションを使ってファイルを指定してください。

##
##  Makefile -- Build procedure for datetimelimit Apache module
##

MODULE_NAME = mod_datetimelimit
VERSION     = 0.0.1

# the used tools
APXS      = /usr/local/apache/bin/apxs
APACHECTL = /usr/local/apache/bin/apachectl

#   the default target
all: mod_datetimelimit.so

# compile the DSO file
mod_datetimelimit.so: mod_datetimelimit.c
	$(APXS) -c $(DEF) $(INC) $(LIB) mod_datetimelimit.c

#   install the DSO file into the Apache installation
#   and activate it in the Apache configuration
install: all
	$(APXS) -i -a -n 'datetimelimit' mod_datetimelimit.so

# cleanup
clean:
	rm -f mod_datetimelimit.o mod_datetimelimit.so

以下はプログラムファイルの内容です。
「mod_datetimelimit.c」として保存してください。
Apacheモジュールの勉強を兼ねているので、あちこちに手抜きが散見しますが。(w
その辺は、ご容赦、という事で。
正確に言うと、TAKE3を使った時の変な挙動から色々試していて、最終的に面倒臭くなって実装を手抜きした、が正解。
最初の実装から原型はカナリ変わっています。実装を凝るより、まずは動くもの、という方針転換で(妥協の産物)。_| ̄|○

/**************************************************************************
  mod_datetimelimit.c -- Apache datetimelimit module
**************************************************************************/


/**************************************************************************
  define of proto-type for utility functions
**************************************************************************/
static int datetimelimit_is_digit( const char * );


/**************************************************************************
  define of header file
**************************************************************************/
#include "httpd.h"
#include "http_conf_globals.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_protocol.h"
#include "ap_config.h"
#include "scoreboard.h"


/**************************************************************************
  define of struct type etc...
**************************************************************************/
typedef struct st_datetimelimit_config
{
 long start_date;
 long start_time;
 char *start_location_pc;
 char *start_location_docomo;
 char *start_location_ezweb;
 char *start_location_softbank;
 long end_date;
 long end_time;
 char *end_location_pc;
 char *end_location_docomo;
 char *end_location_ezweb;
 char *end_location_softbank;
} datetimelimit_config;

module MODULE_VAR_EXPORT datetimelimit_module;


/**************************************************************************
  define of main function
**************************************************************************/
static void *datetimelimit_cdir_config( pool *pool, char *path )
{
 datetimelimit_config *cfg = (datetimelimit_config *)ap_pcalloc( pool, sizeof( datetimelimit_config ) );

 cfg->start_location_pc       = NULL;
 cfg->start_location_docomo   = NULL;
 cfg->start_location_ezweb    = NULL;
 cfg->start_location_softbank = NULL;
 cfg->start_date              = -1;
 cfg->start_time              = -1;
 cfg->end_location_pc         = NULL;
 cfg->end_location_docomo     = NULL;
 cfg->end_location_ezweb      = NULL;
 cfg->end_location_softbank   = NULL;
 cfg->end_date                = -1;
 cfg->end_time                = -1;

 return (void *)cfg;
}


/*************************************************************************/
static const char *set_datetimelimit_start_location_pc( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitStartLocationURL_PC.";
   }

 if( cfg->start_location_pc )
   {
    return "duplicate entry for DateTimeLimitStartLocationURL_PC.";
   }

 cfg->start_location_pc = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_start_location_docomo( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitStartLocationURL_DOCOMO.";
   }

 if( cfg->start_location_docomo )
   {
    return "duplicate entry for DateTimeLimitStartLocationURL_DOCOMO.";
   }

 cfg->start_location_docomo = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_start_location_ezweb( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitStartLocationURL_EZWEB.";
   }

 if( cfg->start_location_ezweb )
   {
    return "duplicate entry for DateTimeLimitStartLocationURL_EZWEB.";
   }

 cfg->start_location_ezweb = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_start_location_softbank( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitStartLocationURL_SOFTBANK.";
   }

 if( cfg->start_location_softbank )
   {
    return "duplicate entry for DateTimeLimitStartLocationURL_SOFTBANK.";
   }

 cfg->start_location_softbank = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_end_location_pc( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitEndLocationURL_PC.";
   }

 if( cfg->end_location_pc )
   {
    return "duplicate entry for DateTimeLimitEndLocationURL_PC.";
   }

 cfg->end_location_pc = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_end_location_docomo( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitEndLocationURL_DOCOMO.";
   }

 if( cfg->end_location_docomo )
   {
    return "duplicate entry for DateTimeLimitEndLocationURL_DOCOMO.";
   }

 cfg->end_location_docomo = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_end_location_ezweb( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitEndLocationURL_EZWEB.";
   }

 if( cfg->end_location_ezweb )
   {
    return "duplicate entry for DateTimeLimitEndLocationURL_EZWEB.";
   }

 cfg->end_location_ezweb = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_end_location_softbank( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !ap_is_url( Buffer ) && Buffer[0] != '/' )
   {
    return "argument is not also a URL or a path in DateTimeLimitEndLocationURL_SOFTBANK.";
   }

 if( cfg->end_location_softbank )
   {
    return "duplicate entry for DateTimeLimitEndLocationURL_SOFTBANK.";
   }

 cfg->end_location_softbank = ap_pstrdup( parms->pool, Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_start_date( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !datetimelimit_is_digit( Buffer ) )
   {
    return "argument is not a number for DateTimeLimitStartDate.";
   }

 if( strlen( Buffer ) != 8 )
   {
    return "argument fomat error for DateTimeLimitStartDate.";
   }

 cfg->start_date = atol( Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_start_time( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !datetimelimit_is_digit( Buffer ) )
   {
    return "argument is not a number for DateTimeLimitStartTime.";
   }

 if( strlen( Buffer ) != 6 )
   {
    return "argument fomat error for DateTimeLimitStartTime.";
   }

 cfg->start_time = atol( Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_end_date( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !datetimelimit_is_digit( Buffer ) )
   {
    return "argument is not a number for DateTimeLimitEndDate.";
   }

 if( strlen( Buffer ) != 8 )
   {
    return "argument fomat error for DateTimeLimitEndDate.";
   }

 cfg->end_date = atol( Buffer );

 return NULL;
}


/*************************************************************************/
static const char *set_datetimelimit_end_time( cmd_parms *parms, void *myconfig, char *Buffer )
{
 datetimelimit_config *cfg = (datetimelimit_config *)myconfig;

 if( !datetimelimit_is_digit( Buffer ) )
   {
    return "argument is not a number for DateTimeLimitEndTime.";
   }

 if( strlen( Buffer ) != 6 )
   {
    return "argument fomat error for DateTimeLimitEndTime.";
   }

 cfg->end_time = atol( Buffer );

 return NULL;
}


/*************************************************************************/
static int datetimelimit_getenv( request_rec *rec, datetimelimit_config *cfg )
{
 const char *agent;
 int Result;

 Result = 0;

 agent  = ap_table_get( rec->headers_in, "User-Agent" );

 if( strncmp( agent, "DoCoMo", 6 ) == 0 )
   {
    if( !cfg->start_location_docomo )
      {
       return Result;
      }

     Result = 2;
   }
   else
 if( strncmp( agent, "UP.Browser", 10 ) == 0 ||
     strncmp( agent, "KDDI-",      5 )  == 0 )
   {
    if( !cfg->start_location_ezweb )
      {
       return Result;
      }

     Result = 3;
   }
   else
 if( strncmp( agent, "J-PHONE",    7 )  == 0 ||
     strncmp( agent, "Vodafone",   8 )  == 0 ||
     strncmp( agent, "MOT-",       4 )  == 0 ||
     strncmp( agent, "J-EMULATOR", 10 ) == 0 ||
     strncmp( agent, "SoftBank",   8 )  == 0 ||
     strncmp( agent, "Vemulator",  9 )  == 0 ||
     strncmp( agent, "Semulator",  9 )  == 0 )
   {
    if( !cfg->start_location_softbank )
      {
       return Result;
      }

     Result = 4;
   }
   else
   {
    if( !cfg->start_location_pc )
      {
       return Result;
      }

     Result = 1;
   }

 return Result;
}


/*************************************************************************/
static int datetimelimit_is_start( request_rec *rec, datetimelimit_config *cfg, long target_date, long target_time )
{
 int Result;

 Result = 0;

 if( cfg->start_date < 0 && cfg->start_time < 0 )
   {
    return Result;
   }

 Result = 1;

 if( cfg->start_date >= 0 && cfg->start_time < 0 )
   {
    if( cfg->start_date <= target_date )
      {
       Result = 0;
      }
   }
   else
 if( cfg->start_date < 0 && cfg->start_time >= 0 )
   {
    if( cfg->start_time <= target_time )
      {
       Result = 0;
      }
   }
   else
   {
    if( target_date < cfg->start_date )
      {
      }
      else
    if( cfg->start_date < target_date )
      {
       Result = 0;
      }
      else
    if( cfg->start_time <= target_time )
      {
       Result = 0;
      }
   }

 return Result;
}


/*************************************************************************/
static int datetimelimit_is_end( request_rec *rec, datetimelimit_config *cfg, long target_date, long target_time )
{
 int Result;

 Result = 0;

 if( cfg->end_date < 0 && cfg->end_time < 0 )
   {
    return Result;
   }

 Result = 1;

 if( cfg->end_date >= 0 && cfg->end_time < 0 )
   {
    if( target_date <= cfg->end_date )
      {
       Result = 0;
      }
   }
   else
 if( cfg->end_date < 0 && cfg->end_time >= 0 )
   {
    if( target_time <= cfg->end_time )
      {
       Result = 0;
      }
   }
   else
   {
    if( cfg->end_date < target_date )
      {
      }
      else
    if( target_date < cfg->end_date )
      {
       Result = 0;
      }
      else
    if( target_time <= cfg->end_time )
      {
       Result = 0;
      }
   }

 return Result;
}


/*************************************************************************/
static int datetimelimit_is_check( request_rec *rec )
{

 datetimelimit_config *cfg = (datetimelimit_config *)ap_get_module_config( rec->per_dir_config, &datetimelimit_module );
 char *url;
 int Result, Target_ID;
 time_t timer;
 struct tm *localtimer;
 char Buffer[10];
 long target_date, target_time;

 timer       = time( NULL );
 localtimer  = localtime( &timer );

 Buffer[0]   = '\0';
 sprintf( Buffer, "%d%02d%02d", ( localtimer->tm_year + 1900 ), ( localtimer->tm_mon + 1 ), localtimer->tm_mday );
 target_date = atol( Buffer );

 Buffer[0]   = '\0';
 sprintf( Buffer, "%02d%02d%02d", localtimer->tm_hour, localtimer->tm_min, localtimer->tm_sec );
 target_time = atol( Buffer );

 Target_ID   = datetimelimit_getenv( rec, cfg );

 if( !Target_ID )
   {
    return DECLINED;
   }

 Result = datetimelimit_is_start( rec, cfg, target_date, target_time );

 if( Result )
   {
    switch( Target_ID )
    {
     case  4 : {
                if( cfg->start_location_softbank[0] == '/' )
                  {
                   if( strcmp( cfg->start_location_softbank, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->start_location_softbank, rec );
                     }
                  }
                  else
                 {
                  url = cfg->start_location_softbank;
                 }

                break;
               }
     case  3 : {
                if( cfg->start_location_ezweb[0] == '/' )
                  {
                   if( strcmp( cfg->start_location_ezweb, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->start_location_ezweb, rec );
                     }
                  }
                  else
                 {
                  url = cfg->start_location_ezweb;
                 }

                break;
               }
     case  2 : {
                if( cfg->start_location_docomo[0] == '/' )
                  {
                   if( strcmp( cfg->start_location_docomo, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->start_location_docomo, rec );
                     }
                  }
                  else
                 {
                  url = cfg->start_location_docomo;
                 }

                break;
               }
     default : {
                if( cfg->start_location_pc[0] == '/' )
                  {
                   if( strcmp( cfg->start_location_pc, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->start_location_pc, rec );
                     }
                  }
                  else
                 {
                  url = cfg->start_location_pc;
                 }
                break;
               }
    }

    ap_table_setn( rec->headers_out, "Location", url );
    return HTTP_MOVED_TEMPORARILY;
   }

 Result = datetimelimit_is_end( rec, cfg, target_date, target_time );

 if( Result )
   {
    switch( Target_ID )
    {
     case  4 : {
                if( cfg->end_location_softbank[0] == '/' )
                  {
                   if( strcmp( cfg->end_location_softbank, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->end_location_softbank, rec );
                     }
                  }
                  else
                 {
                  url = cfg->end_location_softbank;
                 }

                break;
               }
     case  3 : {
                if( cfg->end_location_ezweb[0] == '/' )
                  {
                   if( strcmp( cfg->end_location_ezweb, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->end_location_ezweb, rec );
                     }
                  }
                  else
                 {
                  url = cfg->end_location_ezweb;
                 }

                break;
               }
     case  2 : {
                if( cfg->end_location_docomo[0] == '/' )
                  {
                   if( strcmp( cfg->end_location_docomo, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->end_location_docomo, rec );
                     }
                  }
                  else
                 {
                  url = cfg->end_location_docomo;
                 }

                break;
               }
     default : {
                if( cfg->end_location_pc[0] == '/' )
                  {
                   if( strcmp( cfg->end_location_pc, rec->uri ) == 0 )
                     {
                      return DECLINED;
                     }
                     else
                     {
                      url = ap_construct_url( rec->pool, cfg->end_location_pc, rec );
                     }
                  }
                  else
                 {
                  url = cfg->end_location_pc;
                 }

                break;
               }
    }

    ap_table_setn( rec->headers_out, "Location", url );
    return HTTP_MOVED_TEMPORARILY;
   }

 return DECLINED;
}


/**************************************************************************
 define of utility functions
**************************************************************************/
static int datetimelimit_is_digit( const char *Buffer )
{
 if( !ap_isdigit( *Buffer ) )
   {
    return 0;
   }

 while( ap_isdigit( *( ++Buffer ) ) )
 {
 }

 return *Buffer == '\0' ? 1 : 0;
}


/**************************************************************************
  Dispatch list for API hooks
**************************************************************************/
static command_rec datetimelimit_cmds[] =
{
 { "DateTimeLimitLocationStartURL_PC", set_datetimelimit_start_location_pc,             NULL, OR_LIMIT, TAKE1,
   "specify location start URL for PC" },
 { "DateTimeLimitLocationStartURL_DOCOMO", set_datetimelimit_start_location_docomo,     NULL, OR_LIMIT, TAKE1,
   "specify location start URL for DOCOMO" },
 { "DateTimeLimitLocationStartURL_EZWEB", set_datetimelimit_start_location_ezweb,       NULL, OR_LIMIT, TAKE1,
   "specify location start URL for EZWEB" },
 { "DateTimeLimitLocationStartURL_SOFTBANK", set_datetimelimit_start_location_softbank, NULL, OR_LIMIT, TAKE1,
   "specify location start URL for SOFTBANK" },
 { "DateTimeLimitLocationEndURL_PC", set_datetimelimit_end_location_pc,                 NULL, OR_LIMIT, TAKE1,
   "specify location end URL for PC" },
 { "DateTimeLimitLocationEndURL_DOCOMO", set_datetimelimit_end_location_docomo,         NULL, OR_LIMIT, TAKE1,
   "specify location end URL for DOCOMO" },
 { "DateTimeLimitLocationEndURL_EZWEB", set_datetimelimit_end_location_ezweb,           NULL, OR_LIMIT, TAKE1,
   "specify location end URL for EZWEB" },
 { "DateTimeLimitLocationEndURL_SOFTBANK", set_datetimelimit_end_location_softbank,     NULL, OR_LIMIT, TAKE1,
   "specify location end URL for SOFTBANK" },
 { "DateTimeLimitStartDate", set_datetimelimit_start_date,                              NULL, OR_LIMIT, TAKE1,
   "specify start DATE" },
 { "DateTimeLimitStartTime", set_datetimelimit_start_time,                              NULL, OR_LIMIT, TAKE1,
   "specify start TIME" },
 { "DateTimeLimitEndDate", set_datetimelimit_end_date,                                  NULL, OR_LIMIT, TAKE1,
   "specify start DATE" },
 { "DateTimeLimitEndTime", set_datetimelimit_end_time,                                  NULL, OR_LIMIT, TAKE1,
   "specify start TIME" },
 { NULL }
};

module MODULE_VAR_EXPORT datetimelimit_module = {
    STANDARD_MODULE_STUFF,
    NULL,                       /* module initializer                  */
    datetimelimit_cdir_config,  /* create per-dir    config structures */
    NULL,                       /* merge  per-dir    config structures */
    NULL,                       /* create per-server config structures */
    NULL,                       /* merge  per-server config structures */
    datetimelimit_cmds,         /* table of config file commands       */
    NULL,                       /* [#8] MIME-typed-dispatched handlers */
    NULL,                       /* [#1] URI to filename translation    */
    NULL,                       /* [#4] validate user id from request  */
    NULL,                       /* [#5] check if the user is ok _here_ */
    datetimelimit_is_check,     /* [#3] check access by host address   */
    NULL,                       /* [#6] determine MIME type            */
    NULL,                       /* [#7] pre-run fixups                 */
    NULL,                       /* [#9] log a transaction              */
    NULL,                       /* [#2] header parser                  */
    NULL,                       /* child_init                          */
    NULL,                       /* child_exit                          */
    NULL                        /* [#0] post read-request              */
};

Linux(Debian 4.0 2.6.18-5-686) とSolaris10(sparc)で確認しています。
コンテンツを置く場所を持っていないので、ここに貼り付けてるのスミマセン。