Changeset ed2cb3c
- Timestamp:
- Feb 25, 2021, 3:09:03 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:
- a80db97
- Parents:
- 187fdb8
- Location:
- benchmark/io/http
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/io/http/protocol.cfa
r187fdb8 red2cb3c 20 20 #include "options.hfa" 21 21 22 #define PLAINTEXT_1WRITE 23 #define PLAINTEXT_NOCOPY 24 22 25 struct https_msg_str { 23 26 char msg[512]; … … 30 33 31 34 const int http_codes[KNOWN_CODES] = { 35 200, 32 36 200, 33 37 400, … … 79 83 } 80 84 81 #define PLAINTEXT_1WRITE 82 #if defined(PLAINTEXT_1WRITE) 85 #if defined(PLAINTEXT_NOCOPY) 86 int answer_plaintext( int fd ) { 87 return answer(fd, http_msgs[OK200_PlainText]->msg, http_msgs[OK200_PlainText]->len + 1); // +1 cause snprintf doesn't count nullterminator 88 } 89 #elif defined(PLAINTEXT_1WRITE) 83 90 int answer_plaintext( int fd ) { 84 91 char text[] = "Hello, World!\n"; … … 189 196 const char * original_http_msgs[] = { 190 197 "HTTP/1.1 200 OK\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: ", 198 "HTTP/1.1 200 OK\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 15\n\nHello, World!\n", 191 199 "HTTP/1.1 400 Bad Request\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 0 \n\n", 192 200 "HTTP/1.1 404 Not Found\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 0 \n\n", -
benchmark/io/http/protocol.hfa
r187fdb8 red2cb3c 3 3 enum HttpCode { 4 4 OK200 = 0, 5 OK200_PlainText, 5 6 E400, 6 7 E404,
Note: See TracChangeset
for help on using the changeset viewer.