improve testing on appveyor. revert appveyor image
This commit is contained in:
parent
f23f96ea1f
commit
f40ecac4dd
|
@ -4,7 +4,7 @@ branches:
|
|||
- master
|
||||
- RC_1_2
|
||||
- RC_1_1
|
||||
image: Visual Studio 2015
|
||||
image: Previous Visual Studio 2015
|
||||
clone_depth: 1
|
||||
environment:
|
||||
matrix:
|
||||
|
|
|
@ -446,12 +446,12 @@ pid_type async_run(char const* cmdline)
|
|||
startup.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
|
||||
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
startup.hStdError = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
int ret = CreateProcessA(NULL, buf, NULL, NULL, TRUE
|
||||
, CREATE_NEW_PROCESS_GROUP, NULL, NULL, &startup, &pi);
|
||||
int const ret = CreateProcessA(NULL, buf, NULL, NULL, TRUE
|
||||
, 0, NULL, NULL, &startup, &pi);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
int error = GetLastError();
|
||||
int const error = GetLastError();
|
||||
std::printf("failed (%d) %s\n", error, error_code(error, system_category()).message().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -16,18 +16,20 @@ except Exception:
|
|||
|
||||
|
||||
def debug(s):
|
||||
print('socks.py: ', s, file=sys.stderr)
|
||||
print('socks.py: ', s)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def error(s):
|
||||
print('socks.py, ERROR: ', s, file=sys.stderr)
|
||||
print('socks.py, ERROR: ', s)
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
class MyTCPServer(ThreadingTCPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
def handle_timeout(self):
|
||||
raise Exception('timeout')
|
||||
raise Exception('socks.py: timeout')
|
||||
|
||||
|
||||
CLOSE = object()
|
||||
|
@ -208,7 +210,7 @@ class SocksHandler(StreamRequestHandler):
|
|||
try:
|
||||
out_address = socket.getaddrinfo(dest_address, dest_port)[0][4]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
error('%s' % e)
|
||||
return
|
||||
|
||||
if cmd == UDP_ASSOCIATE:
|
||||
|
@ -220,7 +222,7 @@ class SocksHandler(StreamRequestHandler):
|
|||
try:
|
||||
outbound_sock.connect(out_address)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
error('%s' % e)
|
||||
return
|
||||
|
||||
if address_type == IPV6:
|
||||
|
@ -232,7 +234,7 @@ class SocksHandler(StreamRequestHandler):
|
|||
try:
|
||||
forward(self.request, outbound_sock, 'client')
|
||||
except Exception as e:
|
||||
print(e)
|
||||
error('%s' % e)
|
||||
|
||||
def send_reply_v4(self, xxx_todo_changeme):
|
||||
(bind_addr, bind_port) = xxx_todo_changeme
|
||||
|
@ -274,6 +276,7 @@ class SocksHandler(StreamRequestHandler):
|
|||
|
||||
if __name__ == '__main__':
|
||||
|
||||
debug('starting socks.py %s' % " ".join(sys.argv))
|
||||
listen_port = 8002
|
||||
i = 1
|
||||
while i < len(sys.argv):
|
||||
|
@ -292,6 +295,7 @@ if __name__ == '__main__':
|
|||
if sys.argv[i] != '--help':
|
||||
debug('unknown option "%s"' % sys.argv[i])
|
||||
print('usage: socks.py [--username <user> --password <password>] [--port <listen-port>]')
|
||||
sys.stdout.flush()
|
||||
sys.exit(1)
|
||||
i += 1
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ class http_handler(BaseHTTPRequestHandler):
|
|||
|
||||
print('INCOMING-REQUEST: ', s.requestline)
|
||||
print(s.headers)
|
||||
sys.stdout.flush()
|
||||
|
||||
global chunked_encoding
|
||||
global keepalive
|
||||
|
@ -55,6 +56,7 @@ class http_handler(BaseHTTPRequestHandler):
|
|||
file_path = os.path.normpath(s.path)
|
||||
print(file_path)
|
||||
print(s.path)
|
||||
sys.stdout.flush()
|
||||
|
||||
if s.path == '/password_protected':
|
||||
passed = False
|
||||
|
@ -111,6 +113,7 @@ class http_handler(BaseHTTPRequestHandler):
|
|||
try:
|
||||
filename = os.path.normpath(s.path[1:s.path.find('seed?') + 4])
|
||||
print('filename = %s' % filename)
|
||||
sys.stdout.flush()
|
||||
f = open(filename, 'rb')
|
||||
f.seek(piece * 32 * 1024 + int(ranges[0]))
|
||||
data = f.read(int(ranges[1]) - int(ranges[0]) + 1)
|
||||
|
@ -118,11 +121,13 @@ class http_handler(BaseHTTPRequestHandler):
|
|||
|
||||
s.send_response(200)
|
||||
print('sending %d bytes' % len(data))
|
||||
sys.stdout.flush()
|
||||
s.send_header("Content-Length", "%d" % len(data))
|
||||
s.end_headers()
|
||||
s.wfile.write(data)
|
||||
except Exception as e:
|
||||
print('FILE ERROR: ', filename, e)
|
||||
sys.stdout.flush()
|
||||
s.send_response(404)
|
||||
s.send_header("Content-Length", "0")
|
||||
s.end_headers()
|
||||
|
@ -164,6 +169,7 @@ class http_handler(BaseHTTPRequestHandler):
|
|||
s.request.shutdown()
|
||||
except Exception as e:
|
||||
print('Failed to shutdown read-channel of socket: ', e)
|
||||
sys.stdout.flush()
|
||||
|
||||
s.end_headers()
|
||||
|
||||
|
@ -175,15 +181,18 @@ class http_handler(BaseHTTPRequestHandler):
|
|||
s.wfile.write('%x\r\n' % to_send)
|
||||
data = f.read(to_send)
|
||||
print('read %d bytes' % to_send)
|
||||
sys.stdout.flush()
|
||||
s.wfile.write(data)
|
||||
if chunked_encoding:
|
||||
s.wfile.write('\r\n')
|
||||
length -= to_send
|
||||
print('sent %d bytes (%d bytes left)' % (len(data), length))
|
||||
sys.stdout.flush()
|
||||
if chunked_encoding:
|
||||
s.wfile.write('0\r\n\r\n')
|
||||
except Exception as e:
|
||||
print('FILE ERROR: ', filename, e)
|
||||
sys.stdout.flush()
|
||||
s.send_response(404)
|
||||
s.send_header("Content-Length", "0")
|
||||
s.end_headers()
|
||||
|
|
Loading…
Reference in New Issue