Changeset 278
- Timestamp:
- 06/01/10 19:37:33 (20 months ago)
- Location:
- trunk/src
- Files:
-
- 13 modified
-
ows/ows.c (modified) (7 diffs)
-
ows/ows.h (modified) (1 diff)
-
ows/ows_config.c (modified) (3 diffs)
-
ows/ows_error.c (modified) (2 diffs)
-
ows/ows_metadata.c (modified) (1 diff)
-
ows/ows_request.c (modified) (11 diffs)
-
ows/ows_storage.c (modified) (6 diffs)
-
struct/cgi_request.c (modified) (5 diffs)
-
wfs/wfs_describe.c (modified) (1 diff)
-
wfs/wfs_error.c (modified) (4 diffs)
-
wfs/wfs_get_feature.c (modified) (3 diffs)
-
wfs/wfs_request.c (modified) (26 diffs)
-
wfs/wfs_transaction.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ows/ows.c
r277 r278 58 58 assert(o != NULL); 59 59 60 o->exit = false; 60 61 o->request = NULL; 61 62 o->cgi = NULL; … … 63 64 o->pg = NULL; 64 65 o->pg_dsn = NULL; 65 o->output = NULL;66 o->output = stdout; 66 67 o->config_file = NULL; 67 68 o->online_resource = NULL; … … 101 102 assert(output != NULL); 102 103 104 fprintf(output, "exit : %d\n", o->exit?1:0); 105 103 106 if (o->config_file != NULL) { 104 107 fprintf(output, "config_file: "); … … 264 267 265 268 266 int main(int argc, char *argv[]) 267 { 268 char *query; 269 ows *o; 270 271 o = ows_init(); 272 o->config_file = buffer_init(); 273 274 /* Config Files */ 275 if (getenv("TINYOWS_CONFIG_FILE") != NULL) 276 buffer_add_str(o->config_file, getenv("TINYOWS_CONFIG_FILE")); 277 else 278 buffer_add_str(o->config_file, OWS_CONFIG_FILE_PATH); 279 280 o->output = stdout; 281 282 283 /* retrieve the query in HTTP request */ 284 query = cgi_getback_query(o); 285 286 /* Parse the configuration file and initialize ows struct */ 287 ows_parse_config(o, o->config_file->buf); 288 289 /* Connect the ows to the database */ 290 ows_pg(o, o->pg_dsn->buf); 291 292 /* Fill layers storage metadata */ 293 ows_layers_storage_fill(o); 294 295 /* Open Log file */ 296 if (o->log_file != NULL) 297 o->log = fopen(o->log_file->buf, "a"); 298 299 300 #if TINYOWS_FCGI 301 while (FCGI_Accept() >= 0) 302 { 303 304 #endif 305 306 query = cgi_getback_query(o); 307 308 /* Usage or Version command line options */ 309 if (query == NULL || strlen(query) == 0) { 310 if (argc > 1) { 311 312 if ( !strncmp(argv[1], "--help", 6) 313 || !strncmp(argv[1], "-h", 2) 314 || !strncmp(argv[1], "--check", 7)) 315 ows_usage(o); 316 317 else if ( !strncmp(argv[1], "--version", 9) 318 || !strncmp(argv[1], "-v", 2)) 319 printf("%s\n", TINYOWS_VERSION); 320 321 else ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 322 "Service Unknown", "service"); 323 324 return EXIT_SUCCESS; 325 } 326 327 } 328 329 330 /* Log input query if asked */ 331 if (o->log != NULL) 332 fprintf(o->log, "[QUERY]\n%s\n---\n", query); 333 334 o->request = ows_request_init(); 335 269 static void ows_kvp_or_xml(ows *o, char *query) 270 { 336 271 /* 337 272 * Request encoding and HTTP method WFS 1.1.0 -> 6.5 … … 354 289 !strcmp(getenv("CONTENT_TYPE"), "text/plain")) 355 290 o->request->method = OWS_METHOD_XML; 356 357 291 /* Command line Unit Test cases with XML values (not HTTP) */ 358 292 } else if (!cgi_method_post() && !cgi_method_get() && query[0] == '<') … … 362 296 else ows_error(o, OWS_ERROR_REQUEST_HTTP, "Wrong HTTP request Method", "http"); 363 297 364 switch (o->request->method) { 365 case OWS_METHOD_KVP: 366 o->cgi = cgi_parse_kvp(o, query); 367 break; 368 case OWS_METHOD_XML: 369 o->cgi = cgi_parse_xml(o, query); 370 break; 371 372 default: ows_error(o, OWS_ERROR_REQUEST_HTTP, 298 } 299 300 301 int main(int argc, char *argv[]) 302 { 303 ows *o; 304 char *query=NULL; 305 306 o = ows_init(); 307 o->config_file = buffer_init(); 308 309 /* Config Files */ 310 if (getenv("TINYOWS_CONFIG_FILE") != NULL) 311 buffer_add_str(o->config_file, getenv("TINYOWS_CONFIG_FILE")); 312 else 313 buffer_add_str(o->config_file, OWS_CONFIG_FILE_PATH); 314 315 /* Parse the configuration file and initialize ows struct */ 316 if (!o->exit) ows_parse_config(o, o->config_file->buf); 317 318 /* Connect the ows to the database */ 319 if (!o->exit) ows_pg(o, o->pg_dsn->buf); 320 321 /* Fill layers storage metadata */ 322 if (!o->exit) ows_layers_storage_fill(o); 323 324 /* Open Log file */ 325 if (o->log_file != NULL) 326 o->log = fopen(o->log_file->buf, "a"); 327 328 329 #if TINYOWS_FCGI 330 while (FCGI_Accept() >= 0) 331 { 332 #endif 333 334 if (!o->exit) query = cgi_getback_query(o); 335 336 /* Usage or Version command line options */ 337 if (query == NULL || strlen(query) == 0) { 338 if (argc > 1) { 339 340 if ( !strncmp(argv[1], "--help", 6) 341 || !strncmp(argv[1], "-h", 2) 342 || !strncmp(argv[1], "--check", 7)) 343 ows_usage(o); 344 345 else if ( !strncmp(argv[1], "--version", 9) 346 || !strncmp(argv[1], "-v", 2)) 347 printf("%s\n", TINYOWS_VERSION); 348 349 else ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 350 "Service Unknown", "service"); 351 352 o->exit = true; 353 } 354 } 355 356 357 /* Log input query if asked */ 358 if (o->log != NULL) 359 fprintf(o->log, "[QUERY]\n%s\n---\n", query); 360 361 o->request = ows_request_init(); 362 if (!o->exit) ows_kvp_or_xml(o, query); 363 364 if (!o->exit) { 365 366 switch (o->request->method) { 367 case OWS_METHOD_KVP: 368 o->cgi = cgi_parse_kvp(o, query); 369 break; 370 case OWS_METHOD_XML: 371 o->cgi = cgi_parse_xml(o, query); 372 break; 373 374 default: ows_error(o, OWS_ERROR_REQUEST_HTTP, 373 375 "Wrong HTTP request Method", "http"); 374 } 375 376 o->psql_requests = list_init(); 376 } 377 } 378 379 if (!o->exit) o->psql_requests = list_init(); 377 380 378 381 /* Fill service's metadata */ 379 ows_metadata_fill(o, o->cgi);382 if (!o->exit) ows_metadata_fill(o, o->cgi); 380 383 381 384 /* Process service request */ 382 ows_request_check(o, o->request, o->cgi, query);385 if (!o->exit) ows_request_check(o, o->request, o->cgi, query); 383 386 384 387 /* Run the right OWS service */ 385 switch (o->request->service) { 386 case WFS: 387 o->request->request.wfs = wfs_request_init(); 388 wfs_request_check(o, o->request->request.wfs, o->cgi); 389 wfs(o, o->request->request.wfs); 390 break; 391 default: 392 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 388 if (!o->exit) { 389 switch (o->request->service) { 390 case WFS: 391 o->request->request.wfs = wfs_request_init(); 392 wfs_request_check(o, o->request->request.wfs, o->cgi); 393 if (!o->exit) wfs(o, o->request->request.wfs); 394 break; 395 default: 396 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 393 397 "Service Unknown", "service"); 394 } 395 396 ows_request_free(o->request); 397 o->request=NULL; 398 } 399 } 400 401 if (o->request) { 402 ows_request_free(o->request); 403 o->request=NULL; 404 } 398 405 399 406 #if TINYOWS_FCGI … … 401 408 OS_LibShutdown(); 402 409 #endif 403 404 410 if (o->log) fclose (o->log); 405 411 ows_free(o); -
trunk/src/ows/ows.h
r267 r278 409 409 410 410 typedef struct Ows { 411 bool exit; 411 412 PGconn * pg; 412 413 buffer * config_file; -
trunk/src/ows/ows_config.c
r248 r278 686 686 static void ows_config_check(ows * o) 687 687 { 688 if (o->online_resource == NULL) 688 if (o->online_resource == NULL) { 689 689 ows_error(o, OWS_ERROR_CONFIG_FILE, 690 690 "No 'online_resource' property in tinyows element", 691 691 "parse_config_file"); 692 693 if (o->schema_dir == NULL) 692 return; 693 } 694 695 if (o->schema_dir == NULL) { 694 696 ows_error(o, OWS_ERROR_CONFIG_FILE, 695 697 "No 'schema_dir' property in tinyows element", 696 698 "parse_config_file"); 697 698 if (o->metadata == NULL) 699 return; 700 } 701 702 if (o->metadata == NULL) { 699 703 ows_error(o, OWS_ERROR_CONFIG_FILE, 700 704 "No 'metadata' element", "parse_config_file"); 701 702 if (o->metadata->name == NULL) 705 return; 706 } 707 708 if (o->metadata->name == NULL) { 703 709 ows_error(o, OWS_ERROR_CONFIG_FILE, 704 710 "No 'name' property in metadata element", 705 711 "parse_config_file"); 706 707 if (o->metadata->title == NULL) 712 return; 713 } 714 715 if (o->metadata->title == NULL) { 708 716 ows_error(o, OWS_ERROR_CONFIG_FILE, 709 717 "No 'title' property in metadata element", 710 718 "parse_config_file"); 711 712 if (o->pg_dsn == NULL) 719 return; 720 } 721 722 if (o->pg_dsn == NULL) { 713 723 ows_error(o, OWS_ERROR_CONFIG_FILE, 714 724 "No 'pg' element", 715 725 "parse_config_file"); 716 717 if (o->contact == NULL) 726 return; 727 } 728 729 if (o->contact == NULL) { 718 730 ows_error(o, OWS_ERROR_CONFIG_FILE, 719 731 "No 'contact' element", 720 732 "parse_config_file"); 721 722 if (o->contact->name == NULL) 733 return; 734 } 735 736 if (o->contact->name == NULL) { 723 737 ows_error(o, OWS_ERROR_CONFIG_FILE, 724 738 "No 'name' property in contact element", 725 739 "parse_config_file"); 740 return; 741 } 726 742 } 727 743 … … 746 762 ows_error(o, OWS_ERROR_CONFIG_FILE, "Unable to open config file !", 747 763 "parse_config_file"); 764 return; 748 765 } 749 766 … … 786 803 ows_error(o, OWS_ERROR_CONFIG_FILE, "Unable to open config file !", 787 804 "parse_config_file"); 805 return; 788 806 } 789 807 -
trunk/src/ows/ows_error.c
r276 r278 75 75 assert(locator != NULL); 76 76 77 assert(!o->exit); 78 o->exit = true; 79 77 80 if (o->log != NULL) 78 81 fprintf(o->log, "[ERROR] {%s:%s} %s\n", … … 93 96 fprintf(o->output, " </ows:Exception>\n"); 94 97 fprintf(o->output, "</ows:ExceptionReport>\n"); 95 96 #if 097 #if TINYOWS_FCGI98 OS_LibShutdown();99 #endif100 #endif101 102 if (o->log) fclose (o->log);103 ows_free(o);104 exit(EXIT_SUCCESS);105 98 } 106 107 99 108 100 /* -
trunk/src/ows/ows_metadata.c
r116 r278 203 203 ows_error(o, OWS_ERROR_MISSING_PARAMETER_VALUE, 204 204 "service unknown", "service"); 205 return; 205 206 } 206 207 -
trunk/src/ows/ows_request.c
r248 r278 218 218 } else { 219 219 /* check if version format is x.y.z */ 220 if (b->use < 5) 220 if (b->use < 5) { 221 221 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 222 222 "VERSION parameter is not valid (use x.y.z)", "version"); 223 return v; 224 } 223 225 224 226 l = list_explode('.', b); … … 228 230 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 229 231 "VERSION parameter is not valid (use x.y.z)", "version"); 232 return v; 230 233 } 231 234 … … 240 243 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 241 244 "VERSION parameter is not valid (use x.y.z)", "version"); 245 return v; 242 246 } 243 247 … … 277 281 /* Tests WFS 1.1.0 require a default value for requests 278 282 encoded in XML if service is not set */ 279 if (cgi_method_get()) 283 if (cgi_method_get()) { 280 284 ows_error(o, OWS_ERROR_MISSING_PARAMETER_VALUE, 281 285 "SERVICE is not set", "SERVICE"); 282 else { 286 return; 287 } else { 283 288 if (buffer_case_cmp(o->metadata->type, "WMS")) 284 289 or->service = WMS; 285 290 else if (buffer_case_cmp(o->metadata->type, "WFS")) 286 291 or->service = WFS; 287 else 292 else { 288 293 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 289 294 "service unknown", "service"); 295 return; 296 } 290 297 } 291 298 } else { … … 296 303 else if (buffer_case_cmp(b, "WFS")) 297 304 or->service = WFS; 298 else if (buffer_case_cmp(b, "WCS"))299 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE,300 "service not implemented", "service");301 305 else if (buffer_case_cmp(b, "")) { 302 306 if (buffer_case_cmp(o->metadata->type, "WMS")) … … 304 308 else if (buffer_case_cmp(o->metadata->type, "WFS")) 305 309 or->service = WFS; 306 else 310 else { 307 311 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 308 312 "service unknown", "service"); 309 } else 310 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 313 return; 314 } 315 } else { 316 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 311 317 "service unknown", "service"); 318 return; 319 } 312 320 } 313 321 314 322 315 323 /* check if REQUEST is set */ 316 if (!array_is_key(cgi, "request")) 324 if (!array_is_key(cgi, "request")) { 317 325 ows_error(o, OWS_ERROR_MISSING_PARAMETER_VALUE, 318 326 "REQUEST is not set", "REQUEST"); 319 else320 b = array_get(cgi, "request");327 return; 328 } else b = array_get(cgi, "request"); 321 329 322 330 /* check if VERSION is set and init Version */ … … 326 334 if (!buffer_case_cmp(b, "GetCapabilities")) { 327 335 /* WFS 1.1.0 with KVP need a version set */ 328 if (o->request->method == OWS_METHOD_KVP) 336 if (o->request->method == OWS_METHOD_KVP) { 329 337 ows_error(o, OWS_ERROR_MISSING_PARAMETER_VALUE, 330 338 "VERSION is not set", "VERSION"); 339 return; 340 } 331 341 /* WFS 1.1.0 require a default value for requests 332 342 encoded in XML if version is not set */ … … 342 352 /* check if layers have name or title and srs */ 343 353 for (ln = o->layers->first; ln != NULL; ln = ln->next) { 344 if (ln->layer->name == NULL) 354 if (ln->layer->name == NULL) { 345 355 ows_error(o, OWS_ERROR_CONFIG_FILE, 346 356 "No layer name defined", "config_file"); 357 return; 358 } 347 359 348 360 if (ows_layer_match_table(o, ln->layer->name)) { 349 if (ln->layer->title == NULL) 361 if (ln->layer->title == NULL) { 350 362 ows_error(o, OWS_ERROR_CONFIG_FILE, 351 363 "No layer title defined", "config_file"); 364 return; 365 } 352 366 353 367 if (or->service == WFS) { 354 if (ln->layer->prefix == NULL) 368 if (ln->layer->prefix == NULL) { 355 369 ows_error(o, OWS_ERROR_CONFIG_FILE, 356 370 "No layer prefix defined", "config_file"); 357 358 if (ln->layer->server == NULL) 371 return; 372 } 373 374 if (ln->layer->server == NULL) { 359 375 ows_error(o, OWS_ERROR_CONFIG_FILE, 360 376 "No layer server defined", "config_file"); 377 return; 378 } 361 379 } 362 380 … … 371 389 if (!check_regexp(b->buf, "^http://www.opengis.net") 372 390 && !check_regexp(b->buf, "^EPSG") 373 && !check_regexp(b->buf, "^urn:")) 391 && !check_regexp(b->buf, "^urn:")) { 374 392 ows_error(o, OWS_ERROR_CONFIG_FILE, 375 393 "srsname isn't valid", "srsName"); 394 return; 395 } 376 396 377 397 for (srid = ln->layer->srid->first; srid != NULL; … … 381 401 } 382 402 383 if (srsname == false) 403 if (srsname == false) { 384 404 ows_error(o, OWS_ERROR_CONFIG_FILE, 385 405 "srsname doesn't match srid", 386 406 "config_file"); 407 return; 408 } 387 409 } 388 410 } … … 425 447 buffer_free(xmlstring); 426 448 427 if (valid != 0) 449 if (valid != 0) { 428 450 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 429 451 "xml isn't valid", "request"); 452 return; 453 } 430 454 } 431 455 } -
trunk/src/ows/ows_storage.c
r216 r278 170 170 ows_error(o, OWS_ERROR_REQUEST_SQL_FAILED, 171 171 "Unable to access pg_* tables.", "not_null columns"); 172 return; 172 173 } 173 174 … … 221 222 ows_error(o, OWS_ERROR_REQUEST_SQL_FAILED, 222 223 "Unable to access pg_* tables.", "pkey column"); 224 return; 223 225 } 224 226 … … 248 250 ows_error(o, OWS_ERROR_REQUEST_SQL_FAILED, 249 251 "Unable to find pkey column number.", "pkey_column number"); 252 return; 250 253 } 251 254 … … 271 274 ows_error(o, OWS_ERROR_REQUEST_SQL_FAILED, 272 275 "Unable to use pg_get_serial_sequence.", "pkey_sequence retrieve"); 276 return; 273 277 } 274 278 … … 320 324 ows_error(o, OWS_ERROR_REQUEST_SQL_FAILED, 321 325 "Unable to access pg_* tables.", "fill_attributes"); 326 return; 322 327 } 323 328 … … 364 369 "Some layer(s) described in config file are not available in geometry_columns or geography_columns", 365 370 "storage"); 371 return; 366 372 } 367 373 -
trunk/src/struct/cgi_request.c
r184 r278 83 83 query_size = atoi(getenv("CONTENT_LENGTH")); 84 84 85 if (query_size > CGI_QUERY_MAX) 85 if (query_size > CGI_QUERY_MAX) { 86 86 ows_error(o, OWS_ERROR_REQUEST_HTTP, "QUERY_STRING too long", 87 87 "request"); 88 return NULL; 89 } 88 90 89 91 query = malloc(sizeof(char) * CGI_QUERY_MAX); … … 210 212 "QUERY_STRING contains forbidden characters", 211 213 "request"); 214 return NULL; 212 215 } 213 216 else { … … 224 227 "QUERY_STRING contains forbidden characters", 225 228 "request"); 229 return NULL; 226 230 } 227 231 } … … 235 239 ows_error(o, OWS_ERROR_REQUEST_HTTP, "QUERY_STRING too long", 236 240 "request"); 241 return NULL; 237 242 } 238 243 … … 461 466 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, "xml isn't valid", 462 467 "request"); 468 return NULL; 463 469 } 464 470 -
trunk/src/wfs/wfs_describe.c
r255 r278 104 104 "Not a single layer is available. Check config file", 105 105 "describe"); 106 return; 106 107 } 107 108 -
trunk/src/wfs/wfs_error.c
r269 r278 68 68 assert(locator != NULL); 69 69 70 assert(!o->exit); 71 o->exit = true; 72 73 if (o->log != NULL) 74 fprintf(o->log, "[ERROR] {%s:%s} %s\n", 75 wfs_error_code_string(code), locator, message); 76 70 77 fprintf(o->output, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); 71 78 fprintf(o->output, "<ServiceExceptionReport\n"); … … 79 86 fprintf(o->output, "</ServiceException>\n"); 80 87 fprintf(o->output, "</ServiceExceptionReport>\n"); 81 82 #if TINYOWS_FCGI83 OS_LibShutdown();84 #endif85 if (o->log) fclose (o->log);86 ows_free(o);87 88 exit(EXIT_SUCCESS);89 88 } 90 89 … … 101 100 assert(locator != NULL); 102 101 102 assert(!o->exit); 103 o->exit = true; 104 105 if (o->log != NULL) 106 fprintf(o->log, "[ERROR] {%s:%s} %s\n", 107 wfs_error_code_string(code), locator, message); 108 103 109 fprintf(o->output, "<?xml version='1.0' encoding='UTF-8'?>\n"); 104 110 fprintf(o->output, "<ExceptionReport\n"); … … 113 119 fprintf(o->output, " </Exception>\n"); 114 120 fprintf(o->output, "</ExceptionReport>\n"); 115 116 #if TINYOWS_FCGI117 OS_LibShutdown();118 #endif119 if (o->log) fclose (o->log);120 ows_free(o);121 122 exit(EXIT_SUCCESS);123 121 } 124 122 -
trunk/src/wfs/wfs_get_feature.c
r268 r278 651 651 "error : an id_column is required to use featureid", 652 652 "GetFeature"); 653 return NULL; 653 654 } 654 655 } … … 673 674 buffer_free(layer_name); 674 675 fe_error(o, fe); 676 return NULL; 675 677 } 676 678 … … 860 862 /* retrieve a list of SQL requests from the GetFeature parameters */ 861 863 request_list = wfs_retrieve_sql_request_list(o, wr); 862 864 if (!request_list) return; 863 865 864 866 if (wr->format == WFS_GML2 || wr->format == WFS_GML3) { -
trunk/src/wfs/wfs_request.c
r259 r278 282 282 wfs_error(o, wr, WFS_ERROR_LAYER_NOT_DEFINED, 283 283 "unknown layer name", "typename"); 284 return NULL; 284 285 } 285 286 … … 291 292 "not-retrievable layer(s), GetFeature Operation impossible, change configuration file", 292 293 "typename"); 294 return NULL; 293 295 } 294 296 … … 300 302 "not-writable layer(s), Transaction Operation impossible, change configuration file", 301 303 "typename"); 304 return NULL; 302 305 } 303 306 } … … 342 345 "featureid list size and typename list size must be similar", 343 346 ""); 347 return NULL; 344 348 } 345 349 … … 361 365 "featureid values and typename values don't match", 362 366 ""); 367 return NULL; 363 368 } 364 369 } … … 371 376 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 372 377 "featureid must match layer.id", "GetFeature"); 373 378 return NULL; 374 379 } 375 380 … … 390 395 wfs_error(o, wr, WFS_ERROR_LAYER_NOT_DEFINED, 391 396 "unknown layer name", "GetFeature"); 397 return NULL; 392 398 } 393 399 … … 401 407 "not-retrievable layer(s), GetFeature Operation impossible, change configuration file", 402 408 "GetFeature"); 409 return NULL; 403 410 } 404 411 … … 412 419 "not-writable layer(s), Transaction Operation impossible, change configuration file", 413 420 "Transaction"); 421 return NULL; 414 422 } 415 423 … … 459 467 "layers in TYPENAME must have the same SRS", 460 468 "GetFeature"); 469 return; 461 470 } 462 471 } … … 468 477 "srsName value use an unsupported value, for requested layer(s)", 469 478 "GetFeature"); 470 } 479 return; 480 } 471 481 472 482 } else { … … 477 487 "srsName value use an unsupported value, for requested layer(s)", 478 488 "GetFeature"); 479 } 489 return; 490 } 480 491 } 481 492 } … … 505 516 "Bad parameters for Bbox, must be Xmin,Ymin,Xmax,Ymax", 506 517 "NULL"); 518 return; 507 519 } 508 520 … … 693 705 "propertyname list size and typename list size must be similar", 694 706 "GetFeature"); 707 return; 695 708 } 696 709 … … 713 726 "propertyname values and typename values don't match", 714 727 "GetFeature"); 728 return; 715 729 } 716 730 … … 738 752 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 739 753 "propertyname values not available", "GetFeature"); 754 return; 740 755 } 741 756 } … … 764 779 wr->filter = list_explode_start_end('(', ')', filter); 765 780 766 if (wr->filter->size != wr->typename->size) { 767 buffer_free(filter); 781 if (wr->filter->size != wr->typename->size) 768 782 wfs_error(o, wr, WFS_ERROR_INCORRECT_SIZE_PARAMETER, 769 783 "filter list size and typename list size must be similar", 770 784 "GetFeature"); 771 }772 785 773 786 buffer_free(filter); … … 785 798 786 799 /* operation parameter is mandatory */ 787 if (!array_is_key(o->cgi, "operation")) 800 if (!array_is_key(o->cgi, "operation")) { 788 801 ows_error(o, OWS_ERROR_MISSING_PARAMETER_VALUE, 789 802 "Operation (Delete) must be specified", "Operation"); 803 return; 804 } 790 805 791 806 wr->operation = buffer_init(); 792 807 buffer_copy(wr->operation, array_get(o->cgi, "operation")); 793 808 794 if (buffer_cmp(wr->operation, "Delete") == false) 809 if (buffer_cmp(wr->operation, "Delete") == false) { 795 810 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 796 811 "only Delete operation is supported with GET method, use POST method for insert and update operations", 797 812 "Transaction"); 813 return; 814 } 798 815 } 799 816 … … 807 824 assert(wr != NULL); 808 825 809 if (!array_is_key(o->cgi, "typename") && !array_is_key(o->cgi, "featureid")) 826 if (!array_is_key(o->cgi, "typename") && !array_is_key(o->cgi, "featureid")) { 810 827 ows_error(o, OWS_ERROR_MISSING_PARAMETER_VALUE, 811 828 "Typename or FeatureId must be set", "request"); 829 return; 830 } 812 831 813 832 /* test mutually exclusive parameters (filter,bbox and featureid) */ … … 870 889 list_free(l); 871 890 /* if versions weren't 1.0.0 or 1.1.0, raise an error */ 872 if (version == false) 891 if (version == false) { 873 892 ows_error(o, OWS_ERROR_VERSION_NEGOTIATION_FAILED, 874 893 "VERSION parameter is not valid (use 1.0.0 or 1.1.0)", 875 894 "AcceptVersions"); 895 return; 896 } 876 897 877 898 } … … 881 902 b = array_get(cgi, "updatesequence"); 882 903 883 if (!buffer_cmp(b, "0")) 904 if (!buffer_cmp(b, "0")) { 884 905 ows_error(o, OWS_ERROR_INVALID_UPDATE_SEQUENCE, 885 906 "updateSequence's value must be 0, UpdateSequence not available", 886 907 "updateSequence"); 908 return; 909 } 887 910 } 888 911 … … 963 986 964 987 layer_name = list_init(); 988 965 989 /* typename (requisite except if there is a featureid parameter */ 966 layer_name = wfs_request_check_typename(o, wr, layer_name);990 if (!o->exit) layer_name = wfs_request_check_typename(o, wr, layer_name); 967 991 968 992 /* Featureid, if no typename defined, list of layer_name must be extracted from featureid */ 969 layer_name = wfs_request_check_fid(o, wr, layer_name);993 if (!o->exit) layer_name = wfs_request_check_fid(o, wr, layer_name); 970 994 971 995 /* srsName */ 972 wfs_request_check_srs(o, wr, layer_name);996 if (!o->exit) wfs_request_check_srs(o, wr, layer_name); 973 997 974 998 /* BBox : BBOX=xmin,ymin,xmax,ymax */ 975 wfs_request_check_bbox(o, wr, layer_name);999 if (!o->exit) wfs_request_check_bbox(o, wr, layer_name); 976 1000 977 1001 /* PropertyName */ 978 wfs_request_check_propertyname(o, wr, layer_name); 979 list_free(layer_name); 1002 if (!o->exit) wfs_request_check_propertyname(o, wr, layer_name); 1003 1004 if (!o->exit) list_free(layer_name); 980 1005 981 1006 /* outputFormat */ 982 wfs_request_check_output(o, wr);1007 if (!o->exit) wfs_request_check_output(o, wr); 983 1008 984 1009 /* resultType */ 985 wfs_request_check_resulttype(o, wr);1010 if (!o->exit) wfs_request_check_resulttype(o, wr); 986 1011 987 1012 /* sortBy */ 988 wfs_request_check_sortby(o, wr);1013 if (!o->exit) wfs_request_check_sortby(o, wr); 989 1014 990 1015 /* maxFeatures */ 991 wfs_request_check_maxfeatures(o, wr);1016 if (!o->exit) wfs_request_check_maxfeatures(o, wr); 992 1017 993 1018 /*Filter */ 994 wfs_request_check_filter(o, wr);1019 if (!o->exit) wfs_request_check_filter(o, wr); 995 1020 } 996 1021 … … 1009 1034 1010 1035 /* general checks */ 1011 wfs_request_check_operation(o, wr);1012 wfs_request_check_parameters(o, wr);1036 if (!o->exit) wfs_request_check_operation(o, wr); 1037 if (!o->exit) wfs_request_check_parameters(o, wr); 1013 1038 1014 1039 layer_name = list_init(); 1015 1040 /* typename */ 1016 layer_name = wfs_request_check_typename(o, wr, layer_name);1041 if (!o->exit) layer_name = wfs_request_check_typename(o, wr, layer_name); 1017 1042 1018 1043 /* featureid */ 1019 layer_name = wfs_request_check_fid(o, wr, layer_name);1044 if (!o->exit) layer_name = wfs_request_check_fid(o, wr, layer_name); 1020 1045 1021 1046 /* bbox */ 1022 wfs_request_check_bbox(o, wr, layer_name);1047 if (!o->exit) wfs_request_check_bbox(o, wr, layer_name); 1023 1048 list_free(layer_name); 1024 1049 1025 1050 /* filter */ 1026 wfs_request_check_filter(o, wr);1051 if (!o->exit) wfs_request_check_filter(o, wr); 1027 1052 } 1028 1053 … … 1041 1066 b = array_get(cgi, "request"); 1042 1067 1043 if (o->request->service != WFS) 1068 if (o->request->service != WFS) { 1044 1069 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 1045 1070 "bad service, should be WFS", "SERVICE"); 1071 return; 1072 } 1046 1073 1047 1074 /* version */ 1048 if (!buffer_case_cmp(b, "GetCapabilities")) 1075 if (!buffer_case_cmp(b, "GetCapabilities")) { 1049 1076 wfs_request_check_version(o, wr, cgi); 1077 if (o->exit) return; 1078 } 1050 1079 1051 1080 /* check if request parameter is correct */ … … 1101 1130 if (buffer_cmp(wf->operation, "Delete")) 1102 1131 wfs_delete(o, wf); 1103 else 1132 else { 1104 1133 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 1105 1134 "only Delete operation is supported with GET method, use POST method for insert and update operations", 1106 1135 "Transaction"); 1136 return; 1137 } 1107 1138 1108 1139 } else { … … 1110 1141 op = array_get(o->cgi, "operations"); 1111 1142 wfs_parse_operation(o, wf, op); 1112 } else 1143 } else { 1113 1144 ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 1114 1145 "Operation parameter must be set", "Transaction"); 1146 return; 1147 } 1115 1148 } 1116 1149 -
trunk/src/wfs/wfs_transaction.c
r257 r278 608 608 "error : an id_column is required to use featureid", 609 609 "Delete"); 610 return; 610 611 } 611 612 } … … 920 921 xmlCleanupParser(); 921 922 wfs_error(o, wr, WFS_ERROR_NO_MATCHING, "xml isn't valid", "transaction"); 923 return; 922 924 } 923 925