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

[r2003-12-03 11:36:58 by beppe] Moved to parser directory

Original author: beppe
Date: 2003-12-03 11:36:58+00:00
parent 32f86c50
open Curl
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
let load_url s =
let buff = Buffer.create 4096 in
let conn = init () in
set_url conn s;
set_writefunction conn (Buffer.add_string buff);
perform conn;
Buffer.contents buff
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