diff --git a/.gitmodules b/.gitmodules
index 8ddd1d5bf..8458041b2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -10,3 +10,6 @@
[submodule "packages/zlib"]
path = packages/zlib
url = git://yap.git.sourceforge.net/gitroot/yap/zlib
+[submodule "packages/http"]
+ path = packages/http
+ url = ssh://vsc@yap.git.sourceforge.net/gitroot/yap/http
diff --git a/packages/http b/packages/http
new file mode 160000
index 000000000..77744ad3a
--- /dev/null
+++ b/packages/http
@@ -0,0 +1 @@
+Subproject commit 77744ad3a901eb97cafd95c1e0ac1b89d3859b18
diff --git a/packages/http/ChangeLog b/packages/http/ChangeLog
deleted file mode 100644
index 14a930215..000000000
--- a/packages/http/ChangeLog
+++ /dev/null
@@ -1,792 +0,0 @@
-[Sep 13 2009]
-
- * ADDED: Process HTTP DELETE, OPTIONS and TRACE methods. Torbjörn Lager.
-
-[Aug 27 2009]
-
- * FIXED: JSON Mimetype handling. Matt Lilley.
-
-[Aug 25 2009]
-
- * ENHANCED: Made the detection of JSON more flexible.
-
- * ENHANCED: JSON indentation handling. Matt Lilley.
-
-[Aug 21 2009]
-
- * ENHANCED: Bug#414: Get rid of pool/4 in HTTP request structures.
- Lourens van der Meij.
-
-[Aug 18 2009]
-
- * CLEANUP: Bug#413: Complete 'make distclean'. Feliks Kluzniak
-
-[Aug 16 2009]
-
- * DOC: Provide documentation of http_dispatch.pl through PlDoc
-
- * ADDED: http_redirect/3 to simplify writing redirect handlers and enhance the reflexive capabilities of the HTTP server.
-
-[Aug 14 2009]
-
- * ADDED: Allow grouping of HTTP parameters
-
- * ADDED: Support disjunctive types in HTTP parameter handling
-
- * CLEANUP: Use meta_predicate for json_convert.pl
-
-[Aug 13 2009]
-
- * ADDED: type nonneg to http_parameters/3.
-
- * ADDED: PlDoc wiki to handle references as module:name/arity.
-
- * ADDED: Allow hooking http_parameters type checking and conversion.
-
- * ADDED: &(Int) is written as Int; in html_write. Clarified the documentation.
-
- * ADDED: Types list(Type), boolean and atom to http_parameters/3.
-
-[Aug 12 2009]
-
- * ENHANCED: Better handing of \[...] in cross-referencer
-
-[Aug 10 2009]
-
- * FIXED: Properly deal with external resources
-
- * FIXED: Module-handling of body//1 and head//1 hooks in html_write.pl
-
- * FIXED: Actually handle timout of the threaded HTTP deamon. The connection is now dropped after 60 seconds inactivity of the client.
-
- * FIXED: HTTP server DoS if the clients sends an empty Cookie header.
-
-[Jul 21 2009]
-
- * MODIFIED: Make initialization/1 ISO compliant
- This patch is a modest cleanup to the implementation of '$load_file'/3
- from init.pl and provides an ISO compatible implementation of
- initialization/1. This executes the argument goal *after* loading the
- file rather than when encountering the directive. Often this makes no
- difference, but notably load_foreign_library/1 is an exception.
- Therefore we added use_foreign_library/1,2 that act as a directive and
- provides proper integration with saved-states automatically. Loading
- code using initialization(load_foreign_library(...)) will load the
- library immediately and issue a warning.
-
- See initialization/1,2 for details and further hints for dealing with
- possible compatibility problems.
-[Jul 1 2009]
-
- * ADDED: Allow \-escape inside html(\List).
-
- * ADDED: Return the fact that a handler is a prefix handler in http_current_handler/3.
-
- * ADDED: Allow for http_handler(root(find/concept), ...). I.e., allow for component/component without quotes,
-
-[Jun 29 2009]
-
- * FIXED: http_currect_session(-, ?) did not generate (all) sessions.
-
- * ADDED: http_close_session/1
-
-[Jun 23 2009]
-
- * MODIFIED: Added option unsafe(Bool) to http_reply_file/3. This option is by default false, which causes this predicate to refuse serving files with an absolute path, a path outside the working directory or, if an alias(Path) is used, outside the root of the alias.
- If you want to serve such files, you must provide unsafe(true) explicitely.
-
- * ADDED: Reply with 400 Bad Request on illegal HTTP requests
-
-[Mar 19 2009]
-
- * CLEANUP: Removed all trailing whitespace from all source-files. This avoids many GIT (merge) warnings.
-[Mar 12 2009]
-
- * FIXED: Avoid race condition in session management. Jacco van Ossenbruggen.
-
- * MODIFIED: Renamed concat_atom/2,3 into atomic_list_concat/2,3 for compatibility. Moved the old predicates into library(backcomp). It is adviced to update your code, but 99% of the code will remain working because the old definitions are autoloaded.
-
-[Feb 27 2009]
-
- * FIXED: http_current_server/2 was broken with meta_predicate introduction.
-
-[Feb 25 2009]
-
- * ENHANCED: Use a cache for http_in_session/1 to avoid repetitive access to the CGI stream object.
-
- * FIXED: make http_current_request/1 semidet again. Added is_cgi_stream/1 for testing whether we are in a CGI context without raising an error.
-
-[Feb 23 2009]
-
- * ENHANCED: Allow the start broadcast-message of the HTTP server to throw an exception. This allows for defining additional policy-handlers as broadcast plugins.
-
-[Feb 20 2009]
-
- * ADDED: Use nlink property of stream to close the logfile
-
-[Feb 15 2009]
-
- * FIXED: Proper reply on partial content (use 206 reply; fix length computation)
-
-[Feb 3 2009]
-
- * ADDED: HTTP server support for byte-ranges of files.
-
- * ADDED: Parsing of HTTP Range field into a structured term
-
-[Jan 30 2009]
-
- * ENHANCED: HTTP error handler in formulating replies from a file.
-
-[Jan 29 2009]
-
- * CLEANUP: be careful, but to not crash on unexpected event on CGI streams.
-
-[Jan 28 2009]
-
- * ADDED: When matching a prefix-path in http_dispatch, makethe remainder
- of the path available through path_info(PathInfo) in the request.
-
-[Jan 22 2009]
-
- * ADDED: http_in_session/1 to find the current session but do not raise an
- exception if it doesn't exist.
-
- * ADDED: http_current_handler/3 to get access to accumulated options on a path
-
-[Jan 20 2009]
-
- * FIXED: ?- edit(HTTPLocation). Module-handling issue in locate/3 in http_dispatch.pl
-
- * CLEANUP: http_wrapper.pl: PlDoc and meta-predicate handler
-
- * FIXED: http_open/3: avoid leaking a socket-handle if the tcp_connect
- raises an exception.
-
-[Jan 9 2009]
-
- * ADDED: library(http/html_head), tracking CSS and Javascript dependencies and
- merging them automatically into the HTML
element. Imported from
- Cliopatria project.
-[Dec 20 2008]
-
- * ADDED: http_log_close/1 to provide for cooperation with logrotate
-
-[Dec 18 2008]
-
- * MSFIX: Accept invalid cookie options sent by Microsoft (httponly). Matt Lilley.
-[Nov 26 2008]
-
- * FIXED: Update HTTP header definition for a token to RFC 2616. Matt Lilley
-[Oct 9 2008]
-
- * ADDED: More flexible support for HTTP 503 (service unavailable) replies.
-
-[Oct 8 2008]
-
- * FIXED: drop body of HTTP 304 response
-
-[Oct 7 2008]
-
- * MODIFIED: Generalized the HTTP dispatch module authentication interface.
- * Instead of returning an atom representing the authenticated
- user, the hook must deliver a list of options that is added to
- the request. The new API allows for multiple authentication
- hooks on the same location. It is used by PlDoc to provide host
- access control. See doc_access.pl from the PlDoc package.
-
-[Oct 6 2008]
-
- * FIXED: Updated http_error to deal with new HTTP server
-
-[Oct 5 2008]
-
- * ADDED: Support http_path.pl specifications in http_handler/3.
-
- * MODIFIED: library(http/http_dispatch): Handler changes.
- :- http_handler(prefix(Path), Action, Options) is now
- translated into http_handler(Path, Action, [prefix|Options]) with a
- warning. Future versions will drop the prefix(Path) syntax as it
- becomes ambiguous after integrating http_path.pl with the handler
- declarations.
-
- * ADDED: html_write.pl: Support href(loc+[name1(value1),name2(value2)])
-
-[Oct 3 2008]
-
- * ADDED: Support encode(Value) and describe http location handling.
-
- * ADDED: http_location_by_id/2 and location_by_id(ID) to html_write values.
- Suggested by Jacco van Ossenbruggen.
-
-[Oct 2 2008]
-
- * ADDED: Allow redefining the HTTP server address output of non-200 pages.
-
- * ADDED: Provide hostname in http error messages
-
- * FIXED: File descriptor leak in http session management.
-
-[Oct 1 2008]
-
- * FIXED: undefined parse_url_ex/3 in http_open.pl (deals with redirections)
-
-[Sep 30 2008]
-
- * ADDED: Support for proxy routes in HTTP session management. Also cleanup
- and additional tests in library(http/http_session).
-
-[Sep 11 2008]
-
- * PORT: Add AC_PREREQ to configure.h for systems that auto-select autoconf
- versions. After tip by Ulrich Neumerkel.
-
-[Aug 30 2008]
-
- * FIXED: use csym instead of csymf for valid HTTP fieldname characters. Edward Blake.
-
-[Aug 11 2008]
-
- * INSTALL: Remove all configure files from the git repository
-[Aug 5 2008]
-
- * MODIFIED: http_read_request/3 throws error on illegal request and http_wrapper/5
- maps these to internal server errors.
-
- * MODIFIED: http_open/3 now raises an error if the URL is not well-formed
- (used to fail silently).
-
-[Jul 31 2008]
-
- * FIXED: handling setting http:chunked_transfer(never). Yves Raimond.
-[Jul 3 2008]
-
- * MODIFIED: Deleted the `after' option processing. Modern code can start a
- thread to deal with formulating a reply and start procesing after the reply
- has been sent.
-
-[Jul 2 2008]
-
- * ADDED: Support for HTTP 503 (service unavailable)
-
- * ADDED: Support for options chunked and spawn in http_handler/3.
-
-[Jun 27 2008]
-
- * FIXED: Read JSON reply when using chunked encoding
-
- * FIXED: Post header when using data in CGI format (used by JSON posts)
-
-[Jun 25 2008]
-
- * MODIFIED: http_get/3 using to(atom) or to(codes) perform UTF-8 decoding if
- the content type is declared as UTF-8.
-
-[Jul 2 2008]
-
- * ADDED: Bug#365: timeout support for the HTTP client library. Keri Harris.
-[Jun 16 2008]
-
- * ENHANCED: Reduce HTTP header parsing time
-
- * ENHANCED: Reduce overhead of deleting dead HTTP sessions
-
-[May 21 2008]
-
- * FIXED: atom_json_term(-,+,+): typo. Torbjörn Lager
-
-[Apr 28 2008]
-
- * ENHANCED: Perform a GC at the end of a communication with a client. Note that
- at that moment we have little active memory (=cheap GC), while otherwise we may
- remain idle for a long time with large stacks.
-[Apr 2 2008]
-
- * FIXED: Throw an exception in illegal input wo json_write/3.
-
-[Apr 1 2008]
-
- * FIXED: Close the server socket in http_stop_server/2. John Stewart.
-
-[Mar 28 2008]
-
- * MODIFIED: html//1 interpretation of Module:Term. Previously this acted as
- \(Module:Term), now it acts as Module:html(Term), interpreting an entire
- specification relative to a module.
-
-[Mar 20 2008]
-
- * FIXED: Make HTTP status messages work when using the xhtml dialect
-
-[Mar 10 2008]
-
- * FIXED: HTTP accept loop to deal properly with termination
-
-[Mar 9 2008]
-
- * FIXED: Various issues around JSON booleans and null. Michiel Hildebrand.
-
-[Feb 26 2008]
-
- * FIXED: Avoid error on destroyed message queue in http_stop_server/3.
- Ferreira Maurizio.
-[Feb 8 2008]
-
- * ADDED: Hook to expand HTML head material.
-
-[Feb 7 2008]
-
- * ADDED: html_receive//2 to allow for post-processing of posted messages
-
- * MODIFIED: http_post//2 now executes embedded commands delayed.
-
-[Feb 1 2008]
-
- * FIXED: html_write.pl: avoid multiple receivers for xmlns.
-
-[Jan 23 2008]
-
- * PORT: Bug#346: Allow overriding COFLAGS and CWFLAGS in package
- configuration. Keri Harris.
-
-[Jan 22 2008]
-
- * DOC: Applied various patches. Item#272, Ulrich Neumerkel.
-
-[Dec 22 2007]
-
- * FIXED: Write JSON newlines always as \n. Also write all control characters
- that have no defined escape (< ' ') as \uXXXX. Michiel Hildebrand.
-
- * FIXED: json_read/2 for strings holding double-quotes.
-
-[Dec 18 2007]
-
- * WORKAROUND: Emit no DOCTYPE header of the doctype is set to ''. This avoids
- a bug in Microsoft IE AJAX processing.
-
-[Dec 16 2007]
-
- * FIXED: recursive handling of lists in prolog_to_json/2. Michiel Hildebrand
-
-[Dec 15 2007]
-
- * FIXED: is_json_term/2 for pairs. Michiel Hildebrand.
-
-[Dec 13 2007]
-
- * ADDED: A predefined `head' receiver for http_post//2 and a predefined `xmlns'
- receiver used by xhtml_ns//2 to define XML namespaces in xhml mode. Clarified
- documentation of the html_write library with examples on how to deal with HTML
- head material.
-
-[Dec 11 2007]
-
- * DOC: various enhancement to the presentation of pldoc @keywords
-
-[Dec 7 2007]
-
- * MODIFIED: renamed library(http/http_chunked) to library(http/http_stream).
- Added range-limited streams
-
-[Dec 5 2007]
-
- * ADDED: library(http/http_json.pl), integrating JSON support into the
- HTTP libraries.
-
-[Dec 4 2007]
-
- * ADDED: library(http/json), providing (still incomplete) JSON support
-
-[Nov 16 2007]
-
- * ENHANCED: Bug#323: no longer force bgcolor=white in pagebody//1. Chris Sutton.
-
-[Nov 9 2007]
-
- * ADDED: type between(Low, High) for numerical values
-
-[Nov 6 2007]
-
- * ADDED: post/receive mechanism to modularize CSS and Javascript support in
- library(html_write). Documented using PlDoc LaTeX backend
-
-Oct 1, 2007
-
- * ADDED: http_stop_server/2 to stop a running HTTP server.
-
-Sep 26, 2007
-
- * ADDED: http_set_authorization/2 in library(http/http_open) to provide
- authorization defauls.
-
- * ADDED: authorization(basic(User, Passowrd)) to the options of http_open/3.
- Now generates a permission error for common applicable 4xx errors.
-
-Jun 21, 2007
-
- * Avoid leaking stream handle in http_get/3 on chunked encoding.
-
-Jun 20, 2007
-
- * ENHANCED: Support chunked encoding in http_get/3 and http_post/4 on the
- new http_chunked library, reducing memory usage and overhead.
-
-Jun 19, 2007
-
- * ADDED: Support chunked encoding through library(http/http_open) based on
- new http_chunked library.
-
-Jun 16, 2007
-
- * ADDED: library(http/http_chunked).
-
-Jun 7, 2007
-
- * ADDED: http_dispatch and http_authenticate libraries.
-
-Jun 1, 2007
-
- * FIXED: Use new predicate_indicator frame attribute for safe error
- handling.
-
-May 23, 2007
-
- * FIXED: Preserve extra request-headers over redirect. Yves Raimond.
-
-May 20, 2007
-
- * FIXED: redirection issues. Yves Raimond.
-
-Apr 12, 2007
-
- * ADDED: .svg to mimetypes
-
-Apr 10, 2007
-
- * FIXED: Forcing UTF-8 character set.
-
-Mar 22, 2007
-
- * FIXED: Bug#269: time-stamp was emitted in current locale.
-
-Mar 19, 2007
-
- * ADDED: Include name of parameter in type-errors detected by
- http_parameters/2.
-
-Mar 15, 2007
-
- * ADDED: Include peer in session management for better security.
- * ADDED: Broadcast session start/end to allow deletion of derived
- data.
-
-Mar 11, 2007
-
- * FIXED: http_open/3: send Host: : if port is not 80.
-
-Mar 9, 2007
-
- * ADDED: reply_html_page/2. To be documented
-
- * ADDED: Pass protocol(http/https) into request.
-
-Mar 7, 2007
-
- * FIXED: handle throw(http_reply(moved_temporary(URL))) properly.
-
-Mar 6, 2007
-
- * ADDED: final_url option to http_open/3
-
-Mar 5, 2007
-
- * MODIFIED: debug(header, ...) --> debug(http(header), ...)
-
- * ADDED: codes([Type], Codes) to http_post_data.
-
-Feb 26, 2007
-
- * ADDED: Keep connections open on not_modified and replying files.
-
-Feb 9, 2007
-
- * ADDED: Support for 302 (moved temporary) HTTP replies to the server.
-
-Feb 8, 2007
-
- * ADDED: Map existence_error(http_location, URL) and
- permission_error(http_location, access, URL) to appropriate HTTP
- headers.
-
-Feb 2, 2007
-
- * ADDED: Report status of stopped worker.
-
-Jan 24, 2007
-
- * ADDED: Support for 303 (see other) HTTP replies to the server.
- Yves Raimond.
-
-Jan 18, 2007
-
- * ADDED: html_set_options/1 and html_current_option/1 to html_write.pl.
- Allows for changing the document type as well as writing XHTML output
- from the same DCG rules.
-
-Jan 15, 2007
-
- * ADDED: Redirect support for 301 and 303. Yves Raimond.
-
-Dec 13, 2006
-
- * FIXED: avoid passing reply_header option to convert hooks (conflict
- with SGML plugin).
-
-Dec 12, 2006
-
- * FIXED: Properly close sockets on errors in http_open/3.
-
-Dec 8, 2006
-
- * ADDED: support for HEAD to http_open/3.
-
-Oct 31, 2006
-
- * ENHANCED: Documentation
-
-Oct 30, 2006
-
- * ADDED: Allow for A+B in attribute values.
-
-Sep 18, 2006
-
- * FIXED: inetd_httpd: set stream encoding to octet to be able to handle
- binary data. Nicos Angelopoulos.
-
-Aug 21, 2006
-
- * FIXED: Quote & inside attribute values.
-
-Aug 10, 2006
-
- * ENHANCED: Time printing in http_header.pl to use format_time/3. Faster
- and proper implementation of daylight saving time.
-
-Aug 8, 2006
-
- * FIXED: http_relative_path/2.
-
-Aug 7, 2006
-
- * DEBUG: Do not generate debug info for library html_write.pl, as it makes
- code using the library very hard to debug.
-
-Jun 30, 2006
-
- * FIXED: dangling choicepoint in http_open/3.
-
- * ADDED: zero_or_more as parameter option to http_parameters/[2,3]
-
-Apr 11, 2006
-
- * ADDED: http_parameters library
-
- * FIXED: properly handle the server closing the connection if the connection
- is specified as Keep-alive in the client (http_get/3 and http_post/4).
-
-Feb 24, 2006
-
- * Added http_error.pl to generate nice looking stack-traces.
-
-Feb 23, 2006
-
- * Added http_session.pl and http:request_expansion/2 hook.
-
-Feb 16, 2006
-
- * Added http_current_request/1 to get access to the currently executing
- request.
-
-Feb 10, 2006
-
- * Make http_post deal with Unicode data.
-
-Jan 20, 2006
-
- * Map Host: : into host(Host), port(Port) when reading
- HTTP requests.
-
-Jan 16, 2006
-
- * Fixed redirect handling if the option to(Stream) is given.
- Jacco van Ossenbruggen.
-
-Jan 11, 2006
-
- * Added: handling of 302 redirect messages in http_get/3.
- * Fix http_get/3 with sgml plugin and proxy option. Usenet, `mans'.
-
-Dec 10, 2005
-
- * Enhanced robustness of the server to malicious clients by using
- call_cleanup wrappers around the code doing the actual reply. Old
- code lead to memory and file-descriptor leaking.
-
-Dec 7, 2005
-
- * Added http_timestamp/2 to http_header.pl. Also changed the time
- representation to be compatible to the current RFC1132 standard.
-
-Nov 16, 2005
-
- * Avoid XPCE http servers to be garbage collected.
-
-Oct 17, 2005
-
- * ADDED: Pass peer from threaded HTTP server to request.
-
- * ENHANCED: Use UTF-8 encoding for text by default.
-
-Sep 28, 2005
-
- * FIXED: Regular expressions in xpce_httpd frontend. Wouter Jansweijer.
-
-Sep 23, 2005
-
- * ADDED: .class to mimetypes.pl.
-
-Sep 7, 2005
-
- * FIXED: handle connection error in http_get/3 gracefully.
-
-Sep 6, 2005
-
- * FIXED: handle error in tcp_accept/3 gracefully.
-
-Sep 5, 2005
-
- * ADDED: method(head) --> "HEAD". Matt Lilley.
-
-Apr 26, 2005
-
- * ADDED: debug(sgml_plugin) and some missing use_module calls. Simplifies
- debugging automatic conversion.
-
-Mar 4, 2005
-
- * FIXED: Bug#24: open files binary. Fabien Todescato.
-
-Feb 11, 2005
-
- * FIXED: empy header field eats next line as value. Chris Ritchey.
-
-Jan 4, 2005
-
- * FIXED: Bug#2: Disconnect from POST replies.
-
-Sep 23, 2004
-
- * FIXED: Ignore minor types when deciding which plugin to use for the
- SGML plugin.
-
-Aug 30, 2004
-
- * FIXED: Bug#179: Avoid XPCE dependency on strip_module/3. Sandro Hawke.
-
-Aug 16, 2004
-
- * FIXED: Remove " from boundary=... HTTP-POST requests. Appears necessary
- for posting to Tomcat servers. Also added explicit MIME-Version: 1.0
- to the header.
-
-Aug 12, 2004
-
- * ADDED: form_data(+List) alternative to http_post/4.
-
- * ADDED: option reply_header(-Header) to get the full replied header for
- GET and POST methods. Also added decoding of the SetCookie field.
-
-Aug 5, 2004
-
- * ADDED: request_header(Name=Value) to http_open/3
-
-Aug 3, 2004
-
- * ADDED: keep_alive_timeout(Seconds) for multi-threaded server.
-
- * FIXED: remove choicepoints in http_open/3
-
-Jul 31, 2004
-
- * ADDED: http_current_worker/2
-
-Jul 30, 2004
-
- * ADDED: Allow explicit head and body in page//1 and page//2
-
-Jul 21, 2004
-
- * FIXED: Bug#166: Allow alternative responses (Sandro Hawke).
-
- * FIXED: Bug#168: Close connection on timeout (Sandro Hawke).
-
- * FIXED: Bug#165: Added reuseaddr (Sandro Hawke).
-
-Jul 18, 2004
-
- * ENHANCED: handle `normal' errors silent (David Reitter)
-
-Jun 28, 2004
-
- * ENHANCED: print server errors and continue
-
- * ADDED: SSL interface to threaded HTTP server
-
-Jun 21, 2004
-
- * FIXED: Handling continue header required for POST to MS IIS servers.
- Also more patches sending \r\n where required. With patches from
- Mike Elston.
-
-Jun 16, 2004
-
- * FIXED: make HTTP client library write header line terminate with
- \r\n. Mike Elston.
-
-Jun 15, 2004
-
- * FIXED: Undefined predicate strip_module/2 in thread_httpd.pl when
- there is no access to XPCE. Dmitry.
-
- * ADDED: request_header(Name=Value) option to the option list of
- http_get/3 and http_post/4 for adding user request fields.
-
- * ADDED: Map body throw(status(not_modified)) onto a "304 Not Modified"
- page. Mike Elston.
-
-May 20, 2003
-
- * DOCS: Documented http_post_data/3
-
- * ADDED: form([Name=Value, ...]) input type to http_post_data/3
-
-May 12, 2003
-
- * FIXED: problem in mime_pack/3 using Name=Value
-
-Mar 4, 2003
-
- * ADDED: http_open/3: header(+Name, -Value) option. Wouter
- Jansweijer.
-
-Jan 23, 2003
-
- * ADDED: Provide User-Agent header for the client libraries
-
-Jan 8, 2003
-
- * ADDED: Support for using proxy servers Option: proxy(Host, Port).
-
- * ADDED: Support for 302 (document moved) reply in http_open/3.
-
diff --git a/packages/http/Makefile.in b/packages/http/Makefile.in
deleted file mode 100755
index dff4493c9..000000000
--- a/packages/http/Makefile.in
+++ /dev/null
@@ -1,224 +0,0 @@
-################################################################
-# SWI-Prolog `HTTP' package
-# Author: Jan Wielemaker. J.Wielemaker@cs.vu.nl
-# Copyright: GPL (see COPYING or www.gnu.org
-################################################################
-
-.SUFFIXES: .txt .tex .dvi .doc .pl
-
-ifeq (@PROLOG_SYSTEM@,yap)
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-ROOTDIR = $(prefix)
-EROOTDIR = @exec_prefix@
-abs_top_builddir = @abs_top_builddir@
-
-srcdir=@srcdir@
-
-BINDIR = $(EROOTDIR)/bin
-LIBDIR=@libdir@
-YAPLIBDIR=@libdir@/Yap
-SHAREDIR=$(ROOTDIR)/share/Yap
-
-SHELL=@SHELL@
-PL=@INSTALL_ENV@ $(DESTDIR)$(BINDIR)/yap $(DESTDIR)$(YAPLIBDIR)/startup.yss
-EXDIR=$(YAPLIBDIR)/examples/http
-LN_S=@LN_S@
-#
-#
-DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1
-CC=@CC@
-CFLAGS= @SHLIB_CFLAGS@ $(YAP_EXTRAS) $(DEFS) -I$(srcdir) -I../.. -I$(srcdir)/../../include @CPPFLAGS@
-MKINDEX=true
-
-
-SO=@SO@
-#4.1VPATH=@srcdir@:@srcdir@/OPTYap
-CWD=$(PWD)
-#
-
-LD=@DO_SECOND_LD@ @SHLIB_LD@
-LDFLAGS=@EXTRA_LIBS_FOR_SWIDLLS@ @LDFLAGS@
-
-BINTARGET=$(DESTDIR)$(YAPLIBDIR)
-PLTARGET=$(DESTDIR)$(SHAREDIR)/http
-
-FINAL_BINTARGET=$(YAPLIBDIR)
-FINAL_PLTARGET=$(SHAREDIR)
-
-%.o: $(srcdir)/%.c
- $(CC) -c $(CFLAGS) $< -o $@
-
-else # SWI
-
-SHELL=@SHELL@
-PLBASE=@PLBASE@
-PLARCH=@PLARCH@
-PL=@PL@
-XPCEBASE=$(PLBASE)/xpce
-PKGDOC=$(PLBASE)/doc/packages
-PCEHOME=../xpce
-LIBDIR=$(PLBASE)/library/http
-EXDIR=$(PKGDOC)/examples/http
-
-CC=@CC@
-COFLAGS=@COFLAGS@
-CWFLAGS=@CWFLAGS@
-CMFLAGS=@CMFLAGS@
-CIFLAGS=
-CFLAGS=$(COFLAGS) $(CWFLAGS) $(CMFLAGS) $(CIFLAGS) @DEFS@
-LIBS=@LIBS@
-LD=@LD@
-LDFLAGS=@LDSOFLAGS@
-
-PUBLICPL=swipl
-DOCTOTEX=$(PCEHOME)/bin/doc2tex
-PLTOTEX=$(PUBLICPL) -q -s pltotex.pl -g pltotex --
-RUNTEX=../../man/runtex
-LATEX=latex
-DOC=http
-TEX=$(DOC).tex
-DVI=$(DOC).dvi
-PDF=$(DOC).pdf
-HTML=$(DOC).html
-
-endif
-
-INSTALL=@INSTALL@
-INSTALL_PROGRAM=@INSTALL_PROGRAM@
-INSTALL_DATA=@INSTALL_DATA@
-
-include $(srcdir)/common.mk
-
-STREAMOBJ= http_stream.o
-JSONOBJ= json.o
-SOLIBS= http_stream.@SO@ json.@SO@
-
-all: $(SOLIBS)
-
-
-http_stream.@SO@: $(STREAMOBJ)
- $(LD) $(LDFLAGS) -o $@ $(STREAMOBJ) $(LIBS)
-json.@SO@: $(JSONOBJ)
- $(LD) $(LDFLAGS) -o $@ $(JSONOBJ) $(LIBS)
-
-http_stream.o: $(srcdir)/http_error.c $(srcdir)/http_chunked.c $(srcdir)/cgi_stream.c $(srcdir)/stream_range.c
-
-install: $(LIBPL) $(SOLIBS)
- mkdir -p $(BINTARGET)
- rm -f $(BINTARGET)/http_chunked.@SO@
- $(INSTALL_PROGRAM) $(SOLIBS) $(BINTARGET)
- mkdir -p $(PLTARGET)
- mkdir -p $(PLTARGET)/web/icons
- mkdir -p $(DESTDIR)$(LIBDIR)/web/css
- $(INSTALL_DATA) $(LIBPL) $(PLTARGET)
- $(INSTALL_DATA) $(srcdir)/README $(PLTARGET)
- $(INSTALL_DATA) $(srcdir)/web/icons/*.png $(PLTARGET)/web/icons
- $(INSTALL_DATA) $(srcdir)/web/css/*.css $(DESTDIR)$(LIBDIR)/web/css
- $(PL) -f none -g make -t halt
-
-ln-install: $(LIBPL)
- $(MAKE) INSTALL_DATA="../ln-install" INSTALL_PROGRAM="../ln-install" install
-
-rpm-install: install
-
-pdf-install: install-examples
- $(INSTALL_DATA) $(DOC).pdf $(DESTDIR)$(PKGDOC)
-
-html-install: install-examples
- $(INSTALL_DATA) $(DOC).html httpserver.gif $(DESTDIR)$(PKGDOC)
-
-install-examples::
- mkdir -p $(DESTDIR)$(EXDIR)
- mkdir -p $(DESTDIR)$(EXDIR)/pwp
- (cd examples && $(INSTALL_DATA) $(EXAMPLES) $(DESTDIR)$(EXDIR))
- (cd examples/pwp && $(INSTALL_DATA) *.pwp *.pl $(DESTDIR)$(EXDIR)/pwp)
- (cd examples && $(INSTALL_PROGRAM) $(EXAMPLEEXE) $(DESTDIR)$(EXDIR))
-
-uninstall::
- (cd $(LIBDIR) && rm -f $(LIBPL))
- $(PL) -f none -g make -t halt
-
-check::
- $(PL) -q -f $(srcdir)/test_http.pl -g test_http,halt -t 'halt(1)'
- $(PL) -q -f $(srcdir)/test_json.pl -g test_json,halt -t 'halt(1)'
- $(PL) -q -f $(srcdir)/test_cgi_stream.pl -g true -t test_cgi_stream
-
-################################################################
-# Documentation
-################################################################
-
-doc: $(PDF) $(HTML)
-pdf: $(PDF)
-html: $(HTML)
-
-SUBTEX= post.tex json.tex httplog.tex httppath.tex htmlhead.tex \
- httpsession.tex httpdispatch.tex httpdirindex.tex httppwp.tex \
- httpopen.tex httphost.tex httpopenid.tex jswrite.tex
-
-$(HTML): $(TEX) $(SUBTEX)
- latex2html $(DOC)
- mv html/index.html $@
- mv html/httpserver.gif .
- rmdir html
-
-$(PDF): $(TEX) $(SUBTEX)
- $(RUNTEX) --pdf $(DOC)
-
-$(TEX): $(DOCTOTEX)
-
-json.tex: json.pl json_convert.pl http_json.pl
-
-.txt.tex:
- $(PUBLICPL) -q -s txttotex.pl -g txttotex,halt -t 'halt(1)' -- $*.txt
-
-httplog.tex: http_log.pl
- $(PLTOTEX) --subsection 'library(http/http_log)'
-
-httphost.tex: http_host.pl
- $(PLTOTEX) --subsection 'library(http/http_host)'
-
-httppath.tex: http_path.pl
- $(PLTOTEX) --subsection 'library(http/http_path)'
-
-httpopen.tex: http_open.pl
- $(PLTOTEX) --subsection 'library(http/http_open)'
-
-htmlhead.tex: html_head.pl
- $(PLTOTEX) --subsection 'library(http/html_head)'
-
-httpsession.tex: http_session.pl
- $(PLTOTEX) --subsection 'library(http/http_session)'
-
-httpdispatch.tex: http_dispatch.pl
- $(PLTOTEX) --subsection 'library(http/http_dispatch)'
-
-httpopenid.tex: http_openid.pl
- $(PLTOTEX) --subsection 'library(http/http_openid)'
-
-httpdirindex.tex: http_dirindex.pl
- $(PLTOTEX) --subsection 'library(http/http_dirindex)'
-
-httppwp.tex: http_pwp.pl
- $(PLTOTEX) --subsection 'library(http/http_pwp)'
-
-jswrite.tex: js_write.pl
- $(PLTOTEX) --subsection 'library(http/js_write)'
-
-.doc.tex:
- $(DOCTOTEX) $*.doc > $*.tex
-
-################################################################
-# Clean
-################################################################
-
-clean:
- rm -f $(STREAMOBJ) $(JSONOBJ)
- rm -f *~ *% config.log
- rm -f $(TEX) $(SUBTEX)
- $(RUNTEX) --clean $(DOC)
- rm -rf html
-
-distclean: clean
- rm -f $(SOLIBS) config.cache config.status config.h Makefile
diff --git a/packages/http/Makefile.mak b/packages/http/Makefile.mak
deleted file mode 100644
index 7f01f632f..000000000
--- a/packages/http/Makefile.mak
+++ /dev/null
@@ -1,82 +0,0 @@
-################################################################
-# Install the SWI-Prolog HTTP package for MS-Windows
-#
-# Author: Jan Wielemaker
-#
-# Use:
-# nmake /f Makefile.mak
-# nmake /f Makefile.mak install
-################################################################
-
-PLHOME=..\..
-!include $(PLHOME)\src\rules.mk
-!include common.mk
-
-LIBDIR= $(PLBASE)\library\http
-EXDIR= $(PKGDOC)\examples\http
-
-OBJ= http_stream.obj
-
-all: http_stream.dll json.dll
-
-http_stream.dll: $(OBJ)
- $(LD) /dll /out:$@ $(LDFLAGS) $(OBJ) $(PLLIB) $(LIBS)
-json.dll: json.obj
- $(LD) /dll /out:$@ $(LDFLAGS) json.obj $(PLLIB) $(LIBS)
-
-http_stream.obj: http_error.c http_chunked.c cgi_stream.c stream_range.c
-
-all:
-
-!IF "$(CFG)" == "rt"
-install::
-!ELSE
-install::
- if not exist "$(LIBDIR)\$(NULL)" $(MKDIR) "$(LIBDIR)"
- if not exist "$(LIBDIR)\web\$(NULL)" $(MKDIR) "$(LIBDIR)\web"
- if not exist "$(LIBDIR)\web\icons\$(NULL)" $(MKDIR) "$(LIBDIR)\web\icons"
- if not exist "$(LIBDIR)\web\css\$(NULL)" $(MKDIR) "$(LIBDIR)\web\css"
- @echo Copying $(LIBPL)
- @for %f in ($(LIBPL)) do @copy %f "$(LIBDIR)"
- copy README "$(LIBDIR)\README.TXT"
- copy web\icons\*.* "$(LIBDIR)\web\icons"
- copy web\css\*.* "$(LIBDIR)\web\css"
- copy http_stream.dll "$(BINDIR)"
- copy json.dll "$(BINDIR)"
-!IF "$(PDB)" == "true"
- copy http_stream.pdb "$(BINDIR)"
- copy json.pdb "$(BINDIR)"
-!ENDIF
- $(MAKEINDEX)
-!ENDIF
-
-html-install: install-examples
- copy http.html "$(PKGDOC)"
- copy httpserver.gif "$(PKGDOC)"
-
-pdf-install: install-examples
- copy http.pdf "$(PKGDOC)"
-
-install-examples::
- if not exist "$(EXDIR)\$(NULL)" $(MKDIR) "$(EXDIR)"
- if not exist "$(EXDIR)\pwp\$(NULL)" $(MKDIR) "$(EXDIR)\pwp"
- cd examples & @for %f in ($(EXAMPLES)) do @copy %f "$(EXDIR)"
- cd examples & copy $(EXAMPLEEXE) "$(EXDIR)"
- cd examples & copy pwp\*.* "$(EXDIR)\pwp"
-
-xpce-install::
-
-uninstall::
- cd $(LIBDIR) & del $(LIBPL) README.TXT
- del "$(BINDIR)\http_stream.dll"
- $(MAKEINDEX)
-
-clean::
- if exist *~ del *~
- if exist *.obj del *.obj
-
-distclean: clean
- if exist *.dll del *.dll
- if exist *.pdb del *.pdb
-
-
diff --git a/packages/http/README b/packages/http/README
deleted file mode 100644
index 3e3e4454b..000000000
--- a/packages/http/README
+++ /dev/null
@@ -1,18 +0,0 @@
----+ SWI-Prolog HTTP support library
-
-This directory provides the SWI-Prolog libraries for accessing and
-providing HTTP services. The client libraries come in two forms:
-
- * The lightweight http_open.pl opens an HTTP location as a stream
- * The more full-blown http_client.pl performs arbitrary HTTP
- requests and, depending on loaded plugins, transforms the data
- in a Prolog-friendly format.
-
-The primary server-library is thread_httpd.pl, providing full-blown
-scalable embedded HTTP server.
-
----++ Further reading
-
- * ../../packages/http.pdf
- * ../../packages/examples/http contains some demos.
- * http://www.swi-prolog.org/packages/http.html
diff --git a/packages/http/TODO b/packages/http/TODO
deleted file mode 100644
index 819146150..000000000
--- a/packages/http/TODO
+++ /dev/null
@@ -1,25 +0,0 @@
----+ HTTP Server library todo list
-
----++ Session handling
-
-Especially now that we store the current request as a record in the CGI
-stream, it is now much too expensive to get the current session. How to
-deal with that? Also store in the CGI object?
-
----++ Debugging
-
-We plan to provide a in-core store for requests with predicates that
-control what requests are stored. This allows for showing the requests
-as well as replaying requests from the user-thread for easy debugging.
-
-Can we deal with HTTP POST requests?
-
----++ JSON integration
-
-JavaScript Simple Object Notation is a simple and lightweight exchange
-protocol for structured data. Support for it is progressing, with the
-following items on our todo list.
-
- * Hook json_convert.pl into json.pl
- * Deal with nested objects in conversion
- * Documentation.
diff --git a/packages/http/cgi_stream.c b/packages/http/cgi_stream.c
deleted file mode 100644
index 6436506b0..000000000
--- a/packages/http/cgi_stream.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/* Part of SWI-Prolog
-
- Author: Jan Wielemaker
- E-mail: J.Wielemaker@uva.nl
- WWW: http://www.swi-prolog.org
- Copyright (C): 2009, University of Amsterdam
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include
-#include
-#include
-#include
-#include
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-The task of cgi_stream.c is to interface between the actual wrapper code
-that implements an HTTP location and the socket sending a reply to the
-client. In particular, we want to deal with:
-
- * Separating the header from the body of the reply
- * Chunked or traditional transfer encoding
- * Connection management (Keep-alife)
- * Thread management
-
-The original HTTP infrastructure has an `accept thread' that accepts new
-connections. The connection is handed to a thread that reads the HTTP
-header and calls a handler with the output redirected to a memory file,
-processing the reply-header and reply-data after the handler finished.
-This is a clean and modular design, but it cannot deal with especially
-chunked encoding and thread management. This module remedies these
-issues.
-
-To do this, the stream provides a three call-backs. Initially, the
-stream is in line-buffering mode (SIO_LBUF), waiting for the header to
-become complete. At that moment it calls the hook, passing event type
-'header' and the stream. This processes the head and combines the head
-with the request, deciding on:
-
- * The final header
- * The transfer encoding (chunked/none)
- * The content encoding (octet/utf8)
- * The connection (Keep-Alife/close)
-
-Now, the stream is placed in full buffering mode (SIO_FBUF). If the
-transfer encoding is 'chunked' it immediately calls the hook using
-'send_header' to emit the current header. Output continues. In chunked
-mode sending the chunks, otherwisse collecting the data. On close, it
-writes an empty block (chunked mode) or (normal mode) calls the hook
-'send_header' which now has access to the content-length, followed by
-the data.
-
-Note that the work-flow is kept with the stream. This allows passing the
-cgi stream from thread to thread while keeping track of the work-flow.
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-TODO
-
- * Error handling (many places)
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-
- /*******************************
- * CONSTANTS *
- *******************************/
-
-static atom_t ATOM_header; /* header */
-static atom_t ATOM_header_codes; /* header_codes */
-static atom_t ATOM_send_header; /* send_header */
-static atom_t ATOM_data; /* data */
-static atom_t ATOM_discarded; /* discarded */
-static atom_t ATOM_request; /* request */
-static atom_t ATOM_client; /* client */
-static atom_t ATOM_chunked; /* chunked */
-static atom_t ATOM_none; /* none */
-static atom_t ATOM_state; /* state */
-static atom_t ATOM_transfer_encoding; /* transfer_encoding */
-static atom_t ATOM_connection; /* connection */
-static atom_t ATOM_keep_alife; /* keep_alife */
-static atom_t ATOM_close; /* close */
-static atom_t ATOM_content_length; /* content_length */
-static atom_t ATOM_id; /* id */
-static predicate_t PREDICATE_call3; /* Goal, Event, Handle */
-
-
- /*******************************
- * CONTEXT *
- *******************************/
-
-#define BUFSIZE SIO_BUFSIZE /* raw I/O buffer */
-
-typedef enum
-{ CGI_HDR = 0,
- CGI_DATA,
- CGI_DISCARDED
-} cgi_state;
-
-#define CGI_MAGIC 0xa85ce042
-
-typedef struct cgi_context
-{ IOSTREAM *stream; /* Original stream */
- IOSTREAM *cgi_stream; /* Stream I'm handle of */
- IOENC parent_encoding; /* Saved encoding of parent */
- /* Prolog attributes */
- module_t module; /* Calling module */
- record_t hook; /* Hook called on action */
- record_t request; /* Associated request term */
- record_t header; /* Associated reply header term */
- atom_t transfer_encoding; /* Current transfer encoding */
- atom_t connection; /* Keep alife? */
- /* state */
- cgi_state state; /* Current state */
- /* data buffering */
- size_t data_offset; /* Start of real data */
- char *data; /* Buffered data */
- size_t datasize; /* #bytes buffered */
- size_t dataallocated; /* #bytes allocated */
- int id; /* Identifier */
- unsigned int magic; /* CGI_MAGIC */
-} cgi_context;
-
-
-static int start_chunked_encoding(cgi_context *ctx);
-static ssize_t cgi_chunked_write(cgi_context *ctx, char *buf, size_t size);
-
-
- /*******************************
- * ALLOC/FREE *
- *******************************/
-
-static cgi_context*
-alloc_cgi_context(IOSTREAM *s)
-{ cgi_context *ctx = PL_malloc(sizeof(*ctx));
-
- memset(ctx, 0, sizeof(*ctx));
- ctx->magic = CGI_MAGIC;
- ctx->stream = s;
-
- return ctx;
-}
-
-
-static void
-free_cgi_context(cgi_context *ctx)
-{ if ( ctx->stream->upstream )
- Sset_filter(ctx->stream, NULL);
- else
- PL_release_stream(ctx->stream);
-
- if ( ctx->data ) free(ctx->data);
- if ( ctx->hook ) PL_erase(ctx->hook);
- if ( ctx->request ) PL_erase(ctx->request);
- if ( ctx->header ) PL_erase(ctx->header);
- if ( ctx->connection ) PL_unregister_atom(ctx->connection);
-
- ctx->magic = 0;
- PL_free(ctx);
-}
-
-
-static int
-grow_data_buffer(cgi_context *ctx, size_t size)
-{ size_t newsize;
-
- if ( ctx->dataallocated == 0 )
- newsize = SIO_BUFSIZE;
- else
- newsize = ctx->dataallocated;
-
- while(newsize < size)
- newsize *= 2;
- if ( ctx->data )
- { void *p;
-
- if ( !(p=realloc(ctx->data, newsize)) )
- return -1;
- ctx->data = p;
- ctx->dataallocated = newsize;
- } else
- { if ( !(ctx->data = malloc(newsize)) )
- return -1;
-
- ctx->dataallocated = newsize;
- }
-
- return 0;
-}
-
-
- /*******************************
- * PROPERTIES *
- *******************************/
-
-static IOFUNCTIONS cgi_functions;
-
-static int
-get_cgi_stream(term_t t, IOSTREAM **sp, cgi_context **ctx)
-{ IOSTREAM *s;
-
- if ( !PL_get_stream_handle(t, &s) )
- return FALSE;
- if ( s->functions != &cgi_functions )
- { PL_release_stream(s);
- return type_error(t, "cgi_stream");
- }
-
- *sp = s;
- *ctx = s->handle;
-
- return TRUE;
-}
-
-
-static int
-unify_record(term_t t, record_t r)
-{ if ( r )
- { term_t t2 = PL_new_term_ref();
- PL_recorded(r, t2);
- return PL_unify(t, t2);
- }
- return FALSE;
-}
-
-
-static foreign_t
-is_cgi_stream(term_t cgi)
-{ IOSTREAM *s;
- int rc;
-
- if ( !PL_get_stream_handle(cgi, &s) )
- return FALSE;
- rc = (s->functions == &cgi_functions);
- PL_release_stream(s);
-
- return rc;
-}
-
-
-static foreign_t
-cgi_property(term_t cgi, term_t prop)
-{ IOSTREAM *s;
- cgi_context *ctx;
- term_t arg = PL_new_term_ref();
- atom_t name;
- int arity;
- int rc = TRUE;
-
- if ( !get_cgi_stream(cgi, &s, &ctx) )
- return FALSE;
-
- if ( !PL_get_name_arity(prop, &name, &arity) || arity != 1 )
- { rc = type_error(prop, "cgi_property");
- goto out;
- }
-
- _PL_get_arg(1, prop, arg);
- if ( name == ATOM_request )
- { if ( ctx->request )
- rc = unify_record(arg, ctx->request);
- else
- rc = PL_unify_nil(arg);
- } else if ( name == ATOM_header )
- { if ( ctx->header )
- rc = unify_record(arg, ctx->header);
- else
- rc = PL_unify_nil(arg);
- } else if ( name == ATOM_id )
- { rc = PL_unify_integer(arg, ctx->id);
- } else if ( name == ATOM_client )
- { rc = PL_unify_stream(arg, ctx->stream);
- } else if ( name == ATOM_transfer_encoding )
- { rc = PL_unify_atom(arg, ctx->transfer_encoding);
- } else if ( name == ATOM_connection )
- { rc = PL_unify_atom(arg, ctx->connection ? ctx->connection : ATOM_close);
- } else if ( name == ATOM_content_length )
- { rc = PL_unify_int64(arg, ctx->datasize - ctx->data_offset);
- } else if ( name == ATOM_header_codes )
- { if ( ctx->data_offset > 0 )
- rc = PL_unify_chars(arg, PL_CODE_LIST, ctx->data_offset, ctx->data);
- else
- rc = existence_error(cgi, "header");
- } else if ( name == ATOM_state )
- { atom_t state;
-
- switch(ctx->state)
- { case CGI_HDR: state = ATOM_header; break;
- case CGI_DATA: state = ATOM_data; break;
- case CGI_DISCARDED: state = ATOM_discarded; break;
- default:
- assert(0);
- }
-
- rc = PL_unify_atom(arg, state);
- } else
- { rc = existence_error(prop, "cgi_property");
- }
-
-out:
- PL_release_stream(s);
- return rc;
-}
-
-
-static int
-set_term(record_t *r, term_t t)
-{ if ( *r )
- PL_erase(*r);
- *r = PL_record(t);
-
- return TRUE;
-}
-
-
-static int
-set_atom(atom_t *a, term_t t)
-{ atom_t new;
-
- if ( !PL_get_atom(t, &new) )
- return type_error(t, "atom");
-
- if ( *a != new )
- { if ( *a )
- PL_unregister_atom(*a);
- *a = new;
- PL_register_atom(new);
- }
-
- return TRUE;
-}
-
-
-static foreign_t
-cgi_set(term_t cgi, term_t prop)
-{ IOSTREAM *s;
- cgi_context *ctx;
- term_t arg = PL_new_term_ref();
- atom_t name;
- int arity;
- int rc = TRUE;
-
- if ( !get_cgi_stream(cgi, &s, &ctx) )
- return FALSE;
-
- if ( !PL_get_name_arity(prop, &name, &arity) || arity != 1 )
- { rc = type_error(prop, "cgi_property");
- goto out;
- }
-
- _PL_get_arg(1, prop, arg);
- if ( name == ATOM_request )
- { rc = set_term(&ctx->request, arg);
- } else if ( name == ATOM_header )
- { rc = set_term(&ctx->header, arg);
- } else if ( name == ATOM_connection )
- { rc = set_atom(&ctx->connection, arg);
- } else if ( name == ATOM_transfer_encoding )
- { atom_t enc;
-
- if ( !PL_get_atom(arg, &enc) )
- return type_error(arg, "atom");
-
- if ( ctx->transfer_encoding != enc )
- { if ( enc == ATOM_chunked )
- { ctx->transfer_encoding = enc;
- rc = start_chunked_encoding(ctx);
- } else
- { rc = domain_error(arg, "transfer_encoding");
- }
- }
- } else
- { rc = existence_error(prop, "cgi_property");
- }
-
-out:
- PL_release_stream(s);
- return rc;
-}
-
-
-static foreign_t
-cgi_discard(term_t cgi)
-{ IOSTREAM *s;
- cgi_context *ctx;
-
- if ( !get_cgi_stream(cgi, &s, &ctx) )
- return FALSE;
-
- ctx->state = CGI_DISCARDED;
- /* empty buffer to avoid write */
- ctx->cgi_stream->bufp = ctx->cgi_stream->buffer;
- PL_release_stream(s);
-
- return TRUE;
-}
-
-
- /*******************************
- * HOOKS *
- *******************************/
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Call hook on the data we collected sofar. The hook is called with the
-following additional arguments:
-
- * Event-type (header, data)
- * An input stream pointing to the collected data
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-static int
-call_hook(cgi_context *ctx, atom_t event)
-{ fid_t fid = PL_open_foreign_frame();
- term_t av = PL_new_term_refs(3);
- qid_t qid;
- int rc;
-
- PL_recorded(ctx->hook, av+0);
- PL_put_atom(av+1, event);
- PL_unify_stream(av+2, ctx->cgi_stream);
- qid = PL_open_query(ctx->module, PL_Q_CATCH_EXCEPTION, PREDICATE_call3, av);
- rc = PL_next_solution(qid);
-
- if ( !rc )
- { term_t ex;
-
- if ( (ex = PL_exception(qid)) )
- { Sset_exception(ctx->cgi_stream, ex);
-
- } else
- { char buf[256];
- Ssprintf(buf, "CGI Hook %s failed", PL_atom_chars(event));
-
- Sseterr(ctx->cgi_stream, SIO_WARN, buf);
- }
-
- PL_cut_query(qid);
- PL_close_foreign_frame(fid);
-
- return FALSE;
- }
- PL_close_query(qid);
- PL_discard_foreign_frame(fid);
-
- return TRUE;
-}
-
-
-static int
-start_chunked_encoding(cgi_context *ctx)
-{ if ( call_hook(ctx, ATOM_send_header) )
- { if ( ctx->datasize > ctx->data_offset )
- { int rc = cgi_chunked_write(ctx,
- &ctx->data[ctx->data_offset],
- ctx->datasize - ctx->data_offset);
- if ( rc == -1 )
- return FALSE;
- }
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-static size_t
-find_data(cgi_context *ctx, size_t start)
-{ const char *s = &ctx->data[start];
- const char *e = &ctx->data[ctx->datasize-2];
-
- for(; s<=e; s++)
- { if ( s[0] == '\r' && s[1] == '\n' &&
- s <= e-2 &&
- s[2] == '\r' && s[3] == '\n' )
- return &s[4] - ctx->data;
- if ( s[0] == '\n' && s[1] == '\n' )
- return &s[2] - ctx->data;
- }
-
- return (size_t)-1;
-}
-
-
-
- /*******************************
- * IO FUNCTIONS *
- *******************************/
-
-static ssize_t /* encode */
-cgi_chunked_write(cgi_context *ctx, char *buf, size_t size)
-{ if ( Sfprintf(ctx->stream, "%x\r\n", size) < 0 )
- return -1;
- if ( size > 0 &&
- Sfwrite(buf, sizeof(char), size, ctx->stream) != size )
- return -1;
- if ( Sfprintf(ctx->stream, "\r\n") < 0 )
- return -1;
- if ( Sflush(ctx->stream) < 0 )
- return -1;
-
- return size;
-}
-
-
-static ssize_t
-cgi_write(void *handle, char *buf, size_t size)
-{ cgi_context *ctx = handle;
-
- DEBUG(1, Sdprintf("cgi_write(%ld bytes)\n", (long)size));
-
- if ( ctx->state == CGI_DISCARDED )
- { Sseterr(ctx->cgi_stream, SIO_FERR, "CGI stream was discarded");
- return -1;
- }
-
- if ( ctx->transfer_encoding == ATOM_chunked )
- { return cgi_chunked_write(ctx, buf, size);
- } else
- { size_t osize = ctx->datasize;
- size_t dstart;
-
- if ( osize+size > ctx->dataallocated )
- { if ( grow_data_buffer(ctx, osize+size) < 0 )
- return -1; /* no memory */
- }
- memcpy(&ctx->data[osize], buf, size);
- ctx->datasize = osize+size;
- osize = (osize > 4 ? osize-4 : 0); /* 4 is max size of the separator */
-
- if ( ctx->state == CGI_HDR &&
- (dstart=find_data(ctx, osize)) != ((size_t)-1) )
- { assert(dstart <= ctx->datasize);
- ctx->data_offset = dstart;
- ctx->state = CGI_DATA;
- if ( !call_hook(ctx, ATOM_header) )
- { ctx->state = CGI_DISCARDED;
- return -1; /* TBD: pass error kindly */
- }
- ctx->cgi_stream->flags &= ~(SIO_FBUF|SIO_LBUF|SIO_NBUF);
- ctx->cgi_stream->flags |= SIO_FBUF;
- }
-
- return size;
- }
-}
-
-
-static int
-cgi_control(void *handle, int op, void *data)
-{ cgi_context *ctx = handle;
-
- if ( ctx->magic != CGI_MAGIC )
- { DEBUG(0, Sdprintf("OOPS: cgi_control(%d): invalid handle\n", op));
- errno = EINVAL;
- return -1;
- }
-
- switch(op)
- { case SIO_FLUSHOUTPUT:
- case SIO_SETENCODING:
- return 0; /* allow switching encoding */
- default:
- if ( ctx->stream->functions->control )
- return (*ctx->stream->functions->control)(ctx->stream->handle, op, data);
- return -1;
- }
-}
-
-
-static int
-cgi_close(void *handle)
-{ cgi_context *ctx = handle;
- int rc = 0;
-
- DEBUG(1, Sdprintf("cgi_close()\n"));
-
- switch( ctx->state )
- { case CGI_DATA:
- { if ( ctx->transfer_encoding == ATOM_chunked )
- { if ( cgi_chunked_write(ctx, NULL, 0) < 0 )
- { rc = -1;
- goto out;
- }
- } else
- { size_t clen = ctx->datasize - ctx->data_offset;
- const char *dstart = &ctx->data[ctx->data_offset];
-
- if ( !call_hook(ctx, ATOM_send_header) )
- { rc = -1;
- goto out;
- }
- if ( Sfwrite(dstart, sizeof(char), clen, ctx->stream) != clen ||
- Sflush(ctx->stream) < 0 )
- { rc = -1;
- goto out;
- }
- }
-
- break;
- }
- case CGI_HDR:
- break;
- case CGI_DISCARDED:
- goto out;
- }
-
- if ( !call_hook(ctx, ATOM_close) ) /* what if we had no header sofar? */
- rc = -1; /* TBD: pass error kindly */
-
-out:
- ctx->stream->encoding = ctx->parent_encoding;
- free_cgi_context(ctx);
-
- return rc;
-}
-
-
-static IOFUNCTIONS cgi_functions =
-{ NULL, /* read */
- cgi_write,
- NULL, /* seek */
- cgi_close,
- cgi_control, /* control */
- NULL, /* seek64 */
-};
-
-
- /*******************************
- * OPEN *
- *******************************/
-
-static int current_id = 0; /* TBD: MT: lock */
-
-#define CGI_COPY_FLAGS (SIO_OUTPUT| \
- SIO_TEXT| \
- SIO_REPXML|SIO_REPPL|\
- SIO_RECORDPOS)
-
-static foreign_t
-pl_cgi_open(term_t org, term_t new, term_t closure, term_t options)
-{ term_t tail = PL_copy_term_ref(options);
- term_t head = PL_new_term_ref();
- cgi_context *ctx;
- IOSTREAM *s, *s2;
- module_t module = NULL;
- term_t hook = PL_new_term_ref();
- record_t request = 0;
-
- PL_strip_module(closure, &module, hook);
- if ( !PL_is_callable(hook) )
- return type_error(closure, "callable");
-
- while(PL_get_list(tail, head, tail))
- { atom_t name;
- int arity;
- term_t arg = PL_new_term_ref();
-
- if ( !PL_get_name_arity(head, &name, &arity) || arity != 1 )
- return type_error(head, "option");
- _PL_get_arg(1, head, arg);
- if ( name == ATOM_request )
- { request = PL_record(arg);
- } else
- return existence_error(head, "cgi_open_option");
- }
- if ( !PL_get_nil(tail) )
- return type_error(tail, "list");
-
- if ( !PL_get_stream_handle(org, &s) )
- return FALSE; /* Error */
- if ( !(s->flags&SIO_OUTPUT) ) /* only allow output stream */
- { PL_release_stream(s);
- return permission_error("stream", "write", org);
- }
-
- ctx = alloc_cgi_context(s);
- ctx->hook = PL_record(hook);
- ctx->module = module;
- ctx->request = request;
- ctx->transfer_encoding = ATOM_none;
- if ( !(s2 = Snew(ctx,
- (s->flags&CGI_COPY_FLAGS)|SIO_LBUF,
- &cgi_functions)) )
- { free_cgi_context(ctx); /* no memory */
-
- return FALSE;
- }
-
- s2->encoding = ENC_ASCII; /* Header is ASCII only */
- ctx->parent_encoding = s->encoding;
- s->encoding = ENC_OCTET;
- ctx->cgi_stream = s2;
- if ( PL_unify_stream(new, s2) )
- { Sset_filter(s, s2);
- PL_release_stream(s);
- ctx->id = ++current_id;
-
- return TRUE;
- } else
- { return instantiation_error();
- }
-}
-
-
-static void
-install_cgi_stream()
-{ ATOM_header = PL_new_atom("header");
- ATOM_header_codes = PL_new_atom("header_codes");
- ATOM_send_header = PL_new_atom("send_header");
- ATOM_data = PL_new_atom("data");
- ATOM_discarded = PL_new_atom("discarded");
- ATOM_request = PL_new_atom("request");
- ATOM_header = PL_new_atom("header");
- ATOM_client = PL_new_atom("client");
- ATOM_chunked = PL_new_atom("chunked");
- ATOM_state = PL_new_atom("state");
- ATOM_none = PL_new_atom("none");
- ATOM_transfer_encoding = PL_new_atom("transfer_encoding");
- ATOM_close = PL_new_atom("close");
- ATOM_keep_alife = PL_new_atom("keep_alife");
- ATOM_connection = PL_new_atom("connection");
- ATOM_content_length = PL_new_atom("content_length");
- ATOM_id = PL_new_atom("id");
-
- PREDICATE_call3 = PL_predicate("call", 3, "system");
-
- PL_register_foreign("cgi_open", 4, pl_cgi_open, PL_FA_TRANSPARENT);
- PL_register_foreign("is_cgi_stream", 1, is_cgi_stream, 0);
- PL_register_foreign("cgi_property", 2, cgi_property, 0);
- PL_register_foreign("cgi_set", 2, cgi_set, 0);
- PL_register_foreign("cgi_discard", 1, cgi_discard, 0);
-}
diff --git a/packages/http/common.mk b/packages/http/common.mk
deleted file mode 100644
index fc378df6f..000000000
--- a/packages/http/common.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# Makefile fragments to are updated frequently and can be shared
-
-LIBPL= $(srcdir)/html_write.pl $(srcdir)/http_client.pl \
- $(srcdir)/http_header.pl \
- $(srcdir)/http_mime_plugin.pl $(srcdir)/http_sgml_plugin.pl \
- $(srcdir)/mimepack.pl $(srcdir)/mimetype.pl \
- $(srcdir)/dcg_basics.pl \
- $(srcdir)/thread_httpd.pl $(srcdir)/xpce_httpd.pl \
- $(srcdir)/inetd_httpd.pl \
- $(srcdir)/http_wrapper.pl $(srcdir)/http_open.pl \
- $(srcdir)/http_session.pl \
- $(srcdir)/http_error.pl $(srcdir)/http_parameters.pl \
- $(srcdir)/http_dispatch.pl \
- $(srcdir)/http_authenticate.pl $(srcdir)/http_stream.pl \
- $(srcdir)/http_log.pl \
- $(srcdir)/http_path.pl $(srcdir)/http_hook.pl \
- $(srcdir)/html_head.pl $(srcdir)/http_exception.pl \
- $(srcdir)/json.pl $(srcdir)/http_json.pl \
- $(srcdir)/json_convert.pl $(srcdir)/http_dirindex.pl \
- $(srcdir)/http_server_files.pl $(srcdir)/http_pwp.pl \
- $(srcdir)/http_host.pl \
- $(srcdir)/http_openid.pl $(srcdir)/js_write.pl
-EXAMPLES= $(srcdir)/demo_body.pl $(srcdir)/demo_client.pl \
- $(srcdir)/demo_threads.pl $(srcdir)/demo_xpce.pl \
- $(srcdir)/calc.pl $(srcdir)/demo_files.pl \
- $(srcdir)/demo_pwp.pl $(srcdir)/demo_openid.pl
-EXAMPLEEXE= demo_inetd
-XPCEPL= $(srcdir)/http_image.pl
diff --git a/packages/http/config.h.in b/packages/http/config.h.in
deleted file mode 100644
index b84c2bdbb..000000000
--- a/packages/http/config.h.in
+++ /dev/null
@@ -1,90 +0,0 @@
-/* config.h.in. Generated from configure.in by autoheader. */
-
-/* Define if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
- systems. This function is required for `alloca.c' support on those systems.
- */
-#undef CRAY_STACKSEG_END
-
-/* Define to 1 if using `alloca.c'. */
-#undef C_ALLOCA
-
-/* Define to 1 if you have `alloca', as a function or macro. */
-#undef HAVE_ALLOCA
-
-/* Define to 1 if you have and it should be used (not on Ultrix).
- */
-#undef HAVE_ALLOCA_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if you have the header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at runtime.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-#undef STACK_DIRECTION
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-# undef WORDS_BIGENDIAN
-# endif
-#endif
-
-/* Define for multi-thread support */
-#undef _REENTRANT
diff --git a/packages/http/config.log b/packages/http/config.log
deleted file mode 100644
index ef540fffe..000000000
--- a/packages/http/config.log
+++ /dev/null
@@ -1,483 +0,0 @@
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by configure, which was
-generated by GNU Autoconf 2.65. Invocation command line was
-
- $ ./configure --prefix=/home/vsc/Yap/pl-devel --prefix=/home/vsc/Yap/pl-devel
-
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = xato
-uname -m = x86_64
-uname -r = 2.6.32-22-generic
-uname -s = Linux
-uname -v = #36-Ubuntu SMP Thu Jun 3 19:31:57 UTC 2010
-
-/usr/bin/uname -p = unknown
-/bin/uname -X = unknown
-
-/bin/arch = unknown
-/usr/bin/arch -k = unknown
-/usr/convex/getsysinfo = unknown
-/usr/bin/hostinfo = unknown
-/bin/machine = unknown
-/usr/bin/oslevel = unknown
-/bin/universe = unknown
-
-PATH: /home/vsc/Yap/pl-devel/bin
-PATH: /home/vsc/bin
-PATH: /usr/local/sbin
-PATH: /usr/local/bin
-PATH: /usr/sbin
-PATH: /usr/bin
-PATH: /sbin
-PATH: /bin
-PATH: /usr/games
-PATH: /home/vsc/lgtsvn/xml
-PATH: /home/vsc/lgtsvn/scripts
-PATH: /home/vsc/lgtsvn/integration
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-configure:2132: checking for gmake
-configure:2159: result: make
-configure:2175: checking for etags
-configure:2191: found /usr/bin/etags
-configure:2202: result: etags
-configure:2251: checking for a BSD-compatible install
-configure:2319: result: /usr/bin/install -c
-configure:2378: checking for gcc
-configure:2405: result: ../swipl-ld.sh
-configure:2634: checking for C compiler version
-configure:2643: ../swipl-ld.sh --version >&5
-gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
-Copyright (C) 2009 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-configure:2654: $? = 0
-configure:2643: ../swipl-ld.sh -v >&5
-Using built-in specs.
-Target: x86_64-linux-gnu
-Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
-Thread model: posix
-gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
-configure:2654: $? = 0
-configure:2643: ../swipl-ld.sh -V >&5
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8 has invalid symbol index 2
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9 has invalid symbol index 2
-... rest of stderr output deleted ...
-configure:2654: $? = 1
-configure:2643: ../swipl-ld.sh -qversion >&5
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8 has invalid symbol index 2
-/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9 has invalid symbol index 2
-... rest of stderr output deleted ...
-configure:2654: $? = 1
-configure:2674: checking whether the C compiler works
-configure:2696: ../swipl-ld.sh conftest.c >&5
-% /home/vsc/Yap/pl-devel/library/listing compiled into prolog_listing 0.00 sec, 37,800 bytes
-% halt
-configure:2700: $? = 0
-configure:2749: result: yes
-configure:2752: checking for C compiler default output file name
-configure:2754: result: a.out
-configure:2760: checking for suffix of executables
-configure:2767: ../swipl-ld.sh -o conftest conftest.c >&5
-% /home/vsc/Yap/pl-devel/library/listing compiled into prolog_listing 0.01 sec, 37,800 bytes
-% halt
-configure:2771: $? = 0
-configure:2793: result:
-configure:2815: checking whether we are cross compiling
-configure:2823: ../swipl-ld.sh -o conftest conftest.c >&5
-% /home/vsc/Yap/pl-devel/library/listing compiled into prolog_listing 0.00 sec, 37,800 bytes
-% halt
-configure:2827: $? = 0
-configure:2834: ./conftest
-configure:2838: $? = 0
-configure:2853: result: no
-configure:2858: checking for suffix of object files
-configure:2880: ../swipl-ld.sh -c conftest.c >&5
-configure:2884: $? = 0
-configure:2905: result: o
-configure:2909: checking whether we are using the GNU C compiler
-configure:2928: ../swipl-ld.sh -c conftest.c >&5
-configure:2928: $? = 0
-configure:2937: result: yes
-configure:2946: checking whether ../swipl-ld.sh accepts -g
-configure:2966: ../swipl-ld.sh -c -g conftest.c >&5
-configure:2966: $? = 0
-configure:3007: result: yes
-configure:3024: checking for ../swipl-ld.sh option to accept ISO C89
-configure:3088: ../swipl-ld.sh -c -g -O2 conftest.c >&5
-configure:3088: $? = 0
-configure:3101: result: none needed
-configure:3122: checking for library containing strerror
-configure:3153: ../swipl-ld.sh -o conftest -g -O2 conftest.c >&5
-% /home/vsc/Yap/pl-devel/library/listing compiled into prolog_listing 0.00 sec, 37,800 bytes
-% halt
-configure:3153: $? = 0
-configure:3170: result: none required
-configure:3183: checking how to run the C preprocessor
-configure:3214: ../swipl-ld.sh -E conftest.c
-configure:3214: $? = 0
-configure:3228: ../swipl-ld.sh -E conftest.c
-conftest.c:9:28: error: ac_nonexistent.h: No such file or directory
-gcc -E returned code 256
-*** /home/vsc/Yap/pl-devel/src/../src/swipl-ld exit status 1
-configure:3228: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| #define PACKAGE_URL ""
-| /* end confdefs.h. */
-| #include
-configure:3253: result: ../swipl-ld.sh -E
-configure:3273: ../swipl-ld.sh -E conftest.c
-configure:3273: $? = 0
-configure:3287: ../swipl-ld.sh -E conftest.c
-conftest.c:9:28: error: ac_nonexistent.h: No such file or directory
-gcc -E returned code 256
-*** /home/vsc/Yap/pl-devel/src/../src/swipl-ld exit status 1
-configure:3287: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| #define PACKAGE_URL ""
-| /* end confdefs.h. */
-| #include
-configure:3316: checking for grep that handles long lines and -e
-configure:3374: result: /bin/grep
-configure:3379: checking for egrep
-configure:3441: result: /bin/grep -E
-configure:3446: checking for ANSI C header files
-configure:3466: ../swipl-ld.sh -c -g -O2 conftest.c >&5
-configure:3466: $? = 0
-configure:3539: ../swipl-ld.sh -o conftest -g -O2 conftest.c >&5
-% /home/vsc/Yap/pl-devel/library/listing compiled into prolog_listing 0.00 sec, 37,800 bytes
-% halt
-configure:3539: $? = 0
-configure:3539: ./conftest
-configure:3539: $? = 0
-configure:3550: result: yes
-configure:3564: checking for sys/types.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for sys/stat.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for stdlib.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for string.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for memory.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for strings.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for inttypes.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for stdint.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3564: checking for unistd.h
-configure:3564: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3564: $? = 0
-configure:3564: result: yes
-configure:3579: checking for working alloca.h
-configure:3596: ../swipl-ld.sh -o conftest -fPIC conftest.c >&5
-% /home/vsc/Yap/pl-devel/library/listing compiled into prolog_listing 0.00 sec, 37,800 bytes
-% halt
-configure:3596: $? = 0
-configure:3604: result: yes
-configure:3612: checking for alloca
-configure:3649: ../swipl-ld.sh -o conftest -fPIC conftest.c >&5
-% /home/vsc/Yap/pl-devel/library/listing compiled into prolog_listing 0.01 sec, 37,800 bytes
-% halt
-configure:3649: $? = 0
-configure:3657: result: yes
-configure:3767: checking whether byte ordering is bigendian
-configure:3782: ../swipl-ld.sh -c -fPIC conftest.c >&5
-conftest.c:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'a'
-gcc returned code 256
-*** /home/vsc/Yap/pl-devel/src/../src/swipl-ld exit status 1
-configure:3782: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| #define PACKAGE_URL ""
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_ALLOCA_H 1
-| #define HAVE_ALLOCA 1
-| /* end confdefs.h. */
-| #ifndef __APPLE_CC__
-| not a universal capable compiler
-| #endif
-| typedef int dummy;
-|
-configure:3827: ../swipl-ld.sh -c -fPIC conftest.c >&5
-configure:3827: $? = 0
-configure:3845: ../swipl-ld.sh -c -fPIC conftest.c >&5
-conftest.c: In function 'main':
-conftest.c:28: error: 'not' undeclared (first use in this function)
-conftest.c:28: error: (Each undeclared identifier is reported only once
-conftest.c:28: error: for each function it appears in.)
-conftest.c:28: error: expected ';' before 'big'
-gcc returned code 256
-*** /home/vsc/Yap/pl-devel/src/../src/swipl-ld exit status 1
-configure:3845: $? = 1
-configure: failed program was:
-| /* confdefs.h */
-| #define PACKAGE_NAME ""
-| #define PACKAGE_TARNAME ""
-| #define PACKAGE_VERSION ""
-| #define PACKAGE_STRING ""
-| #define PACKAGE_BUGREPORT ""
-| #define PACKAGE_URL ""
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_ALLOCA_H 1
-| #define HAVE_ALLOCA 1
-| /* end confdefs.h. */
-| #include
-| #include
-|
-| int
-| main ()
-| {
-| #if BYTE_ORDER != BIG_ENDIAN
-| not big endian
-| #endif
-|
-| ;
-| return 0;
-| }
-configure:3973: result: no
-configure:4105: creating ./config.status
-
-## ---------------------- ##
-## Running config.status. ##
-## ---------------------- ##
-
-This file was extended by config.status, which was
-generated by GNU Autoconf 2.65. Invocation command line was
-
- CONFIG_FILES =
- CONFIG_HEADERS =
- CONFIG_LINKS =
- CONFIG_COMMANDS =
- $ ./config.status
-
-on xato
-
-config.status:822: creating Makefile
-config.status:822: creating config.h
-
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-
-ac_cv_c_bigendian=no
-ac_cv_c_compiler_gnu=yes
-ac_cv_env_CC_set=
-ac_cv_env_CC_value=
-ac_cv_env_CFLAGS_set=
-ac_cv_env_CFLAGS_value=
-ac_cv_env_CPPFLAGS_set=
-ac_cv_env_CPPFLAGS_value=
-ac_cv_env_CPP_set=
-ac_cv_env_CPP_value=
-ac_cv_env_LDFLAGS_set=
-ac_cv_env_LDFLAGS_value=
-ac_cv_env_LIBS_set=
-ac_cv_env_LIBS_value=
-ac_cv_env_build_alias_set=
-ac_cv_env_build_alias_value=
-ac_cv_env_host_alias_set=
-ac_cv_env_host_alias_value=
-ac_cv_env_target_alias_set=
-ac_cv_env_target_alias_value=
-ac_cv_func_alloca_works=yes
-ac_cv_header_inttypes_h=yes
-ac_cv_header_memory_h=yes
-ac_cv_header_stdc=yes
-ac_cv_header_stdint_h=yes
-ac_cv_header_stdlib_h=yes
-ac_cv_header_string_h=yes
-ac_cv_header_strings_h=yes
-ac_cv_header_sys_stat_h=yes
-ac_cv_header_sys_types_h=yes
-ac_cv_header_unistd_h=yes
-ac_cv_objext=o
-ac_cv_path_EGREP='/bin/grep -E'
-ac_cv_path_GREP=/bin/grep
-ac_cv_prog_CPP='../swipl-ld.sh -E'
-ac_cv_prog_ETAGS=etags
-ac_cv_prog_MAKE=make
-ac_cv_prog_ac_ct_CC=../swipl-ld.sh
-ac_cv_prog_cc_c89=
-ac_cv_prog_cc_g=yes
-ac_cv_search_strerror='none required'
-ac_cv_working_alloca_h=yes
-
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-
-ALLOCA=''
-CC='../swipl-ld.sh'
-CFLAGS='-fPIC'
-CIFLAGS=''
-CMFLAGS='-fPIC'
-COFLAGS='-O2 -fno-strict-aliasing'
-CPP='../swipl-ld.sh -E'
-CPPFLAGS=''
-CWFLAGS='-Wall'
-DEFS='-DHAVE_CONFIG_H'
-ECHO_C=''
-ECHO_N='-n'
-ECHO_T=''
-EGREP='/bin/grep -E'
-ETAGS='etags'
-EXEEXT=''
-GREP='/bin/grep'
-INSTALL_DATA='/usr/bin/install -c -m 644'
-INSTALL_PROGRAM='${INSTALL}'
-INSTALL_SCRIPT='${INSTALL}'
-LD='../swipl-ld.sh'
-LDFLAGS=''
-LDSOFLAGS='-shared'
-LIBOBJS=''
-LIBS=''
-LTLIBOBJS=''
-MAKE='make'
-OBJEXT='o'
-PACKAGE_BUGREPORT=''
-PACKAGE_NAME=''
-PACKAGE_STRING=''
-PACKAGE_TARNAME=''
-PACKAGE_URL=''
-PACKAGE_VERSION=''
-PATH_SEPARATOR=':'
-PL='../swipl.sh'
-PLARCH='x86_64-linux'
-PLBASE='/home/vsc/Yap/pl-devel/lib/swipl-5.11.1'
-PLINCL='/home/vsc/Yap/pl-devel/include'
-PLLD='../swipl-ld.sh'
-PLLIBS='-lgmp -lrt -lreadline -lncurses -lm -lrt -ldl '
-SHELL='/bin/bash'
-SO='so'
-ac_ct_CC='../swipl-ld.sh'
-bindir='${exec_prefix}/bin'
-build_alias=''
-datadir='${datarootdir}'
-datarootdir='${prefix}/share'
-docdir='${datarootdir}/doc/${PACKAGE}'
-dvidir='${docdir}'
-exec_prefix='${prefix}'
-host_alias=''
-htmldir='${docdir}'
-includedir='${prefix}/include'
-infodir='${datarootdir}/info'
-libdir='${exec_prefix}/lib'
-libexecdir='${exec_prefix}/libexec'
-localedir='${datarootdir}/locale'
-localstatedir='${prefix}/var'
-mandir='${datarootdir}/man'
-oldincludedir='/usr/include'
-pdfdir='${docdir}'
-prefix='/home/vsc/Yap/pl-devel'
-program_transform_name='s,x,x,'
-psdir='${docdir}'
-sbindir='${exec_prefix}/sbin'
-sharedstatedir='${prefix}/com'
-sysconfdir='${prefix}/etc'
-target_alias=''
-
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-
-/* confdefs.h */
-#define PACKAGE_NAME ""
-#define PACKAGE_TARNAME ""
-#define PACKAGE_VERSION ""
-#define PACKAGE_STRING ""
-#define PACKAGE_BUGREPORT ""
-#define PACKAGE_URL ""
-#define STDC_HEADERS 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRING_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_ALLOCA_H 1
-#define HAVE_ALLOCA 1
-
-configure: exit 0
diff --git a/packages/http/configure.in b/packages/http/configure.in
deleted file mode 100644
index d43d00378..000000000
--- a/packages/http/configure.in
+++ /dev/null
@@ -1,9 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-
-AC_INIT(install-sh)
-AC_PREREQ([2.50])
-AC_CONFIG_HEADER(config.h)
-
-m4_include([../ac_swi_c.m4])
-
-AC_OUTPUT(Makefile)
diff --git a/packages/http/dcg_basics.pl b/packages/http/dcg_basics.pl
deleted file mode 100644
index cd48b4073..000000000
--- a/packages/http/dcg_basics.pl
+++ /dev/null
@@ -1,364 +0,0 @@
-/* $Id$
-
- Part of SWI-Prolog
-
- Author: Jan Wielemaker
- E-mail: wielemak@science.uva.nl
- WWW: http://www.swi-prolog.org
- Copyright (C): 1985-2007, University of Amsterdam
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- As a special exception, if you link this library with other files,
- compiled with a Free Software compiler, to produce an executable, this
- library does not by itself cause the resulting executable to be covered
- by the GNU General Public License. This exception does not however
- invalidate any other reasons why the executable file might be covered by
- the GNU General Public License.
-*/
-
-:- module(dcg_basics,
- [ white//0, %
- whites//0, % *
- blank//0, %
- blanks//0, % *
- nonblank//1, %
- nonblanks//1, % * --> chars (long)
- blanks_to_nl//0, % [space,tab,ret]*nl
- string//1, % * -->chars (short)
- string_without//2, % Exclude, -->chars (long)
- % Characters
- alpha_to_lower//1, % Get lower|upper, return lower
- % Decimal numbers
- digits//1, % [0-9]* -->chars
- digit//1, % [0-9] --> char
- integer//1, % [+-][0-9]+ --> integer
- float//1, % [+-]?[0-9]+(.[0-9]*)?(e[+-]?[0-9]+)? --> float
- number//1, % integer | float
- % Hexadecimal numbers
- xdigits//1, % [0-9a-f]* --> 0-15*
- xdigit//1, % [0-9a-f] --> 0-15
- xinteger//1, % [0-9a-f]+ --> integer
- % Misc
- eos//0, % demand end-of-string
- % generation (TBD)
- atom//1 % generate atom
- ]).
-:- use_module(library(lists)).
-
-
-/** Various general DCG utilities
-
-This library provides various commonly used DCG primitives acting on
-list of character codes. Character classification is based on
-code_type/2.
-
-@tbd Try to achieve an accepted standard and move this into the
- general SWI-Prolog library. None of this is HTTP specific.
-*/
-
-%% string_without(+End, -Codes)// is det.
-%
-% Take as many tokens from the input until the next token appears
-% in End. End itself is left on the input. Typical use is to read
-% upto a defined delimiter such as a newline or other reserved
-% character.
-%
-% @see string//1.
-
-string_without(Not, [C|T]) -->
- [C],
- { \+ memberchk(C, Not)
- }, !,
- string_without(Not, T).
-string_without(_, []) -->
- [].
-
-%% string(-Codes)// is nondet.
-%
-% Take as few as possible tokens from the input, taking one more
-% each time on backtracking. This code is normally followed by a
-% test for a delimiter. E.g.
-%
-% ==
-% upto_colon(Atom) -->
-% string(Codes), ":", !,
-% { atom_codes(Atom, Codes) }.
-% ==
-
-string([]) -->
- [].
-string([H|T]) -->
- [H],
- string(T).
-
-%% blanks// is det.
-%
-% Skip zero or more white-space characters.
-
-blanks -->
- blank, !,
- blanks.
-blanks -->
- [].
-
-%% blank// is semidet.
-%
-% Take next =space= character from input. Space characters include
-% newline.
-%
-% @see white//0
-
-blank -->
- [C],
- { nonvar(C),
- code_type(C, space)
- }.
-
-%% nonblanks(-Codes)// is det.
-%
-% Take all =graph= characters
-
-nonblanks([H|T]) -->
- [H],
- { code_type(H, graph)
- }, !,
- nonblanks(T).
-nonblanks([]) -->
- [].
-
-%% nonblank(-Code)// is semidet.
-%
-% Code is the next non-blank (=graph=) character.
-
-nonblank(H) -->
- [H],
- { code_type(H, graph)
- }.
-
-%% blanks_to_nl// is semidet.
-%
-% Take a sequence of blank//0 codes if banks are followed by a
-% newline or end of the input.
-
-blanks_to_nl -->
- "\n", !.
-blanks_to_nl -->
- blank, !,
- blanks_to_nl.
-blanks_to_nl -->
- eos.
-
-%% whites// is det.
-%
-% Skip white space _inside_ a line.
-%
-% @see blanks//0 also skips newlines.
-
-whites -->
- white, !,
- whites.
-whites -->
- [].
-
-%% white// is semidet.
-%
-% Take next =white= character from input. White characters do
-% _not_ include newline.
-
-white -->
- [C],
- { nonvar(C),
- code_type(C, white)
- }.
-
-
- /*******************************
- * CHARACTER STUFF *
- *******************************/
-
-%% alpha_to_lower(+C)// is det.
-%% alpha_to_lower(-C)// is semidet.
-%
-% Read a letter (class =alpha=) and return it as a lowercase
-% letter. In output mode this simply emits the character.
-
-alpha_to_lower(L) -->
- { integer(L) }, !,
- [L].
-alpha_to_lower(L) -->
- [C],
- { code_type(C, alpha),
- code_type(C, to_upper(L))
- }.
-
-
- /*******************************
- * NUMBERS *
- *******************************/
-
-%% digits(?Chars)// is det.
-%% digit(?Char)// is det.
-%% integer(?Integer)// is det.
-%
-% Number processing. The predicate digits//1 matches a posibly
-% empty set of digits, digit//1 processes a single digit and
-% integer processes an optional sign followed by a non-empty
-% sequence of digits into an integer.
-
-digits([H|T]) -->
- digit(H), !,
- digits(T).
-digits([]) -->
- [].
-
-digit(C) -->
- [C],
- { code_type(C, digit)
- }.
-
-integer(I, Head, Tail) :-
- integer(I), !,
- format(codes(Head, Tail), '~w', [I]).
-integer(I) -->
- int_codes(Codes),
- { number_codes(I, Codes)
- }.
-
-int_codes([C,D0|D]) -->
- sign(C), !,
- digit(D0),
- digits(D).
-int_codes([D0|D]) -->
- digit(D0),
- digits(D).
-
-
-%% float(?Float)// is det.
-%
-% Process a floating point number. The actual conversion is
-% controlled by number_codes/2.
-
-float(F, Head, Tail) :-
- float(F), !,
- with_output_to(codes(Head, Tail), write(F)).
-float(F) -->
- number(F),
- { float(F) }.
-
-%% number(+Number)// is det.
-%% number(-Number)// is semidet.
-%
-% Generate extract a number. Handles both integers and floating
-% point numbers.
-
-number(N, Head, Tail) :-
- number(N), !,
- format(codes(Head, Tail), '~w', N).
-number(N) -->
- int_codes(I),
- ( dot,
- digit(DF0),
- digits(DF)
- -> {F = [0'., DF0|DF]}
- ; {F = ""}
- ),
- ( exp
- -> int_codes(DI),
- {E=[0'e|DI]}
- ; {E = ""}
- ),
- { append([I, F, E], Codes),
- number_codes(N, Codes)
- }.
-
-sign(0'-) --> "-".
-sign(0'+) --> "+".
-
-dot --> ".".
-
-exp --> "e".
-exp --> "E".
-
- /*******************************
- * HEX NUMBERS *
- *******************************/
-
-%% xinteger(+Integer)// is det.
-%% xinteger(-Integer)// is semidet.
-%
-% Generate or extract an integer from a sequence of hexadecimal
-% digits.
-
-xinteger(Val, Head, Tail) :-
- integer(Val),
- format(codes(Head, Tail), '~16r', [Val]).
-xinteger(Val) -->
- xdigit(D0),
- xdigits(D),
- { mkval([D0|D], 16, Val)
- }.
-
-%% xdigit(-Weight)// is semidet.
-%
-% True if the next code is a hexdecimal digit with Weight. Weight
-% is between 0 and 15.
-
-xdigit(D) -->
- [C],
- { code_type(C, xdigit(D))
- }.
-
-%% xdigits(-WeightList)// is det.
-%
-% List of weights of a sequence of hexadecimal codes. WeightList
-% may be empty.
-
-xdigits([D0|D]) -->
- xdigit(D0), !,
- xdigits(D).
-xdigits([]) -->
- [].
-
-mkval([W0|Weights], Base, Val) :-
- mkval(Weights, Base, W0, Val).
-
-mkval([], _, W, W).
-mkval([H|T], Base, W0, W) :-
- W1 is W0*Base+H,
- mkval(T, Base, W1, W).
-
-
- /*******************************
- * END-OF-STRING *
- *******************************/
-
-%% eos//
-%
-% True if at end of input list.
-
-eos([], []).
-
- /*******************************
- * GENERATION *
- *******************************/
-
-%% atom(+Atom)// is det.
-%
-% Generate codes of Atom. Current implementation uses write/1,
-% dealing with any Prolog term.
-
-atom(Atom, Head, Tail) :-
- format(codes(Head, Tail), '~w', [Atom]).
diff --git a/packages/http/examples/README b/packages/http/examples/README
deleted file mode 100644
index 81b85e73f..000000000
--- a/packages/http/examples/README
+++ /dev/null
@@ -1,68 +0,0 @@
-This is a simple demo of the HTTP server facilities, providing a simple
-body and the three documented server instantiations.
-
----+ The server main programs are:
-
- $ demo_threads.pl :
- Run threaded server. Requires SWI-Prolog with thread-support.
- The server is started at port 3000 using server/0. server/2
- allows to specify options. tm/0 provides a graphical display
- of the runing threads. See source-file.
-
- $ demo_xpce.pl :
- Run XPCE-based event-driven server. Requires XPCE. Use
- ?- server(3000). to start the server at port 3000.
-
- $ demo_inetd :
- To install this, adjust the first line of this file to point
- to the installed Prolog executable and add the following line
- to /etc/inetd.conf (adjust as needed):
-
- 4001 stream tcp nowait nobody /usr/sbin/tcpd /usr/lib/pl-5.1.4/library/http/demo/demo_inetd
-
----+ Session management demo:
-
- $ calc.pl :
- Multi-threaded server with session management using the
- html_write.pl library. See source for usage.
-
----+ File serving demo:
-
- $ demo_files.pl :
- Is a multi-threaded server that serves static files and
- directory indices.
-
----+ Client demo
-
- $ demo_client.pl :
- Simple multi-threaded client to test the server under
- different conditions. Requires SWI-Prolog with thread-support.
- See source for usage.
-
----+ Performance testing
-
-A very early start of some routines to validate the server platform.
-Eventually, stress_server.pl will serve different tests from multiple
-locations and stress_client.pl will contain client code to run
-individual tests as well as doing multi-threaded tests.
-
- $ stress_server.pl :
- Server platform.
-
- $ stress_client.pl :
- Client.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/http/examples/calc.pl b/packages/http/examples/calc.pl
deleted file mode 100644
index 125b5fe86..000000000
--- a/packages/http/examples/calc.pl
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $Id$
-
- Part of SWI-Prolog
-
- Author: Jan Wielemaker
- E-mail: wielemak@science.uva.nl
- WWW: http://www.swi-prolog.org
- Copyright (C): Public domain
-*/
-
-:- use_module(library('http/thread_httpd')).
-:- use_module(library('http/html_write')).
-:- use_module(library('http/http_session')).
-:- use_module(library('http/http_error')).
-
-/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-This demo shows session state management in a very simple calculator
-package. It also demonstrates the use of the html_write library. To use
-it, start Prolog, load this file and run
-
- ?- server.
-
-Now direct your browser to http://localhost:3000/
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
-
-server :-
- server(3000, []).
-
-server(Port, Options) :-
- http_server(reply,
- [ port(Port),
- timeout(20)
- | Options
- ]).
-
-reply(Request) :-
- memberchk(path(Path), Request),
- reply(Path, Request).
-
-reply(/, _Request) :-
- http_session_retractall(formula(_)),
- Formula = 0,
- http_session_assert(formula(Formula)),
- page(Formula).
-
-reply('/calc', Request) :-
- memberchk(search(Search), Request),
- memberchk(operation=Op, Search),
- memberchk(value=AtomVal, Search),
- atom_number(AtomVal, Val),
- http_session_retract(formula(Formula0)),
- debug(calc, 'Formula0 = ~w', [Formula0]),
- Formula =.. [Op, Formula0, Val],
- http_session_assert(formula(Formula)),
- page(Formula).
-
-
-page(Formula) :-
- reply_page('HTTP Session DEMO',
- [ h2('Simple session demo'),
- form([ action('/calc'),
- method('GET')
- ],
- table([align(center), border(1)],
- [ tr(td(\formula(Formula))),
- tr(td([ \ops,
- input([ name(value) ]),
- input([ type(submit),
- value('Calc!')
- ])
- ]))
- ]))
- ]).
-
-formula(Formula) -->
- { sformat(S, '~w', [Formula]),
- Value is Formula
- },
- html([ S, ' = ', Value ]).
-
-ops -->
- html(select(name(operation),
- [ option([selected], +),
- option([], -),
- option([], /),
- option([], *)
- ])).
-
-reply_page(Title, Content) :-
- phrase(page(title(Title), Content), HTML),
- format('Content-type: text/html~n~n'),
- print_html(HTML).
diff --git a/packages/http/examples/demo_body.pl b/packages/http/examples/demo_body.pl
deleted file mode 100644
index f14b60317..000000000
--- a/packages/http/examples/demo_body.pl
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $Id$
-
- Part of SWI-Prolog
-
- Author: Jan Wielemaker
- E-mail: jan@swi.psy.uva.nl
- WWW: http://www.swi-prolog.org
- Copyright (C): 1985-2002, University of Amsterdam
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- As a special exception, if you link this library with other files,
- compiled with a Free Software compiler, to produce an executable, this
- library does not by itself cause the resulting executable to be covered
- by the GNU General Public License. This exception does not however
- invalidate any other reasons why the executable file might be covered by
- the GNU General Public License.
-*/
-
-:- module(demo_body,
- [ reply/1
- ]).
-:- use_module(library('http/http_client')).
-:- use_module(library('http/http_mime_plugin')). % Decode multipart data
-:- use_module(library('http/http_image')). % make XPCE generate images
-
-
-:- style_check(-atom). % allow long atoms
-
-reply(_) :-
- flag(request, N, N+1),
- fail.
-
-% /quit
-%
-% Explicitely close the connection
-
-reply(Request) :-
- member(path('/quit'), Request), !,
- format('Connection: close~n', []),
- format('Content-type: text/html~n~n', []),
- format('Bye Bye~n').
-
-% /xpce?class=box
-%
-% Make XPCE reply with a graphics image. The demo-body pce_reply/1
-% is called embedded in a message to XPCE to force the XPCE
-% incremental garbage collector to reclaim objects created while
-% serving the request. pce_reply/1 replies to ?class=box using a
-% blue box with rounded corners.
-
-reply(Request) :-
- member(path('/xpce'), Request), !,
- send(@prolog, call, demo_body:pce_reply(Request)).
-
-% /env
-%
-% Reply with the output of printenv (Unix systems only).
-
-reply(Request) :-
- member(path('/env'), Request), !,
- expand_file_name(~, Home),
- format('Content-type: text/html~n~n', []),
- format('~n', []),
- flag(request, RN, RN),
- format('Request ~d~n', [RN]),
- format('~n', []),
- format('HOME = ~w~n~n', [Home]),
- open(pipe(printenv), read, Fd),
- copy_stream_data(Fd, current_output),
- close(Fd),
- format('
~n', []),
- format('~n', []).
-
-% /upload
-% /upload_reply
-%
-% Provide a form for uploading a file, and deal with the resulting
-% upload. Contributed by Nicos Angelopoulos.
-
-reply(Request) :-
- member(path('/upload'), Request), !,
- format('Content-type: text/html~n~n', []),
- format('~n', []),
- format('