Changeset 5730:bffff5f70163 in roaraudio
- Timestamp:
- 11/07/12 01:10:52 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/universal/protocol-http.c
r5729 r5730 410 410 void * data; 411 411 ssize_t ret; 412 int err; 412 413 413 414 // TODO: use content type for some basic filtering. … … 420 421 421 422 ret = roar_vio_read(self->input.vio, data, len); 423 err = roar_error; 422 424 423 425 if ( ret < 1 ) { 424 426 roar_buffer_free(buffer); 425 return 0; 427 roar_error = err; 428 return -1; 426 429 } 427 430 … … 442 445 443 446 static int __res_vio_header_send(struct http_client * self, struct roar_buffer ** obuffer) { 447 static const char * index_files[] = {NULL, "index.html", "index.txt", "index"}; 444 448 struct roar_buffer * buffer; 445 449 struct roar_keyval * path; … … 447 451 const char * slash = "/"; 448 452 const char * content_type = NULL; 453 int uste_check; 454 size_t i; 449 455 450 456 if ( self->pluginpara == NULL ) { … … 478 484 slash = ""; 479 485 480 snprintf(filename, sizeof(filename), "%s%s%s", path->value, slash, self->path); 481 482 483 self->input.vio = &(self->input.vio_store); 484 if ( roar_vio_open_dstr_simple(self->input.vio, filename, ROAR_VIOF_READ|ROAR_VIOF_NONBLOCK) == -1 ) { 485 return -1; 486 } 487 488 if ( roar_vio_ctl(self->input.vio, ROAR_VIO_CTL_GET_MIMETYPE, &content_type) == -1 ) 489 content_type = NULL; 490 491 if ( content_type == NULL ) 492 content_type = __res_vio_content_type_get(self); 493 494 if ( __res_vio_check_uste(self, &buffer, content_type) == 1 ) { 486 uste_check = -1; 487 for (i = 0; uste_check == -1 && i < (sizeof(index_files)/sizeof(*index_files)); i++) { 488 snprintf(filename, sizeof(filename), "%s%s%s%s%s", path->value, slash, self->path, 489 index_files[i] == NULL ? "" : "/", 490 index_files[i] == NULL ? "" : index_files[i]); 491 492 493 self->input.vio = &(self->input.vio_store); 494 if ( roar_vio_open_dstr_simple(self->input.vio, filename, ROAR_VIOF_READ|ROAR_VIOF_NONBLOCK) == -1 ) { 495 continue; 496 } 497 498 if ( roar_vio_ctl(self->input.vio, ROAR_VIO_CTL_GET_MIMETYPE, &content_type) == -1 ) 499 content_type = NULL; 500 501 if ( content_type == NULL ) 502 content_type = __res_vio_content_type_get(self); 503 504 uste_check = __res_vio_check_uste(self, &buffer, content_type); 505 if ( uste_check == -1 ) 506 roar_vio_unref(self->input.vio); 507 } 508 509 if ( uste_check == -1 ) 510 return -1; 511 512 if ( uste_check == 1 ) { 495 513 if ( buffer != NULL ) 496 514 roar_buffer_free(buffer);
Note: See TracChangeset
for help on using the changeset viewer.