Browse Source

v0.7 - updated make and README

Signed-off-by: Brice Figureau <brice@daysofwonder.com>
tags/v0.7
Brice Figureau 16 years ago
parent
commit
ac62a292b1
3 changed files with 150 additions and 75 deletions
  1. 18
    0
      CHANGES
  2. 1
    1
      Makefile
  3. 131
    74
      README

+ 18
- 0
CHANGES View File

@@ -1,3 +1,21 @@
1
+nginx_upload_progress release 0.7                                  21 Nov 2009
2
+
3
+ * fixed segfault when uploads are aborted (thanks to Markus Doppelbauer for
4
+   his bug report)
5
+
6
+ * session ID header name is now configurable (thanks to Valery Kholodkov)
7
+
8
+ * Added directive to format output as pure json (thanks to Valery Kholodkov)
9
+
10
+ * Added directive to format output with configurable template (thanks to 
11
+   Valery Kholodkov)
12
+
13
+ * Added directive to set a probe response content-type (thanks to Valery 
14
+   Kholodkov)
15
+
16
+ * Added upload status variables (needs a status patch) (thanks to Valery 
17
+   Kholodkov)
18
+
1 19
 nginx_upload_progress release 0.6                                  12 Sep 2009
2 20
 
3 21
  * fixed node corruption when cleaning uploads (thanks to Vladimir 

+ 1
- 1
Makefile View File

@@ -1,5 +1,5 @@
1 1
 dist: CHANGES README LICENSE config ngx_http_uploadprogress_module.c
2
-	tar czvf ../nginx_uploadprogress_module-0.5.tar.gz  \
2
+	tar czvf ../nginx_uploadprogress_module-0.7.tar.gz  \
3 3
 		 ../nginx_uploadprogress_module/CHANGES \
4 4
 		 ../nginx_uploadprogress_module/README \
5 5
 		 ../nginx_uploadprogress_module/LICENSE \

+ 131
- 74
README View File

@@ -1,7 +1,6 @@
1 1
 Nginx Upload Progress Module
2 2
 ============================
3 3
 
4
-
5 4
 Introduction
6 5
 ============
7 6
 
@@ -9,7 +8,9 @@ nginx_uploadprogress_module is an implementation of an upload progress system, t
9 8
 RFC1867 POST upload as they are transmitted to upstream servers.
10 9
 
11 10
 It works by tracking the uploads proxied by Nginx to upstream servers without 
12
-analysing the uploaded content and offers a web API to report upload progress in JSON format.
11
+analysing the uploaded content and offers a web API to report upload progress in Javscript, Json or any
12
+other format (through the help of templates).
13
+
13 14
 It works because Nginx acts as an accelerator of an upstream server, storing uploaded POST content
14 15
 on disk, before transmitting it to the upstream server. Each individual POST upload request
15 16
 should contain a progress unique identifier.
@@ -22,10 +23,7 @@ The JSON idea and the mechanism idea are based on Lighttpd mod_uploadprogress:
22 23
 http://blog.lighttpd.net/articles/2006/08/01/mod_uploadprogress-is-back
23 24
 
24 25
 
25
-WARNINGS: 
26
- * this software has never been tested under load. It only passed a few stress lab tests (like
27
-20 or so parallels upload and many progress probes).
28
- * it is not intended to be deployed on *production systems*.
26
+WARNING: 
29 27
  * when compiled with --with-debug, this module will produce high number of log messages.
30 28
 
31 29
 
@@ -60,84 +58,139 @@ This identifier can be transmitted either as a GET argument or as an HTTP header
60 58
 
61 59
 upload_progress
62 60
 +++++++++++++++
63
-	:Syntax: upload_progress <zone_name> <zone_size>
64
-	:Default: none
65
-	:Context: http
66
-	:Description:
67
-	This directive enables the upload progress module and reserve <zone_size> bytes to the <zone_name> which
68
-	will be used to store the per-connection tracking information.
69
-	
61
+    :Syntax: upload_progress <zone_name> <zone_size>
62
+    :Default: none
63
+    :Context: http
64
+    :Description:
65
+    This directive enables the upload progress module and reserve <zone_size> bytes to the <zone_name> which
66
+    will be used to store the per-connection tracking information.
67
+    
70 68
 track_uploads
71 69
 +++++++++++++
72
-	:Syntax: track_uploads <zone_name> <timeout>
73
-	:Default: none
74
-	:Context: location
75
-	:Description:
76
-	This directive enables tracking uploads for the current location. Each POST landing in this location will register
77
-	the request in the <zone_name> upload progress tracker.
78
-	Since Nginx doesn't support yet RFC 1867 upload, the location must be a proxy_pass or fastcgi location.
79
-	The POST _must_ have a query parameter called X-Progress-ID (or an HTTP header of the same name) whose value is the
80
-	unique identifier used to get progress information. If the POST has no such information, the upload will not be tracked.
81
-	The tracked connections are kept at most <timeout> seconds after they have been finished to be able to serve 
82
-	unseful information to upload progress probes.
83
-  	WARNING: this directive must be the last directive of the location. It must be in a proxy_pass or 
84
-	fastcgi_pass location.
85
-	
70
+    :Syntax: track_uploads <zone_name> <timeout>
71
+    :Default: none
72
+    :Context: location
73
+    :Description:
74
+    This directive enables tracking uploads for the current location. Each POST landing in this location will register
75
+    the request in the <zone_name> upload progress tracker.
76
+    Since Nginx doesn't support yet RFC 1867 upload, the location must be a proxy_pass or fastcgi location.
77
+    The POST _must_ have a query parameter called X-Progress-ID (or an HTTP header of the same name) whose value is the
78
+    unique identifier used to get progress information. If the POST has no such information, the upload will not be tracked.
79
+    The tracked connections are kept at most <timeout> seconds after they have been finished to be able to serve 
80
+    unseful information to upload progress probes.
81
+    WARNING: this directive must be the last directive of the location. It must be in a proxy_pass or 
82
+    fastcgi_pass location.
83
+    
86 84
 report_uploads
87 85
 ++++++++++++++
88
-	:Syntax: report_uploads <zone_name>
89
-	:Default: none
90
-	:Context: location
91
-	:Description:
92
-	This directive allows a location to report the upload progress that is tracked by track_uploads for <zone_name>.
93
-	The returned document is a JSON text with the possible 4 results:
94
-	  * the upload request hasn't been registered yet or is unknown:			 
95
-				new Object({ 'state' : 'starting' })
96
-				
97
-		* the upload request has ended:
98
-				new Object({ 'state' : 'done' })
99
-		
100
-		* the upload request generated an HTTP error
101
-				new Object({ 'state' : 'error', 'status' : <error code> })
102
-			one error code that can be of use to track for the client is 413 (request entity too large).
103
-		
104
-		* the upload request is in progress:
105
-				new Object({ 'state' : 'uploading', 'received' : <size_received>, 'size' : <total_size>})
106
-				
107
-	The HTTP request to this location must have a X-Progress-ID parameter or HTTP header containing a valid
108
-	unique identifier of an inprogress upload.
109
-				
86
+    :Syntax: report_uploads <zone_name>
87
+    :Default: none
88
+    :Context: location
89
+    :Description:
90
+    This directive allows a location to report the upload progress that is tracked by track_uploads for <zone_name>.
91
+    The returned document is a Javascript text with the possible 4 results by default:
92
+      * the upload request hasn't been registered yet or is unknown:             
93
+                new Object({ 'state' : 'starting' })
94
+                
95
+        * the upload request has ended:
96
+                new Object({ 'state' : 'done' })
97
+        
98
+        * the upload request generated an HTTP error
99
+                new Object({ 'state' : 'error', 'status' : <error code> })
100
+            one error code that can be of use to track for the client is 413 (request entity too large).
101
+        
102
+        * the upload request is in progress:
103
+                new Object({ 'state' : 'uploading', 'received' : <size_received>, 'size' : <total_size>})
104
+    
105
+    It is possible to return pure json instead of this javascript (see upload_progress_json_output).
106
+    It is also possible to configure completely the response format with the directive:
107
+            upload_progress_template
108
+
109
+    The HTTP request to this location must have a X-Progress-ID parameter or HTTP header containing a valid
110
+    unique identifier of an inprogress upload.
111
+
112
+upload_progress_content_type
113
+++++++++++++++++++++++++++++
114
+    :Syntax: upload_progress_content_type <content_type>
115
+    :Default: text/javascript
116
+    :Context: location
117
+    :Description:
118
+    This directive allows to change the upload progress probe response content-type.
119
+
120
+upload_progress_header
121
+++++++++++++++++++++++
122
+    :Syntax: upload_progress_header <progress-id>
123
+    :Default: X-Progress-ID
124
+    :Context: location
125
+    :Description:
126
+    This directive allows to change the header name of the progress ID.
127
+
128
+upload_progress_json_output
129
++++++++++++++++++++++++++++
130
+    :Syntax: upload_progress_json_output
131
+    :Default: N/A
132
+    :Context: location
133
+    :Description:
134
+    This directive sets everything to output as pure json.
135
+
136
+upload_progress_template
137
+++++++++++++++++++++++++
138
+    :Syntax: upload_progress_template <state> <template>
139
+    :Default: none
140
+    :Context: location
141
+    :Description:
142
+    This directive can be used to install a progress response template.
143
+    The available list of state is:
144
+        * starting
145
+        * uploading
146
+        * error
147
+        * done
148
+
149
+    Nginx will replace the value of the following variables with their respective
150
+    value for the upload:
151
+        * $uploadprogress_length: total size of the upload
152
+        * $uploadprogress_received: what the server has received so far
153
+        * $uploadprogress_status: error code in case of HTTP error
154
+    
155
+    For instance to return XML (instead of the default Javascript or json):
156
+
157
+    upload_progress_content_type 'text/xml';
158
+    upload_progress_template starting '<upload><state>starting</state></upload>';
159
+    upload_progress_template uploading '<upload><state>uploading</state><size>$uploadprogress_length</size><uploaded>$uploadprogress_received</uploaded></upload>';
160
+    upload_progress_template done '<upload><state>done</state></upload>';
161
+    upload_progress_template error '<upload><state>error</state><code>$uploadprogress_status</code></upload>';
162
+
110 163
 
111 164
 Configuration Example:
112 165
 +++++++++++++++++++++
113 166
 
114 167
 http {
115
-	
116
-	# reserve 1MB under the name 'proxied' to track uploads
117
-	upload_progress proxied 1m;
168
+    
169
+    # reserve 1MB under the name 'proxied' to track uploads
170
+    upload_progress proxied 1m;
118 171
 
119 172
   server {
120
-		listen       127.0.0.1 default;
121
-		server_name  _ *;
122
-		
123
-		root /path/to/root;
124
-		
125
-		location / {
126
-			# proxy to upstream server
127
-			proxy_pass http://127.0.0.1;
128
-			proxy_redirect default;
129
-			
130
-			# track uploads in the 'proxied' zone
131
-			# remember connections for 30s after they finished
132
-			track_uploads proxied 30s;
133
-		}
134
-		
135
-		location ^~ /progress {
136
-			# report uploads tracked in the 'proxied' zone
137
-			report_uploads proxied;
138
-		}
173
+        listen       127.0.0.1 default;
174
+        server_name  _ *;
175
+        
176
+        root /path/to/root;
177
+        
178
+        location / {
179
+            # proxy to upstream server
180
+            proxy_pass http://127.0.0.1;
181
+            proxy_redirect default;
182
+            
183
+            # track uploads in the 'proxied' zone
184
+            # remember connections for 30s after they finished
185
+            track_uploads proxied 30s;
186
+        }
187
+        
188
+        location ^~ /progress {
189
+            # report uploads tracked in the 'proxied' zone
190
+            report_uploads proxied;
191
+        }
139 192
 }
140
-	
193
+    
141 194
 
142 195
 Usage Example
143 196
 =============
@@ -217,8 +270,12 @@ function fetch(uuid) {
217 270
  req.send(null);
218 271
 }
219 272
 
273
+Companion Software
274
+==================
220 275
 
276
+This software can also work with Valery Kholodkov' Nginx Upload Module:
277
+http://www.grid.net.ru/nginx/upload.en.html
221 278
 
222
-
223
-
279
+You can also use the following javascript libraries client side:
280
+http://drogomir.com/blog/2008/6/30/upload-progress-script-with-safari-support
224 281
 

Loading…
Cancel
Save