Page tree
Skip to end of metadata
Go to start of metadata

public static FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousGet ( const FB::BrowserHostPtr host,
const FB::URI uri,
const bool  cache = true,
const size_t  bufferSize = 128*1024 

Do not call from the main thread! Starts a Synchronous HTTP get request.

Call this static method to make a synchronous HTTP get request through the browser from a thread that you have started. IMPORTANT: This must never be called on the main thread!

void FBTestPluginAPI::getURL(const std::string& url, const FB::JSObjectPtr& callback)
FB::HttpStreamResponsePtr resp = FB::SimpleStreamHelper::SynchronousGet(m_host, FB::URI::fromString(url));
if (resp->success) {
std::string dstr(reinterpret_cast<const char*>(resp->data.get()), size);
} else {
// The request failed
hostconst FB::BrowserHostPtr& BrowserHostPtr to use to create the stream
uriconst FB::URI& URI to request
cacheconst bool true if cache can be used
bufferSizeconst size_t Specifies the size of the buffer to use internally
See Also
1.7 use SynchronousRequest

Definition at line 130 of file SimpleStreamHelper.cpp.

References FB::BrowserStreamRequest::setBufferSize(), and FB::BrowserStreamRequest::setCacheable().

132 {
133  FB::BrowserStreamRequest req(uri, "GET");
134  req.setCacheable(cache);
135  req.setBufferSize(bufferSize);
136  return SynchronousRequest(host, req);
137 }
Information about an HTTP request to be made.
static HttpStreamResponsePtr SynchronousRequest(const FB::BrowserHostPtr &host, const BrowserStreamRequest &req)
Do not call from the main thread! Starts a Synchronous HTTP request.

Here is the call graph for this function:

  • No labels