Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

contrib/jotnode-register: initial contribution

	new file:   contrib/jotnode-register/certtool.template
	new file:   contrib/jotnode-register/jotnode_register_cli.js
	new file:   contrib/jotnode-register/jotnode_register_srv.js
  • Loading branch information...
commit 9fa600328dd8e835203bfd97f568cec5c2e48db7 1 parent 9ba4326
@jeromeetienne authored
View
89 contrib/jotnode-register/certtool.template
@@ -0,0 +1,89 @@
+ # X.509 Certificate options
+ #
+ # DN options
+
+ # The organization of the subject.
+ organization = "Koko inc."
+
+ # The organizational unit of the subject.
+ unit = "sleeping dept."
+
+ # The locality of the subject.
+ # locality =
+
+ # The state of the certificate owner.
+ state = "Attiki"
+
+ # The country of the subject. Two letter code.
+ country = GR
+
+ # The common name of the certificate owner.
+ cn = "Cindy Lauper"
+
+ # A user id of the certificate owner.
+ #uid = "clauper"
+
+ # If the supported DN OIDs are not adequate you can set
+ # any OID here.
+ # For example set the X.520 Title and the X.520 Pseudonym
+ # by using OID and string pairs.
+ #dn_oid = "2.5.4.12" "Dr." "2.5.4.65" "jackal"
+
+ # This is deprecated and should not be used in new
+ # certificates.
+ # pkcs9_email = "none@none.org"
+
+ # The serial number of the certificate
+ serial = 007
+
+ # In how many days, counting from today, this certificate will expire.
+ expiration_days = 700
+
+ # X.509 v3 extensions
+
+ # A dnsname in case of a WWW server.
+ #dns_name = "www.none.org"
+ #dns_name = "www.morethanone.org"
+
+ # An IP address in case of a server.
+ #ip_address = "192.168.1.1"
+
+ # An email in case of a person
+ email = "none@none.org"
+
+ # An URL that has CRLs (certificate revocation lists)
+ # available. Needed in CA certificates.
+ #crl_dist_points = "http://www.getcrl.crl/getcrl/"
+
+ # Whether this is a CA certificate or not
+ #ca
+
+ # Whether this certificate will be used for a TLS client
+ #tls_www_client
+
+ # Whether this certificate will be used for a TLS server
+ #tls_www_server
+
+ # Whether this certificate will be used to sign data (needed
+ # in TLS DHE ciphersuites).
+ signing_key
+
+ # Whether this certificate will be used to encrypt data (needed
+ # in TLS RSA ciphersuites). Note that it is preferred to use different
+ # keys for encryption and signing.
+ #encryption_key
+
+ # Whether this key will be used to sign other certificates.
+ #cert_signing_key
+
+ # Whether this key will be used to sign CRLs.
+ #crl_signing_key
+
+ # Whether this key will be used to sign code.
+ #code_signing_key
+
+ # Whether this key will be used to sign OCSP data.
+ #ocsp_signing_key
+
+ # Whether this key will be used for time stamping.
+ #time_stamping_key
View
0  contrib/jotnode-register/jotnode_register_cli.js
No changes.
View
58 contrib/jotnode-register/jotnode_register_srv.js
@@ -0,0 +1,58 @@
+var http = require('http');
+var multipart = require('../../vendor/multipart-js/lib/multipart');
+var sys = require('sys');
+
+var server = http.createServer(function(req, res) {
+ console.dir(req);
+ switch (req.url) {
+ case '/':
+ display_form(req, res);
+ break;
+ case '/upload':
+ upload_file(req, res);
+ break;
+ default:
+ show_404(req, res);
+ break;
+ }
+});
+server.listen(8000);
+
+function display_form(req, res) {
+ res.writeHead(200, {'Content-Type': 'text/html'});
+ res.write(
+ '<form action="/upload" method="post" enctype="multipart/form-data">'+
+ '<input type="file" name="upload-file">'+
+ '<input type="submit" value="Upload">'+
+ '</form>'
+ );
+ res.end();
+}
+
+function upload_file(req, res) {
+ req.setBodyEncoding('binary');
+
+ var stream = new multipart.Stream(req);
+ stream.addListener('part', function(part) {
+ part.addListener('body', function(chunk) {
+ var progress = (stream.bytesReceived / stream.bytesTotal * 100).toFixed(2);
+ var mb = (stream.bytesTotal / 1024 / 1024).toFixed(1);
+
+ sys.print("Uploading "+mb+"mb ("+progress+"%)\015");
+
+ // chunk could be appended to a file if the uploaded file needs to be saved
+ });
+ });
+ stream.addListener('complete', function() {
+ res.writeHead(200, {'Content-Type': 'text/plain'});
+ res.write('Thanks for playing!');
+ res.end();
+ sys.puts("\n=> Done");
+ });
+}
+
+function show_404(req, res) {
+ res.writeHead(404, {'Content-Type': 'text/plain'});
+ res.write('You r doing it rong!');
+ res.end();
+}

0 comments on commit 9fa6003

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