Ticket #6597: 6597-datadirect-win32.patch

File 6597-datadirect-win32.patch, 3.2 KB (added by Jeff Lu <jll544@…>, 16 years ago)
  • libs/libmythtv/datadirect.cpp

     
    10141014    poststream << flush;
    10151015    postfile.close();
    10161016
    1017     // Allow for single quotes in userid and password (shell escape)
    1018     password.replace('\'', "'\\''");
    1019     userid.replace('\'', "'\\''");
    1020 
    10211017    QString command;
    10221018    {
    10231019        QMutexLocker locker(&user_agent_lock);
     1020#ifdef USING_MINGW
     1021        // win32 doesn't understand single-quoted strings, uses ^ as escape;
     1022        // also, windows seems to have problems with the gzip pipe here
     1023        password.replace("\"", "^\"");
     1024        userid.replace("\"", "^\"");
     1025
    10241026        command = QString(
     1027            "wget --http-user=\"%1\" --http-passwd=\"%2\" --post-file=\"%3\" "
     1028            " %4 --user-agent=\"%5\" --output-document=- ")
     1029            .arg(userid).arg(password).arg(postFilename).arg(ddurl)
     1030            .arg(user_agent);
     1031    }
     1032#else
     1033        // Allow for single quotes in userid and password (shell escape)
     1034        password.replace('\'', "'\\''");
     1035        userid.replace('\'', "'\\''");
     1036
     1037        command = QString(
    10251038            "wget --http-user='%1' --http-passwd='%2' --post-file='%3' "
    10261039            "--header='Accept-Encoding:gzip' %4 "
    10271040            "--user-agent='%5' --output-document=- ")
     
    10331046    //    command += " 2> /dev/null ";
    10341047
    10351048    command += " | gzip -df";
    1036 
     1049#endif
    10371050    if (SHOW_WGET_OUTPUT)
    10381051        VERBOSE(VB_GENERAL, "command: "<<command<<endl);
    10391052
     
    10931106    QString command;
    10941107    {
    10951108        QMutexLocker locker(&user_agent_lock);
     1109#ifdef USING_MINGW  // single quotes don't work in win32
    10961110        command = QString(
     1111            "wget --http-user=\"%1\" --http-passwd=\"%2\" --post-file=\"%3\" "
     1112            " %4 --user-agent=\"%5\" --output-document=\"%6\"")
     1113            .arg(GetUserID().replace("\"", "^\""))
     1114            .arg(GetPassword().replace("\"", "^\"")).arg(postFilename)
     1115            .arg(ddurl).arg(user_agent).arg(resultFilename);
     1116#else
     1117        command = QString(
    10971118            "wget --http-user='%1' --http-passwd='%2' --post-file='%3' %4 "
    10981119            "--user-agent='%5' --output-document='%6'")
    10991120            .arg(GetUserID().replace('\'', "'\\''"))
    11001121            .arg(GetPassword().replace('\'', "'\\''")).arg(postFilename)
    11011122            .arg(ddurl).arg(user_agent).arg(resultFilename);
     1123#endif
    11021124    }
    11031125
    11041126    if (SHOW_WGET_OUTPUT)
    11051127        VERBOSE(VB_GENERAL, "command: "<<command<<endl);
     1128#ifndef USING_MINGW
    11061129    else
    11071130        command += " 2> /dev/null ";
     1131#endif
    11081132
    11091133    myth_system(command);
    11101134
     
    19912015    }
    19922016
    19932017    if (post_data.length())
     2018#ifdef USING_MINGW       
     2019        command += "--post-data=\"" + post_data + "\" ";
     2020#else
    19942021        command += "--post-data='" + post_data + "' ";
     2022#endif   
    19952023
    19962024    command += url;
    19972025    command += " ";
    19982026
    19992027    {
    20002028        QMutexLocker locker(&user_agent_lock);
    2001         command += QString("--user-agent='%1' ").arg(user_agent);
     2029#ifdef USING_MINGW               
     2030        command += QString("--user-agent=\"%1\" ").arg(user_agent);
     2031#else
     2032        command += QString("--user-agent='%1' ").arg(user_agent);       
     2033#endif
    20022034    }
    20032035
    20042036    command += "--output-document=";