Changeset 4832:085f96f6555c in roaraudio
- Timestamp:
- 04/03/11 11:02:47 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio_proto.c
r4830 r4832 36 36 #include "libroar.h" 37 37 38 #ifndef ROAR_WITHOUT_VIO_PROTO 39 #include <roaraudio/proto_gopher.h> 40 #endif 41 38 42 int roar_vio_proto_init_def (struct roar_vio_defaults * def, char * dstr, int proto, struct roar_vio_defaults * odef) { 39 43 #ifndef ROAR_WITHOUT_VIO_PROTO … … 525 529 526 530 int roar_vio_open_proto_gopher (struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * host, char * file) { 531 struct roar_vio_proto * self; 532 char type; 533 const char * mime = NULL; 534 527 535 if ( calls == NULL || dst == NULL || host == NULL || file == NULL ) 528 536 return -1; 529 537 538 self = calls->inst; 530 539 calls->write = NULL; // Disable write as we do not support this 531 540 532 541 ROAR_DBG("roar_vio_open_proto_gopher(calls=%p, dst=%p, host='%s', file='%s') = ?", calls, dst, host, file); 533 542 534 if ( file[1] == '/' ) 535 file += 2; 536 537 roar_vio_printf(dst, "/%s\r\n", file); 543 type = file[0]; 544 545 file++; 546 547 ROAR_DBG("roar_vio_open_proto_gopher(*): type='%c'", type); 548 549 switch (type) { 550 case ROAR_GOPHER_TYPE_FILE: 551 mime = "text/plain"; 552 break; 553 case ROAR_GOPHER_TYPE_DIR: 554 mime = "inode/directory"; 555 break; 556 case ROAR_GOPHER_TYPE_BIN: 557 mime = "application/octet-stream"; 558 break; 559 case ROAR_GOPHER_TYPE_GIF: 560 mime = "image/gif"; 561 break; 562 case ROAR_GOPHER_TYPE_HTML: 563 mime = "text/html"; 564 break; 565 } 566 567 if ( mime != NULL ) { 568 self->content_type = roar_mm_strdup(mime); 569 } 570 571 roar_vio_printf(dst, "%s\r\n", file); 538 572 539 573 roar_vio_sync(dst); // for encryption/compression layers
Note: See TracChangeset
for help on using the changeset viewer.