#ifndef HTTP_PARSE_H #define HTTP_PARSE_H /* Restrict the size of both uploads and downloads. */ #define MAX_CONTENT_LENGTH 8388608 struct http_source { FILE *fp; const char *string; int index; int length; }; enum token { WORD, QUOTE, SEMICOLON, COLON, EQUALS, COMMA, EOL }; enum header { CONTENT_TYPE, CONTENT_DISPOSITION, CONTENT_TRANSFER_ENCODING }; struct http_sink { FILE *fp; struct buffer *b; }; int whitespacep (const char *s); int http_read_char (struct http_source *source); void http_unread_char (int c, struct http_source *source); void http_write_char (int c, struct http_sink *sink); void http_write_string (const char *string, struct http_sink *sink); void http_write_substring (const char *string, int length, struct http_sink *sink); int maybe_read_crlf (struct http_source *source); int http_read_line (struct http_source *source, struct buffer *b); int read_token (struct http_source *source, struct buffer *b); #endif /* HTTP_PARSE_H */