Exemple #1
0
void BoshTransport::executeRequest (const ByteArrayPtr & data, int timeOutMs, const HttpContext::RequestCallback & callback) {
	HttpRequest req;
	req.start("POST", mUrl);
	req.addHeader("Content-Type", "text/xml; charset=utf-8");
	req.addContent(data);
	req.end();
	mContext.request(req, timeOutMs, callback);
}
Exemple #2
0
int testReuse () {
	// Connections shall be kept open...
	// Note: Prosody itself doesn't seem to do that
	// but NGINX does it.
	HttpContext httpContext;
	BoshNodeBuilder builder;
	builder.addAttribute("content", "text/xml; charset=utf-8");
	builder.addAttribute("from", "autotest1@localhost");
	builder.addAttribute("hold", "1");
	builder.addAttribute("to", "localhost");
	builder.addAttribute ("rid", "3000");
	builder.addAttribute ("xmlns","http://jabber.org/protocol/httpbind");

	HttpRequest req;
	req.start ("POST", "https://localhost/http-bind/");
	req.addHeader("Content-Type", "text/xml; charset=utf-8");
	req.addContent (sf::createByteArrayPtr(builder.toString()));
	req.end();
	std::pair<Error, HttpResponsePtr> res = httpContext.syncRequest(req, 60000);
	tcheck1(!res.first);
	test::millisleep_locked(1000);
	tcheck1 (httpContext.pendingConnections() == 1);
	return 0;
}