[ERROR http_transport_win.cc:170] WinHttpCrackUrl: The URL is invalid

56 views
Skip to first unread message

Jiakuan Wang

unread,
Nov 1, 2017, 2:50:53 AM11/1/17
to Crashpad-dev
I've integrated crashpad with my C++ application and I'm able to generate crash reports successfully on both Mac and Windows.
On Mac, the crashpad_handler can upload crash dumps to server. But when I test crash dump uploading on Windows using the same code, I got the following error:

[3952:2900:20171101,142419.964:ERROR http_transport_win.cc:170] WinHttpCrackUrl: The URL is invalid  (0x2ee5)

The URL I specified is: https://my_team.sp.backtrace.io:6098

Is this URL in wrong format on Windows? (Same URL worked on Mac OS X)

Jiakuan Wang

unread,
Nov 1, 2017, 4:18:13 AM11/1/17
to Crashpad-dev
I wrote a simple servlet running locally for receiving the crash dump from crashpad_handler.

In the servlet, I'm able to receive the POST request from crashpad_handler, but no file content at all.

The crash dumps were generated in 'crash_db' folder successfully. It seems to me the upload function of crashpad_handler is not working for me on Windows.

Any ideas? Thanks in advance.

Mark Mentovai

unread,
Nov 1, 2017, 11:14:20 AM11/1/17
to Jiakuan Wang, Crashpad-dev
WinHttpCrackUrl() is satisfied with https://my_team.sp.backtrace.io:6098 for me, but I’m betting that the underscore is the problem.

Underscore permissibility is confusing: while DNS permits them (RFC 2181 §11), hostnames technically do not (RFC 1123 §2.1 and RFC 952). Traditionally, many systems have been tolerant of underscores in hostnames, macOS included. Windows has historically given a harder time about them.

I tested on both Windows 10 and Windows 7 SP1, and couldn’t reproduce your error code, but this problem may be specific to the OS version or another environmental factor.

--
You received this message because you are subscribed to the Google Groups "Crashpad-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crashpad-dev+unsubscribe@chromium.org.
To post to this group, send email to crashp...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/crashpad-dev/4080b00d-619a-4f50-be79-c2c75583b18a%40chromium.org.

Jake W.

unread,
Nov 1, 2017, 10:01:41 PM11/1/17
to Crashpad-dev, delig...@gmail.com
I built crashpad again from the latest commit of master branch, and now didn't see the 'Invalid URL' issues any more. But still no crash dump files can be uploaded.

From my local servlet debugging, I found POST request can be received from the crashpad_handler, but no dump file content is attached. This may be related to the version of my Windows VM - Windows 7 Professional SP1 (32-bit). I haven't tested on Windows 10 (64-bit) yet. Nowadays, given most machines are 64-bit, just wondering should we still support Windows 32-bit?

I'm thinking about a workaround - on app starts, if crash dumps found, then upload them via my own code, which could be a backup solution to make sure crash dumps can be uploaded any way.


On Wednesday, 1 November 2017 23:14:20 UTC+8, Mark Mentovai wrote:
WinHttpCrackUrl() is satisfied with https://my_team.sp.backtrace.io:6098 for me, but I’m betting that the underscore is the problem.

Underscore permissibility is confusing: while DNS permits them (RFC 2181 §11), hostnames technically do not (RFC 1123 §2.1 and RFC 952). Traditionally, many systems have been tolerant of underscores in hostnames, macOS included. Windows has historically given a harder time about them.

I tested on both Windows 10 and Windows 7 SP1, and couldn’t reproduce your error code, but this problem may be specific to the OS version or another environmental factor.
On Wed, Nov 1, 2017 at 4:18 AM, Jiakuan Wang <delig...@gmail.com> wrote:
I wrote a simple servlet running locally for receiving the crash dump from crashpad_handler.

In the servlet, I'm able to receive the POST request from crashpad_handler, but no file content at all.

The crash dumps were generated in 'crash_db' folder successfully. It seems to me the upload function of crashpad_handler is not working for me on Windows.

Any ideas? Thanks in advance.

On Wednesday, 1 November 2017 14:50:53 UTC+8, Jiakuan Wang wrote:
I've integrated crashpad with my C++ application and I'm able to generate crash reports successfully on both Mac and Windows.
On Mac, the crashpad_handler can upload crash dumps to server. But when I test crash dump uploading on Windows using the same code, I got the following error:

[3952:2900:20171101,142419.964:ERROR http_transport_win.cc:170] WinHttpCrackUrl: The URL is invalid  (0x2ee5)

The URL I specified is: https://my_team.sp.backtrace.io:6098

Is this URL in wrong format on Windows? (Same URL worked on Mac OS X)

--
You received this message because you are subscribed to the Google Groups "Crashpad-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crashpad-dev...@chromium.org.

To post to this group, send email to crashp...@chromium.org.

Jake W.

unread,
Nov 1, 2017, 10:17:36 PM11/1/17
to Crashpad-dev, delig...@gmail.com
BTW, here is the code I'm using with my Qt application. Now the only issue is no dump file can be uploaded, the POST request seems having been sent from crashpad_handler.

#include <QCoreApplication>
#include <QStandardPaths>
#include <QDir>
#include <QDebug>

#include "client/crashpad_client.h"
#include "client/crash_report_database.h"
#include "client/settings.h"

#include "qcrashpad.h"

using namespace crashpad;

QCrashpad::QCrashpad(QObject *parent) : QObject(parent)
{

}

bool QCrashpad::startCrashHandler() {
    std::map<std::string, std::string> annotations;
    std::vector<std::string> arguments;
    CrashpadClient client;
    bool rc;

    /*
     * ENSURE THIS VALUE IS CORRECT.
     *
     * This is the directory you will use to store and queue crash data.
     */
    QString appDataPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
    QDir crashDbDir(QDir(appDataPath).filePath("crash_db"));
    if (!crashDbDir.exists()) {
        crashDbDir.mkpath(crashDbDir.absolutePath());
        qDebug() << "Created directory: " << crashDbDir.absolutePath();
    }
    QString db_path = crashDbDir.absolutePath();

    /*
     * ENSURE THIS VALUE IS CORRECT.
     *
     * Crashpad has the ability to support crashes both in-process and out-of-process.
     * The out-of-process handler is significantly more robust than traditional in-process
     * crash handlers. This path may be relative.
     */
#if defined(Q_OS_MAC)
    QString handler_path = QDir(QCoreApplication::applicationDirPath()).filePath("crashpad_handler");
#elif defined(Q_OS_WIN)
    QString handler_path = QDir(QCoreApplication::applicationDirPath()).filePath("crashpad_handler.exe");
#endif

    QFileInfo fileInfo(handler_path);

    if (!fileInfo.exists()) {
        qFatal("Crashpad handler not found - %s", handler_path.toUtf8().constData());
    }

    /*
     * YOU MUST CHANGE THIS VALUE.
     *
     * This should point to your server dump submission port (labeled as "http/writer"
     * in the listener configuration pane. Preferrably, the SSL enabled port should
     * be used. If Backtrace is hosting your instance, the default port is 6098.
     */
    //std::string url("https://practiceinsight.sp.backtrace.io:6098");
    std::string url("http://10.211.55.2:8080/crashpad");

    /*
     * YOU MUST CHANGE THIS VALUE.
     *
     * Set this to the submission token under the project page.
     * Learn more at https://documentation.backtrace.io/coronerd_setup/#tokens
     */
    annotations["token"] = "dea55a5dc98562aab10a384db3b484fe261b9f7c6a558db6a730a1e7eace3b96";

    /*
     * THE FOLLOWING ANNOTATIONS MUST BE SET.
     *
     * Backtrace supports many file formats. Set format to minidump so it knows
     * how to process the incoming dump.
     */
    annotations["format"] = "minidump";

    /*
     * REMOVE THIS FOR ACTUAL BUILD.
     *
     * We disable crashpad rate limiting for this example.
     */
    arguments.push_back("--no-rate-limit");

#if defined(Q_OS_WIN)
    base::FilePath db(db_path.toStdWString());
    base::FilePath handler(handler_path.toStdWString());
#else
    base::FilePath db(db_path.toStdString());
    base::FilePath handler(handler_path.toStdString());
#endif

    m_database = crashpad::CrashReportDatabase::Initialize(db);

    if (m_database == nullptr || m_database->GetSettings() == NULL) {
        return false;
    }

    /* Enable automated uploads. */
    m_database->GetSettings()->SetUploadsEnabled(true);

    rc = client.StartHandler(handler,
                             db,
                             db,
                             url,
                             annotations,
                             arguments,
                             true,
                             true);
    if (rc == false)
        return false;

#if defined(Q_OS_WIN)
    /* Optional, wait for Crashpad to initialize. */
    rc = client.WaitForHandlerStart(INFINITE);
    if (rc == false)
        return false;
#endif

    return true;
}

void QCrashpad::setUploadsEnabled(bool enabled) {
    if (m_database == nullptr || m_database->GetSettings() == NULL) {
        return;
    }
    m_database->GetSettings()->SetUploadsEnabled(enabled);
}

bool QCrashpad::isUploadsEnabled() {
    if (m_database == nullptr || m_database->GetSettings() == NULL) {
        return false;
    }
    bool enabled;
    m_database->GetSettings()->GetUploadsEnabled(&enabled);
    return enabled;
}


Mark Mentovai

unread,
Nov 1, 2017, 11:16:33 PM11/1/17
to Jake W., Crashpad-dev
Jake W. wrote:
I built crashpad again from the latest commit of master branch, and now didn't see the 'Invalid URL' issues any more. But still no crash dump files can be uploaded.

That’s weird, since we haven’t made substantive changes to how we use WinHttpCrackUrl() in a very long time. But I’m glad you at least got past that error.

From my local servlet debugging, I found POST request can be received from the crashpad_handler, but no dump file content is attached. This may be related to the version of my Windows VM - Windows 7 Professional SP1 (32-bit). I haven't tested on Windows 10 (64-bit) yet. Nowadays, given most machines are 64-bit, just wondering should we still support Windows 32-bit?

Depends on who you mean by “we” in this context. Crashpad needs to support both 32-bit and 64-bit client processes, and both 32-bit and 64-bit handlers. These configurations are all tested and should be working.

I'm thinking about a workaround - on app starts, if crash dumps found, then upload them via my own code, which could be a backup solution to make sure crash dumps can be uploaded any way.

That shouldn’t be necessary. Crashpad should be able to communicate with a crash report collection server properly on its own.

BTW, here is the code I'm using with my Qt application. Now the only issue is no dump file can be uploaded, the POST request seems having been sent from crashpad_handler.

Well, I don’t know anything about your local server or how it handles requests, including whether it’s equipped to interpret Content-Encoding: gzip or Transfer-Encoding: chunked. Crashpad normally uses both of these for uploads, but simple “sample code”-type HTTP servers often omit support for them, or require additional effort to make them function properly.

Crashpad has a fairly complete test suite. Among other things, the tests exercise its HTTP upload functionality. The HTTP tests are part of crashpad_util_test, which you can run without any arguments to test all of the util library, or you can focus just on the HTTP portion with crashpad_util_test --gtest_filter=HTTPTransport.*. Assuming that these tests pass, which they should at HEAD on master, Crashpad’s ability to perform the type of transaction over HTTP that it requires is effectively proven, and my suggestion would be to broaden your search for the underlying problem.

I should also draw your attention to the annotations["token"] in your code snippet. You may not have intended to share that, and may need to take appropriate precautions.

On Wednesday, 1 November 2017 23:14:20 UTC+8, Mark Mentovai wrote:
WinHttpCrackUrl() is satisfied with https://my_team.sp.backtrace.io:6098 for me, but I’m betting that the underscore is the problem.

Underscore permissibility is confusing: while DNS permits them (RFC 2181 §11), hostnames technically do not (RFC 1123 §2.1 and RFC 952). Traditionally, many systems have been tolerant of underscores in hostnames, macOS included. Windows has historically given a harder time about them.

I tested on both Windows 10 and Windows 7 SP1, and couldn’t reproduce your error code, but this problem may be specific to the OS version or another environmental factor.

On Wed, Nov 1, 2017 at 4:18 AM, Jiakuan Wang <delig...@gmail.com> wrote:
I wrote a simple servlet running locally for receiving the crash dump from crashpad_handler.

In the servlet, I'm able to receive the POST request from crashpad_handler, but no file content at all.

The crash dumps were generated in 'crash_db' folder successfully. It seems to me the upload function of crashpad_handler is not working for me on Windows.

Any ideas? Thanks in advance.

On Wednesday, 1 November 2017 14:50:53 UTC+8, Jiakuan Wang wrote:
I've integrated crashpad with my C++ application and I'm able to generate crash reports successfully on both Mac and Windows.
On Mac, the crashpad_handler can upload crash dumps to server. But when I test crash dump uploading on Windows using the same code, I got the following error:

[3952:2900:20171101,142419.964:ERROR http_transport_win.cc:170] WinHttpCrackUrl: The URL is invalid  (0x2ee5)

The URL I specified is: https://my_team.sp.backtrace.io:6098

Is this URL in wrong format on Windows? (Same URL worked on Mac OS X)

--
You received this message because you are subscribed to the Google Groups "Crashpad-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crashpad-dev...@chromium.org.
To post to this group, send email to crashp...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/crashpad-dev/4080b00d-619a-4f50-be79-c2c75583b18a%40chromium.org.

--
You received this message because you are subscribed to the Google Groups "Crashpad-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crashpad-dev+unsubscribe@chromium.org.

To post to this group, send email to crashp...@chromium.org.

Jake W.

unread,
Nov 1, 2017, 11:24:13 PM11/1/17
to Crashpad-dev, delig...@gmail.com
Thank you Mark for the detailed information.

The token mentioned is code was an invalid one.

Will investigate more on this.

Jake W.

unread,
Nov 2, 2017, 1:44:32 AM11/2/17
to Crashpad-dev, delig...@gmail.com
Unit tests of Crashpad passed for me, also now I'm able to upload crash dumps from the crashpad_handler on Windows to my local collection server, but not the Backtrace server.
So it should be some issues on handling Windows upload on their server.
Reply all
Reply to author
Forward
0 new messages