Пример #1
0
SeqFileInput HttpClient::send() {
	if (request == null) {
		try {
			sendRequest(naturalNull, psoAvoid100);
			request->closeOutput();
			loadResponse();
		} catch (NetworkException &) {
			if (connectionReused) {
				closeConnection();
				return send();
			}
			throw;
		} catch (LightSpeed::IOException &) {
			if (connectionReused) {
				closeConnection();
				return send();
			}
			throw;
		}
	} else {
		request->closeOutput();
		loadResponse();
	}
	return SeqFileInput(response.get());
}
Пример #2
0
SeqFileInput HttpClient::send(ConstStrA body) {
	if (request == null) {
		try {
			sendRequest(body.length(), psoAvoid100);
			request->writeAll(body.data(), body.length());
			request->closeOutput();
			loadResponse();
			return SeqFileInput(response.get());
		} catch (NetworkException &) {
			if (connectionReused) {
				closeConnection();
				return send(body);
			}
			throw;
		}
	} else {
		return send();
	}
}
Пример #3
0
	Stream openInclude(String wpath) {
		if (includeStack.empty()) {
			FilePath base(AppBase::current().getAppPathname());
			FilePath p = base / wpath;
			includeStack.insertFirst(p);
			wpath = p;
		} else {
			const FilePath &base = includeStack.getFirst();
			FilePath p = base / wpath;
			includeStack.insertFirst(p);
			wpath = p;
		}
		try {
			SeqFileInput input(wpath,openFlags);
			PInputStream bufferedInput = new IOBuffer<>(input.getStream());
			return Stream(SeqFileInput(bufferedInput),*this);
		} catch (Exception &e) {
			throw FailedToParseINIFileException(THISLOCATION,wpath) << e;
		}

	}
Пример #4
0
SeqFileInput HttpClient::receiveResponse() {
	loadResponse();
	return SeqFileInput(response.get());
}