forked from cory/tildefriends
		
	git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3621 ed5197a5-7fde-0310-b194-c3ffbd925b24
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| cat > test.js << EOF
 | |
| "use strict";
 | |
| 
 | |
| var s = new Socket();
 | |
| print("connecting");
 | |
| print("before connect", s.isConnected);
 | |
| s.onError(function(e) {
 | |
| 	print(e);
 | |
| });
 | |
| print("noDelay", s.noDelay);
 | |
| s.noDelay = true;
 | |
| s.connect("www.unprompted.com", 80).then(function() {
 | |
| 	print("connected", s.isConnected);
 | |
| 	print(s.peerName);
 | |
| 	s.read(function(data) {
 | |
| 		print("read", data.length);
 | |
| 	});
 | |
| 	s.write("GET / HTTP/1.0\r\n\r\n");
 | |
| }).then(function() {
 | |
| 	print("closed");
 | |
| });
 | |
| 
 | |
| var s2 = new Socket();
 | |
| print("connecting");
 | |
| print("before connect", s2.isConnected);
 | |
| s2.onError(function(e) {
 | |
| 	print("error");
 | |
| 	print(e);
 | |
| });
 | |
| print("noDelay", s2.noDelay);
 | |
| s2.noDelay = true;
 | |
| s2.connect("www.unprompted.com", 443).then(function() {
 | |
| 	print("connected");
 | |
| 	s2.read(function(data) {
 | |
| 		print("read", data.length);
 | |
| 	});
 | |
| 	return s2.startTls();
 | |
| }).then(function() {
 | |
| 	print("ready");
 | |
| 	print(s2.peerName);
 | |
| 	s2.write("GET / HTTP/1.0\r\nConnection: close\r\n\r\n").then(function() {
 | |
| 		s2.shutdown();
 | |
| 	});
 | |
| }).catch(function(e) {
 | |
| 	printf("caught");
 | |
| 	print(e);
 | |
| });
 | |
| EOF
 | |
| 
 | |
| $TILDEFRIENDS test.js
 |