Results 1 to 3 of 3

Thread: Missing "+" when calling QNetworkAccessManager.post()?

  1. #1
    Join Date
    Apr 2010
    Posts
    98
    Thanks
    19
    Thanked 8 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question Missing "+" when calling QNetworkAccessManager.post()?

    Here is a strange thing I came cross.When I post something using QNetworkAccessManager:
    Qt Code:
    1. QByteArray content;
    2. fillContent(content);
    3. qDebug()<<content;
    4. QNetworkAccessManager manager;
    5. manager.post(QNetworkRequest(requestURL),content);
    To copy to clipboard, switch view to plain text mode 
    So,I the third line,I can see the output like this:
    "signature=LgcuKoofUFtO+LKWPnARcpJyeRo=&signature_ method=HMAC-SHA1"

    But when the reply finished,I output the data of reply:
    Qt Code:
    1. qDebug()<<reply->readAll();
    To copy to clipboard, switch view to plain text mode 
    I get error message from the sever:
    "Signature does not match. Expected: LgcuKoofUFtO+LKWPnARcpJyeRo= Got: LgcuKoofUFtO LKWPnARcpJyeRo="
    You see,the "+" in the middle of the signature is missing...
    It's pretty strange.Does anybody know how to fix it?

    BTW,I can't encode the data to percent-encoding(like %20%4Babcde) before calling QNetworkAccessManager.post(),because the sever will assume this is wrong too.
    It's not the goodbye that hurts,but the flashback that follow.

  2. #2
    Join Date
    Feb 2007
    Posts
    49
    Thanks
    4
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Missing "+" when calling QNetworkAccessManager.post()?

    Do some network analyzing with Wireshark. See if signature is correctly sended.

  3. The following user says thank you to minimoog for this useful post:

    MorrisLiang (10th May 2010)

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Missing "+" when calling QNetworkAccessManager.post()?

    The "+" character is a stand-in for a space in the POST data encoding scheme (see link below) and is being replaced by a space at the receiving end. Percent encode the literal "+" and all should be well.

    17.13.4 Form content types

  5. The following user says thank you to ChrisW67 for this useful post:

    MorrisLiang (11th May 2010)

Similar Threads

  1. QNetworkAccessManager: "SSL handshake failed"
    By kleag in forum Qt Programming
    Replies: 9
    Last Post: 6th November 2009, 10:41
  2. xlib: extension "XFree86-DRI" missing on display ":0.0".
    By kiransu123 in forum Qt Programming
    Replies: 5
    Last Post: 3rd August 2009, 14:43
  3. Replies: 0
    Last Post: 3rd December 2008, 11:58
  4. "emit" keyword optional when calling signals?
    By will49 in forum Qt Programming
    Replies: 1
    Last Post: 21st November 2008, 01:13
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.