Skip to content

HTTPS clone URL

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
View
2  src/networkaccessmanager.cpp
@@ -207,7 +207,7 @@ QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkR
// http://code.google.com/p/phantomjs/issues/detail?id=337
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

@zhaolong

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

@zhaolong

I did a test:

    QFile file("in.txt");
    if (!file.open(QIODevice::ReadOnly | 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!

@Vitallium
Collaborator

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

@JamesMGreene
Collaborator

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]
@Vitallium
Collaborator

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

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

@JamesMGreene
Collaborator

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.