rffw 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/.gitignore +5 -0
  2. data/.rvmrc +1 -0
  3. data/Gemfile +4 -0
  4. data/README.md +60 -0
  5. data/Rakefile +41 -0
  6. data/bin/rffw +16 -0
  7. data/lib/rffw.rb +7 -0
  8. data/lib/rffw/app.rb +36 -0
  9. data/lib/rffw/app/app_handler.rb +59 -0
  10. data/lib/rffw/app/data/images/bg.png +0 -0
  11. data/lib/rffw/app/data/index.html +56 -0
  12. data/lib/rffw/app/data/javascripts/application.js +110 -0
  13. data/lib/rffw/app/data/stylesheets/style.css +338 -0
  14. data/lib/rffw/app/data/template.html +42 -0
  15. data/lib/rffw/app/db.rb +19 -0
  16. data/lib/rffw/app/description_handler.rb +12 -0
  17. data/lib/rffw/app/dir_handler.rb +36 -0
  18. data/lib/rffw/app/record.rb +43 -0
  19. data/lib/rffw/app/show_handler.rb +25 -0
  20. data/lib/rffw/app/upload_handler.rb +32 -0
  21. data/lib/rffw/app/upload_status_handler.rb +40 -0
  22. data/lib/rffw/app/urlencode_chars.data +224 -0
  23. data/lib/rffw/app/view_helpers.rb +30 -0
  24. data/lib/rffw/parser.rb +9 -0
  25. data/lib/rffw/parser/http_request.rb +137 -0
  26. data/lib/rffw/parser/http_response.rb +29 -0
  27. data/lib/rffw/parser/mime_parser.rb +46 -0
  28. data/lib/rffw/server.rb +15 -0
  29. data/lib/rffw/server/buffered_client.rb +57 -0
  30. data/lib/rffw/server/client.rb +53 -0
  31. data/lib/rffw/server/http_client.rb +49 -0
  32. data/lib/rffw/server/server.rb +46 -0
  33. data/lib/rffw/version.rb +3 -0
  34. data/rffw.db +0 -0
  35. data/rffw.gemspec +21 -0
  36. data/test/fixtures/image.jpg +0 -0
  37. data/test/fixtures/mime_image.data +0 -0
  38. data/test/fixtures/mime_image.png +0 -0
  39. data/test/fixtures/post_form_data.http +14 -0
  40. data/test/fixtures/raw_request.txt +8 -0
  41. data/test/fixtures/request.http +9 -0
  42. data/test/fixtures/upload.http +0 -0
  43. data/test/fixtures/upload_status_request.http +10 -0
  44. data/test/helper.rb +97 -0
  45. data/test/test_buffered_client.rb +50 -0
  46. data/test/test_client.rb +47 -0
  47. data/test/test_db.rb +21 -0
  48. data/test/test_http_client.rb +26 -0
  49. data/test/test_http_request.rb +52 -0
  50. data/test/test_mime_parser.rb +22 -0
  51. data/test/test_record.rb +49 -0
  52. data/test/test_upload_status_handler.rb +18 -0
  53. data/test/test_uploader_handler.rb +10 -0
  54. data/test/test_view_helpers.rb +24 -0
  55. metadata +122 -0
@@ -0,0 +1,18 @@
1
+ require 'helper'
2
+
3
+ class RFFW::App::UploadStatusHandlerTest < IntegrationTest
4
+ def test_upload_status
5
+ uploader = upload_file("upload.http")
6
+
7
+ assert_equal "Not found upload.", send_request("upload_status_request.http")
8
+
9
+ uploader.resume #send chunk one
10
+ assert_equal "{ \"progress\": \"6759/21534\" }", send_request("upload_status_request.http")
11
+
12
+ uploader.resume
13
+ assert_equal "{ \"progress\": \"14162/21534\" }", send_request("upload_status_request.http")
14
+
15
+ uploader.resume
16
+ assert_equal "{ \"mime_type\": \"application/pdf\", \"filename\": \"guillermoalvarez.pdf\" }", send_request("upload_status_request.http")
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ require 'helper'
2
+
3
+ class RFFW::App::UploadHandlerTest < IntegrationTest
4
+ include RFFW::App::UploadHandler
5
+
6
+ def test_upload_status
7
+ response = send_request("upload.http")
8
+ assert_equal 'So... Ok. Excelent.',response
9
+ end
10
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: UTF-8
2
+ require 'helper'
3
+
4
+
5
+ class RFFW::App::ViewHelpersTest < MiniTest::Unit::TestCase
6
+
7
+ include RFFW::App::ViewHelpers
8
+
9
+
10
+ def test_uri_unescape
11
+ string = "Hola+Mundo.%0D%0A%0D%0A%3Cscript%3Ealert%28%27hey%27%29%3B%3C%2Fscript%3E"
12
+ expected = "Hola Mundo.
13
+
14
+ <script>alert('hey');</script>"
15
+ assert_equal expected, uri_unescape(string)
16
+ end
17
+
18
+
19
+ def test_uri_escape
20
+ string = "hola ++ que tal € ‰"
21
+ expected ='hola+%2B%2B++que+tal+%80+%89'
22
+ assert_equal expected, uri_escape(string)
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rffw
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Guillermo Álvarez
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-08 00:00:00.000000000 +02:00
13
+ default_executable:
14
+ dependencies: []
15
+ description: A simple program that listen at port 80 for uploads, and save the uploaded
16
+ files to disk
17
+ email:
18
+ - guillermo@cientifico.net
19
+ executables:
20
+ - rffw
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - .gitignore
25
+ - .rvmrc
26
+ - Gemfile
27
+ - README.md
28
+ - Rakefile
29
+ - bin/rffw
30
+ - lib/rffw.rb
31
+ - lib/rffw/app.rb
32
+ - lib/rffw/app/app_handler.rb
33
+ - lib/rffw/app/data/images/bg.png
34
+ - lib/rffw/app/data/index.html
35
+ - lib/rffw/app/data/javascripts/application.js
36
+ - lib/rffw/app/data/stylesheets/style.css
37
+ - lib/rffw/app/data/template.html
38
+ - lib/rffw/app/db.rb
39
+ - lib/rffw/app/description_handler.rb
40
+ - lib/rffw/app/dir_handler.rb
41
+ - lib/rffw/app/record.rb
42
+ - lib/rffw/app/show_handler.rb
43
+ - lib/rffw/app/upload_handler.rb
44
+ - lib/rffw/app/upload_status_handler.rb
45
+ - lib/rffw/app/urlencode_chars.data
46
+ - lib/rffw/app/view_helpers.rb
47
+ - lib/rffw/parser.rb
48
+ - lib/rffw/parser/http_request.rb
49
+ - lib/rffw/parser/http_response.rb
50
+ - lib/rffw/parser/mime_parser.rb
51
+ - lib/rffw/server.rb
52
+ - lib/rffw/server/buffered_client.rb
53
+ - lib/rffw/server/client.rb
54
+ - lib/rffw/server/http_client.rb
55
+ - lib/rffw/server/server.rb
56
+ - lib/rffw/version.rb
57
+ - rffw.db
58
+ - rffw.gemspec
59
+ - test/fixtures/image.jpg
60
+ - test/fixtures/mime_image.data
61
+ - test/fixtures/mime_image.png
62
+ - test/fixtures/post_form_data.http
63
+ - test/fixtures/raw_request.txt
64
+ - test/fixtures/request.http
65
+ - test/fixtures/upload.http
66
+ - test/fixtures/upload_status_request.http
67
+ - test/helper.rb
68
+ - test/test_buffered_client.rb
69
+ - test/test_client.rb
70
+ - test/test_db.rb
71
+ - test/test_http_client.rb
72
+ - test/test_http_request.rb
73
+ - test/test_mime_parser.rb
74
+ - test/test_record.rb
75
+ - test/test_upload_status_handler.rb
76
+ - test/test_uploader_handler.rb
77
+ - test/test_view_helpers.rb
78
+ has_rdoc: true
79
+ homepage: ''
80
+ licenses: []
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ requirements: []
98
+ rubyforge_project: rffw
99
+ rubygems_version: 1.6.2
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: Recive files from webserver
103
+ test_files:
104
+ - test/fixtures/image.jpg
105
+ - test/fixtures/mime_image.data
106
+ - test/fixtures/mime_image.png
107
+ - test/fixtures/post_form_data.http
108
+ - test/fixtures/raw_request.txt
109
+ - test/fixtures/request.http
110
+ - test/fixtures/upload.http
111
+ - test/fixtures/upload_status_request.http
112
+ - test/helper.rb
113
+ - test/test_buffered_client.rb
114
+ - test/test_client.rb
115
+ - test/test_db.rb
116
+ - test/test_http_client.rb
117
+ - test/test_http_request.rb
118
+ - test/test_mime_parser.rb
119
+ - test/test_record.rb
120
+ - test/test_upload_status_handler.rb
121
+ - test/test_uploader_handler.rb
122
+ - test/test_view_helpers.rb