Skip to content

key server: 2to3 . -w #681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/python
import sys
import os
import httplib
import http.client

f = '/tmp/openvpn_sso_user'
with open (f, "r") as myfile:
session_key = myfile.read().replace('\n', '')

conn = httplib.HTTPConnection("10.8.0.1:8080")
conn = http.client.HTTPConnection("10.8.0.1:8080")
conn.request("GET", "/" + session_key)
r1 = conn.getresponse()

if r1.status == 200:
body = r1.read().rstrip()
print body
print(body)
elif r1.status == 404:
print "Authentication failed"
print("Authentication failed")
else:
print r1.status, r1.reason
print(r1.status, r1.reason)
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from http.server import BaseHTTPRequestHandler, HTTPServer
import os

class ExampleHTTPRequestHandler(BaseHTTPRequestHandler):

def do_GET(self):
session_key = os.path.basename(self.path)
file = '/tmp/openvpn_sso_' + session_key
print 'session file: ' + file
print('session file: ' + file)
try:
f = open(file)
#send code 200 response
Expand All @@ -17,8 +17,8 @@ def do_GET(self):
self.end_headers()
#send file content to client
user = f.read().rstrip()
print 'session user: ' + user
print 'session key: ' + session_key
print('session user: ' + user)
print('session key: ' + session_key)
self.wfile.write('<html><body><h1>Greetings ' + user \
+ '. You are authorized' \
'</h1>' \
Expand Down