summaryrefslogtreecommitdiff
path: root/module/web
Commit message (Expand)AuthorAgeFilesLines
* web: Avoid deprecated '_IOFBF'....* module/web/client.scm (open-socket-for-uri): Use 'block instead of _IOFBF. Ludovic Courtès2017-03-171-1/+1
* web: Remove export of nonexistent 'open-connection-for-uri'....* module/web/client.scm: Don't export 'open-connection-for-uri', which doesn't exist. Ludovic Courtès2017-03-171-2/+1
* http: Do not use 'eq?' to compare characters in parse-request-uri....* module/web/http.scm (parse-request-uri): Use 'eqv?' to compare characters. Mark H Weaver2017-03-011-1/+1
* Web server and client use suspendable ports...* module/web/request.scm (write-request): * module/web/response.scm (write-response): Use put-string instead of display. Andy Wingo2017-02-082-2/+4
* Remove remaining "display" uses in (web http)...* module/web/http.scm (header-writer): Default to calling put-string. (put-list): Rename from write-list, take the port first, and call the put-item function with port then value. Adapt all callers. (write-date): Rename display-digits to put-digits. (put-challenge): Rename from write-challenge, adapt arguments to put convention, and adapt callers. (declare-symbol-list-header!): Use put-symbol. (declare-integer-header!): Use put-non-negative-integer.o (declare-entity-tag-list-header!): Use put-entity-tag-list. ("If-Range", "Etag"): Adapt to put-entity-tag. (make-chunked-output-port): Use put-char. Andy Wingo2017-02-081-59/+62
* Beginnings of suspendable HTTP...* module/web/http.scm: Use put-string and other routines from (ice-9 textual-ports) in preference to `display'. The goal is for these operations to be suspendable. Andy Wingo2017-02-081-134/+146
* Modernize (web http) a bit...* module/web/http.scm: Modernize the Guile Scheme by using more match, when, unless, and non-tail conversion. No functional change, with the exception of fixing a bug in write-key-value-list for symbols like 100-continue that shouldn't print as #{100-continue}#. * test-suite/tests/web-http.test (pass-if-only-parse): (pass-if-reparse, pass-if-parse): Arrange to also serialize and reparse values from pass-if-parse. Apply to all existing tests except fragments where we don't expect fragments to be written out. Andy Wingo2017-02-081-353/+356
* web: Add https support through gnutls....Since importing gnutls directly would result in a dependency cycle, we load gnutls lazily. This uses code originally written for Guix by Ludovic Courtès. * module/web/client.scm: (%http-receive-buffer-size) (gnutls-module, ensure-gnutls, gnutls-ref, tls-wrap): New variables. (open-socket-for-uri): Wrap in tls when uri scheme is https. * doc/ref/web.texi (open-socket-for-uri): Document gnutls usage. Christopher Allan Webber2016-11-071-22/+144
* ETag list headers accept sloppy etags...* module/web/http.scm (parse-entity-tag): Add #:sloppy-delimiters keyword argument, and return a second value indicating the end position. (parse-entity-tag-list): Use parse-entity-tag, so that we also accept sloppy etags that aren't qstrings. * test-suite/tests/web-http.test ("request headers"): Add a test. Andy Wingo2016-08-281-19/+33
* Fix uri-decode behavior for "+"...* module/web/uri.scm (uri-decode): Add #:decode-plus-to-space? keyword argument. (split-and-decode-uri-path): Don't decode plus to space. * doc/ref/web.texi (URIs): Update documentation. * test-suite/tests/web-uri.test ("decode"): Add tests. * NEWS: Add entry. Based on a patch by Brent <brent@tomski.co.za>. Andy Wingo2016-06-201-3/+8
* http: Accept date strings with a leading space for hours....Fixes <http://bugs.gnu.org/23421>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * module/web/http.scm (parse-rfc-822-date): Add two clauses for hours with a leading space. * test-suite/tests/web-http.test ("general headers"): Add two tests. Ludovic Courtès2016-05-221-0/+20
* http: Use 'read-header-line' instead of 'read-line*'....* module/web/http.scm (read-line*): Remove. (read-continuation-line, read-header, read-request-line): Use 'read-header-line' instead of 'read-line*'. Ludovic Courtès2016-05-221-19/+3
* http: Accept empty reason phrases....Fixes <http://bugs.gnu.org/22273>. Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>. * module/web/http.scm (read-header-line): New procedure. (read-response-line): Use it instead of 'read-line*'. * test-suite/tests/web-http.test ("read-response-line"): Add test. Ludovic Courtès2016-05-221-5/+20
* web: Gracefully handle premature EOF when reading chunk header....* module/web/http.scm (read-chunk-header): Return 0 when 'read-line' returns EOF. Ludovic Courtès2016-05-221-9/+16
* web: Fix 'close' method of delimited input ports....* module/web/response.scm (make-delimited-input-port)[close]: Replace erroneous self-recursive call with a call to 'close-port'. * test-suite/tests/web-response.test ("example-1")["response-body-port + close"]: New test. Ludovic Courtès2016-05-221-2/+2
* web: Export 'server-impl' procedures and the 'http' server implementation....* module/web/server.scm: Export the 'server-impl' procedures. * module/web/server/http.scm: Export 'http'. Ludovic Courtès2016-05-222-3/+13
* http: Do not buffer HTTP chunks....Fixes <http://bugs.gnu.org/19939>. * module/web/http.scm (read-chunk, read-chunk-body): Remove. (make-chunked-input-port)[next-chunk, buffer-, buffer-size, buffer-pointer]: Remove. [chunk-size, remaining]: New variables. [read!]: Rewrite to write directly to BV. * test-suite/tests/web-http.test ("chunked encoding")["reads chunks without buffering", "reads across chunk boundaries"]: New tests. Ludovic Courtès2016-05-221-34/+32
* make-chunked-output-port buffering fix...* module/web/http.scm (make-chunked-output-port): Add #:buffering argument, defaulting to 1200 (some random value under the MTU). This will force a flush every so often, and not every character as would otherwise be the case after this port rewrite. Andy Wingo2016-04-111-7/+11
* Use symbols instead of _IONBF values as args to setvbuf...* libguile/ports.c (scm_setvbuf): Use the symbols `none', `line', and `block' instead of the values `_IONBF', `_IOLBF', and `_IOFBF'. * NEWS: Update. * doc/ref/posix.texi (Ports and File Descriptors): Update setvbuf documentation. * module/ice-9/deprecated.scm (define-deprecated): New helper. (_IONBF, _IOLBF, _IOFBF): Define deprecated values. * benchmark-suite/benchmarks/read.bm ("read"): * benchmark-suite/benchmarks/uniform-vector-read.bm ("uniform-vector-read!"): * libguile/r6rs-ports.c (cbip_fill_input): * module/system/base/types.scm (%ffi-memory-backend): * module/web/client.scm (open-socket-for-uri): * module/web/server/http.scm (http-read): * test-suite/tests/ports.test ("pipe, fdopen, and line buffering"): ("setvbuf"): * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports"): Update to use non-deprecated interfaces. Andy Wingo2016-04-042-2/+2
* web: Be less strict when parsing entity tags....* module/web/http.scm (parse-entity-tag): Be less strict, accepting unquoted strings as well. * test-suite/tests/web-http.test ("response headers"): Add a test for etag parsing. Andy Wingo2016-01-071-4/+9
* web: Location header is URI-reference; better URI-reference support...* module/web/uri.scm (validate-uri): Add reference? keyword argument, for validating references. (build-uri): Clarify comments to indicate that the result is an absolute URI. (build-uri-reference): New interface, to build URI-references. (string->uri-reference): Rename from string->uri*. Fix fragment parsing to not include the #. (string->uri): Adapt to string->uri-reference name change. * module/web/request.scm (request-absolute-uri): Add default-scheme optional argument. Use it if the request-uri has no scheme, or error. * module/web/http.scm (write-uri): Reflow to use "when". Fix writing of URI-reference instances. (declare-uri-reference-header!): Rename from declare-relative-uri-header!. Use string->uri-reference. ("Location"): Declare as a URI-reference header, as per RFC 7231. * module/web/client.scm (open-socket-for-uri): Handle the case in which there is no URI scheme. * test-suite/tests/web-http.test: * test-suite/tests/web-uri.test: Add tests. Andy Wingo2014-11-014-45/+70
* Merge branch 'stable-2.0'...Conflicts: benchmark-suite/benchmarks/ports.bm libguile/async.h libguile/bytevectors.c libguile/foreign.c libguile/gsubr.c libguile/srfi-1.c libguile/vm-engine.h libguile/vm-i-scheme.c module/Makefile.am module/language/tree-il/analyze.scm module/language/tree-il/peval.scm module/scripts/compile.scm module/scripts/disassemble.scm test-suite/tests/asm-to-bytecode.test test-suite/tests/peval.test test-suite/tests/rdelim.test Mark H Weaver2014-09-301-3/+1
|\
| * web: Keep the default size for the client's in-kernel receive buffer....Fixes <http://bugs.gnu.org/15368>. * module/web/client.scm (open-socket-for-uri): Remove call to 'setsockopt'. Contrary to what the comment said, its effect was to shrink the receive buffer from 124 KiB (the default size, per /proc/sys/net/core/rmem_default on Linux-based systems) to 12 KiB. Ludovic Courtès2014-05-231-3/+1
* | Merge commit 'a5cbbaa66a2491453db0edff9b0cb592a98f61bf'Andy Wingo2014-02-071-4/+4
|\|
| * Write out HTTP Basic auth headers correctly....Fixes <http://bugs.gnu.org/14370>. Reported by Atom X Zane <atomx@deadlyhead.com>. * module/web/http.scm (write-credentials): Handle the Basic auth scheme correctly. * test-suite/tests/web-http.test (pass-if-round-trip): Use 'pass-if-equal' for better error reporting. ("request headers"): Add tests. * THANKS: Add "Atom X Zane" to bug fix section. Mark H Weaver2014-01-211-4/+4
| * Add support for content-disposition...* module/web/http.scm ("Content-Disposition"): Add a parser and serializer. Defined in RFC2616 section 19.5.1. * test-suite/tests/web-http.test ("entity headers"): New test case. Andy Wingo2014-01-201-1/+25
* | Merge branch 'stable-2.0'...Conflicts: libguile/read.c test-suite/tests/web-response.test Mark H Weaver2014-01-211-11/+16
|\|
| * web: Don't throw if a response is longer than its Content-Length says....* module/web/response.scm (make-delimited-input-port): Read at most LEN bytes from PORT, instead of trying to read more and returning an error if more is available. Try again when 'get-bytevector-n!' return zero. * test-suite/tests/web-response.test (example-1): Add garbage after the body itself. Ludovic Courtès2014-01-151-11/+16
* | Add support for content-disposition...* module/web/http.scm ("Content-Disposition"): Add a parser and serializer. Defined in RFC2616 section 19.5.1. * test-suite/tests/web-http.test ("entity headers"): New test case. Andy Wingo2014-01-181-1/+25
* | Merge commit '8571dbde639e0ee9885bad49c9e180474bd23646'...Conflicts: libguile/procprop.c Andy Wingo2013-11-281-0/+2
|\|
| * Web: accept "UTC" as the zone offset in date headers....Fixes <http://bugs.gnu.org/14128>. Reported by Aleix Conchillo Flaqué <aconchillo@gmail.com>. * module/web/http.scm (parse-zone-offset): Accept "UTC". Mark H Weaver2013-11-191-0/+2
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: module/srfi/srfi-9.scm module/web/server.scm Mark H Weaver2013-09-132-21/+21
|\|
| * Web: Use functional setters in extend-request and extend-response....* module/web/client.scm (extend-request): * module/web/server.scm (extend-response): Reimplement using functional setters. Mark H Weaver2013-09-122-14/+9
| * Web client+server: Add Content-Length header for empty bodies....* module/web/client.scm (sanitize-request): Add a Content-Length header if a body if given, even if the body is empty. * module/web/server.scm (sanitize-response): Add a Content-Length header if a body if given, even if the body is empty. Mark H Weaver2013-09-122-2/+4
| * web client: HTTP methods are symbols, not strings....* module/web/client.scm (request, http-get, http-head, http-post, http-put, http-delete, http-trace, http-options): HTTP methods are symbols. Mark H Weaver2013-09-101-9/+9
| * Fix extend-request to preserve method and meta....* module/web/client.scm (extend-request): Preserve method and meta. Alexandru Cojocaru2013-09-101-2/+5
* | Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-08-231-6/+3
|\|
| * `write-request-line' always prints a path component....* module/web/http.scm (write-request-line): Always write "/" when path is empty, regardless of query. * test-suite/tests/web-http.test ("write-request-line"): Add test. Ian Price2013-08-191-6/+3
* | Merge remote-tracking branch 'origin/stable-2.0'Mark H Weaver2013-07-182-3/+36
|\|
| * Add support for HTTP proxies....* module/web/http.scm (http-proxy-port?, set-http-proxy-port?!): New exported procedures. (write-request-line): If we're using an http proxy, write an absolute-URI in the request line. * module/web/client.scm: Import (web http). (current-http-proxy): New exported parameter. (open-socket-for-uri): If 'current-http-proxy' is not false, connect to the proxy instead of the URI host, and use 'set-http-proxy-port?!' to make note of that fact. * doc/ref/web.texi (Web Client): Document 'current-http-proxy'. Mark H Weaver2013-07-162-3/+36
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: libguile/keywords.c libguile/vm.c Mark H Weaver2013-07-161-5/+6
|\|
| * web: uri-encode hexadecimal percent-encoding is now uppercase...* module/web/uri.scm (uri-encode): the hexadecimal percent-encoding %HH is now uppercased as suggested by RFC3986: "For consistency, URI producers and normalizers should use uppercase hexadecimal digits for all percent-encodings." * test-suite/tests/web-uri.test ("encode"): update tests. Aleix Conchillo Flaque2013-05-021-5/+6
* | Merge remote-tracking branch 'origin/stable-2.0'...Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test Mark H Weaver2013-03-284-52/+108
|\|
| * web http: parse numeric time zones in headers...* module/web/http.scm (parse-zone-offset, normalize-date): New procedures. (parse-rfc-822-date, parse-rfc-850-date, parse-date): Update. * test-suite/tests/web-http.test ("general headers"): Add test. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Daniel Hartwig2013-03-271-15/+46
| * http: support IP-literal (IPv6 address) in Host header...* module/web/http.scm ("Host"): Parse and write IP-literals treating escapes as uri module does: remove brackets on parse, replace them on write. * test-suite/tests/web-http.test ("request headers"): Add tests. Daniel Hartwig2013-03-161-6/+20
| * minor tweaks to web documentation...* doc/ref/web.texi: Say `World Wide Web'; the hyphenated form is almost never used (c.f. w3.org). General predicate arguments are named `obj'. Fill in arguments omitted from some procedure definitions (e.g. `request-method'). Minor tweaks, such as using en-dash and missing markup as appropriate. Wrap very long deffn lines. * module/web/*.scm: Expand texinfo markup in doc strings. Synchronize with changes in web.texi. Daniel Hartwig2013-03-164-24/+22
| * fix response-body-port for responses without content-length...* module/web/response.scm (response-body-port): Correctly handle cases in which EOF terminates the body. Jason Earl2013-03-101-7/+20
* | merge stable-2.0...There are some bugs with command-line handling that will be sorted out with the next commit. Andy Wingo2013-01-232-6/+5
|\|
| * add read-string and read-string! to (ice-9 rdelim)...* module/ice-9/rdelim.scm (read-string!, read-string): New functions. * test-suite/tests/rdelim.test: Add tests. * doc/ref/api-io.texi: Add docs. * module/ice-9/iconv.scm: * module/rnrs/io/ports.scm: * module/web/uri.scm: Use the new functions. Andy Wingo2013-01-221-2/+2
| * Fix http-get* deprecation note...* module/web/client.scm (http-get*): Fix deprecation warning. Thanks to Daniel Hartwig for the report. Andy Wingo2013-01-211-4/+3