Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

empty comment

  • Loading branch information...
commit 99594f77f00434f18231a8d672a6330c87534df6 1 parent fd3ed46
Jani Kajala authored November 30, 2012

Showing 1 changed file with 0 additions and 42 deletions. Show diff stats Hide diff stats

  1. 42  tests/test8-upload.js
42  tests/test8-upload.js
... ...
@@ -1,42 +0,0 @@
1  
-// WORK IN PROGRESS: Tests file upload
2  
-
3  
-var JServer = require( '../index' ).Server;
4  
-var Filter = require( '../index' ).Filter;
5  
-var server = new JServer( {workers:1} );
6  
-var filter = new Filter();
7  
-server.ServerResponse.settings.headers['Access-Control-Allow-Origin'] = '*';
8  
-if ( server.start() ) return;
9  
-
10  
-server.proxy = function( req, res ) {
11  
-	//console.dir( req.headers );
12  
-	return false;
13  
-};
14  
-
15  
-server.get( '/favicon.ico', function(req,res) {
16  
-	res.html('');
17  
-} ); 
18  
-		
19  
-server.get( '/upload', function(req,res) {
20  
-	res.html('<html><body><form method="post" action="/upload" enctype="multipart/form-data">'
21  
-		+ '<p><input type="file" name="test" /></p>'
22  
-		+ '<p><input type="submit" value="Upload" /></p>'
23  
-		+ '</form></body></html>');
24  
-} );
25  
-
26  
-server.post( "/upload", function(req,res) {
27  
-	var body = '';
28  
-	var header = '';
29  
-	var content_type = req.headers['content-type'];
30  
-	var boundary = content_type.split('; ')[1].split('=')[1];
31  
-	var content_length = parseInt(req.headers['content-length']);
32  
-	var header_flag = true;
33  
-	var filename = 'dummy.bin';
34  
-	var filename_regex = /filename="(.*)"/m;
35  
-	console.log('[test8] content-type: ' + content_type);
36  
-	console.log('[test8] boundary: ' + boundary);
37  
-	console.log('[test8] content-length: ' + content_length);
38  
-
39  
-	res.html( "1" );
40  
-} );
41  
-
42  
-server.listenHTTP( 3008 );

0 notes on commit 99594f7

Please sign in to comment.
Something went wrong with that request. Please try again.