FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
public static FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousPost ( const FB::BrowserHostPtr host,
const FB::URI uri,
const std::string &  postdata,
const bool  cache = true,
const size_t  bufferSize = 128*1024 

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

Call this static method to make a synchronous HTTP POST 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::SynchronousPost(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
postdataconst std::string& Post data to send
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 139 of file SimpleStreamHelper.cpp.

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

141 {
142  FB::BrowserStreamRequest req(uri, "POST");
143  req.setCacheable(cache);
144  req.setBufferSize(bufferSize);
145  req.setPostData(postdata);
146  return SynchronousRequest(host, req);
147 }
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: