Changeset 97748ee
- Timestamp:
- Jan 13, 2021, 1:38:51 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- a00bc5b
- Parents:
- 7270432
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/worker.cfa
r7270432 r97748ee 65 65 // If this wasn't a request retrun 400 66 66 if( code != OK200 ) { 67 if( options.log )printf("=== Invalid Request : %d ===\n", code_val(code));67 printf("=== Invalid Request : %d ===\n", code_val(code)); 68 68 answer_error(fd, code); 69 69 continue REQUEST; … … 77 77 // Send the header 78 78 answer_plain(fd, text, sizeof(text)); 79 80 if( options.log ) printf("=== Answer sent ===\n"); 81 continue REQUEST; 79 82 } 80 else {81 if( options.log ) printf("=== Request for file %.*s ===\n", (int)name_size, file);82 83 83 // Get the fd from the file cache 84 int ans_fd; 85 size_t count; 86 [ans_fd, count] = get_file( file, name_size ); 87 88 // If we can't find the file, return 404 89 if( ans_fd < 0 ) { 90 if( options.log ) printf("=== File Not Found ===\n"); 91 answer_error(fd, E404); 92 continue REQUEST; 93 } 84 if(0 == strncmp(file, "ping", min(name_size, sizeof("ping") ))) { 85 if( options.log ) printf("=== Request for /ping ===\n"); 94 86 95 87 // Send the header 96 answer_ header(fd, count);88 answer_empty(fd); 97 89 98 // Send the desired file99 sendfile( this.pipe, fd, ans_fd, count);90 if( options.log ) printf("=== Answer sent ===\n"); 91 continue REQUEST; 100 92 } 93 94 if( options.log ) printf("=== Request for file %.*s ===\n", (int)name_size, file); 95 96 // Get the fd from the file cache 97 int ans_fd; 98 size_t count; 99 [ans_fd, count] = get_file( file, name_size ); 100 101 // If we can't find the file, return 404 102 if( ans_fd < 0 ) { 103 printf("=== File Not Found ===\n"); 104 answer_error(fd, E404); 105 continue REQUEST; 106 } 107 108 // Send the header 109 answer_header(fd, count); 110 111 // Send the desired file 112 sendfile( this.pipe, fd, ans_fd, count); 101 113 102 114 if( options.log ) printf("=== Answer sent ===\n");
Note: See TracChangeset
for help on using the changeset viewer.