http.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * http.h
  3. * HTTP parsers.
  4. *
  5. * Matej Pfajfar <mp292@cam.ac.uk>
  6. */
  7. /*
  8. * Changes :
  9. * $Log$
  10. * Revision 1.2 2002/07/20 02:01:18 arma
  11. * bugfixes: don't hang waiting for new children to die; accept HTTP/1.1
  12. *
  13. * Revision 1.1.1.1 2002/06/26 22:45:50 arma
  14. * initial commit: current code
  15. *
  16. * Revision 1.2 2002/04/02 14:27:33 badbytes
  17. * Final finishes.
  18. *
  19. * Revision 1.1 2002/03/12 23:46:14 mp292
  20. * HTTP-related routines.
  21. *
  22. */
  23. #define HTTPAP_MAXLEN 1024 /* maximum length of a line */
  24. #define HTTPAP_CR '\015'
  25. #define HTTPAP_LF '\012'
  26. #define HTTPAP_CRLF "\015\012"
  27. #define HTTPAP_VERSION "HTTP/1.0"
  28. #define HTTPAP_STATUS_LINE_FORBIDDEN HTTPAP_VERSION " 403 Only local connections are allowed." HTTPAP_CRLF
  29. #define HTTPAP_STATUS_LINE_VERSION_NOT_SUPPORTED HTTPAP_VERSION " 501 Only HTTP/1.0 is supported." HTTPAP_CRLF
  30. #define HTTPAP_STATUS_LINE_UNAVAILABLE HTTPAP_VERSION " 503 Connection to the server failed." HTTPAP_CRLF
  31. #define HTTPAP_STATUS_LINE_BAD_REQUEST HTTPAP_VERSION " 400 Invalid syntax." HTTPAP_CRLF
  32. #define HTTPAP_STATUS_LINE_UNEXPECTED HTTPAP_VERSION " 500 Internal server error." HTTPAP_CRLF
  33. #define HTTPAP_HEADER_PROXY_CONNECTION "Proxy-Connection"
  34. #define HTTPAP_HEADER_USER_AGENT "User-Agent"
  35. #define HTTPAP_HEADER_REFERER "Referer"
  36. int http_get_line(int s, unsigned char **line, size_t *len, struct timeval *conn_tout);
  37. int http_get_version(unsigned char *rl, unsigned char **http_ver);
  38. int http_get_dest(unsigned char *rl, unsigned char **addr, unsigned char **port);
  39. int http_get_header_name(unsigned char *rl, unsigned char **hname);