/*DOC:
===absolute-url===
- (absolute-url URL [#http | :http BOOL] [#https | :https BOOL] [:port NUM]) -> STRING
+ (absolute-url URL [#http | :http BOOL] [#https | :https BOOL] [#no-proto | :no-proto BOOL] [:port NUM]) -> STRING
*/
//#AFUNC absolute-url ml_absolute_url
enum {
PROTO_HTTP,
PROTO_HTTPS,
+ PROTO_NONE
} proto;
int port = 0;
ustring* u;
static paramList kwlist[] = {
{CharConst ("http"), true},
{CharConst ("https"), true},
+ {CharConst ("no-proto"), true},
{CharConst ("port"), false},
{NULL, 0, 0}
};
proto = PROTO_HTTP;
if (keywords[1] && eval_bool (keywords[1], mlenv))
proto = PROTO_HTTPS;
- if (evkw (2, t)) {
+ if (keywords[2] && eval_bool (keywords[2], mlenv))
+ proto = PROTO_NONE;
+ if (evkw (3, t)) {
n = to_int (t ());
if (1 <= n && n <= 65535)
port = n;
case PROTO_HTTPS:
ans = new ustring (CharConst ("https://"));
break;
+ case PROTO_NONE:
+ ans = new ustring (CharConst ("//"));
+ break;
default:
assert (0);
}