rhodes 1.5.5 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Manifest.txt +214 -32
- data/Rakefile +33 -10
- data/bin/upgrade-rhodes-app +0 -1
- data/lib/build/compileERB/bb.rb +2 -2
- data/lib/build/compileERB/default.rb +7 -5
- data/lib/build/jake.rb +1 -1
- data/lib/extensions/digest-md5/ext.yml +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +35 -36
- data/lib/extensions/digest-md5/ext/build.bat +1 -0
- data/lib/extensions/digest-md5/ext/digest-md5.vcproj +203 -0
- data/lib/extensions/digest-sha1/ext.yml +1 -1
- data/lib/extensions/digest/ext.yml +1 -1
- data/lib/extensions/digest/ext/Rakefile +35 -39
- data/lib/extensions/digest/ext/build.bat +1 -2
- data/lib/extensions/digest/ext/digest.vcproj +203 -0
- data/lib/framework/rho/render.rb +79 -22
- data/lib/framework/rho/rho.rb +294 -56
- data/lib/framework/rho/rhoapplication.rb +10 -0
- data/lib/framework/rho/rhofsconnector.rb +2 -6
- data/lib/framework/rho/rhoutils.rb +56 -14
- data/lib/framework/rho/rhoviewhelpers.rb +2 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom.rb +42 -15
- data/lib/framework/rhom/rhom_db_adapter.rb +165 -159
- data/lib/framework/rhom/rhom_object.rb +0 -1
- data/lib/framework/rhom/rhom_object_factory.rb +343 -166
- data/lib/framework/rhom/rhom_source.rb +28 -15
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +39 -44
- data/platform/android/Rhodes/jni/include/JNIRhodes.h +1 -1
- data/platform/android/Rhodes/jni/include/details/rhojava.inc +23 -20
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_RhoMenu.h +61 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_Rhodes.h +16 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_alert_Alert.h +21 -0
- data/platform/android/Rhodes/jni/include/sslimpl.h +1 -1
- data/platform/android/Rhodes/jni/src/alert.cpp +32 -5
- data/platform/android/Rhodes/jni/src/callbacks.cpp +51 -21
- data/platform/android/Rhodes/jni/src/mapview.cpp +3 -8
- data/platform/android/Rhodes/jni/src/menu.cpp +70 -0
- data/platform/android/Rhodes/jni/src/navbar.cpp +16 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +37 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -3
- data/platform/android/Rhodes/jni/src/webview.cpp +21 -7
- data/platform/android/Rhodes/res/drawable/alert_alert.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_info.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_question.png +0 -0
- data/platform/android/Rhodes/res/drawable/camera.png +0 -0
- data/platform/android/Rhodes/res/layout/camera.xml +18 -3
- data/platform/android/Rhodes/res/menu/options.xml +0 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +5 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +105 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +157 -122
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +7 -58
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +16 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +220 -17
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +22 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +44 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +3 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +44 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +47 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +13 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/TelUriHandler.java +11 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +1 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/VideoUriHandler.java +61 -0
- data/platform/android/build/RhodesSRC_build.files +3 -0
- data/platform/android/build/android.rake +173 -60
- data/platform/android/build/androidcommon.rb +1 -2
- data/platform/android/build/librhocommon_build.files +5 -0
- data/platform/android/build/librhodes_build.files +2 -0
- data/platform/android/build/libruby_build.files +2 -1
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -3
- data/platform/bb/Hsqldb/src/com/rho/db/FileUtilBB.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +16 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +5 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +25 -4
- data/platform/bb/Hsqldb/src/com/rho/db/Journal.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -1
- data/platform/bb/Hsqldb/src/j2me/math/Number.java +6 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/CompiledStatementExecutor.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Result.java +2 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Select.java +12 -6
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +19 -12
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +10 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Token.java +10 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/lib/java/JavaSystem.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlProperties.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/ScaledRAFile.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptReaderText.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptWriterBase.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +9 -10
- data/platform/bb/build/RubyVM_build.files +9 -7
- data/platform/bb/build/bb.rake +13 -3
- data/platform/bb/build/hsqldb_build.files +0 -2
- data/platform/bb/build/rhodes_build.files +5 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +154 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/rhodes.jdp +12 -7
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +331 -0
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +10 -0
- data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +4 -0
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +2 -4
- data/platform/bb/rhodes/src/com/rho/{Jsr75File.java → file/Jsr75File.java} +83 -36
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/Jsr75RAFileImpl.java +0 -1
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/PersistRAFileImpl.java +0 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +8 -10
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +39 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +63 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +100 -0
- data/platform/bb/rhodes/src/rhomobile/LogScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +13 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +138 -492
- data/platform/bb/rhodes/src/rhomobile/SecondaryResourceFetchThread.java +11 -2
- data/platform/bb/rhodes/src/rhomobile/Utilities.java +14 -10
- data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +5 -14
- data/platform/bb/rhodes/src/rhomobile/camera/ImageBrowserScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +37 -14
- data/platform/iphone/Classes/Camera/PickImageDelegate.h +15 -4
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +53 -50
- data/platform/iphone/Classes/DateTimePicker.h +17 -0
- data/platform/iphone/Classes/DateTimePicker.m +35 -0
- data/platform/iphone/Classes/GeoLocation/LocationController.m +2 -3
- data/platform/iphone/Classes/LogOptionsController.m +3 -2
- data/platform/iphone/Classes/LogViewController.m +4 -2
- data/platform/iphone/Classes/MapView/GoogleGeocoder.m +12 -20
- data/platform/iphone/Classes/MapView/MapAnnotation.h +9 -13
- data/platform/iphone/Classes/MapView/MapAnnotation.m +17 -65
- data/platform/iphone/Classes/MapView/MapViewController.h +1 -7
- data/platform/iphone/Classes/MapView/MapViewController.m +51 -25
- data/platform/iphone/Classes/NativeBar.h +0 -12
- data/platform/iphone/Classes/NativeBar.m +121 -2
- data/platform/iphone/Classes/NavBar.h +16 -0
- data/platform/iphone/Classes/NavBar.m +115 -0
- data/platform/iphone/Classes/RhoAlert.h +19 -0
- data/platform/iphone/Classes/RhoAlert.m +258 -0
- data/platform/iphone/Classes/RhoDelegate.m +1 -0
- data/platform/iphone/Classes/RhoMainView.h +33 -0
- data/platform/iphone/Classes/Rhodes.h +56 -0
- data/platform/iphone/Classes/Rhodes.m +533 -0
- data/platform/iphone/Classes/RingtoneManager.h +17 -0
- data/platform/iphone/Classes/RingtoneManager.m +73 -0
- data/platform/iphone/Classes/SimpleMainView.h +30 -0
- data/platform/iphone/Classes/SimpleMainView.m +380 -0
- data/platform/iphone/Classes/TabbedMainView.h +24 -0
- data/platform/iphone/Classes/TabbedMainView.m +202 -0
- data/platform/iphone/Classes/WebView.m +123 -0
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +2 -2
- data/platform/iphone/Classes/rho/net/sslimpl.cpp +13 -1
- data/platform/iphone/Classes/rho/net/sslimpl.h +1 -1
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +44 -0
- data/platform/iphone/main.m +1 -2
- data/platform/iphone/rbuild/iphone.rake +8 -16
- data/platform/iphone/rhoextlib/dosyscall.c +1 -1
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +6 -4
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +97 -62
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +12 -0
- data/platform/osx/Rhodes Launcher/launch.rb +14 -21
- data/platform/shared/common/AppMenu.cpp +122 -0
- data/platform/shared/common/AppMenu.h +46 -0
- data/platform/shared/common/PosixThreadImpl.cpp +1 -1
- data/platform/shared/common/RhoConf.cpp +27 -2
- data/platform/shared/common/RhoConf.h +5 -0
- data/platform/shared/common/RhoFilePath.h +21 -0
- data/platform/shared/common/RhoStd.h +44 -5
- data/platform/shared/common/RhoTime.h +20 -7
- data/platform/shared/common/RhodesApp.cpp +236 -177
- data/platform/shared/common/RhodesApp.h +36 -13
- data/platform/shared/common/SplashScreen.cpp +2 -2
- data/platform/shared/common/StringConverter.h +10 -11
- data/platform/shared/common/rhoparams.c +0 -6
- data/platform/shared/curl/lib/rhossl.c +3 -2
- data/platform/shared/curl/lib/url.c +0 -5
- data/platform/shared/db/DBAdapter.cpp +304 -81
- data/platform/shared/db/DBAdapter.h +24 -7
- data/platform/shared/db/DBAttrManager.cpp +83 -30
- data/platform/shared/db/DBAttrManager.h +6 -0
- data/platform/shared/db/DBResult.h +15 -4
- data/platform/shared/json/JSONIterator.cpp +100 -3
- data/platform/shared/json/JSONIterator.h +28 -3
- data/platform/shared/net/AsyncHttp.cpp +25 -22
- data/platform/shared/net/AsyncHttp.h +10 -6
- data/platform/shared/net/CURLNetRequest.cpp +115 -36
- data/platform/shared/net/CURLNetRequest.h +6 -0
- data/platform/shared/net/HttpServer.cpp +6 -4
- data/platform/shared/net/HttpServer.h +0 -1
- data/platform/shared/net/INetRequest.h +19 -3
- data/platform/shared/net/URI.cpp +2 -2
- data/platform/shared/net/ssl.cpp +2 -2
- data/platform/shared/net/ssl.h +2 -2
- data/platform/shared/ruby/ext/alert/alert.i +14 -2
- data/platform/shared/ruby/ext/alert/alert_wrap.c +40 -20
- data/platform/shared/ruby/ext/asynchttp/asynchttp.i +8 -8
- data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +112 -16
- data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -12
- data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +481 -125
- data/platform/shared/ruby/ext/navbar/navbar.i +20 -0
- data/platform/shared/ruby/ext/navbar/navbar_wrap.c +1859 -0
- data/platform/shared/ruby/ext/rho/extensions.c +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +32 -2
- data/platform/shared/ruby/ext/rho/rhoruby.h +7 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +4 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +31 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +188 -3226
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -25
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +96 -104
- data/platform/shared/ruby/ext/system/system.i +12 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +101 -7
- data/platform/shared/ruby/ext/webview/webview.i +20 -15
- data/platform/shared/ruby/ext/webview/webview_wrap.c +42 -16
- data/platform/shared/ruby/thread_pthread.c +4 -4
- data/platform/shared/ruby/thread_win32.c +4 -4
- data/platform/shared/ruby/wince/io_wce.c +0 -1
- data/platform/shared/rubyJVM/src/com/rho/FilePath.java +18 -2
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/Properties.java +9 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoClassFactory.java +2 -3
- data/platform/shared/rubyJVM/src/com/rho/RhoConf.java +47 -8
- data/platform/shared/rubyJVM/src/com/rho/RhoLogConf.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoLogFileSink.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoRuby.java +43 -5
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +98 -3
- data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +460 -175
- data/platform/shared/rubyJVM/src/com/rho/db/DBAttrManager.java +81 -33
- data/platform/shared/rubyJVM/src/com/rho/db/IDBCallback.java +3 -5
- data/platform/shared/rubyJVM/src/com/rho/db/IDBResult.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/db/IDBStorage.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/{IFile.java → file/IFile.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IFileAccess.java → file/IFileAccess.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IRAFile.java → file/IRAFile.java} +1 -1
- data/platform/{bb/Hsqldb/src/com/rho/db → shared/rubyJVM/src/com/rho/file}/RandomAccessFile.java +1 -2
- data/platform/shared/rubyJVM/src/com/rho/{SimpleFile.java → file/SimpleFile.java} +5 -1
- data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +23 -18
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +167 -250
- data/platform/shared/rubyJVM/src/com/rho/net/RhoConnection.java +100 -30
- data/platform/shared/rubyJVM/src/com/rho/net/URI.java +0 -1
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +30 -33
- data/platform/shared/rubyJVM/src/com/rho/sync/ISyncProtocol.java +20 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONEntry.java +5 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONStructIterator.java +74 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +486 -257
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +89 -58
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncProtocol_3.java +79 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +634 -495
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +74 -90
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubySymbol_Methods.java +1 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyThread.java +6 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyRuntime.java +6 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubySymbol.java +17 -1
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyValue.java +1 -0
- data/platform/shared/rubyJVM/src/org/json/me/JSONObject.java +3 -0
- data/platform/shared/rubyext/GeoLocation.cpp +23 -0
- data/platform/shared/rubyext/GeoLocation.h +2 -0
- data/platform/shared/rubyext/RhoRuby.cpp +31 -0
- data/platform/shared/rubyext/RhoRuby.h +32 -0
- data/platform/shared/rubyext/System.cpp +14 -3
- data/platform/shared/rubyext/WebView.h +21 -0
- data/platform/shared/sync/ClientRegister.cpp +23 -28
- data/platform/shared/sync/ClientRegister.h +6 -2
- data/platform/shared/sync/ISyncProtocol.h +29 -0
- data/platform/shared/sync/SyncEngine.cpp +450 -190
- data/platform/shared/sync/SyncEngine.h +28 -38
- data/platform/shared/sync/SyncNotify.cpp +43 -41
- data/platform/shared/sync/SyncNotify.h +7 -7
- data/platform/shared/sync/SyncProtocol_3.h +86 -0
- data/platform/shared/sync/SyncSource.cpp +535 -371
- data/platform/shared/sync/SyncSource.h +48 -55
- data/platform/shared/sync/SyncThread.cpp +59 -103
- data/platform/shared/sync/SyncThread.h +10 -23
- data/platform/shared/unzip/unzip.cpp +3 -2
- data/platform/shared/unzip/unzip.h +5 -1
- data/platform/shared/wtl80/include/atlapp.h +10 -10
- data/platform/wm/RhoLib/RhoLib.vcproj +32 -0
- data/platform/wm/build/build_inf.js +40 -3
- data/platform/wm/build/wm.rake +95 -9
- data/platform/wm/rhodes/Alert.cpp +4 -0
- data/platform/wm/rhodes/DateTimePicker.cpp +183 -0
- data/platform/wm/rhodes/DateTimePicker.h +100 -0
- data/platform/wm/rhodes/MainWindow.cpp +222 -209
- data/platform/wm/rhodes/MainWindow.h +28 -35
- data/platform/wm/rhodes/Rhodes.cpp +20 -60
- data/platform/wm/rhodes/Rhodes.rc +41 -7
- data/platform/wm/rhodes/Utils.cpp +65 -0
- data/platform/wm/rhodes/Utils.h +9 -0
- data/platform/wm/rhodes/camera/Camera.cpp +2 -2
- data/platform/wm/rhodes/menubar.cpp +2 -33
- data/platform/wm/rhodes/menubar.h +0 -14
- data/platform/wm/rhodes/resource.h +13 -11
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +16 -35
- data/platform/wm/rhodes/rho/net/NetRequest.h +8 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +264 -46
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +14 -4
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +77 -4
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +63 -0
- data/platform/wm/rhodes/rhodes.vcproj +20 -66
- data/platform/wm/rhodes/stdafx.h +22 -0
- data/platform/wm/rubylib/rubylib.vcproj +4 -0
- data/platform/wm/syncengine/syncengine.vcproj +8 -0
- data/platform/wm/tools/detool.sln +66 -0
- data/platform/wm/tools/detool/DEMComInterface.tlb +0 -0
- data/platform/wm/tools/detool/ReadMe.txt +33 -0
- data/platform/wm/tools/detool/detool.cpp +559 -0
- data/platform/wm/tools/detool/detool.h +5 -0
- data/platform/wm/tools/detool/detool.vcproj +233 -0
- data/platform/wm/tools/detool/stdafx.cpp +8 -0
- data/platform/wm/tools/detool/stdafx.h +15 -0
- data/platform/wm/tools/detool/targetver.h +24 -0
- data/platform/wm/tools/rhosetup/ReadMe.txt +41 -0
- data/platform/wm/tools/rhosetup/rhosetup.cpp +52 -0
- data/platform/wm/tools/rhosetup/rhosetup.vcproj +641 -0
- data/platform/wm/tools/rhosetup/stdafx.cpp +8 -0
- data/platform/wm/tools/rhosetup/stdafx.h +59 -0
- data/rakefile.rb +33 -10
- data/res/build-tools/db/syncdb.schema +25 -23
- data/res/build-tools/db/syncdb.triggers +1 -1
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/rhosetup.dll +0 -0
- data/res/generators/rhogen.rb +27 -22
- data/res/generators/templates/application/app/Settings/controller.rb +3 -1
- data/res/generators/templates/application/app/Settings/home.bb.erb +17 -0
- data/res/generators/templates/application/app/Settings/home.erb +21 -12
- data/res/generators/templates/application/app/Settings/index.bb.erb +32 -0
- data/res/generators/templates/application/app/Settings/index.erb +44 -15
- data/res/generators/templates/application/app/Settings/login.bb.erb +35 -0
- data/res/generators/templates/application/app/Settings/login.erb +29 -30
- data/res/generators/templates/application/app/Settings/reset.bb.erb +15 -0
- data/res/generators/templates/application/app/Settings/reset.erb +16 -13
- data/res/generators/templates/application/app/Settings/wait.bb.erb +3 -0
- data/res/generators/templates/application/app/Settings/wait.erb +4 -4
- data/res/generators/templates/application/app/application.rb +8 -0
- data/res/generators/templates/application/app/helpers/browser_helper.rb +13 -0
- data/res/generators/templates/application/app/index.bb.erb +26 -0
- data/res/generators/templates/application/app/index.erb +21 -12
- data/res/generators/templates/application/app/layout.erb +9 -11
- data/res/generators/templates/application/public/css/android.css +285 -0
- data/res/generators/templates/application/public/css/blackberry.css +85 -78
- data/res/generators/templates/application/public/css/iphone.css +286 -296
- data/res/generators/templates/application/public/css/webkit.css +34 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +208 -0
- data/res/generators/templates/application/public/icons/Read me first - license.txt +14 -0
- data/res/generators/templates/application/public/icons/about.png +0 -0
- data/res/generators/templates/application/public/icons/airplane.png +0 -0
- data/res/generators/templates/application/public/icons/baby.png +0 -0
- data/res/generators/templates/application/public/icons/badge.png +0 -0
- data/res/generators/templates/application/public/icons/bandaid.png +0 -0
- data/res/generators/templates/application/public/icons/bar-chart.png +0 -0
- data/res/generators/templates/application/public/icons/battery.png +0 -0
- data/res/generators/templates/application/public/icons/beaker.png +0 -0
- data/res/generators/templates/application/public/icons/beaker2.png +0 -0
- data/res/generators/templates/application/public/icons/beermug.png +0 -0
- data/res/generators/templates/application/public/icons/bird.png +0 -0
- data/res/generators/templates/application/public/icons/book.png +0 -0
- data/res/generators/templates/application/public/icons/bookmark.png +0 -0
- data/res/generators/templates/application/public/icons/brightness.png +0 -0
- data/res/generators/templates/application/public/icons/bug.png +0 -0
- data/res/generators/templates/application/public/icons/cabinet.png +0 -0
- data/res/generators/templates/application/public/icons/calendar.png +0 -0
- data/res/generators/templates/application/public/icons/camera.png +0 -0
- data/res/generators/templates/application/public/icons/changeName.rb +22 -0
- data/res/generators/templates/application/public/icons/chat2.png +0 -0
- data/res/generators/templates/application/public/icons/chicken.png +0 -0
- data/res/generators/templates/application/public/icons/clock.png +0 -0
- data/res/generators/templates/application/public/icons/cloud.png +0 -0
- data/res/generators/templates/application/public/icons/coffee.png +0 -0
- data/res/generators/templates/application/public/icons/compass.png +0 -0
- data/res/generators/templates/application/public/icons/contrast.png +0 -0
- data/res/generators/templates/application/public/icons/dashboard.png +0 -0
- data/res/generators/templates/application/public/icons/display.png +0 -0
- data/res/generators/templates/application/public/icons/dogpaw.png +0 -0
- data/res/generators/templates/application/public/icons/download.png +0 -0
- data/res/generators/templates/application/public/icons/dumbbell.png +0 -0
- data/res/generators/templates/application/public/icons/ekg.png +0 -0
- data/res/generators/templates/application/public/icons/envelope.png +0 -0
- data/res/generators/templates/application/public/icons/equalizer.png +0 -0
- data/res/generators/templates/application/public/icons/eye.png +0 -0
- data/res/generators/templates/application/public/icons/film-roll.png +0 -0
- data/res/generators/templates/application/public/icons/flag.png +0 -0
- data/res/generators/templates/application/public/icons/fork-and-knife.png +0 -0
- data/res/generators/templates/application/public/icons/fuel.png +0 -0
- data/res/generators/templates/application/public/icons/gameplan.png +0 -0
- data/res/generators/templates/application/public/icons/gear.png +0 -0
- data/res/generators/templates/application/public/icons/gear2.png +0 -0
- data/res/generators/templates/application/public/icons/gift.png +0 -0
- data/res/generators/templates/application/public/icons/heart.png +0 -0
- data/res/generators/templates/application/public/icons/house.png +0 -0
- data/res/generators/templates/application/public/icons/inbox.png +0 -0
- data/res/generators/templates/application/public/icons/index-cards.png +0 -0
- data/res/generators/templates/application/public/icons/iphone.png +0 -0
- data/res/generators/templates/application/public/icons/ipod.png +0 -0
- data/res/generators/templates/application/public/icons/key.png +0 -0
- data/res/generators/templates/application/public/icons/lifebuoy.png +0 -0
- data/res/generators/templates/application/public/icons/lightbulb.png +0 -0
- data/res/generators/templates/application/public/icons/line-chart.png +0 -0
- data/res/generators/templates/application/public/icons/location.png +0 -0
- data/res/generators/templates/application/public/icons/lock.png +0 -0
- data/res/generators/templates/application/public/icons/loopback.png +0 -0
- data/res/generators/templates/application/public/icons/magnifying-glass.png +0 -0
- data/res/generators/templates/application/public/icons/map-marker.png +0 -0
- data/res/generators/templates/application/public/icons/map.png +0 -0
- data/res/generators/templates/application/public/icons/medical-bag.png +0 -0
- data/res/generators/templates/application/public/icons/medical.png +0 -0
- data/res/generators/templates/application/public/icons/microphone.png +0 -0
- data/res/generators/templates/application/public/icons/movie1.png +0 -0
- data/res/generators/templates/application/public/icons/movie2.png +0 -0
- data/res/generators/templates/application/public/icons/network.png +0 -0
- data/res/generators/templates/application/public/icons/note.png +0 -0
- data/res/generators/templates/application/public/icons/outlet.png +0 -0
- data/res/generators/templates/application/public/icons/palette.png +0 -0
- data/res/generators/templates/application/public/icons/paperclip.png +0 -0
- data/res/generators/templates/application/public/icons/phone.png +0 -0
- data/res/generators/templates/application/public/icons/photos.png +0 -0
- data/res/generators/templates/application/public/icons/piano.png +0 -0
- data/res/generators/templates/application/public/icons/picture-frame.png +0 -0
- data/res/generators/templates/application/public/icons/pill.png +0 -0
- data/res/generators/templates/application/public/icons/pin.png +0 -0
- data/res/generators/templates/application/public/icons/pinetree.png +0 -0
- data/res/generators/templates/application/public/icons/planet.png +0 -0
- data/res/generators/templates/application/public/icons/puzzle.png +0 -0
- data/res/generators/templates/application/public/icons/radar.png +0 -0
- data/res/generators/templates/application/public/icons/redo.png +0 -0
- data/res/generators/templates/application/public/icons/refresh.png +0 -0
- data/res/generators/templates/application/public/icons/runner.png +0 -0
- data/res/generators/templates/application/public/icons/shoebox.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-bag.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-cart.png +0 -0
- data/res/generators/templates/application/public/icons/shuffle.png +0 -0
- data/res/generators/templates/application/public/icons/signpost.png +0 -0
- data/res/generators/templates/application/public/icons/skull-n-crossbones.png +0 -0
- data/res/generators/templates/application/public/icons/skull.png +0 -0
- data/res/generators/templates/application/public/icons/sliders.png +0 -0
- data/res/generators/templates/application/public/icons/spraycan.png +0 -0
- data/res/generators/templates/application/public/icons/squiggle.png +0 -0
- data/res/generators/templates/application/public/icons/star.png +0 -0
- data/res/generators/templates/application/public/icons/stopwatch.png +0 -0
- data/res/generators/templates/application/public/icons/suitcase.png +0 -0
- data/res/generators/templates/application/public/icons/tag.png +0 -0
- data/res/generators/templates/application/public/icons/tags.png +0 -0
- data/res/generators/templates/application/public/icons/target.png +0 -0
- data/res/generators/templates/application/public/icons/testtube.png +0 -0
- data/res/generators/templates/application/public/icons/thermometer.png +0 -0
- data/res/generators/templates/application/public/icons/toolbox.png +0 -0
- data/res/generators/templates/application/public/icons/trophy.png +0 -0
- data/res/generators/templates/application/public/icons/tshirt.png +0 -0
- data/res/generators/templates/application/public/icons/tv.png +0 -0
- data/res/generators/templates/application/public/icons/umbrella.png +0 -0
- data/res/generators/templates/application/public/icons/walk.png +0 -0
- data/res/generators/templates/application/public/icons/weather.png +0 -0
- data/res/generators/templates/application/public/icons/widescreen.png +0 -0
- data/res/generators/templates/application/public/icons/wineglass.png +0 -0
- data/res/generators/templates/application/public/icons/zap.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_on.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_on.png +0 -0
- data/res/generators/templates/application/public/images/android/ic_menu_more.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure_detail.png +0 -0
- data/res/generators/templates/application/public/images/iphone/radiobutton.png +0 -0
- data/res/generators/templates/application/public/images/iphone/select.png +0 -0
- data/res/generators/templates/application/public/images/iphone/switch.png +0 -0
- data/res/generators/templates/application/public/images/listArrow.png +0 -0
- data/res/generators/templates/application/public/images/listArrowDown.png +0 -0
- data/res/generators/templates/model/controller.rb +2 -0
- data/res/generators/templates/model/edit.bb.erb +24 -0
- data/res/generators/templates/model/edit.erb +21 -25
- data/res/generators/templates/model/index.bb.erb +21 -0
- data/res/generators/templates/model/index.erb +28 -14
- data/res/generators/templates/model/new.bb.erb +24 -0
- data/res/generators/templates/model/new.erb +20 -20
- data/res/generators/templates/model/show.bb.erb +21 -0
- data/res/generators/templates/model/show.erb +15 -15
- data/rhobuild.yml +37 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/Account/config.rb +57 -1
- data/spec/framework_spec/app/Case/config.rb +1 -1
- data/spec/framework_spec/app/Customer/config.rb +1 -1
- data/spec/framework_spec/app/Product/config.rb +15 -1
- data/spec/framework_spec/app/spec/fixtures/object_values.txt +90 -90
- data/spec/framework_spec/app/spec/pagination/fixtures/object_values.txt +91 -91
- data/spec/framework_spec/app/spec/rho_spec.rb +1 -1
- data/spec/framework_spec/app/spec/rhom_object_spec.rb +47 -28
- data/spec/framework_spec/app/spec/rhom_spec.rb +8 -8
- data/spec/framework_spec/app/spec/spec_helper.rb +13 -5
- data/spec/framework_spec/app/spec_runner.rb +5 -4
- data/spec/framework_spec/public/css/base.css +0 -1
- data/spec/framework_spec/public/css/iphone.css +0 -1
- data/spec/framework_spec/rhoconfig.txt +3 -1
- metadata +220 -37
- data/platform/bb/rhodes/src/rhomobile/WebView.java +0 -90
- data/platform/iphone/Classes/BarItem.h +0 -27
- data/platform/iphone/Classes/BarItem.m +0 -32
- data/platform/iphone/Classes/JSString.h +0 -12
- data/platform/iphone/Classes/JSString.m +0 -7
- data/platform/iphone/Classes/RhoRunnerAppDelegate.h +0 -48
- data/platform/iphone/Classes/RhoRunnerAppDelegate.m +0 -617
- data/platform/iphone/Classes/Server/ServerHost.h +0 -81
- data/platform/iphone/Classes/Server/ServerHost.m +0 -597
- data/platform/iphone/Classes/Server/WebViewUrl.h +0 -13
- data/platform/iphone/Classes/Server/WebViewUrl.m +0 -8
- data/platform/iphone/Classes/TabBarDelegate.h +0 -39
- data/platform/iphone/Classes/TabBarDelegate.m +0 -151
- data/platform/iphone/Classes/Utils/unzip.cpp +0 -4328
- data/platform/iphone/Classes/Utils/unzip.h +0 -234
- data/platform/iphone/Classes/WebViewController.h +0 -59
- data/platform/iphone/Classes/WebViewController.m +0 -472
- data/platform/wm/rhodes/GetURLDialog.cpp +0 -64
- data/platform/wm/rhodes/GetURLDialog.h +0 -39
- data/res/generators/templates/application/public/css/base.css +0 -39
- data/res/generators/templates/application/public/css/rho.css +0 -3
- data/res/generators/templates/application/public/css/xhtml.css +0 -114
- data/spec/framework_spec/app/Question/config.rb +0 -3
- data/spec/generator_spec/source_generator_spec.rb +0 -27
@@ -4,38 +4,7 @@
|
|
4
4
|
|
5
5
|
#include "resource.h"
|
6
6
|
#include "menubar.h"
|
7
|
-
|
8
|
-
/*
|
9
|
-
void CODButtonImpl::DrawItem ( LPDRAWITEMSTRUCT lpdis )
|
10
|
-
{
|
11
|
-
CDCHandle dc = lpdis->hDC;
|
12
|
-
CDC dcMem;
|
13
|
-
|
14
|
-
dcMem.CreateCompatibleDC ( dc );
|
15
|
-
dc.SaveDC();
|
16
|
-
dcMem.SaveDC();
|
17
|
-
|
18
|
-
// Draw the button's background, red if it has the focus, blue if not.
|
19
|
-
if ( lpdis->itemState & ODS_FOCUS ) {
|
20
|
-
dc.FillSolidRect ( &lpdis->rcItem, ::GetSysColor(COLOR_3DLIGHT) );
|
21
|
-
dc.Draw3dRect(&lpdis->rcItem, ::GetSysColor(COLOR_BTNHILIGHT), ::GetSysColor(COLOR_BTNSHADOW));
|
22
|
-
} else {
|
23
|
-
dc.FillSolidRect ( &lpdis->rcItem, ::GetSysColor(COLOR_3DLIGHT) );
|
24
|
-
}
|
25
|
-
|
26
|
-
// Draw the bitmap in the top-left, or offset by 1 pixel if the button
|
27
|
-
// is clicked.
|
28
|
-
//dcMem.SelectBitmap ( m_bmp );
|
29
|
-
|
30
|
-
//if ( lpdis->itemState & ODS_SELECTED )
|
31
|
-
// dc.BitBlt ( 1, 1, 80, 80, dcMem, 0, 0, SRCCOPY );
|
32
|
-
//else
|
33
|
-
// dc.BitBlt ( 0, 0, 80, 80, dcMem, 0, 0, SRCCOPY );
|
34
|
-
|
35
|
-
dcMem.RestoreDC(-1);
|
36
|
-
dc.RestoreDC(-1);
|
37
|
-
}
|
38
|
-
*/
|
7
|
+
#include "common/RhodesApp.h"
|
39
8
|
|
40
9
|
LRESULT CMenuBar::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
|
41
10
|
// m_btnLeft.Create(m_hWnd,CWindow::rcDefault,TEXT("Exit"),WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,0,10);
|
@@ -74,7 +43,7 @@ LRESULT CMenuBar::OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/,
|
|
74
43
|
|
75
44
|
LRESULT CMenuBar::OnBackCommand(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
|
76
45
|
{
|
77
|
-
|
46
|
+
RHODESAPP().navigateBack();
|
78
47
|
return 0;
|
79
48
|
}
|
80
49
|
|
@@ -1,20 +1,6 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
3
|
#if !defined(_WIN32_WCE)
|
4
|
-
/*
|
5
|
-
class CODButtonImpl : public CWindowImpl<CODButtonImpl, CButton>,
|
6
|
-
public COwnerDraw<CODButtonImpl>
|
7
|
-
{
|
8
|
-
public:
|
9
|
-
BEGIN_MSG_MAP_EX(CODButtonImpl)
|
10
|
-
CHAIN_MSG_MAP_ALT(COwnerDraw<CODButtonImpl>, 1)
|
11
|
-
DEFAULT_REFLECTION_HANDLER()
|
12
|
-
END_MSG_MAP()
|
13
|
-
|
14
|
-
void DrawItem ( LPDRAWITEMSTRUCT lpdis );
|
15
|
-
};
|
16
|
-
*/
|
17
|
-
|
18
4
|
#define IDB_BACK 10
|
19
5
|
#define IDB_MENU 11
|
20
6
|
|
@@ -16,6 +16,9 @@
|
|
16
16
|
#define IDR_LOGVIEW_MENU 115
|
17
17
|
#define IDD_SIMULATOR_LOGOPTIONS 116
|
18
18
|
#define IDI_ICON 117
|
19
|
+
#define IDD_DATETIME_PICKER 118
|
20
|
+
#define IDD_DATEPICKER 119
|
21
|
+
#define IDD_TIME_PICKER 119
|
19
22
|
#define IDC_STATIC_PROMPT 1001
|
20
23
|
#define IDC_EDIT_URL 1002
|
21
24
|
#define IDC_LOGEDIT 1003
|
@@ -26,6 +29,10 @@
|
|
26
29
|
#define IDC_EDIT2 1007
|
27
30
|
#define IDC_MSGEXCLUDE 1007
|
28
31
|
#define IDC_BUTTON2 1010
|
32
|
+
#define IDC_DATE_CTRL 1012
|
33
|
+
#define IDC_TIME_CTRL 1013
|
34
|
+
#define IDC_DATE_STATIC 1017
|
35
|
+
#define IDC_TIME_STATIC 1019
|
29
36
|
#define IDS_EXIT 10001
|
30
37
|
#define IDS_MENU 10002
|
31
38
|
#define IDS_OK 10003
|
@@ -34,20 +41,13 @@
|
|
34
41
|
#define IDM_SK1_EXIT 40001
|
35
42
|
#define IDM_SK2_MENU 40002
|
36
43
|
#define IDM_BACK 40003
|
37
|
-
#define
|
38
|
-
#define IDM_HOME 40005
|
39
|
-
#define IDM_OPENURL 40006
|
44
|
+
#define IDM_NAVIGATE_BACK 40005
|
40
45
|
#define IDM_REFRESH 40007
|
41
|
-
#define IDM_STOP 40008
|
42
46
|
#define IDM_POPUP_MENU 40009
|
43
47
|
#define ID_SYNC 40010
|
44
|
-
#define IDM_SYNC 40011
|
45
|
-
#define ID__RELOADRHOBUNDLE 40012
|
46
|
-
#define IDM_RELOADRHOBUNDLE 40013
|
47
48
|
#define ID__OPTIONS 40014
|
48
49
|
#define IDM_OPTIONS 40015
|
49
50
|
#define ID_EXIT 40016
|
50
|
-
#define ID_MENU 40017
|
51
51
|
#define ID_MENU_HELLO 40018
|
52
52
|
#define IDM_EXIT 40019
|
53
53
|
#define IDM_LOG 40020
|
@@ -58,14 +58,16 @@
|
|
58
58
|
#define ID_MENU_SELECTALL 40025
|
59
59
|
#define ID_MENU_FIND 40026
|
60
60
|
#define IDM_SENDLOG 40027
|
61
|
+
#define ID_Menu 40028
|
62
|
+
#define ID_FULLSCREEN 40029
|
61
63
|
|
62
64
|
// Next default values for new objects
|
63
65
|
//
|
64
66
|
#ifdef APSTUDIO_INVOKED
|
65
67
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
66
|
-
#define _APS_NEXT_RESOURCE_VALUE
|
67
|
-
#define _APS_NEXT_COMMAND_VALUE
|
68
|
-
#define _APS_NEXT_CONTROL_VALUE
|
68
|
+
#define _APS_NEXT_RESOURCE_VALUE 120
|
69
|
+
#define _APS_NEXT_COMMAND_VALUE 40030
|
70
|
+
#define _APS_NEXT_CONTROL_VALUE 1020
|
69
71
|
#define _APS_NEXT_SYMED_VALUE 111
|
70
72
|
#endif
|
71
73
|
#endif
|
@@ -3,6 +3,7 @@
|
|
3
3
|
#include "NetRequest.h"
|
4
4
|
#include "common/AutoPointer.h"
|
5
5
|
#include "common/RhoFile.h"
|
6
|
+
#include "common/RhoFilePath.h"
|
6
7
|
#include "NetRequestImpl.h"
|
7
8
|
#include "common/RhodesApp.h"
|
8
9
|
|
@@ -31,7 +32,7 @@ INetResponse* CNetRequest::pullCookies(const String& strUrl, const String& strBo
|
|
31
32
|
|
32
33
|
INetResponse* CNetRequest::doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders )
|
33
34
|
{
|
34
|
-
CNetRequestImpl oImpl(this, method,strUrl,oSession,pHeaders);
|
35
|
+
CNetRequestImpl oImpl(this, method,strUrl,oSession,pHeaders, m_sslVerifyPeer);
|
35
36
|
return oImpl.sendString(strBody);
|
36
37
|
}
|
37
38
|
|
@@ -48,55 +49,35 @@ void CNetRequest::cancel()
|
|
48
49
|
m_pCurNetRequestImpl->cancel();
|
49
50
|
}
|
50
51
|
|
51
|
-
INetResponse* CNetRequest::
|
52
|
+
INetResponse* CNetRequest::pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
52
53
|
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
return new CNetResponseImpl();
|
58
|
-
}
|
59
|
-
|
60
|
-
int nTry = 0;
|
61
|
-
m_bCancel = false;
|
62
|
-
CNetResponseImpl* pResp = 0;
|
63
|
-
do
|
64
|
-
{
|
65
|
-
if ( pResp )
|
66
|
-
delete pResp;
|
54
|
+
CNetRequestImpl oImpl(this, "POST",strUrl,oSession,pHeaders,m_sslVerifyPeer);
|
55
|
+
CNetResponseImpl* pResp = oImpl.sendMultipartData(arItems);
|
56
|
+
return pResp;
|
57
|
+
}
|
67
58
|
|
68
|
-
|
69
|
-
|
70
|
-
|
59
|
+
INetResponse* CNetRequest::pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
60
|
+
{
|
61
|
+
VectorPtr<CMultipartItem*> arItems;
|
62
|
+
arItems.addElement(&oItem);
|
71
63
|
|
72
|
-
|
64
|
+
INetResponse* pResp = pushMultipartData(strUrl, arItems, oSession, pHeaders);
|
73
65
|
|
66
|
+
arItems[0] = 0; //do not delete item
|
74
67
|
return pResp;
|
75
68
|
}
|
76
69
|
|
77
70
|
INetResponse* CNetRequest::pullFile(const String& strUrl, const String& strFilePath, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
78
71
|
{
|
79
72
|
common::CRhoFile oFile;
|
80
|
-
if ( !oFile.open(strFilePath.c_str(),common::CRhoFile::
|
73
|
+
if ( !oFile.open(strFilePath.c_str(),common::CRhoFile::OpenForAppend) )
|
81
74
|
{
|
82
75
|
LOG(ERROR) + "pullFile: cannot create file :" + strFilePath;
|
83
76
|
return new CNetResponseImpl();
|
84
77
|
}
|
85
78
|
|
86
|
-
|
87
|
-
|
88
|
-
CNetResponseImpl* pResp = 0;
|
89
|
-
do
|
90
|
-
{
|
91
|
-
if ( pResp )
|
92
|
-
delete pResp;
|
93
|
-
|
94
|
-
CNetRequestImpl oImpl(this, "GET",strUrl,oSession,pHeaders);
|
95
|
-
pResp = oImpl.downloadFile(oFile);
|
96
|
-
nTry++;
|
97
|
-
|
98
|
-
}while( !m_bCancel && !pResp->isResponseRecieved() && nTry < MAX_NETREQUEST_RETRY );
|
99
|
-
|
79
|
+
CNetRequestImpl oImpl(this, "GET",strUrl,oSession,pHeaders,m_sslVerifyPeer);
|
80
|
+
CNetResponseImpl* pResp = oImpl.downloadFile(oFile);
|
100
81
|
return pResp;
|
101
82
|
}
|
102
83
|
|
@@ -10,20 +10,26 @@ class CNetRequest : public INetRequest
|
|
10
10
|
{
|
11
11
|
DEFINE_LOGCLASS;
|
12
12
|
boolean m_bCancel;
|
13
|
+
boolean m_sslVerifyPeer;
|
13
14
|
public:
|
14
15
|
CNetRequestImpl* m_pCurNetRequestImpl;
|
15
16
|
|
16
|
-
CNetRequest(void) : m_pCurNetRequestImpl(null), m_bCancel(false){}
|
17
|
+
CNetRequest(void) : m_pCurNetRequestImpl(null), m_bCancel(false), m_sslVerifyPeer(true) {}
|
17
18
|
virtual ~CNetRequest(void){}
|
18
19
|
|
19
20
|
virtual INetResponse* pullData(const String& strUrl, IRhoSession* oSession );
|
20
21
|
virtual INetResponse* pushData(const String& strUrl, const String& strBody, IRhoSession* oSession);
|
21
|
-
virtual INetResponse*
|
22
|
+
virtual INetResponse* pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
23
|
+
virtual INetResponse* pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
24
|
+
|
22
25
|
virtual INetResponse* pullFile(const String& strUrl, const String& strFilePath, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
23
26
|
virtual INetResponse* pullCookies(const String& strUrl, const String& strBody, IRhoSession* oSession);
|
24
27
|
|
25
28
|
virtual INetResponse* doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders );
|
26
29
|
|
30
|
+
virtual boolean sslVerifyPeer() {return m_sslVerifyPeer;}
|
31
|
+
virtual void sslVerifyPeer(boolean mode) {m_sslVerifyPeer = mode;}
|
32
|
+
|
27
33
|
virtual String resolveUrl(const String& strUrl);
|
28
34
|
|
29
35
|
virtual void cancel();
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
#include "NetRequestImpl.h"
|
4
4
|
#include "common/RhoFile.h"
|
5
|
+
#include "common/RhoFilePath.h"
|
5
6
|
#include "NetRequest.h"
|
6
7
|
#include "common/StringConverter.h"
|
7
8
|
#include "net/URI.h"
|
@@ -18,13 +19,15 @@ namespace rho {
|
|
18
19
|
namespace net {
|
19
20
|
IMPLEMENT_LOGCLASS(CNetRequestImpl,"Net");
|
20
21
|
|
21
|
-
CNetRequestImpl::CNetRequestImpl(CNetRequest* pParent, const char* method, const String& strUrl,
|
22
|
+
CNetRequestImpl::CNetRequestImpl(CNetRequest* pParent, const char* method, const String& strUrl,
|
23
|
+
IRhoSession* oSession, Hashtable<String,String>* pHeaders, boolean sslVerifyPeer)
|
22
24
|
{
|
23
25
|
m_pParent = pParent;
|
24
26
|
m_pParent->m_pCurNetRequestImpl = this;
|
25
27
|
m_pHeaders = pHeaders;
|
26
28
|
m_bCancel = false;
|
27
29
|
m_pSession = oSession;
|
30
|
+
m_sslVerifyPeer = sslVerifyPeer;
|
28
31
|
|
29
32
|
pszErrFunction = NULL;
|
30
33
|
hInet = NULL, hConnection = NULL, hRequest = NULL;
|
@@ -78,6 +81,9 @@ CNetRequestImpl::CNetRequestImpl(CNetRequest* pParent, const char* method, const
|
|
78
81
|
if ( uri.lpszScheme && wcsicmp(uri.lpszScheme,L"https")==0)
|
79
82
|
dwFlags |= INTERNET_FLAG_SECURE;
|
80
83
|
|
84
|
+
if ( !m_sslVerifyPeer )
|
85
|
+
dwFlags |= INTERNET_FLAG_IGNORE_CERT_CN_INVALID|INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;
|
86
|
+
|
81
87
|
hRequest = HttpOpenRequest( hConnection, CAtlStringW(method), strReqUrlW, NULL, NULL, NULL, dwFlags, NULL );
|
82
88
|
if ( !hRequest )
|
83
89
|
{
|
@@ -101,6 +107,46 @@ CNetRequestImpl::CNetRequestImpl(CNetRequest* pParent, const char* method, const
|
|
101
107
|
}while(0);
|
102
108
|
}
|
103
109
|
|
110
|
+
boolean CNetRequestImpl::checkSslCertError()
|
111
|
+
{
|
112
|
+
DWORD dwError = GetLastError ();
|
113
|
+
if (!m_sslVerifyPeer &&(
|
114
|
+
(dwError == ERROR_INTERNET_INVALID_CA) ||
|
115
|
+
(dwError == ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED) ||
|
116
|
+
(dwError == ERROR_INTERNET_SEC_CERT_DATE_INVALID) ||
|
117
|
+
(dwError == ERROR_INTERNET_SEC_CERT_CN_INVALID)))
|
118
|
+
{
|
119
|
+
DWORD dwFlag;
|
120
|
+
DWORD dwBuffLen = sizeof(dwFlag);
|
121
|
+
InternetQueryOption (hRequest, INTERNET_OPTION_SECURITY_FLAGS,(LPVOID)&dwFlag, &dwBuffLen);
|
122
|
+
dwFlag |= (SECURITY_FLAG_IGNORE_UNKNOWN_CA
|
123
|
+
| SECURITY_FLAG_IGNORE_CERT_CN_INVALID
|
124
|
+
| SECURITY_FLAG_IGNORE_CERT_DATE_INVALID );
|
125
|
+
InternetSetOption (hRequest, INTERNET_OPTION_SECURITY_FLAGS, &dwFlag, sizeof (dwFlag) );
|
126
|
+
/*
|
127
|
+
INTERNET_CERTIFICATE_INFO sInfo;
|
128
|
+
DWORD dwSize = sizeof(sInfo);
|
129
|
+
if(!InternetQueryOption(m_hSess,INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
|
130
|
+
&sInfo, &dwSize))
|
131
|
+
{
|
132
|
+
dwError = GetLastError();
|
133
|
+
}
|
134
|
+
*/
|
135
|
+
|
136
|
+
return true;
|
137
|
+
}
|
138
|
+
|
139
|
+
return false;
|
140
|
+
}
|
141
|
+
|
142
|
+
String CNetRequestImpl::getBodyContentType()
|
143
|
+
{
|
144
|
+
if ( m_pSession )
|
145
|
+
return m_pSession->getContentType();
|
146
|
+
else
|
147
|
+
return "application/x-www-form-urlencoded";
|
148
|
+
}
|
149
|
+
|
104
150
|
CNetResponseImpl* CNetRequestImpl::sendString(const String& strBody)
|
105
151
|
{
|
106
152
|
CNetResponseImpl* pNetResp = new CNetResponseImpl;
|
@@ -110,9 +156,12 @@ CNetResponseImpl* CNetRequestImpl::sendString(const String& strBody)
|
|
110
156
|
if ( isError() )
|
111
157
|
break;
|
112
158
|
|
113
|
-
if ( strBody.length() > 0
|
159
|
+
if ( strBody.length() > 0 )
|
114
160
|
{
|
115
|
-
CAtlStringW strHeaders = L"Content-Type:
|
161
|
+
CAtlStringW strHeaders = L"Content-Type: ";
|
162
|
+
strHeaders += getBodyContentType().c_str();
|
163
|
+
strHeaders += L"\r\n";
|
164
|
+
|
116
165
|
if ( !HttpAddRequestHeaders( hRequest, strHeaders, -1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE ) )
|
117
166
|
{
|
118
167
|
pszErrFunction = L"HttpAddRequestHeaders";
|
@@ -123,8 +172,18 @@ CNetResponseImpl* CNetRequestImpl::sendString(const String& strBody)
|
|
123
172
|
|
124
173
|
if ( !HttpSendRequest( hRequest, NULL, 0, const_cast<char*>(strBody.c_str()), strBody.length() ) )
|
125
174
|
{
|
126
|
-
|
127
|
-
|
175
|
+
if (checkSslCertError())
|
176
|
+
{
|
177
|
+
if ( !HttpSendRequest( hRequest, NULL, 0, const_cast<char*>(strBody.c_str()), strBody.length() ) )
|
178
|
+
{
|
179
|
+
pszErrFunction = L"HttpSendRequest";
|
180
|
+
break;
|
181
|
+
}
|
182
|
+
}else
|
183
|
+
{
|
184
|
+
pszErrFunction = L"HttpSendRequest";
|
185
|
+
break;
|
186
|
+
}
|
128
187
|
}
|
129
188
|
|
130
189
|
readResponse(pNetResp);
|
@@ -255,7 +314,7 @@ void CNetRequestImpl::readResponse(CNetResponseImpl* pNetResp)
|
|
255
314
|
return;
|
256
315
|
}
|
257
316
|
|
258
|
-
if ( nCode != 200 )
|
317
|
+
if ( nCode != 200 && nCode != 206 && nCode != 416 )
|
259
318
|
{
|
260
319
|
LOG(ERROR) + "An error occured connecting to the sync source: " + szHttpRes + " returned.";
|
261
320
|
|
@@ -274,6 +333,8 @@ void CNetRequestImpl::readResponse(CNetResponseImpl* pNetResp)
|
|
274
333
|
CNetResponseImpl* CNetRequestImpl::downloadFile(common::CRhoFile& oFile)
|
275
334
|
{
|
276
335
|
CNetResponseImpl* pNetResp = new CNetResponseImpl;
|
336
|
+
const int nDownloadBufferSize = 1024*50;
|
337
|
+
char* pDownloadBuffer = 0;
|
277
338
|
|
278
339
|
do
|
279
340
|
{
|
@@ -282,34 +343,122 @@ CNetResponseImpl* CNetRequestImpl::downloadFile(common::CRhoFile& oFile)
|
|
282
343
|
if ( isError() )
|
283
344
|
break;
|
284
345
|
|
346
|
+
//if ( oFile.size() > 0 )
|
347
|
+
{
|
348
|
+
CAtlStringW strHeaders = L"Range: bytes=";
|
349
|
+
strHeaders += common::convertToStringW(oFile.size()).c_str();
|
350
|
+
strHeaders += L"-";
|
351
|
+
//strHeaders += common::convertToStringW(oFile.size()+30068032).c_str();
|
352
|
+
strHeaders += "\r\n";
|
353
|
+
|
354
|
+
if ( !HttpAddRequestHeaders( hRequest, strHeaders, -1, HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE ) )
|
355
|
+
{
|
356
|
+
pszErrFunction = L"HttpAddRequestHeaders";
|
357
|
+
break;
|
358
|
+
}
|
359
|
+
}
|
360
|
+
|
285
361
|
if ( !HttpSendRequest( hRequest, NULL, 0, NULL, 0 ) )
|
286
362
|
{
|
287
|
-
|
288
|
-
|
363
|
+
if (checkSslCertError())
|
364
|
+
{
|
365
|
+
if ( !HttpSendRequest( hRequest, NULL, 0, NULL, 0 ) )
|
366
|
+
{
|
367
|
+
pszErrFunction = L"HttpSendRequest";
|
368
|
+
break;
|
369
|
+
}
|
370
|
+
}else
|
371
|
+
{
|
372
|
+
pszErrFunction = L"HttpSendRequest";
|
373
|
+
break;
|
374
|
+
}
|
289
375
|
}
|
290
376
|
|
291
377
|
readResponse(pNetResp);
|
292
378
|
if ( isError() )
|
293
379
|
break;
|
294
380
|
|
295
|
-
|
381
|
+
if ( pNetResp->getRespCode() == 416 )
|
382
|
+
{
|
383
|
+
pNetResp->setResponseCode(206);
|
384
|
+
break;
|
385
|
+
}
|
386
|
+
|
387
|
+
if (!pDownloadBuffer)
|
388
|
+
pDownloadBuffer = new char[nDownloadBufferSize];
|
389
|
+
|
390
|
+
readInetFile(hRequest,pNetResp, &oFile, pDownloadBuffer, nDownloadBufferSize);
|
296
391
|
|
297
392
|
}while(0);
|
298
393
|
|
394
|
+
if (pDownloadBuffer)
|
395
|
+
delete pDownloadBuffer;
|
396
|
+
|
299
397
|
return pNetResp;
|
300
398
|
}
|
301
399
|
|
302
|
-
static const
|
303
|
-
|
304
|
-
"Content-Disposition: form-data; name=\"blob\"; filename=\"doesnotmatter.png\"\r\n"
|
305
|
-
"Content-Type: application/octet-stream\r\n\r\n";
|
400
|
+
static const wchar_t* szMultipartContType =
|
401
|
+
L"Content-Type: multipart/form-data; boundary=----------A6174410D6AD474183FDE48F5662FCC5\r\n";
|
306
402
|
static const char* szMultipartPostfix =
|
307
403
|
"\r\n------------A6174410D6AD474183FDE48F5662FCC5--";
|
308
404
|
|
309
|
-
|
310
|
-
|
405
|
+
int CNetRequestImpl::processMultipartItems( VectorPtr<CMultipartItem*>& arItems )
|
406
|
+
{
|
407
|
+
int nSize = 0;
|
408
|
+
for( int i = 0; i < (int)arItems.size(); i++ )
|
409
|
+
{
|
410
|
+
CMultipartItem& oItem = *arItems.elementAt(i);
|
411
|
+
|
412
|
+
if ( oItem.m_strName.length() == 0 )
|
413
|
+
oItem.m_strName = "blob";
|
414
|
+
|
415
|
+
if ( oItem.m_strFileName.length() == 0 )
|
416
|
+
{
|
417
|
+
if ( oItem.m_strFilePath.length() > 0 )
|
418
|
+
{
|
419
|
+
common::CFilePath oPath(oItem.m_strFilePath);
|
420
|
+
oItem.m_strFileName = oPath.getBaseName();
|
421
|
+
}
|
422
|
+
//else
|
423
|
+
// oItem.m_strFileName = "doesnotmatter.txt";
|
424
|
+
}
|
425
|
+
|
426
|
+
oItem.m_strDataPrefix = i > 0 ? "\r\n" : "";
|
427
|
+
oItem.m_strDataPrefix +=
|
428
|
+
"------------A6174410D6AD474183FDE48F5662FCC5\r\n"
|
429
|
+
"Content-Disposition: form-data; name=\"";
|
430
|
+
oItem.m_strDataPrefix += oItem.m_strName + "\"";
|
431
|
+
if (oItem.m_strFileName.length()>0)
|
432
|
+
oItem.m_strDataPrefix += "; filename=\"" + oItem.m_strFileName + "\"";
|
433
|
+
oItem.m_strDataPrefix += "\r\n";
|
434
|
+
if ( oItem.m_strContentType.length() > 0 )
|
435
|
+
oItem.m_strDataPrefix += "Content-Type: " + oItem.m_strContentType + "\r\n";
|
436
|
+
|
437
|
+
int nContentSize = 0;
|
438
|
+
if ( oItem.m_strFilePath.length() > 0 )
|
439
|
+
{
|
440
|
+
common::CRhoFile oFile;
|
441
|
+
if ( oFile.open(oItem.m_strFilePath.c_str(),common::CRhoFile::OpenReadOnly) )
|
442
|
+
nContentSize = oFile.size();
|
443
|
+
}
|
444
|
+
else
|
445
|
+
nContentSize = oItem.m_strBody.length();
|
311
446
|
|
312
|
-
|
447
|
+
if ( oItem.m_strContentType.length() > 0 )
|
448
|
+
oItem.m_strDataPrefix += "Content-Length: " + common::convertToStringA(nContentSize) + "\r\n";
|
449
|
+
|
450
|
+
oItem.m_strDataPrefix += "\r\n";
|
451
|
+
|
452
|
+
nSize += oItem.m_strDataPrefix.length() + nContentSize;
|
453
|
+
|
454
|
+
}
|
455
|
+
|
456
|
+
nSize += strlen(szMultipartPostfix);
|
457
|
+
|
458
|
+
return nSize;
|
459
|
+
}
|
460
|
+
|
461
|
+
CNetResponseImpl* CNetRequestImpl::sendMultipartData(VectorPtr<CMultipartItem*>& arItems)
|
313
462
|
{
|
314
463
|
CNetResponseImpl* pNetResp = new CNetResponseImpl;
|
315
464
|
|
@@ -329,44 +478,83 @@ CNetResponseImpl* CNetRequestImpl::sendStream(common::InputStream* bodyStream)
|
|
329
478
|
INTERNET_BUFFERS BufferIn;
|
330
479
|
memset(&BufferIn, 0, sizeof(INTERNET_BUFFERS));
|
331
480
|
BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or error will occur
|
332
|
-
BufferIn.dwBufferTotal =
|
481
|
+
BufferIn.dwBufferTotal = processMultipartItems( arItems );
|
333
482
|
|
334
483
|
if(!HttpSendRequestEx( hRequest, &BufferIn, NULL, 0, 0))
|
335
484
|
{
|
336
|
-
|
337
|
-
|
485
|
+
if (checkSslCertError())
|
486
|
+
{
|
487
|
+
if(!HttpSendRequestEx( hRequest, &BufferIn, NULL, 0, 0))
|
488
|
+
{
|
489
|
+
pszErrFunction = L"HttpSendRequestEx";
|
490
|
+
break;
|
491
|
+
}
|
492
|
+
}else
|
493
|
+
{
|
494
|
+
pszErrFunction = L"HttpSendRequestEx";
|
495
|
+
break;
|
496
|
+
}
|
338
497
|
}
|
339
498
|
|
340
|
-
|
341
|
-
|
499
|
+
//write all items
|
500
|
+
for( int i = 0; i < (int)arItems.size(); i++ )
|
342
501
|
{
|
343
|
-
|
344
|
-
break;
|
345
|
-
}
|
502
|
+
CMultipartItem& oItem = *arItems.elementAt(i);
|
346
503
|
|
347
|
-
|
348
|
-
|
349
|
-
|
504
|
+
if ( oItem.m_strFilePath.length() > 0 )
|
505
|
+
{
|
506
|
+
common::CRhoFile oFile;
|
507
|
+
if ( !oFile.open(oItem.m_strFilePath.c_str(),common::CRhoFile::OpenReadOnly) )
|
508
|
+
{
|
509
|
+
pszErrFunction = L"InternetWriteFile";
|
510
|
+
return pNetResp;
|
511
|
+
}
|
512
|
+
common::InputStream* bodyStream = oFile.getInputStream();
|
513
|
+
|
514
|
+
if ( !internetWriteHeader( oItem.m_strDataPrefix.c_str(), "", "") )
|
515
|
+
{
|
516
|
+
pszErrFunction = L"InternetWriteFile";
|
517
|
+
return pNetResp;
|
518
|
+
}
|
350
519
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
520
|
+
DWORD dwBytesWritten = 0;
|
521
|
+
if ( bodyStream->available() > 0 )
|
522
|
+
{
|
523
|
+
DWORD dwBufSize = 4096;
|
524
|
+
char* pBuf = (char*)malloc(dwBufSize);
|
525
|
+
int nReaded = 0;
|
526
|
+
|
527
|
+
do
|
528
|
+
{
|
529
|
+
nReaded = bodyStream->read(pBuf,0,dwBufSize);
|
530
|
+
if ( nReaded > 0 )
|
531
|
+
{
|
532
|
+
if ( !InternetWriteFile( hRequest, pBuf, nReaded, &dwBytesWritten) )
|
533
|
+
{
|
534
|
+
pszErrFunction = L"InternetWriteFile";
|
535
|
+
return pNetResp;
|
536
|
+
}
|
537
|
+
}
|
538
|
+
}while(nReaded > 0);
|
539
|
+
|
540
|
+
free(pBuf);
|
541
|
+
}
|
542
|
+
|
543
|
+
}else
|
355
544
|
{
|
356
|
-
|
545
|
+
if ( !internetWriteHeader( oItem.m_strDataPrefix.c_str(), oItem.m_strBody.c_str(), "") )
|
357
546
|
{
|
358
547
|
pszErrFunction = L"InternetWriteFile";
|
359
|
-
|
548
|
+
return pNetResp;
|
360
549
|
}
|
361
550
|
}
|
362
|
-
}while(nReaded > 0);
|
363
551
|
|
364
|
-
|
552
|
+
}
|
365
553
|
|
366
|
-
if ( !
|
554
|
+
if ( !internetWriteHeader( "", "", szMultipartPostfix) )
|
367
555
|
{
|
368
556
|
pszErrFunction = L"InternetWriteFile";
|
369
|
-
|
557
|
+
return pNetResp;
|
370
558
|
}
|
371
559
|
|
372
560
|
if ( !HttpEndRequest(hRequest, NULL, 0, 0) )
|
@@ -389,6 +577,21 @@ CNetResponseImpl* CNetRequestImpl::sendStream(common::InputStream* bodyStream)
|
|
389
577
|
return pNetResp;
|
390
578
|
}
|
391
579
|
|
580
|
+
bool CNetRequestImpl::internetWriteHeader( const char* szPrefix, const char* szBody, const char* szPrefixEnd)
|
581
|
+
{
|
582
|
+
DWORD dwBytesWritten = 0;
|
583
|
+
if ( szPrefix && *szPrefix && !InternetWriteFile( hRequest, szPrefix, strlen(szPrefix), &dwBytesWritten) )
|
584
|
+
return false;
|
585
|
+
|
586
|
+
if ( szBody && *szBody && !InternetWriteFile( hRequest, szBody, strlen(szBody), &dwBytesWritten) )
|
587
|
+
return false;
|
588
|
+
|
589
|
+
if ( szPrefixEnd && *szPrefixEnd && !InternetWriteFile( hRequest, szPrefixEnd, strlen(szPrefixEnd), &dwBytesWritten) )
|
590
|
+
return false;
|
591
|
+
|
592
|
+
return true;
|
593
|
+
}
|
594
|
+
|
392
595
|
void CNetRequestImpl::cancel()
|
393
596
|
{
|
394
597
|
m_bCancel = true;
|
@@ -432,13 +635,24 @@ CNetRequestImpl::~CNetRequestImpl()
|
|
432
635
|
m_pParent->m_pCurNetRequestImpl = null;
|
433
636
|
}
|
434
637
|
|
435
|
-
void CNetRequestImpl::readInetFile( HINTERNET hRequest, CNetResponseImpl* pNetResp, common::CRhoFile* pFile /*=NULL
|
638
|
+
void CNetRequestImpl::readInetFile( HINTERNET hRequest, CNetResponseImpl* pNetResp, common::CRhoFile* pFile /*=NULL*/,
|
639
|
+
char* pBuf, DWORD dwBufSize )
|
436
640
|
{
|
437
641
|
//if ( pNetResp->getRespCode() == 500 || pNetResp->getRespCode() == 422 )
|
438
642
|
// return;
|
643
|
+
char* pBufToFree = 0;
|
644
|
+
if (!pBuf)
|
645
|
+
{
|
646
|
+
if ( dwBufSize==0)
|
647
|
+
dwBufSize=1024*4;
|
648
|
+
|
649
|
+
pBuf = (char*)malloc(dwBufSize);
|
650
|
+
pBufToFree = pBuf;
|
651
|
+
}
|
439
652
|
|
440
|
-
DWORD dwBufSize =
|
441
|
-
char* pBuf = (char*)malloc(dwBufSize);
|
653
|
+
//DWORD dwBufSize = 1024*100;
|
654
|
+
//char* pBuf = (char*)malloc(dwBufSize);
|
655
|
+
//char* pBufToFree = pBuf;
|
442
656
|
DWORD dwBytesRead = 0;
|
443
657
|
BOOL bRead = FALSE;
|
444
658
|
do
|
@@ -447,6 +661,7 @@ void CNetRequestImpl::readInetFile( HINTERNET hRequest, CNetResponseImpl* pNetRe
|
|
447
661
|
if ( !bRead )
|
448
662
|
{
|
449
663
|
pszErrFunction = L"InternetReadFile";
|
664
|
+
pNetResp->setResponseCode(408);
|
450
665
|
break;
|
451
666
|
}
|
452
667
|
|
@@ -465,7 +680,8 @@ void CNetRequestImpl::readInetFile( HINTERNET hRequest, CNetResponseImpl* pNetRe
|
|
465
680
|
if ( !pNetResp->isOK() )
|
466
681
|
LOG(TRACE) + "Server response: " + pNetResp->getCharData();
|
467
682
|
|
468
|
-
|
683
|
+
if ( pBufToFree )
|
684
|
+
free(pBufToFree);
|
469
685
|
}
|
470
686
|
|
471
687
|
void CNetRequestImpl::ErrorMessage(LPCTSTR pszFunction)
|
@@ -485,7 +701,7 @@ void CNetRequestImpl::ErrorMessage(LPCTSTR pszFunction)
|
|
485
701
|
(LPTSTR)&pszMessage,
|
486
702
|
0, NULL );
|
487
703
|
|
488
|
-
|
704
|
+
wchar_t* szExtError = 0;
|
489
705
|
if ( dwLastError == ERROR_INTERNET_EXTENDED_ERROR )
|
490
706
|
{
|
491
707
|
DWORD dwInetError =0, dwExtLength = 0;
|
@@ -493,8 +709,8 @@ void CNetRequestImpl::ErrorMessage(LPCTSTR pszFunction)
|
|
493
709
|
|
494
710
|
if ( dwExtLength > 0 )
|
495
711
|
{
|
496
|
-
|
497
|
-
|
712
|
+
szExtError = (wchar_t*)malloc(sizeof(wchar_t)*(dwExtLength+1));
|
713
|
+
InternetGetLastResponseInfo( &dwInetError, szExtError, &dwExtLength );
|
498
714
|
}
|
499
715
|
}
|
500
716
|
|
@@ -503,9 +719,11 @@ void CNetRequestImpl::ErrorMessage(LPCTSTR pszFunction)
|
|
503
719
|
|
504
720
|
if ( pszMessage )
|
505
721
|
oLogMsg + ".Message: " + pszMessage;
|
506
|
-
if (
|
507
|
-
oLogMsg + ".Extended info: " +
|
722
|
+
if ( szExtError && *szExtError )
|
723
|
+
oLogMsg + ".Extended info: " + szExtError;
|
508
724
|
|
725
|
+
if ( szExtError )
|
726
|
+
free(szExtError);
|
509
727
|
if ( pszMessage )
|
510
728
|
LocalFree(pszMessage);
|
511
729
|
}
|