1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

13 commits

Author SHA1 Message Date
Andy Wingo
679eea4f0e allow URIs of the form file:///etc/hosts
* module/web/uri.scm (parse-authority): Allow empty authorities, so that
  we accept URIs of the form, file:///etc/hosts.
* test-suite/tests/web-uri.test ("string->uri"): Add tests.
2011-12-06 11:47:41 +01:00
Andy Wingo
a964aa62c2 web server more assiduous about closing ports
* module/web/uri.scm:
* module/web/server.scm (call-with-output-string*):
  (call-with-output-bytevector*): Local procs to output to strings or
  bytevectors, *and then close the port*.  We can't make this change in
  call-with-output-string because it would be incompatible.

* module/web/uri.scm (call-with-encoded-output-string, decode-string)
  (uri-decode)
* module/web/server.scm (call-with-encoded-output-string): Use the new
  helpers.
2011-02-24 11:10:49 +01:00
Andy Wingo
6854c32480 core modules use (ice-9 binary-ports) instead of (rnrs io ports)
* module/language/assembly/compile-bytecode.scm:
* module/language/elisp/lexer.scm:
* module/web/request.scm:
* module/web/response.scm:
* module/web/server.scm:
* module/web/uri.scm: Use ice-9 binary-ports.
2011-02-18 16:01:25 +01:00
Andy Wingo
91b320fe16 uri-encode fast path
* module/web/uri.scm (uri-encode): Add a fast-path for the common case
  in which the string does not contain any reserved characters.
2011-01-07 09:18:36 -08:00
Andy Wingo
7d6b8b75fc uri-decode #:encoding, not #:charset
* module/web/uri.scm (call-with-encoded-output-string, encode-string)
  (decode-string, uri-decode, uri-encode): Change all instances of
  "charset" to "encoding", as variables and arguments.
2011-01-07 09:18:36 -08:00
Andy Wingo
8745c33afb rename string->uri and uri->string.
* 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.
2011-01-07 09:18:36 -08:00
Andy Wingo
277bbe9624 document (web uri), and simplify uri-encode
* module/web/uri.scm: Add docstrings.
  (uri-encode): Simplify. Not sure what I was thinking before.
2010-12-16 14:48:34 +01:00
Andy Wingo
998191fd4f fix testing code in web/server
* module/web/server.scm (call-with-encoded-output-string): Fix some code
  I accidentally left in while testing. Re-tested the difference in
  speed; pleasantly surprised.

* module/web/uri.scm: Make the same change here.
2010-12-12 23:34:18 +01:00
Andy Wingo
c7857da63a (web uri) can uri-decode non-utf-8 payloads
* module/web/uri.scm (call-with-encoded-output-string, encode-string):
  Copy from server.scm
  (decode-string): Copy from tekuti.
  (uri-decode): The #:charset arg is a string, like
  port-encoding. Support other charsets.
  (uri-encode): Charset is a string. Other encodings still not nicely
  supported. Hmm.
2010-12-11 19:19:41 +01:00
Andy Wingo
4eb7c8f004 unparse-uri avoids serializing e.g. :80 in http:// uris
* module/web/uri.scm (declare-default-port!): New function, declares a
  default port for a scheme. Predeclare default ports for http and
  https.
  (unparse-uri): If the port is the default port for the given scheme,
  don't serialize the port part of the URI.
2010-11-12 17:16:35 +01:00
Andy Wingo
5a2f7fb315 URI parsing errors throw to `uri-error'
* module/web/uri.scm (uri-error): New proc, throws to 'uri-error.
  (validate-uri, uri-decode, uri-encode): Use uri-error.

* test-suite/tests/web-uri.test: Update for uri-error.
2010-11-04 22:52:47 +01:00
Andy Wingo
73124c6c63 web/uri: reimplement for rfc 3986, add tests
* module/web/uri.scm: Reimplement for RFC 3986.

* module/Makefile.am: Add to build.

* test-suite/Makefile.am:
* test-suite/tests/web-uri.test: Add tests.
2010-10-17 20:35:22 +02:00
Andy Wingo
15c9af8c71 import uri.scm from tekuti, from guile-www 2010-10-17 20:35:22 +02:00