LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
handlenetworkreply.cpp
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #include "handlenetworkreply.h"
10 
11 namespace LC::Util
12 {
13  ReplyWithHeaders::ReplyWithHeaders (QNetworkReply *reply)
14  : Code_ { reply->attribute (QNetworkRequest::HttpStatusCodeAttribute).toInt () }
15  , Data_ { reply->readAll () }
16  {
17  const auto& raws = reply->rawHeaderPairs ();
18 
19  Headers_.reserve (raws.size ());
20  for (const auto& [header, value] : raws)
21  Headers_ [header] << value;
22  }
23 
24  ReplyError::ReplyError (QNetworkReply *reply)
25  : Error_ { reply->error () }
26  , ErrorString_ { reply->errorString () }
27  , HttpStatusCode_ { reply->attribute (QNetworkRequest::HttpStatusCodeAttribute) }
28  {
29  }
30 }
LC::Util
Definition: icoreproxy.h:33
LC::Util::ReplyError::ReplyError
ReplyError(QNetworkReply *)
Definition: handlenetworkreply.cpp:30
LC::Util::ReplyWithHeaders::ReplyWithHeaders
ReplyWithHeaders(QNetworkReply *)
Definition: handlenetworkreply.cpp:19
handlenetworkreply.h