Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (20 sloc) 0.735 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
(* Ohm is © 2012 Victor Nicollet *)

open Util
open BatPervasives
module BS = BatString

open Action_Common

class type ['param] server = object
  method protocol : 'param -> [`HTTP|`HTTPS]
  method domain : 'param -> string
  method port : 'param -> int
  method cookie_domain : 'param -> string option
  method matches : [`HTTP|`HTTPS] -> string -> int -> 'param option
end

let server_root server param =
  let protocol = server # protocol param in
  String.concat ""
    ( (match protocol with `HTTP -> "http://" | `HTTPS -> "https://")
      :: (server # domain param)
      :: (match protocol, server # port param with
| `HTTPS, 443 | `HTTP, 80 -> []
| _, port -> [ ":" ; string_of_int port ]))
Something went wrong with that request. Please try again.