okheaders.c 433 B

12345678910111213141516171819202122
  1. #include <u.h>
  2. #include <libc.h>
  3. #include <bin.h>
  4. #include <httpd.h>
  5. /*
  6. * write initial part of successful header
  7. */
  8. void
  9. hokheaders(HConnect *c)
  10. {
  11. Hio *hout;
  12. hout = &c->hout;
  13. hprint(hout, "%s 200 OK\r\n", hversion);
  14. hprint(hout, "Server: Plan9\r\n");
  15. hprint(hout, "Date: %D\r\n", time(nil));
  16. if(c->head.closeit)
  17. hprint(hout, "Connection: close\r\n");
  18. else if(!http11(c))
  19. hprint(hout, "Connection: Keep-Alive\r\n");
  20. }