@@ -2092,60 +2092,63 @@ static const char *_add_tile_config(cmd_parms *cmd, void *mconfig,
20922092
20932093static const char * add_tile_mime_config (cmd_parms * cmd , void * mconfig , const char * baseuri , const char * name , const char * fileExtension )
20942094{
2095- // this configuration option should be deprecated and be replaced by
2096- // a version of AddTileConfig with "extension=xxx"
2097- // how to log a warning here?
2098- if (strcmp (fileExtension , "png" ) == 0 ) {
2099- return _add_tile_config (cmd , mconfig , baseuri , name , 0 , MAX_ZOOM , 1 , 1 , fileExtension , "image/png" , NULL , NULL , 0 , NULL , NULL , NULL , 0 );
2100- }
2095+ char * cors = NULL ;
2096+ char * mimeType = "image/png" ;
21012097
21022098 if (strcmp (fileExtension , "js" ) == 0 ) {
2103- return _add_tile_config (cmd , mconfig , baseuri , name , 0 , MAX_ZOOM , 1 , 1 , fileExtension , "text/javascript" , NULL , NULL , 0 , NULL , "*" , NULL , 0 );
2099+ cors = "*" ;
2100+ mimeType = "text/javascript" ;
21042101 }
21052102
2106- return _add_tile_config (cmd , mconfig , baseuri , name , 0 , MAX_ZOOM , 1 , 1 , fileExtension , "image/png" , NULL , NULL , 0 , NULL , NULL , NULL , 0 );
2103+ ap_log_error (APLOG_MARK , APLOG_NOTICE , APR_SUCCESS , cmd -> server ,
2104+ "AddTileMimeConfig will be deprecated in a future release, please use the following instead: AddTileConfig %s %s mimetype=%s extension=%s" ,
2105+ baseuri , name , mimeType , fileExtension );
2106+ return _add_tile_config (cmd , mconfig , baseuri , name , 0 , MAX_ZOOM , 1 , 1 , fileExtension , mimeType , NULL , NULL , 0 , NULL , cors , NULL , 0 );
21072107}
21082108
2109- static const char * add_tile_config (cmd_parms * cmd , void * mconfig , const char * args )
2109+ static const char * add_tile_config (cmd_parms * cmd , void * mconfig , int argc , char * const argv [] )
21102110{
2111- const char * baseuri = ap_getword_conf (cmd -> pool , & args );
2112- if (!baseuri ) return ("AddTileConfig error" );
2113- const char * name = ap_getword_conf (cmd -> pool , & args );
2114- if (!name ) return ("AddTileConfig error" );
2111+ if (argc < 1 ) {
2112+ return ("AddTileConfig error, URL path not defined" );
2113+ }
2114+
2115+ if (argc < 2 ) {
2116+ return ("AddTileConfig error, name of renderd config not defined" );
2117+ }
2118+
21152119 int maxzoom = MAX_ZOOM ;
21162120 int minzoom = 0 ;
2117- const char * extension = "png" ;
2118- const char * mimeType = "image/png" ;
2119- char * token = ap_getword_conf ( cmd -> pool , & args ) ;
2120- while ( token )
2121- {
2122- char * eq = strchr ( token , '=' );
2123- if ( eq )
2124- {
2125- * eq ++ = 0 ;
2126- if (! strcmp ( token , "maxzoom" ))
2127- {
2128- maxzoom = atoi ( eq );
2129- }
2130- else if (! strcmp ( token , "minzoom" ))
2131- {
2132- minzoom = atoi ( eq );
2133- }
2134- else if (! strcmp ( token , "extension" ))
2135- {
2136- extension = eq ;
2137- }
2138- else if (! strcmp ( token , "mimetype" ))
2139- {
2140- mimeType = eq ;
2121+ char * baseuri = argv [ 0 ] ;
2122+ char * name = argv [ 1 ] ;
2123+ char * fileExtension = "png" ;
2124+ char * mimeType = "image/png" ;
2125+ char * tile_dir = RENDERD_TILE_DIR ;
2126+
2127+ int i ;
2128+
2129+ for ( i = 2 ; i < argc ; i ++ ) {
2130+ char * value = strchr ( argv [ i ], '=' );
2131+
2132+ if ( value ) {
2133+ * value ++ = 0 ;
2134+
2135+ if (! strcmp ( argv [ i ], "maxzoom" )) {
2136+ maxzoom = strtol ( value , NULL , 10 );
2137+ } else if (! strcmp ( argv [ i ], "minzoom" )) {
2138+ minzoom = strtol ( value , NULL , 10 );
2139+ } else if (! strcmp ( argv [ i ], "extension" )) {
2140+ fileExtension = value ;
2141+ } else if (! strcmp ( argv [ i ], "mimetype" )) {
2142+ mimeType = value ;
2143+ } else if (! strcmp ( argv [ i ], "tile_dir" )) {
2144+ tile_dir = value ;
21412145 }
21422146 }
2143- if (!* args ) break ;
2144- token = ap_getword_conf (cmd -> pool , & args );
21452147 }
21462148
2147- return _add_tile_config (cmd , mconfig , baseuri , name , minzoom , maxzoom , 1 , 1 , extension , mimeType , NULL ,NULL ,0 , NULL ,NULL ,NULL , 0 );
2149+ return _add_tile_config (cmd , mconfig , baseuri , name , minzoom , maxzoom , 1 , 1 , fileExtension , mimeType , NULL , NULL , 0 , NULL , NULL , tile_dir , 0 );
21482150}
2151+
21492152static const char * load_tile_config (cmd_parms * cmd , void * mconfig , const char * conffile )
21502153{
21512154 FILE * hini ;
@@ -2889,19 +2892,19 @@ static const command_rec tile_cmds[] = {
28892892 OR_OPTIONS , /* where available */
28902893 "load an entire renderd config file" /* directive description */
28912894 ),
2892- AP_INIT_RAW_ARGS (
2895+ AP_INIT_TAKE_ARGV (
28932896 "AddTileConfig" , /* directive name */
28942897 add_tile_config , /* config action routine */
28952898 NULL , /* argument to include in call */
28962899 OR_OPTIONS , /* where available */
2897- "path, name, and optional key-value pairs for renderd config to use" /* directive description */
2900+ "path, name of renderd config and optional key-value pairs to use" /* directive description */
28982901 ),
28992902 AP_INIT_TAKE3 (
29002903 "AddTileMimeConfig" , /* directive name */
29012904 add_tile_mime_config , /* config action routine */
29022905 NULL , /* argument to include in call */
29032906 OR_OPTIONS , /* where available */
2904- "path, name and file extension of renderd config to use" /* directive description */
2907+ "path, name of renderd config and file extension to use" /* directive description */
29052908 ),
29062909 AP_INIT_TAKE1 (
29072910 "ModTileRequestTimeout" , /* directive name */
0 commit comments