Commit 8621f758 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2003-12-03 11:37:24 by beppe] moved from misc directory

Original author: beppe
Date: 2003-12-03 11:37:24+00:00
parent e10a24b1
type url = Filename of string | Url of string
let is_url s =
try let _ = Neturl.extract_url_scheme s in true
with Neturl.Malformed_URL -> false
ifdef CURL then
let load_url s =
let buff = Buffer.create 4096 in
let conn = Curl.init () in
Curl.set_url conn s;
Curl.set_writefunction conn (Buffer.add_string buff);
Curl.perform conn;
Buffer.contents buff
else
let load_url s =
let msg =
Printf.sprintf "\"%s\": for URLs you need to compile CDuce with CURL support" s
in
raise (Location.Generic msg)
let process s =
if is_url s then Url (load_url s)
else Filename s
type url = Filename of string | Url of string
(* It recognizes if it is a valid url. If it is connect and bufferize
* in a string otherwise consider it as filename
*)
val process: string -> url
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