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
@@ -1,5 +1,5 @@
|
|
1
1
|
#include "net/AsyncHttp.h"
|
2
|
-
#include "
|
2
|
+
#include "rubyext/RhoRuby.h"
|
3
3
|
#include "common/StringConverter.h"
|
4
4
|
#include "net/URI.h"
|
5
5
|
#include "common/RhodesApp.h"
|
@@ -20,7 +20,8 @@ extern "C" void header_iter(const char* szName, const char* szValue, void* pHash
|
|
20
20
|
}
|
21
21
|
|
22
22
|
CAsyncHttp::CAsyncHttp(common::IRhoClassFactory* factory, EHttpCommands eCmd,
|
23
|
-
const char* url, unsigned long headers, const char* body,
|
23
|
+
const char* url, unsigned long headers, const char* body,
|
24
|
+
const char* callback, const char* callback_params, boolean ssl_verify_peer) : CRhoThread(factory)
|
24
25
|
{
|
25
26
|
m_bFinished = false;
|
26
27
|
m_ptrFactory = factory;
|
@@ -29,6 +30,7 @@ CAsyncHttp::CAsyncHttp(common::IRhoClassFactory* factory, EHttpCommands eCmd,
|
|
29
30
|
m_strCallback = callback != null ? callback : "";
|
30
31
|
m_strCallbackParams = callback_params != null ? callback_params : "";
|
31
32
|
m_eCmd = eCmd;
|
33
|
+
m_sslVerifyPeer = ssl_verify_peer;
|
32
34
|
|
33
35
|
rho_ruby_enum_strhash(headers, &header_iter, &m_mapHeaders);
|
34
36
|
|
@@ -106,11 +108,12 @@ void CAsyncHttp::cancel(boolean bWait)
|
|
106
108
|
|
107
109
|
void CAsyncHttp::run()
|
108
110
|
{
|
109
|
-
|
111
|
+
LOG(INFO) + "RhoHttp thread start.";
|
110
112
|
|
111
113
|
{
|
112
|
-
|
114
|
+
synchronized(m_mxRequest)
|
113
115
|
m_pNetRequest = m_ptrFactory->createNetRequest();
|
116
|
+
m_pNetRequest->sslVerifyPeer(m_sslVerifyPeer);
|
114
117
|
}
|
115
118
|
|
116
119
|
switch( m_eCmd )
|
@@ -127,13 +130,19 @@ void CAsyncHttp::run()
|
|
127
130
|
break;
|
128
131
|
|
129
132
|
case hcUpload:
|
130
|
-
|
131
|
-
|
133
|
+
{
|
134
|
+
net::CMultipartItem oItem;
|
135
|
+
oItem.m_strFilePath = m_strBody;
|
136
|
+
oItem.m_strContentType = "application/octet-stream";
|
137
|
+
|
138
|
+
m_pNetResponse = m_pNetRequest->pushMultipartData( m_strUrl, oItem, null, &m_mapHeaders );
|
139
|
+
break;
|
140
|
+
}
|
132
141
|
}
|
133
142
|
|
134
143
|
if ( !m_pNetRequest->isCancelled())
|
135
144
|
{
|
136
|
-
//processResponse(m_pNetResponse);
|
145
|
+
//processResponse(*m_pNetResponse);
|
137
146
|
callNotify(*m_pNetResponse,0);
|
138
147
|
}
|
139
148
|
|
@@ -205,13 +214,7 @@ void CAsyncHttp::callNotify(rho::net::INetResponse& resp, int nError )
|
|
205
214
|
else
|
206
215
|
{
|
207
216
|
m_strResBody += "error&error_code=";
|
208
|
-
|
209
|
-
m_strResBody += convertToStringA(1);//RhoRuby.ERR_NETWORK);
|
210
|
-
else if ( resp.isUnathorized() )
|
211
|
-
m_strResBody += convertToStringA(9);//RhoRuby.ERR_UNATHORIZED);
|
212
|
-
else
|
213
|
-
m_strResBody += convertToStringA(2);//RhoRuby.ERR_REMOTESERVER);
|
214
|
-
|
217
|
+
m_strResBody += convertToStringA(RhoRuby.getErrorFromResponse(resp));
|
215
218
|
if ( resp.isResponseRecieved())
|
216
219
|
m_strResBody += "&http_error=" + convertToStringA(resp.getRespCode());
|
217
220
|
}
|
@@ -244,27 +247,27 @@ extern "C" {
|
|
244
247
|
|
245
248
|
using namespace rho::net;
|
246
249
|
|
247
|
-
unsigned long rho_asynchttp_get(const char* url, unsigned long headers, const char* callback, const char* callback_params)
|
250
|
+
unsigned long rho_asynchttp_get(const char* url, unsigned long headers, const char* callback, const char* callback_params, int ssl_verify_peer)
|
248
251
|
{
|
249
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcGet, url, headers, null, callback, callback_params );
|
252
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcGet, url, headers, null, callback, callback_params, ssl_verify_peer!=0 );
|
250
253
|
return pHttp->getRetValue();
|
251
254
|
}
|
252
255
|
|
253
|
-
unsigned long rho_asynchttp_post(const char* url, unsigned long headers, const char* body, const char* callback, const char* callback_params)
|
256
|
+
unsigned long rho_asynchttp_post(const char* url, unsigned long headers, const char* body, const char* callback, const char* callback_params, int ssl_verify_peer)
|
254
257
|
{
|
255
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcPost, url, headers, body!=null?body:"", callback, callback_params );
|
258
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcPost, url, headers, body!=null?body:"", callback, callback_params, ssl_verify_peer!=0 );
|
256
259
|
return pHttp->getRetValue();
|
257
260
|
}
|
258
261
|
|
259
|
-
unsigned long rho_asynchttp_downloadfile(const char* url, unsigned long headers, const char* file_path, const char* callback, const char* callback_params)
|
262
|
+
unsigned long rho_asynchttp_downloadfile(const char* url, unsigned long headers, const char* file_path, const char* callback, const char* callback_params, int ssl_verify_peer)
|
260
263
|
{
|
261
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcDownload, url, headers, file_path, callback, callback_params );
|
264
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcDownload, url, headers, file_path, callback, callback_params, ssl_verify_peer!=0 );
|
262
265
|
return pHttp->getRetValue();
|
263
266
|
}
|
264
267
|
|
265
|
-
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* file_path, const char* callback, const char* callback_params)
|
268
|
+
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* file_path, const char* callback, const char* callback_params, int ssl_verify_peer)
|
266
269
|
{
|
267
|
-
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcUpload, url, headers, file_path, callback, callback_params );
|
270
|
+
CAsyncHttp* pHttp = new CAsyncHttp(rho::common::createClassFactory(), CAsyncHttp::hcUpload, url, headers, file_path, callback, callback_params, ssl_verify_peer!=0 );
|
268
271
|
return pHttp->getRetValue();
|
269
272
|
}
|
270
273
|
|
@@ -26,7 +26,8 @@ class CAsyncHttp : public common::CRhoThread, rho::ICallbackObject
|
|
26
26
|
Hashtable<String,String> m_mapHeaders;
|
27
27
|
|
28
28
|
String m_strUrl, m_strBody, m_strCallback, m_strCallbackParams;
|
29
|
-
|
29
|
+
String m_strResBody;
|
30
|
+
boolean m_sslVerifyPeer;
|
30
31
|
boolean m_bFinished;
|
31
32
|
public:
|
32
33
|
enum EHttpCommands{ hcGet = 0, hcPost, hcDownload, hcUpload };
|
@@ -34,8 +35,11 @@ private:
|
|
34
35
|
EHttpCommands m_eCmd;
|
35
36
|
public:
|
36
37
|
|
38
|
+
static boolean m_bNoThreaded;
|
39
|
+
|
37
40
|
CAsyncHttp(common::IRhoClassFactory* factory, EHttpCommands eCmd,
|
38
|
-
const char* url, unsigned long headers, const char* body,
|
41
|
+
const char* url, unsigned long headers, const char* body,
|
42
|
+
const char* callback, const char* callback_params, boolean ssl_verify_peer = true);
|
39
43
|
|
40
44
|
void cancel(boolean bWait);
|
41
45
|
|
@@ -63,10 +67,10 @@ private:
|
|
63
67
|
extern "C" {
|
64
68
|
#endif //__cplusplus
|
65
69
|
|
66
|
-
unsigned long rho_asynchttp_get(const char* url, unsigned long headers, const char* callback, const char* callback_params);
|
67
|
-
unsigned long rho_asynchttp_post(const char* url, unsigned long headers, const char* body, const char* callback, const char* callback_params);
|
68
|
-
unsigned long rho_asynchttp_downloadfile(const char* url, unsigned long headers, const char* filename, const char* callback, const char* callback_params);
|
69
|
-
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* filename, const char* callback, const char* callback_params);
|
70
|
+
unsigned long rho_asynchttp_get(const char* url, unsigned long headers, const char* callback, const char* callback_params, int ssl_verify_peer);
|
71
|
+
unsigned long rho_asynchttp_post(const char* url, unsigned long headers, const char* body, const char* callback, const char* callback_params, int ssl_verify_peer);
|
72
|
+
unsigned long rho_asynchttp_downloadfile(const char* url, unsigned long headers, const char* filename, const char* callback, const char* callback_params, int ssl_verify_peer);
|
73
|
+
unsigned long rho_asynchttp_uploadfile(const char* url, unsigned long headers, const char* filename, const char* callback, const char* callback_params, int ssl_verify_peer);
|
70
74
|
void rho_asynchttp_cancel(const char* cancel_callback);
|
71
75
|
void rho_asynchttp_destroy();
|
72
76
|
|
@@ -16,7 +16,8 @@ namespace rho
|
|
16
16
|
{
|
17
17
|
namespace net
|
18
18
|
{
|
19
|
-
curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const String& strUrl,
|
19
|
+
curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const String& strUrl, const String& strBody,
|
20
|
+
IRhoSession* pSession, Hashtable<String,String>* pHeaders, bool sslVerifyPeer);
|
20
21
|
CURLMcode do_curl_perform(CURLM *curlm, CURL *curl);
|
21
22
|
|
22
23
|
IMPLEMENT_LOGCLASS(CURLNetRequest, "Net");
|
@@ -81,6 +82,7 @@ public:
|
|
81
82
|
CURLNetRequest::CURLNetRequest()
|
82
83
|
{
|
83
84
|
m_bTraceCalls = rho_conf_getBool("net_trace");
|
85
|
+
m_sslVerifyPeer = true;
|
84
86
|
curlm = curl_multi_init();
|
85
87
|
curl = curl_easy_init();
|
86
88
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &errbuf);
|
@@ -115,7 +117,7 @@ static size_t curlBodyStringCallback(void *ptr, size_t size, size_t nmemb, void
|
|
115
117
|
RAWTRACE1("Received %d bytes (string)", nBytes);
|
116
118
|
pStr->append((const char *)ptr, nBytes);
|
117
119
|
return nBytes;
|
118
|
-
}
|
120
|
+
}
|
119
121
|
|
120
122
|
INetResponse* CURLNetRequest::pullData(const String& strUrl, IRhoSession* oSession )
|
121
123
|
{
|
@@ -129,11 +131,11 @@ INetResponse* CURLNetRequest::pushData(const String& strUrl, const String& strBo
|
|
129
131
|
|
130
132
|
INetResponse* CURLNetRequest::pullCookies(const String& strUrl, const String& strBody, IRhoSession* oSession)
|
131
133
|
{
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
INetResponse* pResp = doRequest("POST", strUrl, strBody, oSession, null );
|
135
|
+
if ( pResp->isOK() )
|
136
|
+
((CURLNetResponseImpl*)pResp)->setCharData(pResp->getCookies());
|
137
|
+
|
138
|
+
return pResp;
|
137
139
|
}
|
138
140
|
|
139
141
|
INetResponse* CURLNetRequest::doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders )
|
@@ -142,35 +144,90 @@ INetResponse* CURLNetRequest::doRequest( const char* method, const String& strUr
|
|
142
144
|
m_bCancel = false;
|
143
145
|
int nRespCode = -1;
|
144
146
|
String strRespBody;
|
145
|
-
|
147
|
+
|
146
148
|
RAWLOG_INFO1("Request url: %s", strUrl.c_str());
|
147
|
-
|
149
|
+
|
148
150
|
rho_net_impl_network_indicator(1);
|
149
|
-
|
150
|
-
curl_slist *hdrs = set_curl_options(m_bTraceCalls, curl, method, strUrl, oSession, pHeaders );
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
CURLMcode err = do_curl_perform(curlm, curl);
|
159
|
-
curl_slist_free_all(hdrs);
|
160
|
-
|
151
|
+
|
152
|
+
curl_slist *hdrs = set_curl_options(m_bTraceCalls, curl, method, strUrl, strBody, oSession, pHeaders, m_sslVerifyPeer);
|
153
|
+
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strRespBody);
|
154
|
+
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyStringCallback);
|
155
|
+
|
156
|
+
CURLMcode err = do_curl_perform(curlm, curl);
|
157
|
+
curl_slist_free_all(hdrs);
|
158
|
+
|
161
159
|
rho_net_impl_network_indicator(0);
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
160
|
+
|
161
|
+
nRespCode = getResponseCode(err, strRespBody, oSession);
|
162
|
+
if (nRespCode == 200)
|
163
|
+
{
|
166
164
|
RAWTRACE("RESPONSE-----");
|
167
165
|
RAWTRACE(strRespBody.c_str());
|
168
166
|
RAWTRACE("END RESPONSE-----");
|
169
|
-
|
167
|
+
}
|
168
|
+
|
169
|
+
return makeResponse(strRespBody, nRespCode);
|
170
|
+
}
|
171
|
+
|
172
|
+
INetResponse* CURLNetRequest::pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
173
|
+
{
|
174
|
+
int nRespCode = -1;
|
175
|
+
String strRespBody;
|
176
|
+
|
177
|
+
rho_net_impl_network_indicator(1);
|
178
|
+
|
179
|
+
curl_slist *hdrs = set_curl_options(m_bTraceCalls, curl, "POST", strUrl, String(), oSession, pHeaders, m_sslVerifyPeer);
|
180
|
+
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strRespBody);
|
181
|
+
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyStringCallback);
|
170
182
|
|
183
|
+
curl_httppost *post = NULL, *last = NULL;
|
184
|
+
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL);
|
185
|
+
for (size_t i = 0, lim = arItems.size(); i < lim; ++i) {
|
186
|
+
CMultipartItem *mi = arItems[i];
|
187
|
+
|
188
|
+
const char *name = mi->m_strName.c_str();
|
189
|
+
int opt = mi->m_strFilePath.empty() ? CURLFORM_COPYCONTENTS : CURLFORM_FILE;
|
190
|
+
const char *data = mi->m_strFilePath.empty() ? mi->m_strBody.c_str() : mi->m_strFilePath.c_str();
|
191
|
+
const char *ct = mi->m_strContentType.empty() ? NULL : mi->m_strContentType.c_str();
|
192
|
+
if (ct) {
|
193
|
+
curl_formadd(&post, &last,
|
194
|
+
CURLFORM_COPYNAME, name,
|
195
|
+
opt, data,
|
196
|
+
CURLFORM_CONTENTTYPE, ct,
|
197
|
+
CURLFORM_END);
|
198
|
+
}
|
199
|
+
else {
|
200
|
+
curl_formadd(&post, &last,
|
201
|
+
CURLFORM_COPYNAME, name,
|
202
|
+
opt, data,
|
203
|
+
CURLFORM_END);
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|
207
|
+
curl_easy_setopt(curl, CURLOPT_HTTPPOST, post);
|
208
|
+
|
209
|
+
CURLMcode err = do_curl_perform(curlm, curl);
|
210
|
+
|
211
|
+
curl_slist_free_all(hdrs);
|
212
|
+
curl_formfree(post);
|
213
|
+
|
214
|
+
rho_net_impl_network_indicator(0);
|
215
|
+
|
216
|
+
nRespCode = getResponseCode(err, strRespBody, oSession);
|
171
217
|
return makeResponse(strRespBody, nRespCode);
|
172
218
|
}
|
173
219
|
|
220
|
+
INetResponse* CURLNetRequest::pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
221
|
+
{
|
222
|
+
VectorPtr<CMultipartItem*> arItems;
|
223
|
+
arItems.addElement(&oItem);
|
224
|
+
|
225
|
+
INetResponse* pResp = pushMultipartData(strUrl, arItems, oSession, pHeaders);
|
226
|
+
|
227
|
+
arItems[0] = 0; //do not delete item
|
228
|
+
return pResp;
|
229
|
+
}
|
230
|
+
|
174
231
|
INetResponse* CURLNetRequest::pushFile(const String& strUrl, const String& strFilePath, IRhoSession* oSession, Hashtable<String,String>* pHeaders)
|
175
232
|
{
|
176
233
|
m_bCancel = false;
|
@@ -188,9 +245,9 @@ INetResponse* CURLNetRequest::pushFile(const String& strUrl, const String& strFi
|
|
188
245
|
|
189
246
|
rho_net_impl_network_indicator(1);
|
190
247
|
|
191
|
-
curl_slist *hdrs = set_curl_options(m_bTraceCalls, curl, "POST", strUrl, oSession, pHeaders );
|
192
|
-
|
193
|
-
|
248
|
+
curl_slist *hdrs = set_curl_options(m_bTraceCalls, curl, "POST", strUrl, String(), oSession, pHeaders, m_sslVerifyPeer);
|
249
|
+
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &strRespBody);
|
250
|
+
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyStringCallback);
|
194
251
|
|
195
252
|
curl_httppost *post = NULL, *last = NULL;
|
196
253
|
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL);
|
@@ -208,7 +265,7 @@ INetResponse* CURLNetRequest::pushFile(const String& strUrl, const String& strFi
|
|
208
265
|
|
209
266
|
rho_net_impl_network_indicator(0);
|
210
267
|
|
211
|
-
|
268
|
+
nRespCode = getResponseCode(err, strRespBody, oSession);
|
212
269
|
return makeResponse(strRespBody, nRespCode);
|
213
270
|
}
|
214
271
|
|
@@ -229,7 +286,7 @@ INetResponse* CURLNetRequest::pullFile(const String& strUrl, const String& strFi
|
|
229
286
|
|
230
287
|
rho_net_impl_network_indicator(1);
|
231
288
|
|
232
|
-
curl_slist *hdrs = set_curl_options(m_bTraceCalls, curl, "GET", strUrl, oSession, pHeaders);
|
289
|
+
curl_slist *hdrs = set_curl_options(m_bTraceCalls, curl, "GET", strUrl, String(), oSession, pHeaders, m_sslVerifyPeer);
|
233
290
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &oFile);
|
234
291
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &curlBodyFileCallback);
|
235
292
|
|
@@ -368,11 +425,11 @@ static size_t curlHeaderCallback(void *ptr, size_t size, size_t nmemb, void *opa
|
|
368
425
|
int nSep = strHeader.find(':');
|
369
426
|
if (nSep > 0 )
|
370
427
|
{
|
371
|
-
String strName =
|
428
|
+
String strName = String_trim(strHeader.substr(0, nSep));
|
372
429
|
String lName;
|
373
430
|
std::transform(strName.begin(), strName.end(), std::back_inserter(lName), &::tolower);
|
374
431
|
|
375
|
-
String strValue =
|
432
|
+
String strValue = String_trim(strHeader.substr(nSep+1, strHeader.length() - (nSep+3) ));
|
376
433
|
|
377
434
|
pHeaders->put(lName, strValue);
|
378
435
|
}
|
@@ -380,7 +437,8 @@ static size_t curlHeaderCallback(void *ptr, size_t size, size_t nmemb, void *opa
|
|
380
437
|
return nBytes;
|
381
438
|
}
|
382
439
|
|
383
|
-
curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const String& strUrl,
|
440
|
+
curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const String& strUrl, const String& strBody,
|
441
|
+
IRhoSession* pSession, Hashtable<String,String>* pHeaders, bool sslVerifyPeer)
|
384
442
|
{
|
385
443
|
curl_easy_reset(curl);
|
386
444
|
if (strcasecmp(method, "GET") == 0)
|
@@ -405,6 +463,8 @@ curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const S
|
|
405
463
|
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 180);
|
406
464
|
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
|
407
465
|
|
466
|
+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)sslVerifyPeer);
|
467
|
+
|
408
468
|
// Set very large timeout in case of local requests
|
409
469
|
// It is required because otherwise requests (especially requests to writing!)
|
410
470
|
// could repeated twice or more times
|
@@ -416,13 +476,22 @@ curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const S
|
|
416
476
|
hdrs = curl_slist_append(hdrs, "Expect:");
|
417
477
|
// Add Keep-Alive header
|
418
478
|
hdrs = curl_slist_append(hdrs, "Connection: Keep-Alive");
|
479
|
+
|
480
|
+
if (strcasecmp(method, "POST") == 0) {
|
481
|
+
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strBody.size());
|
482
|
+
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, strBody.c_str());
|
483
|
+
}
|
484
|
+
|
485
|
+
bool hasContentType = false;
|
419
486
|
if (pHeaders)
|
420
487
|
{
|
421
488
|
for ( Hashtable<String,String>::iterator it = pHeaders->begin(); it != pHeaders->end(); ++it )
|
422
489
|
{
|
423
|
-
|
490
|
+
if (!hasContentType && strcasecmp(it->first.c_str(), "content-type") == 0)
|
491
|
+
hasContentType = true;
|
492
|
+
String strHeader = it->first + ": " + it->second;
|
424
493
|
hdrs = curl_slist_append(hdrs, strHeader.c_str());
|
425
|
-
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, hdrs);
|
494
|
+
// curl_easy_setopt(curl, CURLOPT_HTTPHEADER, hdrs);
|
426
495
|
}
|
427
496
|
|
428
497
|
//set header callback
|
@@ -431,6 +500,16 @@ curl_slist *set_curl_options(bool trace, CURL *curl, const char *method, const S
|
|
431
500
|
|
432
501
|
}
|
433
502
|
|
503
|
+
if (!hasContentType && strcasecmp(method, "POST") == 0 && strBody.length() > 0)
|
504
|
+
{
|
505
|
+
String strHeader = "Content-Type: ";
|
506
|
+
if ( pSession )
|
507
|
+
strHeader += pSession->getContentType().c_str();
|
508
|
+
else
|
509
|
+
strHeader += "application/x-www-form-urlencoded";
|
510
|
+
hdrs = curl_slist_append(hdrs, strHeader.c_str());
|
511
|
+
}
|
512
|
+
|
434
513
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, hdrs);
|
435
514
|
|
436
515
|
if (trace) {
|
@@ -21,10 +21,15 @@ public:
|
|
21
21
|
INetResponse *pullData(const String& strUrl, IRhoSession *oSession);
|
22
22
|
INetResponse *pushData(const String& strUrl, const String& strBody, IRhoSession *oSession);
|
23
23
|
INetResponse *pushFile(const String& strUrl, const String& strFileName, IRhoSession *oSession, Hashtable<String,String>* pHeaders);
|
24
|
+
INetResponse* pushMultipartData(const String& strUrl, VectorPtr<CMultipartItem*>& arItems, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
25
|
+
INetResponse* pushMultipartData(const String& strUrl, CMultipartItem& oItem, IRhoSession* oSession, Hashtable<String,String>* pHeaders);
|
24
26
|
INetResponse *pullFile(const String& strUrl, const String& strFilePath, IRhoSession *oSession, Hashtable<String,String>* pHeaders);
|
25
27
|
INetResponse *pullCookies(const String& strUrl, const String& strBody, IRhoSession *oSession);
|
26
28
|
INetResponse* doRequest( const char* method, const String& strUrl, const String& strBody, IRhoSession* oSession, Hashtable<String,String>* pHeaders );
|
27
29
|
|
30
|
+
boolean sslVerifyPeer() {return m_sslVerifyPeer;}
|
31
|
+
void sslVerifyPeer(boolean mode) {m_sslVerifyPeer = mode;}
|
32
|
+
|
28
33
|
String resolveUrl(const String& strUrl);
|
29
34
|
|
30
35
|
void cancel();
|
@@ -40,6 +45,7 @@ private:
|
|
40
45
|
CURL *curl;
|
41
46
|
char *errbuf[CURL_ERROR_SIZE];
|
42
47
|
boolean m_bTraceCalls;
|
48
|
+
boolean m_sslVerifyPeer;
|
43
49
|
};
|
44
50
|
|
45
51
|
} // namespace net
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#include <algorithm>
|
2
|
-
|
3
1
|
#include "net/HttpServer.h"
|
4
2
|
#include "common/RhodesApp.h"
|
5
3
|
#include "common/RhoFilePath.h"
|
6
4
|
#include "ruby/ext/rho/rhoruby.h"
|
7
5
|
|
6
|
+
#include <algorithm>
|
7
|
+
|
8
8
|
#if !defined(OS_WINCE)
|
9
9
|
#include <sys/stat.h>
|
10
10
|
#else
|
@@ -813,7 +813,9 @@ bool CHttpServer::dispatch(String const &uri, Route &route)
|
|
813
813
|
bool CHttpServer::send_file(String const &path)
|
814
814
|
{
|
815
815
|
String fullPath = CFilePath::normalizePath(path);
|
816
|
-
|
816
|
+
if (String_startsWith(fullPath,"/app/db/db-files") )
|
817
|
+
fullPath = CFilePath::join( RHODESAPP().getRhoRootPath(), path.substr(4) );
|
818
|
+
else if (fullPath.find(m_root) != 0)
|
817
819
|
fullPath = CFilePath::join( m_root, path );
|
818
820
|
|
819
821
|
if (verbose) RAWTRACE1("Sending file %s...", fullPath.c_str());
|
@@ -877,7 +879,7 @@ bool CHttpServer::decide(String const &method, String const &uri, String const &
|
|
877
879
|
callback_t callback = registered(uri);
|
878
880
|
if (callback) {
|
879
881
|
RAWTRACE1("Uri %s is registered callback, so handle it appropriately", uri.c_str());
|
880
|
-
callback(this, query);
|
882
|
+
callback(this, query.length() ? query : body);
|
881
883
|
return true;
|
882
884
|
}
|
883
885
|
|