mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-22 08:02:06 +02:00
synced with main repository
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# HTTPLoadTest.vmsbuild
|
||||
#
|
||||
# $Id: //poco/Main/Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild#1 $
|
||||
# $Id: //poco/svn/Net/samples/HTTPLoadTest/HTTPLoadTest.vmsbuild#1 $
|
||||
#
|
||||
EXE=HTTPLoadTest
|
||||
HTTPLoadTest
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Makefile
|
||||
#
|
||||
# $Id: //poco/Main/Net/samples/HTTPLoadTest/Makefile#1 $
|
||||
# $Id: //poco/svn/Net/samples/HTTPLoadTest/Makefile#1 $
|
||||
#
|
||||
# Makefile for Poco HTTPLoadTest
|
||||
#
|
||||
|
@@ -1,7 +1,7 @@
|
||||
//
|
||||
// HTTPLoadTest.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp#5 $
|
||||
// $Id: //poco/svn/Net/samples/HTTPLoadTest/src/HTTPLoadTest.cpp#3 $
|
||||
//
|
||||
// This sample demonstrates the HTTPClientSession class.
|
||||
//
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "Poco/Runnable.h"
|
||||
#include "Poco/Stopwatch.h"
|
||||
#include "Poco/NumberParser.h"
|
||||
#include "Poco/StreamCopier.h"
|
||||
#include "Poco/NullStream.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include "Poco/Util/Application.h"
|
||||
#include "Poco/Util/Option.h"
|
||||
@@ -74,14 +76,17 @@ using Poco::NumberParser;
|
||||
using Poco::Path;
|
||||
using Poco::URI;
|
||||
using Poco::Exception;
|
||||
using Poco::StreamCopier;
|
||||
using Poco::NullOutputStream;
|
||||
|
||||
|
||||
class HTTPClient : public Runnable
|
||||
{
|
||||
public:
|
||||
HTTPClient(const URI& uri, int repetitions, bool cookies=false, bool verbose=false):
|
||||
_uri(uri),
|
||||
_cookies(cookies),
|
||||
_verbose(verbose),
|
||||
_cookies(cookies),
|
||||
_repetitions(repetitions),
|
||||
_usec(0),
|
||||
_success(0)
|
||||
@@ -123,6 +128,8 @@ public:
|
||||
sw.restart();
|
||||
session.sendRequest(req);
|
||||
std::istream& rs = session.receiveResponse(res);
|
||||
NullOutputStream nos;
|
||||
StreamCopier::copyStream(rs, nos);
|
||||
sw.stop();
|
||||
_success += HTTPResponse::HTTP_OK == res.getStatus() ? 1 : 0;
|
||||
if (_cookies) res.getCookies(cookies);
|
||||
@@ -218,10 +225,10 @@ class HTTPLoadTest: public Application
|
||||
public:
|
||||
HTTPLoadTest():
|
||||
_helpRequested(false),
|
||||
_repetitions(1),
|
||||
_threads(1),
|
||||
_verbose(false),
|
||||
_cookies(false)
|
||||
_cookies(false),
|
||||
_repetitions(1),
|
||||
_threads(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user