rhodes 5.5.0.22 → 5.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +1 -1
  3. data/CREDITS +3 -3
  4. data/Rakefile +0 -22
  5. data/extensions/rhoconnect-push/ext/rhoconnect-push/platform/android/Rakefile +1 -1
  6. data/lib/build/jake.rb +0 -5
  7. data/lib/commonAPI/coreapi/ext/shared/TimerImpl.cpp +27 -36
  8. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.h +0 -2
  9. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +25 -183
  10. data/platform/iphone/Classes/rho/net/IPhoneNetRequest.mm +4 -91
  11. data/platform/iphone/rbuild/iphone.rake +231 -272
  12. data/platform/shared/common/RhoTime.cpp +40 -81
  13. data/platform/shared/db/DBAdapter.cpp +0 -33
  14. data/platform/shared/db/DBAdapter.h +0 -5
  15. data/platform/shared/net/HttpServer.cpp +1 -27
  16. data/platform/shared/net/INetRequest.cpp +6 -33
  17. data/platform/shared/qt/rhodes/qkineticscroller.cpp +2 -2
  18. data/platform/shared/qt/rhodes/qkineticscroller_p.h +1 -1
  19. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +3 -3
  20. data/platform/shared/qt/rhodes/qtscrollevent.cpp +2 -2
  21. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +1 -1
  22. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +1 -1
  23. data/platform/wm/build/wm.rake +3 -7
  24. data/platform/wm/rhodes/browser/BrowserFactory.cpp +6 -4
  25. data/platform/wm/rhodes/rhodes.vcproj +2 -31
  26. data/rakefile.rb +0 -22
  27. data/res/generators/templates/application/app/Settings/home.erb +1 -1
  28. data/res/generators/templates/application/build.yml +4 -61
  29. data/res/generators/templates/application/icon/icon.png +0 -0
  30. data/res/generators/templates/application/icon/icon114.png +0 -0
  31. data/res/generators/templates/application/icon/icon120.png +0 -0
  32. data/res/generators/templates/application/icon/icon144.png +0 -0
  33. data/res/generators/templates/application/icon/icon152.png +0 -0
  34. data/res/generators/templates/application/icon/icon180.png +0 -0
  35. data/res/generators/templates/application/icon/icon57.png +0 -0
  36. data/res/generators/templates/application/icon/icon60.png +0 -0
  37. data/res/generators/templates/application/icon/icon72.png +0 -0
  38. data/res/generators/templates/application/icon/icon76.png +0 -0
  39. data/res/generators/templates/application/production/iTunesArtwork.png +0 -0
  40. data/res/generators/templates/application/production/iTunesArtwork@2x.png +0 -0
  41. data/res/generators/templates/iphone_project/buildRhoBundle +7 -23
  42. data/res/generators/templates/iphone_project/root/Info.plist +2 -0
  43. data/res/generators/templates/iphone_project/root/iTunesArtwork +0 -0
  44. data/res/generators/templates/iphone_project/root/iTunesArtwork@2x +0 -0
  45. data/res/generators/templates/iphone_project/root/icon114.png +0 -0
  46. data/res/generators/templates/iphone_project/root/icon120.png +0 -0
  47. data/res/generators/templates/iphone_project/root/icon144.png +0 -0
  48. data/res/generators/templates/iphone_project/root/icon152.png +0 -0
  49. data/res/generators/templates/iphone_project/root/icon180.png +0 -0
  50. data/res/generators/templates/iphone_project/root/icon57.png +0 -0
  51. data/res/generators/templates/iphone_project/root/icon60.png +0 -0
  52. data/res/generators/templates/iphone_project/root/icon72.png +0 -0
  53. data/res/generators/templates/iphone_project/root/icon76.png +0 -0
  54. data/rhodes.gemspec +6 -7
  55. data/version +1 -1
  56. metadata +16 -46
  57. data/platform/iphone/rbuild/putsOverride.rake +0 -8
  58. data/platform/wm/rhodes/browser/stubs.cpp +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b59d660eec4516c51b9d05121cf3ec2a002447c8
4
- data.tar.gz: 3dff6eb9aaf1b99bdbc1e73a7391b7505952e4e6
3
+ metadata.gz: ca79afe2871dc844140855c5c576cde2e543561f
4
+ data.tar.gz: 205d5827bdf76a53bacd15aecbbe94ef1eafe2fd
5
5
  SHA512:
6
- metadata.gz: 6e9dfe2d490773cb366588e3b30c65d4a3781918b50b70fc34b36e9e8d60a1adedb4d38f5303ef68430ae0f21b86641f793787ede5df479441622b3afc436e6b
7
- data.tar.gz: 3b2b2095210b17c711bb34a6d0de3136b42669fea381dc11d24cf8e34d33441ae098d51bca8c829dee53ee9b87352c92dbe7dc52bb768819747c54c687e84b3e
6
+ metadata.gz: 6bbd7b25acd92e68ed940b77f4687fe92ce3044d65380183f9595e68b5ca1a82c20db7866ec2ea8334fc2c5d7ee5780196972cd1368a24a0365489b1ad10672e
7
+ data.tar.gz: 9368726e9ccadcc979254160487ee1a36e3d39413be60c3de7691cf6ac0dcb05e07764e48da2faa52deba9664bb76f8416db09cc970707f85efc3ba18c22836e
data/CONTRIBUTING.md CHANGED
@@ -4,7 +4,7 @@ Found an issue with Rhodes, give feedback or provide a patch? Here's how!
4
4
 
5
5
  ## Reporting issues
6
6
 
7
- We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems that we can fix within Rhodes. For application-specific or API-related questions, please visit our [Forums](http://forums.tau-technologies.com). Please read the following guidelines before opening any issue.
7
+ We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems that we can fix within Rhodes. For application-specific or API-related questions, please visit our [Launchpad Disscussion Area](https://developer.zebra.com/community/rhomobile-suite/discussions/rhomobile-discussions). Please read the following guidelines before opening any issue.
8
8
 
9
9
  1. **Search for existing issues.** We sometimes get duplicate issues, and you'd help us out a lot by first checking if someone else has reported the same issue. Moreover, the issue may have already been resolved with a fix available.
10
10
  2. **Create an isolated and reproducible test case.** Be sure the problem exists in Rhodes' code.
data/CREDITS CHANGED
@@ -1,4 +1,4 @@
1
- This media, software or hardware ("Product") obtained from Tau Technologies, Inc. ("Tau") may include Tau?
1
+ This media, software or hardware ("Product") obtained from Tau, Inc. ("Tau") may include Tau?
2
2
  Software, Third Party Software (defined below), and/or Open Source Software
3
3
  (defined below).
4
4
 
@@ -9,9 +9,9 @@ more agreements in force between the purchaser of the Tau
9
9
  Product or licensee of the Tau Software and Tau. SOFTWARE IS PROTECTED BY U.S. COPYRIGHT LAWS AND INTERNATIONAL
10
10
  LAWS AND TREATIES. UNAUTHORIZED COPYING, DISTRIBUTION OR OTHER USE OF
11
11
  THIS PRODUCT IS STRICTLY PROHIBITED. ANY DISTRIBUTION OR USE NOT
12
- SPECIFICALLY APPROVED BY TAU IS STRICTLY PROHIBITED.
12
+ SPECIFICALLY APPROVED BY ZEBRA IS STRICTLY PROHIBITED.
13
13
 
14
- Tau Software is subject to the commercial terms and
14
+ Tau? Software is subject to the commercial terms and
15
15
  conditions entered into with Tau, any other use is strictly
16
16
  prohibited. Commercial Software licensed for redistribution by Tau ("Third Party Software") is subject to the terms and conditions
17
17
  in force between Tau and the licensor of the Third party
data/Rakefile CHANGED
@@ -74,7 +74,6 @@ end
74
74
  #------------------------------------------------------------------------
75
75
 
76
76
  $app_basedir = pwd
77
- $is_webkit_engine = false
78
77
  $startdir = File.dirname(__FILE__)
79
78
  $startdir.gsub!('\\', '/')
80
79
 
@@ -2487,10 +2486,6 @@ def init_extensions(dest, mode = "")
2487
2486
 
2488
2487
  $app_config["extensions"].each do |extname|
2489
2488
  puts 'ext - ' + extname
2490
-
2491
- if extname == "webkit"
2492
- $is_webkit_engine = true
2493
- end
2494
2489
 
2495
2490
  extpath = nil
2496
2491
  extpaths.each do |p|
@@ -2675,23 +2670,6 @@ def init_extensions(dest, mode = "")
2675
2670
 
2676
2671
  end
2677
2672
 
2678
- stubs = File.join($startdir, "platform", "wm", "rhodes", "browser", "stubs.cpp")
2679
- if $is_webkit_engine == false
2680
- File.open(stubs, "w+") do |f|
2681
- f.puts "// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!"
2682
- f.puts "#include \"StdAfx.h\""
2683
- f.puts "#include \"common/RhoStd.h\""
2684
- f.puts "#include \"IBrowserEngine.h\""
2685
- f.puts "rho::IBrowserEngine* rho_wmimpl_get_webkitBrowserEngine(HWND hwndParent, HINSTANCE rhoAppInstance) {return 0;}"
2686
- Jake.modify_file_if_content_changed( stubs, f )
2687
- end
2688
- else
2689
- File.open(stubs, "w+") do |f|
2690
- f.puts "// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!"
2691
- f.puts "#include \"StdAfx.h\""
2692
- Jake.modify_file_if_content_changed( stubs, f )
2693
- end
2694
- end
2695
2673
 
2696
2674
  if ($ruby_only_extensions_list)
2697
2675
  BuildOutput.warning([
@@ -21,7 +21,7 @@ ARGS = [
21
21
  "-I\"#{$rootdir}/platform/android/Rhodes/jni/include\"",
22
22
  "-I\"#{$rootdir}/platform/android/Rhodes/jni/include/rhodes/details\"",
23
23
  "-I\"#{$rootdir}/platform/shared/ruby/include\"",
24
- "-I\"#{$rootdir}/lib/commonAPI/coreapi/ext/shared\"",
24
+ "-I\"#{$rootdir}/lib/commonApi/coreapi/ext/shared\"",
25
25
  "-I\"#{$rootdir}/platform/shared\"",
26
26
  "-I\"#{$rootdir}/platform/shared/common\"",
27
27
  "-I\"#{$rootdir}/platform/shared/api_generator\"",
data/lib/build/jake.rb CHANGED
@@ -876,11 +876,6 @@ class Jake
876
876
  app_version += "\r\napp_name='#{$app_config["name"]}'"
877
877
  app_version += "\r\ntitle_text='#{$app_config["name"]}'" if $current_platform == "win32"
878
878
  app_version += "\r\norg_name='#{$app_config["vendor"]}'" if $current_platform == "win32"
879
- app_version += "\r\nrho_app_id='#{$app_config["rho_app_id"]}'" if $app_config['rho_app_id']
880
-
881
- if $is_webkit_engine == true
882
- File.open(File.join($srcdir,'apps/rhoconfig.txt'), "a"){ |f| f.write("\r\nwebengine=webkit") }
883
- end
884
879
 
885
880
  File.open(File.join($srcdir,'apps/rhoconfig.txt'), "a"){ |f| f.write(app_version) }
886
881
  File.open(File.join($srcdir,'apps/rhoconfig.txt.timestamp'), "w"){ |f| f.write(Time.now.to_f().to_s()) }
@@ -11,41 +11,35 @@
11
11
 
12
12
  extern "C" void rho_ios_log_console_output(const char* message);
13
13
 
14
-
15
-
16
- #undef DEFAULT_LOGCATEGORY
17
- #define DEFAULT_LOGCATEGORY "TimerImpl"
18
-
19
-
20
- namespace rho
21
- {
14
+ namespace rho
15
+ {
22
16
  class CTimerFactory;
23
17
 
24
18
  using namespace apiGenerator;
25
19
  using namespace common;
26
-
20
+
27
21
  class CTimerSingletonImpl: public CTimerSingletonBase
28
22
  {
29
23
  static unsigned int createdTimers;
30
24
 
31
25
  public:
32
-
26
+
33
27
  CTimerSingletonImpl(): CTimerSingletonBase(){}
34
-
28
+
35
29
  //methods
36
- // create Create a timers objects.
37
- virtual void create(rho::apiGenerator::CMethodResult& oResult)
30
+ // create Create a timers objects.
31
+ virtual void create(rho::apiGenerator::CMethodResult& oResult)
38
32
  {
39
33
  ++createdTimers;
40
34
 
41
35
  char buf[10];
42
36
  sprintf(buf, "%d", createdTimers);
43
37
  oResult.set(buf);
44
- }
45
- // enumerate This is documentation
46
- virtual void enumerate(rho::apiGenerator::CMethodResult& oResult) { }
38
+ }
39
+ // enumerate This is documentation
40
+ virtual void enumerate(rho::apiGenerator::CMethodResult& oResult) { }
47
41
  };
48
-
42
+
49
43
  unsigned int CTimerSingletonImpl::createdTimers = 0;
50
44
 
51
45
  class CTimerImpl : public CTimerBase, public common::CRhoTimer::ICallback
@@ -61,7 +55,7 @@ namespace rho
61
55
 
62
56
  virtual void run()
63
57
  {
64
-
58
+
65
59
  while ( !RHODESAPP().isApplicationActive() ) {
66
60
  wait(10);
67
61
  }
@@ -77,40 +71,37 @@ namespace rho
77
71
 
78
72
  public:
79
73
  CTimerImpl(const rho::String& timerID) : m_timerID(timerID), m_answerThread(0) {}
80
- virtual ~CTimerImpl()
74
+ virtual ~CTimerImpl()
81
75
  {
82
76
  if (!m_answerThread)
83
77
  delete m_answerThread;
84
78
  }
85
79
 
86
80
  //methods
87
- virtual void start( int interval, rho::apiGenerator::CMethodResult& oResult)
81
+ virtual void start( int interval, rho::apiGenerator::CMethodResult& oResult)
88
82
  {
89
83
  if (interval <= 0)
90
84
  {
91
- LOG(ERROR) + "$NetRequestProcess$ PRE SET ERROR CTimerImpl::start";
92
85
  oResult.setError("invalid interval");
93
- LOG(ERROR) + "$NetRequestProcess$ POST SET ERROR CTimerImpl::start";
94
-
95
- return;
86
+ return;
96
87
  }
97
88
 
98
89
  m_oResult = oResult;
99
90
  common::CRhoTimer& timerManager = RHODESAPP().getTimer();
100
91
  timerManager.addNativeTimer(interval, this);
101
- }
92
+ }
102
93
 
103
94
  virtual void stop(rho::apiGenerator::CMethodResult& oResult)
104
95
  {
105
96
  common::CRhoTimer& timerManager = RHODESAPP().getTimer();
106
97
  timerManager.stopNativeTimer(this);
107
- }
98
+ }
108
99
 
109
- virtual void isAlive(rho::apiGenerator::CMethodResult& oResult)
100
+ virtual void isAlive(rho::apiGenerator::CMethodResult& oResult)
110
101
  {
111
102
  common::CRhoTimer& timerManager = RHODESAPP().getTimer();
112
103
  oResult.set(timerManager.isNativeTimerExist(this));
113
- }
104
+ }
114
105
 
115
106
  virtual bool onTimer()
116
107
  {
@@ -123,20 +114,20 @@ namespace rho
123
114
  return true;
124
115
  }
125
116
  };
126
-
117
+
127
118
  ////////////////////////////////////////////////////////////////////////
128
-
129
- class CTimerFactory: public CTimerFactoryBase
119
+
120
+ class CTimerFactory: public CTimerFactoryBase
130
121
  {
131
122
  public:
132
123
  CTimerFactory(){}
133
-
124
+
134
125
  ITimerSingleton* createModuleSingleton()
135
- {
126
+ {
136
127
  return new CTimerSingletonImpl();
137
128
  }
138
-
139
- virtual ITimer* createModuleByID(const rho::String& strID){
129
+
130
+ virtual ITimer* createModuleByID(const rho::String& strID){
140
131
  return new CTimerImpl(strID);
141
132
  };
142
133
 
@@ -145,7 +136,7 @@ namespace rho
145
136
  return m_hashModules.size();
146
137
  }
147
138
  };
148
-
139
+
149
140
  }
150
141
 
151
142
  extern "C" void Init_Timer_extension()
@@ -15,6 +15,4 @@
15
15
  @property (retain) NSMutableDictionary* httpHeaders;
16
16
  @property (retain) NSData* httpBody;
17
17
 
18
- @property (nonatomic) BOOL isStopped;
19
-
20
18
  @end
@@ -6,25 +6,6 @@
6
6
 
7
7
  #import "common/RhoConf.h"
8
8
 
9
-
10
- #import "logging/RhoLog.h"
11
- #undef DEFAULT_LOGCATEGORY
12
- #define DEFAULT_LOGCATEGORY "RhoURLProtocol"
13
-
14
- static bool is_net_trace() {
15
- static int res = -1;
16
- if (res == -1) {
17
- if (rho_conf_getBool("net_trace") ) {
18
- res = 1;
19
- }
20
- else {
21
- res = 0;
22
- }
23
- }
24
- return res == 1;
25
- }
26
-
27
-
28
9
  extern int rho_http_started();
29
10
  extern int rho_http_get_port();
30
11
 
@@ -47,7 +28,6 @@ int on_http_data_cb(http_parser* parser, const char *at, size_t length) { return
47
28
  int on_http_cb(http_parser* parser) { return 0; }
48
29
 
49
30
 
50
-
51
31
  @interface CRhoURLResponse : NSHTTPURLResponse {
52
32
 
53
33
  }
@@ -59,16 +39,6 @@ int on_http_cb(http_parser* parser) { return 0; }
59
39
 
60
40
  @implementation CRhoURLProtocol
61
41
 
62
-
63
- -(const char*)selfIDstring {
64
- return [[NSString stringWithFormat:@"<%p>", self] UTF8String];
65
- }
66
-
67
- + (const char*)requestInfo:(NSURLRequest*)req {
68
- return [[NSString stringWithFormat:@"<NSURLRequest:<%p>, URL:[ %@ ], Headers:[ %@ ]", req, req.URL, req.allHTTPHeaderFields] UTF8String];
69
- }
70
-
71
-
72
42
  - (void)dealloc
73
43
  {
74
44
  [httpBody release];
@@ -89,27 +59,17 @@ int on_http_cb(http_parser* parser) { return 0; }
89
59
 
90
60
  + (BOOL)canInitWithRequest:(NSURLRequest*)theRequest
91
61
  {
92
- if (is_net_trace()) {
93
- RAWTRACE1("$NetRequestProcess$ canInitWithRequest BEGIN: { %s }", [CRhoURLProtocol requestInfo:theRequest]);
94
- }
95
-
96
62
  NSURL* theUrl = [theRequest URL];
97
63
  if ([[theUrl path] isEqualToString:@"/!__rhoNativeApi"]) {
98
64
 
99
65
  NSString* jsonRequestTest = [theRequest valueForHTTPHeaderField:@"__rhoNativeApiCall"];
100
66
  if (jsonRequestTest != nil) {
101
67
  //NSLog(@"$$$ process Request: [%@:%@]", [theUrl absoluteString], jsonRequestTest);
102
- if (is_net_trace()) {
103
- RAWTRACE("$NetRequestProcess$ canInitWithRequest END: return YES by !__rhoNativeApi prefix");
104
- }
105
68
  return YES;
106
69
  }
107
70
  }
108
71
  #if defined(RHO_NO_RUBY_API) && defined(RHO_NO_HTTP_SERVER)
109
72
  if ([theRequest.URL.scheme isEqualToString:@"file"]) {
110
- if (is_net_trace()) {
111
- RAWTRACE("$NetRequestProcess$ canInitWithRequest END: return YES by file scheme when no Ruby API server");
112
- }
113
73
  return YES;
114
74
  }
115
75
  #endif
@@ -119,21 +79,10 @@ int on_http_cb(http_parser* parser) { return 0; }
119
79
  canHandle = rho_conf_getBool("ios_direct_local_requests")!=0;
120
80
  }
121
81
 
122
- if ( canHandle ) {
123
- if (is_net_trace()) {
124
- RAWTRACE("$NetRequestProcess$ canInitWithRequest: ios_direct_local_requests = true !");
125
- }
126
- if ([CRhoURLProtocol isLocalURL:theUrl]) {
127
- if (is_net_trace()) {
128
- RAWTRACE("$NetRequestProcess$ canInitWithRequest END: return YES URL is local !");
129
- }
130
- return YES;
131
- }
82
+ if ( canHandle && [CRhoURLProtocol isLocalURL:theUrl] ) {
83
+ return YES;
132
84
  }
133
85
 
134
- if (is_net_trace()) {
135
- RAWTRACE("$NetRequestProcess$ canInitWithRequest END: return NO");
136
- }
137
86
  return NO;
138
87
  }
139
88
 
@@ -142,27 +91,19 @@ int on_http_cb(http_parser* parser) { return 0; }
142
91
  return request;
143
92
  }
144
93
 
145
- - (void)startLoadingInThread
94
+ - (void)startLoading
146
95
  {
147
- if (is_net_trace()) {
148
- RAWTRACE2("$NetRequestProcess$ CRhoURLProtocol %s :: startLoadingInThread BEGIN: { %s }", [self selfIDstring], [CRhoURLProtocol requestInfo:[self request]]);
149
- }
150
96
  NSURL* theUrl = [[self request] URL];
151
97
 
152
98
 
153
99
  if ([[theUrl path] isEqualToString:@"/!__rhoNativeApi"]) {
154
- if (is_net_trace()) {
155
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading URL has !__rhoNativeApi", [self selfIDstring]);
156
- }
100
+
157
101
  NSString* jsonRequestTest = [[self request] valueForHTTPHeaderField:@"__rhoNativeApiCall"];
158
102
  if (jsonRequestTest != nil) {
159
103
  NSString* responseStr = [CJSEntryPoint js_entry_point:jsonRequestTest];
160
104
  if (responseStr != nil) {
161
105
  //NSLog(@"$$$ send responce for[%@:%@] = [%@]", [theUrl absoluteString], jsonRequestTest, responseStr);
162
106
  [self sendResponseWithResponseCode:200 data:[responseStr dataUsingEncoding:NSUTF8StringEncoding]];
163
- if (is_net_trace()) {
164
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading END", [self selfIDstring]);
165
- }
166
107
  return;
167
108
  }
168
109
  }
@@ -192,13 +133,12 @@ int on_http_cb(http_parser* parser) { return 0; }
192
133
  textEncodingName:@"UTF-8"];
193
134
  response.statusCode = 200;
194
135
 
195
- if (!self.isStopped) {
196
- [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
197
- if (data != nil) {
198
- [[self client] URLProtocol:self didLoadData:data];
199
- }
200
- [[self client] URLProtocolDidFinishLoading:self];
136
+ [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
137
+ if (data != nil) {
138
+ [[self client] URLProtocol:self didLoadData:data];
201
139
  }
140
+ [[self client] URLProtocolDidFinishLoading:self];
141
+
202
142
 
203
143
  return;
204
144
  }
@@ -207,9 +147,6 @@ int on_http_cb(http_parser* parser) { return 0; }
207
147
 
208
148
  if ( [CRhoURLProtocol isLocalURL:theUrl] )
209
149
  {
210
- if (is_net_trace()) {
211
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: URL is local !", [self selfIDstring]);
212
- }
213
150
  NSURL* url = theUrl;
214
151
  CRhoURLResponse* resp = nil;
215
152
 
@@ -217,14 +154,7 @@ int on_http_cb(http_parser* parser) { return 0; }
217
154
 
218
155
  if ( resp != nil )
219
156
  {
220
- if (is_net_trace()) {
221
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading has Responce from local server", [self selfIDstring]);
222
- }
223
157
  if ( ((self.httpStatusCode==301)||(self.httpStatusCode==302)) && ( [self.httpHeaders objectForKey:@"location"] != nil ) ) {
224
-
225
- if (is_net_trace()) {
226
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading we have REDIRECT from local server !", [self selfIDstring]);
227
- }
228
158
  NSString* loc = [self.httpHeaders objectForKey:@"location"];
229
159
 
230
160
  NSString* escaped = [loc stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
@@ -272,89 +202,34 @@ int on_http_cb(http_parser* parser) { return 0; }
272
202
  }
273
203
 
274
204
 
275
- NSMutableURLRequest* redirReq = [NSMutableURLRequest requestWithURL:url];
276
-
277
- // clone headers from original request to redirect request
278
- NSDictionary* headers = [[self request] allHTTPHeaderFields];
279
- for (NSString* key in headers) {
280
- NSString* value = [headers objectForKey:key];
281
- [redirReq setValue:value forHTTPHeaderField:key];
282
- }
283
-
284
- if (is_net_trace()) {
285
- RAWTRACE2("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading wasRedirectedToRequest with Request { %s }", [self selfIDstring], [CRhoURLProtocol requestInfo:redirReq]);
286
- }
287
- if (!self.isStopped) {
288
-
289
- [[self client] URLProtocol:self wasRedirectedToRequest:redirReq redirectResponse:resp];
290
- }
291
- if (is_net_trace()) {
292
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading END", [self selfIDstring]);
293
- }
205
+ NSURLRequest* redirReq = [NSURLRequest requestWithURL:url];
206
+ [[self client] URLProtocol:self wasRedirectedToRequest:redirReq redirectResponse:resp];
294
207
  return;
295
208
  }
296
- else {
297
- RAWLOG_ERROR2("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading Redirect response has no URL ! Initial request: { %s }", [self selfIDstring], [CRhoURLProtocol requestInfo:[self request]]);
298
- }
299
209
  }
300
210
  else
301
211
  {
302
- if (is_net_trace()) {
303
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading just request - no redirection", [self selfIDstring]);
304
- }
305
- if (!self.isStopped) {
306
-
307
- [[self client] URLProtocol:self didReceiveResponse:resp cacheStoragePolicy:NSURLCacheStorageNotAllowed];
308
- }
309
- if (self.httpBody != nil) {
310
- if (!self.isStopped) {
311
- [[self client] URLProtocol:self didLoadData:self.httpBody];
312
- }
313
- }
314
- if (!self.isStopped) {
315
- [[self client] URLProtocolDidFinishLoading:self];
316
- }
317
-
318
- if (is_net_trace()) {
319
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading END", [self selfIDstring]);
212
+ [[self client] URLProtocol:self didReceiveResponse:resp cacheStoragePolicy:NSURLCacheStorageNotAllowed];
213
+
214
+ if (self.httpBody != nil) {
215
+ [[self client] URLProtocol:self didLoadData:self.httpBody];
320
216
  }
217
+
218
+ [[self client] URLProtocolDidFinishLoading:self];
321
219
  return;
322
220
  }
323
221
  }
324
- else {
325
- RAWLOG_ERROR2("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading has NO Responce from local server !!! Initial request: { %s }", [self selfIDstring], [CRhoURLProtocol requestInfo:[self request]]);
326
- }
327
222
  }
328
223
 
329
224
  //NSLog(@"$$$ responce ERROR: [%@]", [theUrl absoluteString]);
330
225
  NSString* body = @"error";
331
226
  [self sendResponseWithResponseCode:401 data:[body dataUsingEncoding:NSUTF8StringEncoding]];
332
- if (is_net_trace()) {
333
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoadingInThread END", [self selfIDstring]);
334
- }
227
+
335
228
  }
336
229
 
337
- - (void)startLoading
338
- {
339
- self.isStopped = NO;
340
- if (is_net_trace()) {
341
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: startLoading()", [self selfIDstring]);
342
- }
343
-
344
- dispatch_async( dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
345
- [self startLoadingInThread];
346
- });
347
- }
348
-
349
-
350
230
  - (CRhoURLResponse*) makeDirectHttpRequest:(NSURL*)theUrl
351
231
  {
352
-
353
- if (is_net_trace()) {
354
- RAWTRACE2("$NetRequestProcess$ CRhoURLProtocol %s :: makeDirectHttpRequest : URL [ %s ]", [self selfIDstring], [[theUrl absoluteString] UTF8String]);
355
- }
356
-
357
- //NSLog(@"Will make local request to %@", [theUrl absoluteString]);
232
+ //NSLog(@"Will make local request to %@", [theUrl absoluteString]);
358
233
 
359
234
  const char* uri = [[theUrl path] UTF8String];
360
235
  const char* method = [[[self request] HTTPMethod] UTF8String];
@@ -427,10 +302,6 @@ int on_http_cb(http_parser* parser) { return 0; }
427
302
 
428
303
  - (void)stopLoading
429
304
  {
430
- self.isStopped = YES;
431
- if (is_net_trace()) {
432
- RAWTRACE1("$NetRequestProcess$ CRhoURLProtocol %s :: stopLoading()", [self selfIDstring]);
433
- }
434
305
 
435
306
  }
436
307
 
@@ -441,13 +312,7 @@ int on_http_cb(http_parser* parser) { return 0; }
441
312
 
442
313
  - (void)sendResponseWithResponseCode:(NSInteger)statusCode data:(NSData*)data
443
314
  {
444
- if (is_net_trace()) {
445
- RAWTRACE2("$NetRequestProcess$ CRhoURLProtocol %s :: sendResponseWithResponseCode : code: [ %d ] ", [self selfIDstring], (int)statusCode);
446
- }
447
315
 
448
- if (self.isStopped) {
449
- return;
450
- }
451
316
  CRhoURLResponse* response =
452
317
  [[CRhoURLResponse alloc] initWithURL:[[self request] URL]
453
318
  MIMEType:@"text/plain"
@@ -455,39 +320,25 @@ int on_http_cb(http_parser* parser) { return 0; }
455
320
  textEncodingName:@"UTF-8"];
456
321
  response.statusCode = statusCode;
457
322
 
458
- if (!self.isStopped) {
459
- [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
460
- }
323
+ [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
461
324
  if (data != nil) {
462
- if (!self.isStopped) {
463
- [[self client] URLProtocol:self didLoadData:data];
464
- }
465
- }
466
- if (!self.isStopped) {
467
- [[self client] URLProtocolDidFinishLoading:self];
325
+ [[self client] URLProtocol:self didLoadData:data];
468
326
  }
327
+ [[self client] URLProtocolDidFinishLoading:self];
328
+
469
329
  [response release];
470
330
  }
471
331
 
472
332
  + (BOOL) isLocalURL:(NSURL*)url
473
333
  {
474
- if (is_net_trace()) {
475
- RAWTRACE1("$NetRequestProcess$ isLocalURL BEGIN : URL: [ %s ] ", [[url absoluteString] UTF8String]);
476
- }
477
334
  if ( [[url absoluteString] isEqualToString:@""] )
478
335
  {
479
- if (is_net_trace()) {
480
- RAWTRACE("isLocalURL END : return NO");
481
- }
482
336
  return NO;
483
337
  }
484
338
 
485
339
  const char* scheme = [[url scheme] UTF8String];
486
340
  if (scheme != 0) {
487
341
  if ((strcmp(scheme, "http") !=0 ) && (strcmp(scheme, "https") !=0 )) {
488
- if (is_net_trace()) {
489
- RAWTRACE("$NetRequestProcess$ isLocalURL END : return NO");
490
- }
491
342
  return NO;
492
343
  }
493
344
  }
@@ -496,10 +347,7 @@ int on_http_cb(http_parser* parser) { return 0; }
496
347
 
497
348
  if ( 0 == host )
498
349
  {
499
- if (is_net_trace()) {
500
- RAWTRACE("$NetRequestProcess$ isLocalURL END : return YES");
501
- }
502
- return YES;
350
+ return YES;
503
351
  }
504
352
 
505
353
  NSNumber* p = [url port];
@@ -507,15 +355,10 @@ int on_http_cb(http_parser* parser) { return 0; }
507
355
 
508
356
  int rhoPort = rho_http_get_port();
509
357
 
510
- BOOL ret = (
358
+ return (
511
359
  ((port == rhoPort))
512
360
  && ( (strcmp(host,"127.0.0.1")==0) || (strcmp(host,"localhost")==0) )
513
361
  );
514
- if (is_net_trace()) {
515
- RAWTRACE1("$NetRequestProcess$ isLocalURL END : return [%s]", [[[NSNumber numberWithBool:ret] stringValue] UTF8String]);
516
- }
517
-
518
- return ret;
519
362
  }
520
363
 
521
364
 
@@ -523,7 +366,6 @@ int on_http_cb(http_parser* parser) { return 0; }
523
366
  @synthesize httpHeaderName;
524
367
  @synthesize httpHeaders;
525
368
  @synthesize httpBody;
526
- @synthesize isStopped;
527
369
 
528
370
 
529
371
  @end