}
}
-static void url_sub (const ustring& url, HTTPSend* http) {
+static void url_sub (const ustring& url, HTTPSend* http, bool noencode) {
ustring str;
uiterator b, e;
umatch m;
} else {
http->proto = uHttp;
http->reqhost = ustring (m[2].first, m[2].second);
- http->path = str;
+ if (noencode) {
+ http->path = str;
+ } else {
+ http->path = ustring (b, m[0].second - 1);
+ http->path.append (percentEncode_path (m[0].second - 1, e));
+ }
if (http->host.port == 0)
http->host.port = 80;
}
http->host.port = to_uint32 (ustring (m[5].first, m[5].second));
else
http->host.port = 0;
- http->path = percentEncode_path (m[0].second - 1, e);
+ if (noencode)
+ http->path = ustring (m[0].second - 1, e);
+ else
+ http->path = percentEncode_path (m[0].second - 1, e);
}
} else {
// throw (str + ": bad URL.");
http->proto.resize (0);
http->host.host.resize (0);
http->host.port = 0;
- http->path = percentEncode_path (str);
+ if (noencode)
+ http->path = str;
+ else
+ http->path = percentEncode_path (str);
}
}
[:proxy-id STRING] [:proxy-password STRING | :proxy-pw STRING]
[#sjis] [#euc-jp] [:iconv NAME]
[:on-error FUNCTION]
- [#no-verify]
+ [#no-verify] [#no-encode]
[SUBFUNCTION...]) -> LAST VALUE
*/
MNodePtr headerquery;
MNodePtr errfn;
bool fnoverify = false;
+ bool fnoencode = false;
std::vector<MNode*> params;
std::vector<MNode*> keywords;
MNode* rest;
{CharConst ("raw-file-serial"), false}, // 27
{CharConst ("raw-file-named"), false}, // 28
{CharConst ("raw-file-static"), false}, // 29
+ {CharConst ("no-encode"), true}, // 30
{NULL, 0, 0}
};
obj.http->rawqueryfile = mlenv->env->path_storage_file (eval_str (keywords[28], mlenv));
if (keywords[29]) // raw-file-static
obj.http->rawqueryfile = mlenv->env->path_static_file (eval_str (keywords[29], mlenv));
+ if (keywords[30]) // no-encode
+ fnoencode = eval_bool (keywords[30], mlenv);
- url_sub (url, obj.http);
+ url_sub (url, obj.http, fnoencode);
if (obj.http->proto.empty ()) {
throw (obj.http->path + ": bad URL.");
}