libqtaws
0.1.0
UnofficialAWSlibraryforQt-InternalDocumentation
|
Private implementation for AwsAbstractSignature. More...
Public Member Functions | |
virtual | ~AwsAbstractSignaturePrivate () |
AwsAbstractSignaturePrivate destructor. More... | |
AwsAbstractSignaturePrivate (AwsAbstractSignature *const q) | |
Constructs a new AwsAbstractSignaturePrivate object. More... | |
QString | canonicalPath (const QUrl &url) const |
Create an AWS Signature canonical path. More... | |
QByteArray | canonicalQuery (const QUrlQuery &query) const |
Create an AWS Signature canonical query. More... | |
QString | httpMethod (const QNetworkAccessManager::Operation operation) const |
Create an AWS Signature request method string. More... | |
bool | setQueryItem (QUrlQuery &query, const QString &key, const QString &value, const bool warnOnNonIdenticalDuplicate=true) const |
Set a query item, checking for existing values first. More... | |
Protected Attributes | |
AwsAbstractSignature *const | q_ptr |
Internal q-pointer. | |
Friends | |
class | TestAwsAbstractSignature |
Private implementation for AwsAbstractSignature.
Definition at line 32 of file awsabstractsignature_p.h.
|
virtual |
AwsAbstractSignaturePrivate destructor.
This virtual destructor does nothing (yet) - its here to allow for safe polymorphic destruction.
Definition at line 116 of file awsabstractsignature.cpp.
AwsAbstractSignaturePrivate::AwsAbstractSignaturePrivate | ( | AwsAbstractSignature *const | q | ) |
Constructs a new AwsAbstractSignaturePrivate object.
q | Pointer to this object's public AwsAbstractSignature instance. |
Definition at line 103 of file awsabstractsignature.cpp.
QString AwsAbstractSignaturePrivate::canonicalPath | ( | const QUrl & | url | ) | const |
Create an AWS Signature canonical path.
This function simply returns the fully-URL-encoded path. However, if the path is empty, then a single '/' is returned, as is required by Amazon for both V2 and V4 signatures (and presumably other versions too).
url | URL from which to extract the path. |
Definition at line 135 of file awsabstractsignature.cpp.
Referenced by AwsSignatureV2Private::canonicalRequest(), AwsSignatureV3Private::canonicalRequest(), and AwsSignatureV4Private::canonicalRequest().
QByteArray AwsAbstractSignaturePrivate::canonicalQuery | ( | const QUrlQuery & | query | ) | const |
Create an AWS Signature canonical query.
This function returns an HTTP query string in Amazon's canonical form. That is, all query parameters are sorted by keys (but not keys-then-values), then joined with &
separators, in key=value
pairs with both keys and values being URL percent encoded.
query | Query to encode the HTTP query string from. |
Definition at line 178 of file awsabstractsignature.cpp.
Referenced by AwsSignatureV2Private::canonicalRequest(), AwsSignatureV3Private::canonicalRequest(), and AwsSignatureV4Private::canonicalRequest().
QString AwsAbstractSignaturePrivate::httpMethod | ( | const QNetworkAccessManager::Operation | operation | ) | const |
Create an AWS Signature request method string.
This function simply converts QNetworkAccessManager operations (enum values) to strings appropriate to use in AWS signatures.
operation | The network operation to convert to string. |
operation
, or an empty string if the operation is not recognised or otherwise unsupported. Definition at line 203 of file awsabstractsignature.cpp.
Referenced by AwsSignatureV2Private::canonicalRequest(), AwsSignatureV3Private::canonicalRequest(), and AwsSignatureV4Private::canonicalRequest().
bool AwsAbstractSignaturePrivate::setQueryItem | ( | QUrlQuery & | query, |
const QString & | key, | ||
const QString & | value, | ||
const bool | warnOnNonIdenticalDuplicate = true |
||
) | const |
Set a query item, checking for existing values first.
This function is a light wrapper around QUrlQuery::addQueryItem() that first checks for existing values. Existing values will not be overwritten, instead if existing values are found, this function will simply check if the exsting value matches the desired value, and if not, will return false
and optionally (according to warnOnNonIdenticalDuplicate) issue a qWarning().
Typically, when setting something that must be a specific value, such as an access key ID, warnOnNonIdenticalDuplicate would be true
. However, when setting query items as a fall-back default, such as a current timestamp, warnOnNonIdenticalDuplicate would typically be set to false
.
query | URL query to add the query item to. |
key | Query item key to add to query. |
value | Query item value to add to query. |
warnOnNonIdenticalDuplicate | If true , and an exisiting key value is found in query that has a value other than value, then a qWarning() is issued, otherwise the duplicate is silently ignored. |
true
if the query item was set successfully or was already set to the requested value previously, false
otherwise. Definition at line 244 of file awsabstractsignature.cpp.
Referenced by AwsSignatureV0Private::adornRequest(), and AwsSignatureV2Private::adornRequest().