2011-06-08 05:36:45 -04:00
|
|
|
#include "Header.h"
|
|
|
|
#include "WebPage.h"
|
2012-04-04 18:18:17 -04:00
|
|
|
#include "WebPageManager.h"
|
2011-06-08 05:36:45 -04:00
|
|
|
#include "NetworkAccessManager.h"
|
|
|
|
|
2012-07-08 15:04:30 -04:00
|
|
|
Header::Header(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
|
2011-06-08 05:36:45 -04:00
|
|
|
}
|
|
|
|
|
2012-03-16 19:58:58 -04:00
|
|
|
void Header::start() {
|
|
|
|
QString key = arguments()[0];
|
|
|
|
QString value = arguments()[1];
|
2013-03-18 08:11:59 -04:00
|
|
|
NetworkAccessManager* networkAccessManager = manager()->networkAccessManager();
|
2011-06-08 05:36:45 -04:00
|
|
|
if (key.toLower().replace("-", "_") == "user_agent") {
|
|
|
|
page()->setUserAgent(value);
|
|
|
|
} else {
|
2011-06-25 07:31:19 -04:00
|
|
|
networkAccessManager->addHeader(key, value);
|
2011-06-08 05:36:45 -04:00
|
|
|
}
|
2013-02-11 18:31:41 -05:00
|
|
|
finish(true);
|
2011-06-08 05:36:45 -04:00
|
|
|
}
|