summaryrefslogtreecommitdiff
path: root/module/web/http.scm
AgeCommit message (Collapse)AuthorFilesLines
2011-12-22Extend handling of "Cache-Control" header.Daniel Hartwig1-3/+9
* module/web/http.scm ("Cache-Control"): Value for `max-stale' is optional. Strict validation for value-less directives (`no-store', etc.). String values optional for "cache-extension" directives. * test-suite/tests/web-http.test: Value for `max-stale' is optional.
2011-11-23fix validators for various list-style headersDaniel Hartwig1-8/+18
* module/web/http.scm (default-val-validator): Valid with no value. (key-value-list?): Keys are always symbols, do not accept strings. (validate-param-list): Apply `valid?' to list elements. (validate-credentials): Validate param for Basic scheme, which is parsed as a string. (declare-symbol-list-header!): `list-of?' args were in wrong order. ("Cache-Control"): Replace `default-val-validator' with more specific procedure. ("Accept"): Validate on first param which has no value.
2011-10-17fix (web http) write-date for mondaysAndy Wingo1-1/+1
* module/web/http.scm (write-date): Fix bug on Mondays. Jeez!
2011-09-10RFC 822 allows single digit days of the monthIan Price1-9/+19
* module/web/http.scm (parse-rfc-822-date): Add single digit day conditional. * test-suite/tests/web-http.test("general headers"): Add test.
2011-08-04(web http): locale-independent parsing and serialization of datesAndy Wingo1-11/+170
* module/web/http.scm (parse-month, parse-rfc-822-date): (parse-rfc-850-date, parse-asctime-date, parse-date): (write-date): Parse and write dates without regard to the current locale, using a custom parser. Also permits parsing of the deprecated RFC 850 and asctime() date formats.
2011-01-10parse credentials and challengesAndy Wingo1-9/+119
* module/web/http.scm (parse-credentials, validate-credentials) (write-credentials, parse-challenge, parse-challenges) (validate-challenges, write-challenge, write-challenges) (declare-credentials-header!, declare-challenge-list-header!): New helpers. ("Authorization", "Proxy-Authorization"): Parse out credentials. ("Proxy-Authenticate", "WWW-Authenticate"): Parse out challenges.
2011-01-08more symbols in (web http)Andy Wingo1-4/+14
* module/web/http.scm (declare-symbol-list-header!): New helper. ("Connection"): Redefine as a header list. ("Allow", "Content-Encoding", "Accept-Ranges"): Redefine as symbol lists. * test-suite/tests/web-http.test: * test-suite/tests/web-response.test: Adapt tests.
2011-01-08(web http): keys are always symbolsAndy Wingo1-70/+53
* module/web/http.scm (parse-media-type): Parse media types as symbols. (parse-key-value-list, parse-param-component, parse-param-list): Change kons to val-parser. Always parse keys as symbols, and always either cons, if there is a val, or just have the key, if there is no val. Easier to explain and just as correct. (declare-param-list-header!, declare-key-value-list-header!): Adapt to key-list and param-list kons change. ("Cache-Control", "Pragma", "Transfer-Encoding", "Accept", "Expect") ("TE"): Likewise, adapt. ("Content-Type"): Param keys are symbols.
2011-01-08(web http): don't expose header-decl objectsAndy Wingo1-46/+63
* module/web/http.scm: Change to not expose the header-decl objects, instead exposing header-parse, header-validator, header-writer et al. Explaining header decls in the manual was too complicated. (string->header, header->string): New helpers. (<header-decl>): Remove the `sym' field. (declare-header!): Adapt to header-decl change, and use string->header. (known-header?, header-parser, header-validator, header-writer): New procedures. Adapt to use the new procedures internally.
2011-01-08(web http): header names always represented as symbolsAndy Wingo1-276/+174
* module/web/http.scm (declare-header!): No need to specify `sym', as it can be derived from `name'. Change to take parser, validator, and writer as positional arguments, and multiple? as a keyword. (parse-header): Change to take the header as a symbol already, and just return the parsed value. All headers are symbols now, including unknown headers. I feel OK doing this given that the symbol GC works now. (lookup-header-decl): Only look up headers by symbol. (read-header): Adapt to parse-header change. (valid-header?, write-header): Adapt to all headers being symbols. (split-header-names, list-of-header-names?, write-header-list): Represent all header names as symbols. (declare-opaque-header!, declare-date-header!) (declare-string-list-header!, declare-header-list-header!) (declare-integer-header!, declare-uri-header!) (declare-quality-list-header!, declare-param-list-header!) (declare-key-value-list-header!, declare-entity-tag-list-header!): Change to be functions instead of syntax, and no need to specify the symbolic name. Update all header declarations accordingly. * module/web/request.scm (validate-headers): * module/web/response.scm (validate-headers): Adapt to all headers being symbols. * test-suite/tests/web-http.test (pass-if-parse, pass-if-any-error) (pass-if-parse-error): Update for parse-header change. ("general headers"): Update header list examples to be all symbols.
2011-01-07read-header returns EOF at end, update (web http) docsAndy Wingo1-6/+8
* doc/ref/web.texi (HTTP): Add an example for declaring a header, and adapt to read-header change. * module/web/http.scm (read-header): Return EOF for both values if there are no more headers, instead of #f. (read-headers): Adapt.
2011-01-07rename string->uri and uri->string.Andy Wingo1-3/+3
* module/web/uri.scm (string->uri, uri->string): Rename from parse-uri and unparse-uri. * test-suite/tests/web-uri.test: * module/web/http.scm: All callers changed.
2010-12-16http: lists of header names parse betterAndy Wingo1-15/+41
* module/web/http.scm (list-of-strings?, write-list-of-strings): Move definitions up. (split-header-names, list-of-header-names?, write-header-list): New helpers. (declare-header-list-header): New helper. (cache-control): Use split-header-names for private and no-cache. (trailer): Use declare-header-list-header to parse known headers to symbols. (vary): Likewise, use split-header-names et al. * test-suite/tests/web-http.test ("general headers"): Add a test.
2010-12-16better cache-control: private, no-cache parsingAndy Wingo1-1/+6
* module/web/http.scm (cache-control): Parse private and no-cache better. * test-suite/tests/web-http.test ("general headers"): Update.
2010-12-16(web http) docstringsAndy Wingo1-2/+45
* module/web/http.scm: Add docstrings all around.
2010-12-06leniency regarding quality values in http.scmAndy Wingo1-0/+20
* module/web/http.scm: Add commentary. (parse-quality): Allow .NNN to be interpreted as 0.NNN. * test-suite/tests/web-http.test ("request headers"): Add a test.
2010-12-06fix entity tag writingAndy Wingo1-1/+1
* module/web/http.scm (write-entity-tag): Fix writing of entity tags (strong versus weak).
2010-11-23fix web server bugsAndy Wingo1-1/+1
* module/web/http.scm (valid-quality?): * module/web/server.scm (sanitize-response): Fix a couple bugs.
2010-11-13(web http) parses content-type as "foo/bar", not "foo" "bar"Andy Wingo1-31/+32
* module/web/http.scm (parse-media-type, validate-media-type, (content-type): Change to represent media types as ("foo/bar" ("param" . "val") ...) instead of ("foo" "bar" ("param" . "val") ...). Seems to be more in line with what people expect. * test-suite/tests/web-http.test ("entity headers"): Add content-type test. * test-suite/tests/web-response.test ("example-1"): Adapt expected parse.
2010-11-12more (web http) exports for parsing request componentsAndy Wingo1-5/+15
* module/web/http.scm (lookup-header-decl): New exported function. (parse-http-version, parse-http-method, parse-request-uri): Export these functions.
2010-11-04add HTTP moduleAndy Wingo1-0/+1464
* module/web/http.scm: New module, declares known HTTP headers, and their parsers and unparsers. * test-suite/tests/web-http.test: Add test suite. * module/Makefile.am: * test-suite/Makefile.am: Adapt.