Changeset ed2cb3c


Ignore:
Timestamp:
Feb 25, 2021, 3:09:03 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
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
Message:

Client can now send message without copying.

Location:
benchmark/io/http
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • benchmark/io/http/protocol.cfa

    r187fdb8 red2cb3c  
    2020#include "options.hfa"
    2121
     22#define PLAINTEXT_1WRITE
     23#define PLAINTEXT_NOCOPY
     24
    2225struct https_msg_str {
    2326        char msg[512];
     
    3033
    3134const int http_codes[KNOWN_CODES] = {
     35        200,
    3236        200,
    3337        400,
     
    7983}
    8084
    81 #define PLAINTEXT_1WRITE
    82 #if defined(PLAINTEXT_1WRITE)
     85#if defined(PLAINTEXT_NOCOPY)
     86int 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)
    8390int answer_plaintext( int fd ) {
    8491        char text[] = "Hello, World!\n";
     
    189196const char * original_http_msgs[] = {
    190197        "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",
    191199        "HTTP/1.1 400 Bad Request\nServer: HttoForall\nDate: %s \nContent-Type: text/plain\nContent-Length: 0 \n\n",
    192200        "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  
    33enum HttpCode {
    44        OK200 = 0,
     5        OK200_PlainText,
    56        E400,
    67        E404,
Note: See TracChangeset for help on using the changeset viewer.