Ticket #6597: 6597-datadirect-win32.patch
| File 6597-datadirect-win32.patch, 3.2 KB (added by , 16 years ago) |
|---|
-
libs/libmythtv/datadirect.cpp
1014 1014 poststream << flush; 1015 1015 postfile.close(); 1016 1016 1017 // Allow for single quotes in userid and password (shell escape)1018 password.replace('\'', "'\\''");1019 userid.replace('\'', "'\\''");1020 1021 1017 QString command; 1022 1018 { 1023 1019 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 1024 1026 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( 1025 1038 "wget --http-user='%1' --http-passwd='%2' --post-file='%3' " 1026 1039 "--header='Accept-Encoding:gzip' %4 " 1027 1040 "--user-agent='%5' --output-document=- ") … … 1033 1046 // command += " 2> /dev/null "; 1034 1047 1035 1048 command += " | gzip -df"; 1036 1049 #endif 1037 1050 if (SHOW_WGET_OUTPUT) 1038 1051 VERBOSE(VB_GENERAL, "command: "<<command<<endl); 1039 1052 … … 1093 1106 QString command; 1094 1107 { 1095 1108 QMutexLocker locker(&user_agent_lock); 1109 #ifdef USING_MINGW // single quotes don't work in win32 1096 1110 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( 1097 1118 "wget --http-user='%1' --http-passwd='%2' --post-file='%3' %4 " 1098 1119 "--user-agent='%5' --output-document='%6'") 1099 1120 .arg(GetUserID().replace('\'', "'\\''")) 1100 1121 .arg(GetPassword().replace('\'', "'\\''")).arg(postFilename) 1101 1122 .arg(ddurl).arg(user_agent).arg(resultFilename); 1123 #endif 1102 1124 } 1103 1125 1104 1126 if (SHOW_WGET_OUTPUT) 1105 1127 VERBOSE(VB_GENERAL, "command: "<<command<<endl); 1128 #ifndef USING_MINGW 1106 1129 else 1107 1130 command += " 2> /dev/null "; 1131 #endif 1108 1132 1109 1133 myth_system(command); 1110 1134 … … 1991 2015 } 1992 2016 1993 2017 if (post_data.length()) 2018 #ifdef USING_MINGW 2019 command += "--post-data=\"" + post_data + "\" "; 2020 #else 1994 2021 command += "--post-data='" + post_data + "' "; 2022 #endif 1995 2023 1996 2024 command += url; 1997 2025 command += " "; 1998 2026 1999 2027 { 2000 2028 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 2002 2034 } 2003 2035 2004 2036 command += "--output-document=";
