ChrisOS Research ProjectOperating systems · language systems · graphics · machine emulation
DOCUMENTATION ARCHIVEMAIN BRANCH
ChrisOS/Source reference: APPS/NET/HTTP.CC

Source reference: APPS/NET/HTTP.CC

Deterministic source record. The complete textual file is reproduced below; this page does not replace architectural interpretation in the authored chapters.

File identity

Field Value
Path APPS/NET/HTTP.CC
Lines 41
Bytes 737
SHA-256 954c1bd1094c0c8af116bf914ea76ffe6916bc6fdd4ccff8f2b5d7334720a944
ChrisOS revision da3df29cb397932c43d32373871fb9380e688ade

Detected syntactic dependencies

Line Include
— No preprocessor include detected.

Detected symbols

Line Symbol
1 main

Complete source

The following block is the complete textual file at the recorded revision. No lines are elided, abbreviated or paraphrased.

void main() {
  int fd;
  int c;
  char req[64];
  char rep[48];
  int i;
  viewport(200, 80);
  text(8, 8, "http", 0x00FFFFFF);
  fd = sock_listen(8080);
  while (1) {
    c = sock_accept(fd);
    if (c > 0) {
      i = sock_recv(c, req, 60);
      rep[0] = 72;
      rep[1] = 84;
      rep[2] = 84;
      rep[3] = 80;
      rep[4] = 47;
      rep[5] = 49;
      rep[6] = 46;
      rep[7] = 48;
      rep[8] = 32;
      rep[9] = 50;
      rep[10] = 48;
      rep[11] = 48;
      rep[12] = 32;
      rep[13] = 79;
      rep[14] = 75;
      rep[15] = 13;
      rep[16] = 10;
      rep[17] = 13;
      rep[18] = 10;
      rep[19] = 104;
      rep[20] = 105;
      rep[21] = 0;
      sock_send(c, rep, 21);
      sock_close(c);
    }
  }
}

Role of this record

The atlas guarantees file-by-file traceability. Responsibility, invariants, ownership, concurrency, security, performance and subsystem interactions belong in authored chapters and must cite this file when applicable.

Document record ID: source-954c1bd1094c0c8a Reviewed source: da3df29cb397 Class: generated-source-reference