rack_iphone_web_app 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/rack_iphone_web_app.rb +6 -12
  3. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -33,6 +33,7 @@ module Rack
33
33
  localStorage.setItem('__cookie__', ''+document.cookie);
34
34
  }
35
35
  },1000);
36
+
36
37
  }
37
38
  })()
38
39
  </script>
@@ -45,24 +46,17 @@ module Rack
45
46
 
46
47
  def call(env)
47
48
  if iphone_web_app?(env)
48
- status, headers, body = @app.call(env)
49
-
50
49
  if new_session?(env)
51
50
  [200,{'Content-Length' => code(true).length.to_s, 'Content-Type' => 'text/html'}, code(true)]
52
51
  else
52
+ status, headers, body = @app.call(env)
53
53
  # Put in patch code
54
+ response = Rack::Response.new([], status, headers)
54
55
  body.each do |part|
55
- if part =~ /<\/head>/
56
- part.sub!(/<\/head>/, "#{code}</head>")
57
-
58
- if headers['Content-Length']
59
- headers['Content-Length'] = (headers['Content-Length'].to_i + code.length).to_s
60
- end
61
-
62
- break
63
- end
56
+ part.gsub!(/<\/head>/, "#{code}</head>")
57
+ response.write(part)
64
58
  end
65
- [status, headers, body]
59
+ response.finish
66
60
  end
67
61
  else
68
62
  @app.call(env)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack_iphone_web_app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Hoskins