while (iter.hasNext()) {
Map.Entry<Value,Value> entry = iter.next();
String optionName = entry.getKey().toString();
Value optionValue = entry.getValue();
if (optionName.equals("method"))
_httpStream.setMethod(optionValue.toString());
else if (optionName.equals("header")) {
String option = optionValue.toString();
int start = 0;
int len = option.length();
while (start < len) {
int end = option.indexOf("\r\n", start);
if (end < 0)
end = len;
int i = option.indexOf(':', start);
if (i < 0 || i > end) {
_httpStream.setAttribute(option.substring(start, end), "");
break;
}
else {
String name = option.substring(start, i);
String value = option.substring(i + 1, end).trim();
_httpStream.setAttribute(name, value);
}
start = end += 2;
}
}
else if (optionName.equals("user_agent"))
_httpStream.setAttribute("User-Agent", optionValue.toString());
else if (optionName.equals("content"))
_bodyStart = optionValue.toBinaryValue(env).toBytes();
else if (optionName.equals("proxy"))
env.stub("StreamContextResource::proxy option");
else if (optionName.equals("request_fulluri"))
env.stub("StreamContextResource::request_fulluri option");
else if (optionName.equals("protocol_version")) {
double version = optionValue.toDouble();
if (version == 1.1) {
}
else if (version == 1.0)
_httpStream.setHttp10();
else
env.stub("StreamContextResource::protocol_version " + version);
}
else if (optionName.equals("timeout")) {
long ms = (long) optionValue.toDouble() * 1000;
_httpStream.setSocketTimeout(ms);
}
else if (optionName.equals("ignore_errors"))
env.stub("ignore_errors::ignore_errors option");
else