Commit abaa1335 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-12-04 21:20:39 by afrisch] Add support for netclient

Original author: afrisch
Date: 2003-12-04 21:20:39+00:00
parent b8230ce6
...@@ -28,11 +28,19 @@ pxp => 1.9.94.2 ...@@ -28,11 +28,19 @@ pxp => 1.9.94.2
Furthermore if you want to load xml, html, and schema files remotely on the Furthermore if you want to load xml, html, and schema files remotely on the
web (http, https, ftp, ...: e.g. load_html "http://www.cduce.org") you will web (http, https, ftp, ...: e.g. load_html "http://www.cduce.org") you will
also need: also need either:
ocurl => 0.15 ocurl => 0.15
http://sourceforge.net/projects/ocurl/ http://sourceforge.net/projects/ocurl/
or
netclient => 0.90.1
http://www.ocaml-programming.de/programming/netclient.html
netclient support only the http protocol. curl supports in addition https,
ftp, and other protocols.
Important notes: Important notes:
...@@ -146,8 +154,12 @@ PXP_WLEX=false: use ocamllex for parsing UTF-8 XML files ...@@ -146,8 +154,12 @@ PXP_WLEX=false: use ocamllex for parsing UTF-8 XML files
EXPAT=true: build expat support (see below) EXPAT=true: build expat support (see below)
default: false default: false
OCURL=true: build ocurl support CURL=true: build ocurl support
default: false
NETCLIENT=true: build netclient support
default: false default: false
(note: if the support for both CURL and NETCLIENT are included, curl is used)
PREFIX=/usr/local by default: where to install CDuce files (see PREFIX=/usr/local by default: where to install CDuce files (see
Makefile.conf) Makefile.conf)
......
...@@ -14,7 +14,9 @@ PXP_WLEX = false ...@@ -14,7 +14,9 @@ PXP_WLEX = false
EXPAT = false EXPAT = false
# use curl library for load remote xml files and schemas # use curl library for load remote xml files and schemas
CURL = true CURL = false
NETCLIENT = true
# Installation directory # Installation directory
# cduce and dtd2cduce => $(PREFIX)/bin # cduce and dtd2cduce => $(PREFIX)/bin
......
...@@ -43,6 +43,11 @@ ifeq ($(CURL), true) ...@@ -43,6 +43,11 @@ ifeq ($(CURL), true)
SYNTAX += -symbol CURL= SYNTAX += -symbol CURL=
endif endif
ifeq ($(NETCLIENT), true)
PACKAGES += netclient
SYNTAX += -symbol NETCLIENT=
endif
SYNTAX_PARSER = -syntax camlp4o $(SYNTAX:%=-ppopt %) SYNTAX_PARSER = -syntax camlp4o $(SYNTAX:%=-ppopt %)
CAMLC_P = ocamlc -g CAMLC_P = ocamlc -g
......
...@@ -108,8 +108,8 @@ schema/schema_parser.cmx: misc/q_symbol.cmo misc/encodings.cmx types/intervals.c ...@@ -108,8 +108,8 @@ schema/schema_parser.cmx: misc/q_symbol.cmo misc/encodings.cmx types/intervals.c
runtime/value.cmx schema/schema_parser.cmi runtime/value.cmx schema/schema_parser.cmi
parser/location.cmo: misc/q_symbol.cmo parser/location.cmi parser/location.cmo: misc/q_symbol.cmo parser/location.cmi
parser/location.cmx: misc/q_symbol.cmo parser/location.cmi parser/location.cmx: misc/q_symbol.cmo parser/location.cmi
parser/url.cmo: misc/q_symbol.cmo parser/location.cmi parser/url.cmi parser/url.cmo: misc/q_symbol.cmo parser/url.cmi
parser/url.cmx: misc/q_symbol.cmo parser/location.cmx parser/url.cmi parser/url.cmx: misc/q_symbol.cmo parser/url.cmi
parser/ulexer.cmo: misc/q_symbol.cmo parser/ulexer.cmi parser/ulexer.cmo: misc/q_symbol.cmo parser/ulexer.cmi
parser/ulexer.cmx: misc/q_symbol.cmo parser/ulexer.cmi parser/ulexer.cmx: misc/q_symbol.cmo parser/ulexer.cmi
parser/ast.cmo: misc/q_symbol.cmo types/builtin_defs.cmi types/chars.cmi types/ident.cmo \ parser/ast.cmo: misc/q_symbol.cmo types/builtin_defs.cmi types/chars.cmi types/ident.cmo \
......
...@@ -13,10 +13,21 @@ ifdef CURL then ...@@ -13,10 +13,21 @@ ifdef CURL then
Curl.set_writefunction conn (Buffer.add_string buff); Curl.set_writefunction conn (Buffer.add_string buff);
Curl.perform conn; Curl.perform conn;
Buffer.contents buff Buffer.contents buff
else
ifdef NETCLIENT then
let load_url s =
match Neturl.extract_url_scheme s with
| "http" -> Http_client.Convenience.http_get s
| sc ->
let msg =
Printf.sprintf "Error: netclient does not handle the %s protocol" sc
in
raise (Location.Generic msg)
else else
let load_url s = let load_url s =
let msg = let msg =
Printf.sprintf "Error \"%s\": \nfor URLs you need to compile CDuce with CURL support" s Printf.sprintf
"Error \"%s\": \nTo fetch external URLs, you need to compile CDuce with curl and/or netclient" s
in in
raise (Location.Generic msg) raise (Location.Generic msg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment