Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix compilation with MSVC 2010

Issue #10158: #10158
This bug introduced by the marco max( ) defined in <windef.h>.
It replaces max( ) with another statement but still preceeded by numberic_limits<Type>::
The workaround is to use the parenthesis
  • Loading branch information...
commit 3edcabef9f36636adcf05926351a3fb09c781e0d 1 parent 78242e5
@Vitallium Vitallium authored committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/networkaccessmanager.cpp
2  src/networkaccessmanager.cpp
@@ -207,7 +207,7 @@ QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkR
if (op == QNetworkAccessManager::PostOperation) {
- if (outgoingData) postData = outgoingData->peek(std::numeric_limits < qint64 >::max());
+ if (outgoingData) postData = outgoingData->peek((std::numeric_limits<qint64>::max)());
QString contentType = req.header(QNetworkRequest::ContentTypeHeader).toString();
if (contentType.isEmpty()) {
req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

6 comments on commit 3edcabe


Have you tried MSVC2008?
When run the test.I always got a error: [FATAL] In file tools\qbytearray.cpp, line 1416: Out of memory


I did a test:

    QFile file("in.txt");
    if (! | QIODevice::Text))

    QByteArray postData;
    postData = file.peek(std::numeric_limits<qint16>::max()); // OK
    postData = file.peek(std::numeric_limits<qint32>::max()); // CRASH
    postData = file.peek(std::numeric_limits<qint64>::max()); // CRASH

It seems like 'std::numeric_limits::max()' is too big!


Yeah, got it too. I think we should limit postData size to 10 Mb(?)


Well, there isn't any HTTP limitation on the size of a POST request, so these limitations are all configured at the web server level. Theoretically, you could accept a file as large as the server's available (free) memory (minus the memory needed for processing the request afterward, etc.).

Some defaults:

  • IIS 7.x: ~30MB [ref]
  • Apache 2.0: 0 (unlimited), or max size of 2GB if not unlimited [ref]
  • Tomcat 7.0: 2MB [ref]
  • Nginx 1.2.0: 1MB [ref]

No, I meant to limit the size of the data which will be passed in the requestData

Like it was done in Webkit Developer Tools. There is a limit in 10 Mb for a request's data size. [ref]


Understood, I was just trying to add background info and some common defaults to consider for our users' best interests. I think 10MB sounds good. I also think that this is something we should try to control at the build script/config level so it's easy to update for custom builds if anyone needs a higher limit.

Please sign in to comment.
Something went wrong with that request. Please try again.