/
usr
/
lib64
/
python2.6
/
/usr/lib64/python2.6
mkdir
upload
Name
Size
Mode
Actions
bsddb/
-
0755
rm
compiler/
-
0755
rm
config/
-
0755
rm
ctypes/
-
0755
rm
curses/
-
0755
rm
Demo/
-
0755
rm
distutils/
-
0755
rm
Doc/
-
0755
rm
email/
-
0755
rm
encodings/
-
0755
rm
hotshot/
-
0755
rm
idlelib/
-
0755
rm
json/
-
0755
rm
lib-dynload/
-
0755
rm
lib-tk/
-
0755
rm
lib2to3/
-
0755
rm
logging/
-
0755
rm
multiprocessing/
-
0755
rm
plat-linux2/
-
0755
rm
site-packages/
-
0755
rm
sqlite3/
-
0755
rm
test/
-
0755
rm
Tools/
-
0755
rm
wsgiref/
-
0755
rm
xml/
-
0755
rm
abc.py
7034
0644
edit
dl
rm
abc.pyc
6071
0644
edit
dl
rm
abc.pyo
6013
0644
edit
dl
rm
aifc.py
33188
0644
edit
dl
rm
aifc.pyc
29564
0644
edit
dl
rm
aifc.pyo
29564
0644
edit
dl
rm
anydbm.py
2620
0644
edit
dl
rm
anydbm.pyc
2775
0644
edit
dl
rm
anydbm.pyo
2775
0644
edit
dl
rm
ast.py
11347
0644
edit
dl
rm
ast.pyc
12780
0644
edit
dl
rm
ast.pyo
12780
0644
edit
dl
rm
asynchat.py
11402
0644
edit
dl
rm
asynchat.pyc
8737
0644
edit
dl
rm
asynchat.pyo
8737
0644
edit
dl
rm
asyncore.py
20061
0644
edit
dl
rm
asyncore.pyc
18452
0644
edit
dl
rm
asyncore.pyo
18452
0644
edit
dl
rm
atexit.py
1705
0644
edit
dl
rm
atexit.pyc
2215
0644
edit
dl
rm
atexit.pyo
2215
0644
edit
dl
rm
audiodev.py
7597
0644
edit
dl
rm
audiodev.pyc
8537
0644
edit
dl
rm
audiodev.pyo
8537
0644
edit
dl
rm
base64.py
11335
0755
edit
dl
rm
base64.pyc
11003
0644
edit
dl
rm
base64.pyo
11003
0644
edit
dl
rm
BaseHTTPServer.py
21974
0644
edit
dl
rm
BaseHTTPServer.pyc
21575
0644
edit
dl
rm
BaseHTTPServer.pyo
21575
0644
edit
dl
rm
Bastion.py
5744
0644
edit
dl
rm
Bastion.pyc
6667
0644
edit
dl
rm
Bastion.pyo
6667
0644
edit
dl
rm
bdb.py
20597
0644
edit
dl
rm
bdb.pyc
18567
0644
edit
dl
rm
bdb.pyo
18567
0644
edit
dl
rm
binhex.py
14878
0644
edit
dl
rm
binhex.pyc
15875
0644
edit
dl
rm
binhex.pyo
15875
0644
edit
dl
rm
bisect.py
2662
0644
edit
dl
rm
bisect.pyc
3173
0644
edit
dl
rm
bisect.pyo
3173
0644
edit
dl
rm
calendar.py
23110
0644
edit
dl
rm
calendar.pyc
28165
0644
edit
dl
rm
calendar.pyo
28165
0644
edit
dl
rm
cgi.py
34478
0755
edit
dl
rm
cgi.pyc
32818
0644
edit
dl
rm
cgi.pyo
32818
0644
edit
dl
rm
CGIHTTPServer.py
12773
0644
edit
dl
rm
CGIHTTPServer.pyc
10820
0644
edit
dl
rm
CGIHTTPServer.pyo
10820
0644
edit
dl
rm
cgitb.py
12155
0644
edit
dl
rm
cgitb.pyc
12461
0644
edit
dl
rm
cgitb.pyo
12461
0644
edit
dl
rm
chunk.py
5372
0644
edit
dl
rm
chunk.pyc
5645
0644
edit
dl
rm
chunk.pyo
5645
0644
edit
dl
rm
cmd.py
14962
0644
edit
dl
rm
cmd.pyc
13954
0644
edit
dl
rm
cmd.pyo
13954
0644
edit
dl
rm
code.py
10217
0644
edit
dl
rm
code.pyc
10427
0644
edit
dl
rm
code.pyo
10427
0644
edit
dl
rm
codecs.py
35266
0644
edit
dl
rm
codecs.pyc
36721
0644
edit
dl
rm
codecs.pyo
36721
0644
edit
dl
rm
codeop.py
5999
0644
edit
dl
rm
codeop.pyc
6636
0644
edit
dl
rm
codeop.pyo
6636
0644
edit
dl
rm
collections.py
13730
0644
edit
dl
rm
collections.pyc
14462
0644
edit
dl
rm
collections.pyo
14409
0644
edit
dl
rm
colorsys.py
3459
0644
edit
dl
rm
colorsys.pyc
4041
0644
edit
dl
rm
colorsys.pyo
4041
0644
edit
dl
rm
commands.py
2543
0644
edit
dl
rm
commands.pyc
2489
0644
edit
dl
rm
commands.pyo
2489
0644
edit
dl
rm
compileall.py
5285
0644
edit
dl
rm
compileall.pyc
4997
0644
edit
dl
rm
compileall.pyo
4997
0644
edit
dl
rm
ConfigParser.py
25989
0644
edit
dl
rm
ConfigParser.pyc
23865
0644
edit
dl
rm
ConfigParser.pyo
23865
0644
edit
dl
rm
contextlib.py
4136
0644
edit
dl
rm
contextlib.pyc
4151
0644
edit
dl
rm
contextlib.pyo
4151
0644
edit
dl
rm
Cookie.py
25054
0644
edit
dl
rm
Cookie.pyc
22145
0644
edit
dl
rm
Cookie.pyo
22145
0644
edit
dl
rm
cookielib.py
64726
0644
edit
dl
rm
cookielib.pyc
55370
0644
edit
dl
rm
cookielib.pyo
55179
0644
edit
dl
rm
copy.py
11177
0644
edit
dl
rm
copy.pyc
11675
0644
edit
dl
rm
copy.pyo
11579
0644
edit
dl
rm
copy_reg.py
6800
0644
edit
dl
rm
copy_reg.pyc
5178
0644
edit
dl
rm
copy_reg.pyo
5132
0644
edit
dl
rm
cProfile.py
6337
0755
edit
dl
rm
cProfile.pyc
6239
0644
edit
dl
rm
cProfile.pyo
6239
0644
edit
dl
rm
crypt.py
2229
0644
edit
dl
rm
crypt.pyc
3055
0644
edit
dl
rm
crypt.pyo
3055
0644
edit
dl
rm
csv.py
15730
0644
edit
dl
rm
csv.pyc
13226
0644
edit
dl
rm
csv.pyo
13226
0644
edit
dl
rm
dbhash.py
535
0644
edit
dl
rm
dbhash.pyc
760
0644
edit
dl
rm
dbhash.pyo
760
0644
edit
dl
rm
decimal.py
199273
0644
edit
dl
rm
decimal.pyc
155681
0644
edit
dl
rm
decimal.pyo
155615
0644
edit
dl
rm
difflib.py
81080
0644
edit
dl
rm
difflib.pyc
61193
0644
edit
dl
rm
difflib.pyo
61139
0644
edit
dl
rm
dircache.py
1126
0644
edit
dl
rm
dircache.pyc
1584
0644
edit
dl
rm
dircache.pyo
1584
0644
edit
dl
rm
dis.py
6449
0644
edit
dl
rm
dis.pyc
6366
0644
edit
dl
rm
dis.pyo
6366
0644
edit
dl
rm
doctest.py
101516
0644
edit
dl
rm
doctest.pyc
80994
0644
edit
dl
rm
doctest.pyo
80706
0644
edit
dl
rm
DocXMLRPCServer.py
10599
0644
edit
dl
rm
DocXMLRPCServer.pyc
9957
0644
edit
dl
rm
DocXMLRPCServer.pyo
9849
0644
edit
dl
rm
dumbdbm.py
8820
0644
edit
dl
rm
dumbdbm.pyc
6585
0644
edit
dl
rm
dumbdbm.pyo
6585
0644
edit
dl
rm
dummy_thread.py
4418
0644
edit
dl
rm
dummy_thread.pyc
5413
0644
edit
dl
rm
dummy_thread.pyo
5413
0644
edit
dl
rm
dummy_threading.py
2804
0644
edit
dl
rm
dummy_threading.pyc
1297
0644
edit
dl
rm
dummy_threading.pyo
1297
0644
edit
dl
rm
filecmp.py
9470
0644
edit
dl
rm
filecmp.pyc
9632
0644
edit
dl
rm
filecmp.pyo
9632
0644
edit
dl
rm
fileinput.py
14143
0644
edit
dl
rm
fileinput.pyc
14928
0644
edit
dl
rm
fileinput.pyo
14928
0644
edit
dl
rm
fnmatch.py
3239
0644
edit
dl
rm
fnmatch.pyc
3579
0644
edit
dl
rm
fnmatch.pyo
3579
0644
edit
dl
rm
formatter.py
14911
0644
edit
dl
rm
formatter.pyc
19303
0644
edit
dl
rm
formatter.pyo
19303
0644
edit
dl
rm
fpformat.py
4699
0644
edit
dl
rm
fpformat.pyc
4735
0644
edit
dl
rm
fpformat.pyo
4735
0644
edit
dl
rm
fractions.py
20073
0644
edit
dl
rm
fractions.pyc
18119
0644
edit
dl
rm
fractions.pyo
18119
0644
edit
dl
rm
ftplib.py
29197
0644
edit
dl
rm
ftplib.pyc
28503
0644
edit
dl
rm
ftplib.pyo
28503
0644
edit
dl
rm
functools.py
2162
0644
edit
dl
rm
functools.pyc
1927
0644
edit
dl
rm
functools.pyo
1927
0644
edit
dl
rm
genericpath.py
3020
0644
edit
dl
rm
genericpath.pyc
3292
0644
edit
dl
rm
genericpath.pyo
3292
0644
edit
dl
rm
getopt.py
7328
0644
edit
dl
rm
getopt.pyc
6730
0644
edit
dl
rm
getopt.pyo
6683
0644
edit
dl
rm
getpass.py
5534
0644
edit
dl
rm
getpass.pyc
4754
0644
edit
dl
rm
getpass.pyo
4754
0644
edit
dl
rm
gettext.py
19968
0644
edit
dl
rm
gettext.pyc
15760
0644
edit
dl
rm
gettext.pyo
15760
0644
edit
dl
rm
glob.py
2249
0644
edit
dl
rm
glob.pyc
2409
0644
edit
dl
rm
glob.pyo
2409
0644
edit
dl
rm
gzip.py
16754
0644
edit
dl
rm
gzip.pyc
14386
0644
edit
dl
rm
gzip.pyo
14386
0644
edit
dl
rm
hashlib.py
4427
0644
edit
dl
rm
hashlib.pyc
3981
0644
edit
dl
rm
hashlib.pyo
3981
0644
edit
dl
rm
heapq.py
15995
0644
edit
dl
rm
heapq.pyc
12694
0644
edit
dl
rm
heapq.pyo
12694
0644
edit
dl
rm
hmac.py
4531
0644
edit
dl
rm
hmac.pyc
4509
0644
edit
dl
rm
hmac.pyo
4509
0644
edit
dl
rm
htmlentitydefs.py
18054
0644
edit
dl
rm
htmlentitydefs.pyc
6371
0644
edit
dl
rm
htmlentitydefs.pyo
6371
0644
edit
dl
rm
htmllib.py
12869
0644
edit
dl
rm
htmllib.pyc
20384
0644
edit
dl
rm
htmllib.pyo
20384
0644
edit
dl
rm
HTMLParser.py
13576
0644
edit
dl
rm
HTMLParser.pyc
12258
0644
edit
dl
rm
HTMLParser.pyo
11950
0644
edit
dl
rm
httplib.py
48797
0644
edit
dl
rm
httplib.pyc
37732
0644
edit
dl
rm
httplib.pyo
37536
0644
edit
dl
rm
ihooks.py
17452
0644
edit
dl
rm
ihooks.pyc
20837
0644
edit
dl
rm
ihooks.pyo
20758
0644
edit
dl
rm
imaplib.py
47771
0644
edit
dl
rm
imaplib.pyc
45225
0644
edit
dl
rm
imaplib.pyo
42475
0644
edit
dl
rm
imghdr.py
3544
0644
edit
dl
rm
imghdr.pyc
4905
0644
edit
dl
rm
imghdr.pyo
4905
0644
edit
dl
rm
imputil.py
26009
0644
edit
dl
rm
imputil.pyc
16037
0644
edit
dl
rm
imputil.pyo
15865
0644
edit
dl
rm
inspect.py
38189
0644
edit
dl
rm
inspect.pyc
37165
0644
edit
dl
rm
inspect.pyo
37165
0644
edit
dl
rm
io.py
66165
0644
edit
dl
rm
io.pyc
63042
0644
edit
dl
rm
io.pyo
63042
0644
edit
dl
rm
keyword.py
1997
0755
edit
dl
rm
keyword.pyc
2117
0644
edit
dl
rm
keyword.pyo
2117
0644
edit
dl
rm
linecache.py
4128
0644
edit
dl
rm
linecache.pyc
3268
0644
edit
dl
rm
linecache.pyo
3268
0644
edit
dl
rm
locale.py
82674
0644
edit
dl
rm
locale.pyc
46676
0644
edit
dl
rm
locale.pyo
46676
0644
edit
dl
rm
macpath.py
6253
0644
edit
dl
rm
macpath.pyc
7707
0644
edit
dl
rm
macpath.pyo
7707
0644
edit
dl
rm
macurl2path.py
3275
0644
edit
dl
rm
macurl2path.pyc
2825
0644
edit
dl
rm
macurl2path.pyo
2825
0644
edit
dl
rm
mailbox.py
75824
0644
edit
dl
rm
mailbox.pyc
76069
0644
edit
dl
rm
mailbox.pyo
76020
0644
edit
dl
rm
mailcap.py
8402
0644
edit
dl
rm
mailcap.pyc
8079
0644
edit
dl
rm
mailcap.pyo
8079
0644
edit
dl
rm
markupbase.py
14350
0644
edit
dl
rm
markupbase.pyc
9464
0644
edit
dl
rm
markupbase.pyo
9270
0644
edit
dl
rm
md5.py
410
0644
edit
dl
rm
md5.pyc
378
0644
edit
dl
rm
md5.pyo
378
0644
edit
dl
rm
mhlib.py
33434
0644
edit
dl
rm
mhlib.pyc
34137
0644
edit
dl
rm
mhlib.pyo
34137
0644
edit
dl
rm
mimetools.py
7168
0644
edit
dl
rm
mimetools.pyc
8320
0644
edit
dl
rm
mimetools.pyo
8320
0644
edit
dl
rm
mimetypes.py
18822
0644
edit
dl
rm
mimetypes.pyc
16872
0644
edit
dl
rm
mimetypes.pyo
16872
0644
edit
dl
rm
MimeWriter.py
6482
0644
edit
dl
rm
MimeWriter.pyc
7383
0644
edit
dl
rm
MimeWriter.pyo
7383
0644
edit
dl
rm
mimify.py
15024
0755
edit
dl
rm
mimify.pyc
12219
0644
edit
dl
rm
mimify.pyo
12219
0644
edit
dl
rm
modulefinder.py
24283
0644
edit
dl
rm
modulefinder.pyc
19007
0644
edit
dl
rm
modulefinder.pyo
18919
0644
edit
dl
rm
multifile.py
4820
0644
edit
dl
rm
multifile.pyc
5479
0644
edit
dl
rm
multifile.pyo
5435
0644
edit
dl
rm
mutex.py
1866
0644
edit
dl
rm
mutex.pyc
2526
0644
edit
dl
rm
mutex.pyo
2526
0644
edit
dl
rm
netrc.py
4111
0644
edit
dl
rm
netrc.pyc
3602
0644
edit
dl
rm
netrc.pyo
3602
0644
edit
dl
rm
new.py
706
0644
edit
dl
rm
new.pyc
910
0644
edit
dl
rm
new.pyo
910
0644
edit
dl
rm
nntplib.py
21470
0644
edit
dl
rm
nntplib.pyc
21179
0644
edit
dl
rm
nntplib.pyo
21179
0644
edit
dl
rm
ntpath.py
17752
0644
edit
dl
rm
ntpath.pyc
11620
0644
edit
dl
rm
ntpath.pyo
11573
0644
edit
dl
rm
nturl2path.py
2239
0644
edit
dl
rm
nturl2path.pyc
1777
0644
edit
dl
rm
nturl2path.pyo
1777
0644
edit
dl
rm
numbers.py
10271
0644
edit
dl
rm
numbers.pyc
13964
0644
edit
dl
rm
numbers.pyo
13964
0644
edit
dl
rm
opcode.py
5248
0644
edit
dl
rm
opcode.pyc
5917
0644
edit
dl
rm
opcode.pyo
5917
0644
edit
dl
rm
optparse.py
60849
0644
edit
dl
rm
optparse.pyc
54239
0644
edit
dl
rm
optparse.pyo
54157
0644
edit
dl
rm
ordereddict.py
36
0644
edit
dl
rm
ordereddict.pyc
185
0644
edit
dl
rm
ordereddict.pyo
185
0644
edit
dl
rm
os.py
25802
0644
edit
dl
rm
os.pyc
25808
0644
edit
dl
rm
os.pyo
25808
0644
edit
dl
rm
os2emxpath.py
4603
0644
edit
dl
rm
os2emxpath.pyc
4536
0644
edit
dl
rm
os2emxpath.pyo
4536
0644
edit
dl
rm
pdb.doc
7899
0644
edit
dl
rm
pdb.py
45333
0755
edit
dl
rm
pdb.pyc
43813
0644
edit
dl
rm
pdb.pyo
43813
0644
edit
dl
rm
pickle.py
44811
0644
edit
dl
rm
pickle.pyc
38645
0644
edit
dl
rm
pickle.pyo
38440
0644
edit
dl
rm
pickletools.py
74348
0644
edit
dl
rm
pickletools.pyc
57143
0644
edit
dl
rm
pickletools.pyo
56246
0644
edit
dl
rm
pipes.py
9647
0644
edit
dl
rm
pipes.pyc
9460
0644
edit
dl
rm
pipes.pyo
9460
0644
edit
dl
rm
pkgutil.py
20001
0644
edit
dl
rm
pkgutil.pyc
19020
0644
edit
dl
rm
pkgutil.pyo
19020
0644
edit
dl
rm
platform.py
52630
0755
edit
dl
rm
platform.pyc
38797
0644
edit
dl
rm
platform.pyo
38797
0644
edit
dl
rm
plistlib.py
15806
0644
edit
dl
rm
plistlib.pyc
20050
0644
edit
dl
rm
plistlib.pyo
19960
0644
edit
dl
rm
popen2.py
8416
0644
edit
dl
rm
popen2.pyc
9064
0644
edit
dl
rm
popen2.pyo
9020
0644
edit
dl
rm
poplib.py
12825
0644
edit
dl
rm
poplib.pyc
13418
0644
edit
dl
rm
poplib.pyo
13418
0644
edit
dl
rm
posixfile.py
8003
0644
edit
dl
rm
posixfile.pyc
7724
0644
edit
dl
rm
posixfile.pyo
7724
0644
edit
dl
rm
posixpath.py
13119
0644
edit
dl
rm
posixpath.pyc
11188
0644
edit
dl
rm
posixpath.pyo
11188
0644
edit
dl
rm
pprint.py
11932
0644
edit
dl
rm
pprint.pyc
10394
0644
edit
dl
rm
pprint.pyo
10219
0644
edit
dl
rm
profile.py
23510
0755
edit
dl
rm
profile.pyc
16680
0644
edit
dl
rm
profile.pyo
16435
0644
edit
dl
rm
pstats.py
27310
0644
edit
dl
rm
pstats.pyc
25340
0644
edit
dl
rm
pstats.pyo
25340
0644
edit
dl
rm
pty.py
4869
0644
edit
dl
rm
pty.pyc
4919
0644
edit
dl
rm
pty.pyo
4919
0644
edit
dl
rm
pyclbr.py
13282
0644
edit
dl
rm
pyclbr.pyc
9732
0644
edit
dl
rm
pyclbr.pyo
9732
0644
edit
dl
rm
pydoc.py
92432
0755
edit
dl
rm
pydoc.pyc
91052
0644
edit
dl
rm
pydoc.pyo
90984
0644
edit
dl
rm
pydoc_topics.py
423126
0644
edit
dl
rm
pydoc_topics.pyc
407588
0644
edit
dl
rm
pydoc_topics.pyo
407588
0644
edit
dl
rm
py_compile.py
5633
0644
edit
dl
rm
py_compile.pyc
6554
0644
edit
dl
rm
py_compile.pyo
6554
0644
edit
dl
rm
Queue.py
8574
0644
edit
dl
rm
Queue.pyc
9447
0644
edit
dl
rm
Queue.pyo
9447
0644
edit
dl
rm
quopri.py
6972
0755
edit
dl
rm
quopri.pyc
6688
0644
edit
dl
rm
quopri.pyo
6688
0644
edit
dl
rm
random.py
31966
0644
edit
dl
rm
random.pyc
25106
0644
edit
dl
rm
random.pyo
25106
0644
edit
dl
rm
re.py
12966
0644
edit
dl
rm
re.pyc
13164
0644
edit
dl
rm
re.pyo
13164
0644
edit
dl
rm
repr.py
4296
0644
edit
dl
rm
repr.pyc
5434
0644
edit
dl
rm
repr.pyo
5434
0644
edit
dl
rm
rexec.py
20152
0644
edit
dl
rm
rexec.pyc
24220
0644
edit
dl
rm
rexec.pyo
24220
0644
edit
dl
rm
rfc822.py
33295
0644
edit
dl
rm
rfc822.pyc
32110
0644
edit
dl
rm
rfc822.pyo
32110
0644
edit
dl
rm
rlcompleter.py
5866
0644
edit
dl
rm
rlcompleter.pyc
6073
0644
edit
dl
rm
rlcompleter.pyo
6073
0644
edit
dl
rm
robotparser.py
7014
0644
edit
dl
rm
robotparser.pyc
7852
0644
edit
dl
rm
robotparser.pyo
7852
0644
edit
dl
rm
runpy.py
5413
0644
edit
dl
rm
runpy.pyc
3979
0644
edit
dl
rm
runpy.pyo
3979
0644
edit
dl
rm
sched.py
5091
0644
edit
dl
rm
sched.pyc
5005
0644
edit
dl
rm
sched.pyo
5005
0644
edit
dl
rm
sets.py
19050
0644
edit
dl
rm
sets.pyc
16997
0644
edit
dl
rm
sets.pyo
16997
0644
edit
dl
rm
sgmllib.py
17884
0644
edit
dl
rm
sgmllib.pyc
15598
0644
edit
dl
rm
sgmllib.pyo
15598
0644
edit
dl
rm
sha.py
445
0644
edit
dl
rm
sha.pyc
421
0644
edit
dl
rm
sha.pyo
421
0644
edit
dl
rm
shelve.py
8078
0644
edit
dl
rm
shelve.pyc
10296
0644
edit
dl
rm
shelve.pyo
10296
0644
edit
dl
rm
shlex.py
11137
0644
edit
dl
rm
shlex.pyc
7710
0644
edit
dl
rm
shlex.pyo
7710
0644
edit
dl
rm
shutil.py
8632
0644
edit
dl
rm
shutil.pyc
9555
0644
edit
dl
rm
shutil.pyo
9555
0644
edit
dl
rm
SimpleHTTPServer.py
7422
0644
edit
dl
rm
SimpleHTTPServer.pyc
7766
0644
edit
dl
rm
SimpleHTTPServer.pyo
7766
0644
edit
dl
rm
SimpleXMLRPCServer.py
21992
0644
edit
dl
rm
SimpleXMLRPCServer.pyc
19633
0644
edit
dl
rm
SimpleXMLRPCServer.pyo
19633
0644
edit
dl
rm
site.py
19187
0644
edit
dl
rm
site.pyc
18825
0644
edit
dl
rm
site.pyo
18825
0644
edit
dl
rm
smtpd.py
18920
0755
edit
dl
rm
smtpd.pyc
16188
0644
edit
dl
rm
smtpd.pyo
16188
0644
edit
dl
rm
smtplib.py
30924
0755
edit
dl
rm
smtplib.pyc
29737
0644
edit
dl
rm
smtplib.pyo
29737
0644
edit
dl
rm
sndhdr.py
5973
0644
edit
dl
rm
sndhdr.pyc
7420
0644
edit
dl
rm
sndhdr.pyo
7420
0644
edit
dl
rm
socket.py
20149
0644
edit
dl
rm
socket.pyc
16129
0644
edit
dl
rm
socket.pyo
16044
0644
edit
dl
rm
SocketServer.py
22326
0644
edit
dl
rm
SocketServer.pyc
23143
0644
edit
dl
rm
SocketServer.pyo
23143
0644
edit
dl
rm
sre.py
384
0644
edit
dl
rm
sre.pyc
519
0644
edit
dl
rm
sre.pyo
519
0644
edit
dl
rm
sre_compile.py
16507
0644
edit
dl
rm
sre_compile.pyc
11483
0644
edit
dl
rm
sre_compile.pyo
11370
0644
edit
dl
rm
sre_constants.py
7137
0644
edit
dl
rm
sre_constants.pyc
6093
0644
edit
dl
rm
sre_constants.pyo
6093
0644
edit
dl
rm
sre_parse.py
26878
0644
edit
dl
rm
sre_parse.pyc
19696
0644
edit
dl
rm
sre_parse.pyo
19696
0644
edit
dl
rm
ssl.py
16677
0644
edit
dl
rm
ssl.pyc
14276
0644
edit
dl
rm
ssl.pyo
14276
0644
edit
dl
rm
stat.py
1718
0644
edit
dl
rm
stat.pyc
2703
0644
edit
dl
rm
stat.pyo
2703
0644
edit
dl
rm
statvfs.py
898
0644
edit
dl
rm
statvfs.pyc
620
0644
edit
dl
rm
statvfs.pyo
620
0644
edit
dl
rm
string.py
20745
0644
edit
dl
rm
string.pyc
20066
0644
edit
dl
rm
string.pyo
20066
0644
edit
dl
rm
StringIO.py
10621
0644
edit
dl
rm
StringIO.pyc
11532
0644
edit
dl
rm
StringIO.pyo
11532
0644
edit
dl
rm
stringold.py
12449
0644
edit
dl
rm
stringold.pyc
12593
0644
edit
dl
rm
stringold.pyo
12593
0644
edit
dl
rm
stringprep.py
13522
0644
edit
dl
rm
stringprep.pyc
14526
0644
edit
dl
rm
stringprep.pyo
14452
0644
edit
dl
rm
struct.py
82
0644
edit
dl
rm
struct.pyc
239
0644
edit
dl
rm
struct.pyo
239
0644
edit
dl
rm
subprocess.py
57945
0644
edit
dl
rm
subprocess.pyc
41071
0644
edit
dl
rm
subprocess.pyo
41014
0644
edit
dl
rm
sunau.py
16537
0644
edit
dl
rm
sunau.pyc
18072
0644
edit
dl
rm
sunau.pyo
18072
0644
edit
dl
rm
sunaudio.py
1399
0644
edit
dl
rm
sunaudio.pyc
1997
0644
edit
dl
rm
sunaudio.pyo
1997
0644
edit
dl
rm
symbol.py
2050
0755
edit
dl
rm
symbol.pyc
3025
0644
edit
dl
rm
symbol.pyo
3025
0644
edit
dl
rm
symtable.py
7911
0644
edit
dl
rm
symtable.pyc
12609
0644
edit
dl
rm
symtable.pyo
12479
0644
edit
dl
rm
tabnanny.py
11339
0755
edit
dl
rm
tabnanny.pyc
8333
0644
edit
dl
rm
tabnanny.pyo
8333
0644
edit
dl
rm
tarfile.py
87786
0644
edit
dl
rm
tarfile.pyc
73922
0644
edit
dl
rm
tarfile.pyo
73922
0644
edit
dl
rm
telnetlib.py
21808
0644
edit
dl
rm
telnetlib.pyc
19913
0644
edit
dl
rm
telnetlib.pyo
19913
0644
edit
dl
rm
tempfile.py
17774
0644
edit
dl
rm
tempfile.pyc
19571
0644
edit
dl
rm
tempfile.pyo
19571
0644
edit
dl
rm
textwrap.py
16889
0644
edit
dl
rm
textwrap.pyc
11792
0644
edit
dl
rm
textwrap.pyo
11700
0644
edit
dl
rm
this.py
1002
0644
edit
dl
rm
this.pyc
1241
0644
edit
dl
rm
this.pyo
1241
0644
edit
dl
rm
threading.py
31808
0644
edit
dl
rm
threading.pyc
28152
0644
edit
dl
rm
threading.pyo
26080
0644
edit
dl
rm
timeit.py
12003
0644
edit
dl
rm
timeit.pyc
11827
0644
edit
dl
rm
timeit.pyo
11827
0644
edit
dl
rm
toaiff.py
3142
0644
edit
dl
rm
toaiff.pyc
3134
0644
edit
dl
rm
toaiff.pyo
3134
0644
edit
dl
rm
token.py
2947
0755
edit
dl
rm
token.pyc
3840
0644
edit
dl
rm
token.pyo
3840
0644
edit
dl
rm
tokenize.py
16326
0644
edit
dl
rm
tokenize.pyc
14018
0644
edit
dl
rm
tokenize.pyo
13925
0644
edit
dl
rm
trace.py
30325
0644
edit
dl
rm
trace.pyc
23051
0644
edit
dl
rm
trace.pyo
22989
0644
edit
dl
rm
traceback.py
11211
0644
edit
dl
rm
traceback.pyc
11677
0644
edit
dl
rm
traceback.pyo
11677
0644
edit
dl
rm
tty.py
879
0644
edit
dl
rm
tty.pyc
1317
0644
edit
dl
rm
tty.pyo
1317
0644
edit
dl
rm
types.py
2323
0644
edit
dl
rm
types.pyc
2620
0644
edit
dl
rm
types.pyo
2620
0644
edit
dl
rm
unittest.py
31157
0644
edit
dl
rm
unittest.pyc
34862
0644
edit
dl
rm
unittest.pyo
34862
0644
edit
dl
rm
urllib.py
59022
0644
edit
dl
rm
urllib.pyc
51348
0644
edit
dl
rm
urllib.pyo
51254
0644
edit
dl
rm
urllib2.py
50866
0644
edit
dl
rm
urllib2.pyc
45813
0644
edit
dl
rm
urllib2.pyo
45719
0644
edit
dl
rm
urlparse.py
15618
0644
edit
dl
rm
urlparse.pyc
14777
0644
edit
dl
rm
urlparse.pyo
14777
0644
edit
dl
rm
user.py
1627
0644
edit
dl
rm
user.pyc
1736
0644
edit
dl
rm
user.pyo
1736
0644
edit
dl
rm
UserDict.py
5778
0644
edit
dl
rm
UserDict.pyc
8892
0644
edit
dl
rm
UserDict.pyo
8892
0644
edit
dl
rm
UserList.py
3644
0644
edit
dl
rm
UserList.pyc
6603
0644
edit
dl
rm
UserList.pyo
6603
0644
edit
dl
rm
UserString.py
9691
0755
edit
dl
rm
UserString.pyc
14922
0644
edit
dl
rm
UserString.pyo
14922
0644
edit
dl
rm
uu.py
5942
0755
edit
dl
rm
uu.pyc
4237
0644
edit
dl
rm
uu.pyo
4237
0644
edit
dl
rm
uuid.py
20944
0644
edit
dl
rm
uuid.pyc
21279
0644
edit
dl
rm
uuid.pyo
21279
0644
edit
dl
rm
warnings.py
14172
0644
edit
dl
rm
warnings.pyc
13042
0644
edit
dl
rm
warnings.pyo
12205
0644
edit
dl
rm
wave.py
17952
0644
edit
dl
rm
wave.pyc
19436
0644
edit
dl
rm
wave.pyo
19436
0644
edit
dl
rm
weakref.py
10087
0644
edit
dl
rm
weakref.pyc
13375
0644
edit
dl
rm
weakref.pyo
13375
0644
edit
dl
rm
webbrowser.py
21073
0644
edit
dl
rm
webbrowser.pyc
18755
0644
edit
dl
rm
webbrowser.pyo
18708
0644
edit
dl
rm
whichdb.py
3353
0644
edit
dl
rm
whichdb.pyc
2247
0644
edit
dl
rm
whichdb.pyo
2247
0644
edit
dl
rm
xdrlib.py
5513
0644
edit
dl
rm
xdrlib.pyc
9157
0644
edit
dl
rm
xdrlib.pyo
9157
0644
edit
dl
rm
xmllib.py
34865
0644
edit
dl
rm
xmllib.pyc
27274
0644
edit
dl
rm
xmllib.pyo
27274
0644
edit
dl
rm
xmlrpclib.py
47775
0644
edit
dl
rm
xmlrpclib.pyc
41496
0644
edit
dl
rm
xmlrpclib.pyo
41313
0644
edit
dl
rm
zipfile.py
53092
0644
edit
dl
rm
zipfile.pyc
37652
0644
edit
dl
rm
zipfile.pyo
37652
0644
edit
dl
rm
_abcoll.py
14242
0644
edit
dl
rm
_abcoll.pyc
21591
0644
edit
dl
rm
_abcoll.pyo
21591
0644
edit
dl
rm
_LWPCookieJar.py
6553
0644
edit
dl
rm
_LWPCookieJar.pyc
5601
0644
edit
dl
rm
_LWPCookieJar.pyo
5601
0644
edit
dl
rm
_MozillaCookieJar.py
5809
0644
edit
dl
rm
_MozillaCookieJar.pyc
4517
0644
edit
dl
rm
_MozillaCookieJar.pyo
4476
0644
edit
dl
rm
_strptime.py
19754
0644
edit
dl
rm
_strptime.pyc
14966
0644
edit
dl
rm
_strptime.pyo
14966
0644
edit
dl
rm
_threading_local.py
7114
0644
edit
dl
rm
_threading_local.pyc
6385
0644
edit
dl
rm
_threading_local.pyo
6385
0644
edit
dl
rm
__future__.py
4380
0644
edit
dl
rm
__future__.pyc
4233
0644
edit
dl
rm
__future__.pyo
4233
0644
edit
dl
rm
__phello__.foo.py
64
0644
edit
dl
rm
__phello__.foo.pyc
125
0644
edit
dl
rm
__phello__.foo.pyo
125
0644
edit
dl
rm
Edit:
/usr/lib64/python2.6/httplib.py
(48797B)
"""HTTP/1.1 client library <intro stuff goes here> <other stuff, too> HTTPConnection goes through a number of "states", which define when a client may legally make another request or fetch the response for a particular request. This diagram details these state transitions: (null) | | HTTPConnection() v Idle | | putrequest() v Request-started | | ( putheader() )* endheaders() v Request-sent | | response = getresponse() v Unread-response [Response-headers-read] |\____________________ | | | response.read() | putrequest() v v Idle Req-started-unread-response ______/| / | response.read() | | ( putheader() )* endheaders() v v Request-started Req-sent-unread-response | | response.read() v Request-sent This diagram presents the following rules: -- a second request may not be started until {response-headers-read} -- a response [object] cannot be retrieved until {request-sent} -- there is no differentiation between an unread response body and a partially read response body Note: this enforcement is applied by the HTTPConnection class. The HTTPResponse class does not enforce this state machine, which implies sophisticated clients may accelerate the request/response pipeline. Caution should be taken, though: accelerating the states beyond the above pattern may imply knowledge of the server's connection-close behavior for certain requests. For example, it is impossible to tell whether the server will close the connection UNTIL the response headers have been read; this means that further requests cannot be placed into the pipeline until it is known that the server will NOT be closing the connection. Logical State __state __response ------------- ------- ---------- Idle _CS_IDLE None Request-started _CS_REQ_STARTED None Request-sent _CS_REQ_SENT None Unread-response _CS_IDLE <response_class> Req-started-unread-response _CS_REQ_STARTED <response_class> Req-sent-unread-response _CS_REQ_SENT <response_class> """ from array import array import re import socket from sys import py3kwarning from urlparse import urlsplit import warnings with warnings.catch_warnings(): if py3kwarning: warnings.filterwarnings("ignore", ".*mimetools has been removed", DeprecationWarning) import mimetools try: from cStringIO import StringIO except ImportError: from StringIO import StringIO __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPException", "NotConnected", "UnknownProtocol", "UnknownTransferEncoding", "UnimplementedFileMode", "IncompleteRead", "InvalidURL", "ImproperConnectionState", "CannotSendRequest", "CannotSendHeader", "ResponseNotReady", "BadStatusLine", "error", "responses"] HTTP_PORT = 80 HTTPS_PORT = 443 _UNKNOWN = 'UNKNOWN' # connection states _CS_IDLE = 'Idle' _CS_REQ_STARTED = 'Request-started' _CS_REQ_SENT = 'Request-sent' # status codes # informational CONTINUE = 100 SWITCHING_PROTOCOLS = 101 PROCESSING = 102 # successful OK = 200 CREATED = 201 ACCEPTED = 202 NON_AUTHORITATIVE_INFORMATION = 203 NO_CONTENT = 204 RESET_CONTENT = 205 PARTIAL_CONTENT = 206 MULTI_STATUS = 207 IM_USED = 226 # redirection MULTIPLE_CHOICES = 300 MOVED_PERMANENTLY = 301 FOUND = 302 SEE_OTHER = 303 NOT_MODIFIED = 304 USE_PROXY = 305 TEMPORARY_REDIRECT = 307 # client error BAD_REQUEST = 400 UNAUTHORIZED = 401 PAYMENT_REQUIRED = 402 FORBIDDEN = 403 NOT_FOUND = 404 METHOD_NOT_ALLOWED = 405 NOT_ACCEPTABLE = 406 PROXY_AUTHENTICATION_REQUIRED = 407 REQUEST_TIMEOUT = 408 CONFLICT = 409 GONE = 410 LENGTH_REQUIRED = 411 PRECONDITION_FAILED = 412 REQUEST_ENTITY_TOO_LARGE = 413 REQUEST_URI_TOO_LONG = 414 UNSUPPORTED_MEDIA_TYPE = 415 REQUESTED_RANGE_NOT_SATISFIABLE = 416 EXPECTATION_FAILED = 417 UNPROCESSABLE_ENTITY = 422 LOCKED = 423 FAILED_DEPENDENCY = 424 UPGRADE_REQUIRED = 426 # server error INTERNAL_SERVER_ERROR = 500 NOT_IMPLEMENTED = 501 BAD_GATEWAY = 502 SERVICE_UNAVAILABLE = 503 GATEWAY_TIMEOUT = 504 HTTP_VERSION_NOT_SUPPORTED = 505 INSUFFICIENT_STORAGE = 507 NOT_EXTENDED = 510 # Mapping status codes to official W3C names responses = { 100: 'Continue', 101: 'Switching Protocols', 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non-Authoritative Information', 204: 'No Content', 205: 'Reset Content', 206: 'Partial Content', 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified', 305: 'Use Proxy', 306: '(Unused)', 307: 'Temporary Redirect', 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', 403: 'Forbidden', 404: 'Not Found', 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout', 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Request Entity Too Large', 414: 'Request-URI Too Long', 415: 'Unsupported Media Type', 416: 'Requested Range Not Satisfiable', 417: 'Expectation Failed', 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable', 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported', } # maximal amount of data to read at one time in _safe_read MAXAMOUNT = 1048576 # maximal line length when calling readline(). _MAXLINE = 65536 # maximum amount of headers accepted _MAXHEADERS = 100 # Header name/value ABNF (http://tools.ietf.org/html/rfc7230#section-3.2) # # VCHAR = %x21-7E # obs-text = %x80-FF # header-field = field-name ":" OWS field-value OWS # field-name = token # field-value = *( field-content / obs-fold ) # field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] # field-vchar = VCHAR / obs-text # # obs-fold = CRLF 1*( SP / HTAB ) # ; obsolete line folding # ; see Section 3.2.4 # token = 1*tchar # # tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" # / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" # / DIGIT / ALPHA # ; any VCHAR, except delimiters # # VCHAR defined in http://tools.ietf.org/html/rfc5234#appendix-B.1 # the patterns for both name and value are more leniant than RFC # definitions to allow for backwards compatibility _is_legal_header_name = re.compile(r'\A[^:\s][^:\r\n]*\Z').match _is_illegal_header_value = re.compile(r'\n(?![ \t])|\r(?![ \t\n])').search # These characters are not allowed within HTTP method names # to prevent http header injection. _contains_disallowed_method_pchar_re = re.compile('[\x00-\x1f]') class HTTPMessage(mimetools.Message): def addheader(self, key, value): """Add header for field key handling repeats.""" prev = self.dict.get(key) if prev is None: self.dict[key] = value else: combined = ", ".join((prev, value)) self.dict[key] = combined def addcontinue(self, key, more): """Add more field data from a continuation line.""" prev = self.dict[key] self.dict[key] = prev + "\n " + more def readheaders(self): """Read header lines. Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over it; it is never included in the returned list. The variable self.status is set to the empty string if all went well, otherwise it is an error message. The variable self.headers is a completely uninterpreted list of lines contained in the header (so printing them will reproduce the header exactly as it appears in the file). If multiple header fields with the same name occur, they are combined according to the rules in RFC 2616 sec 4.2: Appending each subsequent field-value to the first, each separated by a comma. The order in which header fields with the same field-name are received is significant to the interpretation of the combined field value. """ # XXX The implementation overrides the readheaders() method of # rfc822.Message. The base class design isn't amenable to # customized behavior here so the method here is a copy of the # base class code with a few small changes. self.dict = {} self.unixfrom = '' self.headers = hlist = [] self.status = '' headerseen = "" firstline = 1 startofline = unread = tell = None if hasattr(self.fp, 'unread'): unread = self.fp.unread elif self.seekable: tell = self.fp.tell while True: if len(hlist) > _MAXHEADERS: raise HTTPException("got more than %d headers" % _MAXHEADERS) if tell: try: startofline = tell() except IOError: startofline = tell = None self.seekable = 0 line = self.fp.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise LineTooLong("header line") if not line: self.status = 'EOF in headers' break # Skip unix From name time lines if firstline and line.startswith('From '): self.unixfrom = self.unixfrom + line continue firstline = 0 if headerseen and line[0] in ' \t': # XXX Not sure if continuation lines are handled properly # for http and/or for repeating headers # It's a continuation line. hlist.append(line) self.addcontinue(headerseen, line.strip()) continue elif self.iscomment(line): # It's a comment. Ignore it. continue elif self.islast(line): # Note! No pushback here! The delimiter line gets eaten. break headerseen = self.isheader(line) if headerseen: # It's a legal header line, save it. hlist.append(line) self.addheader(headerseen, line[len(headerseen)+1:].strip()) continue else: # It's not a header line; throw it back and stop here. if not self.dict: self.status = 'No headers' else: self.status = 'Non-header line where header expected' # Try to undo the read. if unread: unread(line) elif tell: self.fp.seek(startofline) else: self.status = self.status + '; bad seek' break class HTTPResponse: # strict: If true, raise BadStatusLine if the status line can't be # parsed as a valid HTTP/1.0 or 1.1 status line. By default it is # false because it prevents clients from talking to HTTP/0.9 # servers. Note that a response with a sufficiently corrupted # status line will look like an HTTP/0.9 response. # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. def __init__(self, sock, debuglevel=0, strict=0, method=None): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.strict = strict self._method = method self.msg = None # from the Status-Line of the response self.version = _UNKNOWN # HTTP-Version self.status = _UNKNOWN # Status-Code self.reason = _UNKNOWN # Reason-Phrase self.chunked = _UNKNOWN # is "chunked" being used? self.chunk_left = _UNKNOWN # bytes left to read in current chunk self.length = _UNKNOWN # number of bytes left in response self.will_close = _UNKNOWN # conn will close at end of response def _read_status(self): # Initialize with Simple-Response defaults line = self.fp.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise LineTooLong("header line") if self.debuglevel > 0: print "reply:", repr(line) if not line: # Presumably, the server closed the connection before # sending a valid response. raise BadStatusLine(line) try: [version, status, reason] = line.split(None, 2) except ValueError: try: [version, status] = line.split(None, 1) reason = "" except ValueError: # empty version will cause next test to fail and status # will be treated as 0.9 response. version = "" if not version.startswith('HTTP/'): if self.strict: self.close() raise BadStatusLine(line) else: # assume it's a Simple-Response from an 0.9 server self.fp = LineAndFileWrapper(line, self.fp) return "HTTP/0.9", 200, "" # The status code is a three-digit number try: status = int(status) if status < 100 or status > 999: raise BadStatusLine(line) except ValueError: raise BadStatusLine(line) return version, status, reason def begin(self): if self.msg is not None: # we've already started reading the response return # read until we get a non-100 response while True: version, status, reason = self._read_status() if status != CONTINUE: break # skip the header from the 100 response skipped_headers = [] while True: skip = self.fp.readline(_MAXLINE + 1) if len(skip) > _MAXLINE: raise LineTooLong("header line") skipped_headers.append(skip) if len(skipped_headers) > _MAXHEADERS: raise HTTPException("got more than %d headers" % _MAXHEADERS) if skip in (b'\r\n', b'\n', b''): break if self.debuglevel > 0: print "headers:", skipped_headers del skipped_headers self.status = status self.reason = reason.strip() if version == 'HTTP/1.0': self.version = 10 elif version.startswith('HTTP/1.'): self.version = 11 # use HTTP/1.1 code for HTTP/1.x where x>=1 elif version == 'HTTP/0.9': self.version = 9 else: raise UnknownProtocol(version) if self.version == 9: self.length = None self.chunked = 0 self.will_close = 1 self.msg = HTTPMessage(StringIO()) return self.msg = HTTPMessage(self.fp, 0) if self.debuglevel > 0: for hdr in self.msg.headers: print "header:", hdr, # don't let the msg keep an fp self.msg.fp = None # are we using the chunked-style of transfer encoding? tr_enc = self.msg.getheader('transfer-encoding') if tr_enc and tr_enc.lower() == "chunked": self.chunked = 1 self.chunk_left = None else: self.chunked = 0 # will the connection close at the end of the response? self.will_close = self._check_close() # do we have a Content-Length? # NOTE: RFC 2616, S4.4, #3 says we ignore this if tr_enc is "chunked" length = self.msg.getheader('content-length') if length and not self.chunked: try: self.length = int(length) except ValueError: self.length = None else: if self.length < 0: # ignore nonsensical negative lengths self.length = None else: self.length = None # does the body have a fixed length? (of zero) if (status == NO_CONTENT or status == NOT_MODIFIED or 100 <= status < 200 or # 1xx codes self._method == 'HEAD'): self.length = 0 # if the connection remains open, and we aren't using chunked, and # a content-length was not provided, then assume that the connection # WILL close. if not self.will_close and \ not self.chunked and \ self.length is None: self.will_close = 1 def _check_close(self): conn = self.msg.getheader('connection') if self.version == 11: # An HTTP/1.1 proxy is assumed to stay open unless # explicitly closed. conn = self.msg.getheader('connection') if conn and "close" in conn.lower(): return True return False # Some HTTP/1.0 implementations have support for persistent # connections, using rules different than HTTP/1.1. # For older HTTP, Keep-Alive indicates persistent connection. if self.msg.getheader('keep-alive'): return False # At least Akamai returns a "Connection: Keep-Alive" header, # which was supposed to be sent by the client. if conn and "keep-alive" in conn.lower(): return False # Proxy-Connection is a netscape hack. pconn = self.msg.getheader('proxy-connection') if pconn and "keep-alive" in pconn.lower(): return False # otherwise, assume it will close return True def close(self): if self.fp: self.fp.close() self.fp = None def isclosed(self): # NOTE: it is possible that we will not ever call self.close(). This # case occurs when will_close is TRUE, length is None, and we # read up to the last byte, but NOT past it. # # IMPLIES: if will_close is FALSE, then self.close() will ALWAYS be # called, meaning self.isclosed() is meaningful. return self.fp is None # XXX It would be nice to have readline and __iter__ for this, too. def read(self, amt=None): if self.fp is None: return '' if self._method == 'HEAD': self.close() return '' if self.chunked: return self._read_chunked(amt) if amt is None: # unbounded read if self.length is None: s = self.fp.read() else: s = self._safe_read(self.length) self.length = 0 self.close() # we read everything return s if self.length is not None: if amt > self.length: # clip the read to the "end of response" amt = self.length # we do not use _safe_read() here because this may be a .will_close # connection, and the user is reading more bytes than will be provided # (for example, reading in 1k chunks) s = self.fp.read(amt) if self.length is not None: self.length -= len(s) if not self.length: self.close() return s def _read_chunked(self, amt): assert self.chunked != _UNKNOWN chunk_left = self.chunk_left value = [] while True: if chunk_left is None: line = self.fp.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise LineTooLong("chunk size") i = line.find(';') if i >= 0: line = line[:i] # strip chunk-extensions try: chunk_left = int(line, 16) except ValueError: # close the connection as protocol synchronisation is # probably lost self.close() raise IncompleteRead(''.join(value)) if chunk_left == 0: break if amt is None: value.append(self._safe_read(chunk_left)) elif amt < chunk_left: value.append(self._safe_read(amt)) self.chunk_left = chunk_left - amt return ''.join(value) elif amt == chunk_left: value.append(self._safe_read(amt)) self._safe_read(2) # toss the CRLF at the end of the chunk self.chunk_left = None return ''.join(value) else: value.append(self._safe_read(chunk_left)) amt -= chunk_left # we read the whole chunk, get another self._safe_read(2) # toss the CRLF at the end of the chunk chunk_left = None # read and discard trailer up to the CRLF terminator ### note: we shouldn't have any trailers! while True: line = self.fp.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise LineTooLong("trailer line") if not line: # a vanishingly small number of sites EOF without # sending the trailer break if line == '\r\n': break # we read everything; close the "file" self.close() return ''.join(value) def _safe_read(self, amt): """Read the number of bytes requested, compensating for partial reads. Normally, we have a blocking socket, but a read() can be interrupted by a signal (resulting in a partial read). Note that we cannot distinguish between EOF and an interrupt when zero bytes have been read. IncompleteRead() will be raised in this situation. This function should be used when <amt> bytes "should" be present for reading. If the bytes are truly not available (due to EOF), then the IncompleteRead exception can be used to detect the problem. """ s = [] while amt > 0: chunk = self.fp.read(min(amt, MAXAMOUNT)) if not chunk: raise IncompleteRead(''.join(s), amt) s.append(chunk) amt -= len(chunk) return ''.join(s) def getheader(self, name, default=None): if self.msg is None: raise ResponseNotReady() return self.msg.getheader(name, default) def getheaders(self): """Return list of (header, value) tuples.""" if self.msg is None: raise ResponseNotReady() return self.msg.items() class HTTPConnection: _http_vsn = 11 _http_vsn_str = 'HTTP/1.1' response_class = HTTPResponse default_port = HTTP_PORT auto_open = 1 debuglevel = 0 strict = 0 def __init__(self, host, port=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): self.timeout = timeout self.sock = None self._buffer = [] self.__response = None self.__state = _CS_IDLE self._method = None self._tunnel_host = None self._tunnel_port = None self._tunnel_headers = {} self._set_hostport(host, port) if strict is not None: self.strict = strict def _set_tunnel(self, host, port=None, headers=None): """ Sets up the host and the port for the HTTP CONNECT Tunnelling. The headers argument should be a mapping of extra HTTP headers to send with the CONNECT request. """ self._tunnel_host = host self._tunnel_port = port if headers: self._tunnel_headers = headers else: self._tunnel_headers.clear() def _set_hostport(self, host, port): if port is None: i = host.rfind(':') j = host.rfind(']') # ipv6 addresses have [...] if i > j: try: port = int(host[i+1:]) except ValueError: raise InvalidURL("nonnumeric port: '%s'" % host[i+1:]) host = host[:i] else: port = self.default_port if host and host[0] == '[' and host[-1] == ']': host = host[1:-1] self.host = host self.port = port def set_debuglevel(self, level): self.debuglevel = level def _tunnel(self): self._set_hostport(self._tunnel_host, self._tunnel_port) self.send("CONNECT %s:%d HTTP/1.0\r\n" % (self.host, self.port)) for header, value in self._tunnel_headers.iteritems(): self.send("%s: %s\r\n" % (header, value)) self.send("\r\n") response = self.response_class(self.sock, strict = self.strict, method = self._method) (version, code, message) = response._read_status() if code != 200: self.close() raise socket.error("Tunnel connection failed: %d %s" % (code, message.strip())) while True: line = response.fp.readline(_MAXLINE + 1) if len(line) > _MAXLINE: raise LineTooLong("header line") if line == '\r\n': break def connect(self): """Connect to the host and port specified in __init__.""" self.sock = socket.create_connection((self.host,self.port), self.timeout) if self._tunnel_host: self._tunnel() def close(self): """Close the connection to the HTTP server.""" if self.sock: self.sock.close() # close it manually... there may be other refs self.sock = None if self.__response: self.__response.close() self.__response = None self.__state = _CS_IDLE def send(self, str): """Send `str' to the server.""" if self.sock is None: if self.auto_open: self.connect() else: raise NotConnected() # send the data to the server. if we get a broken pipe, then close # the socket. we want to reconnect when somebody tries to send again. # # NOTE: we DO propagate the error, though, because we cannot simply # ignore the error... the caller will know if they can retry. if self.debuglevel > 0: print "send:", repr(str) try: blocksize=8192 if hasattr(str,'read') and not isinstance(str, array): if self.debuglevel > 0: print "sendIng a read()able" data=str.read(blocksize) while data: self.sock.sendall(data) data=str.read(blocksize) else: self.sock.sendall(str) except socket.error, v: if v.args[0] == 32: # Broken pipe self.close() raise def _output(self, s): """Add a line of output to the current request buffer. Assumes that the line does *not* end with \\r\\n. """ self._buffer.append(s) def _send_output(self): """Send the currently buffered request and clear the buffer. Appends an extra \\r\\n to the buffer. """ self._buffer.extend(("", "")) msg = "\r\n".join(self._buffer) del self._buffer[:] self.send(msg) def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): """Send a request to the server. `method' specifies an HTTP request method, e.g. 'GET'. `url' specifies the object being requested, e.g. '/index.html'. `skip_host' if True does not add automatically a 'Host:' header `skip_accept_encoding' if True does not add automatically an 'Accept-Encoding:' header """ # if a prior response has been completed, then forget about it. if self.__response and self.__response.isclosed(): self.__response = None # in certain cases, we cannot issue another request on this connection. # this occurs when: # 1) we are in the process of sending a request. (_CS_REQ_STARTED) # 2) a response to a previous request has signalled that it is going # to close the connection upon completion. # 3) the headers for the previous response have not been read, thus # we cannot determine whether point (2) is true. (_CS_REQ_SENT) # # if there is no prior response, then we can request at will. # # if point (2) is true, then we will have passed the socket to the # response (effectively meaning, "there is no prior response"), and # will open a new one when a new request is made. # # Note: if a prior response exists, then we *can* start a new request. # We are not allowed to begin fetching the response to this new # request, however, until that prior response is complete. # if self.__state == _CS_IDLE: self.__state = _CS_REQ_STARTED else: raise CannotSendRequest() self._validate_method(method) # Save the method we use, we need it later in the response phase self._method = method if not url: url = '/' str = '%s %s %s' % (method, url, self._http_vsn_str) self._output(str) if self._http_vsn == 11: # Issue some standard headers for better HTTP/1.1 compliance if not skip_host: # this header is issued *only* for HTTP/1.1 # connections. more specifically, this means it is # only issued when the client uses the new # HTTPConnection() class. backwards-compat clients # will be using HTTP/1.0 and those clients may be # issuing this header themselves. we should NOT issue # it twice; some web servers (such as Apache) barf # when they see two Host: headers # If we need a non-standard port,include it in the # header. If the request is going through a proxy, # but the host of the actual URL, not the host of the # proxy. netloc = '' if url.startswith('http'): nil, netloc, nil, nil, nil = urlsplit(url) if netloc: try: netloc_enc = netloc.encode("ascii") except UnicodeEncodeError: netloc_enc = netloc.encode("idna") self.putheader('Host', netloc_enc) else: try: host_enc = self.host.encode("ascii") except UnicodeEncodeError: host_enc = self.host.encode("idna") if self.port == self.default_port: self.putheader('Host', host_enc) else: self.putheader('Host', "%s:%s" % (host_enc, self.port)) # note: we are assuming that clients will not attempt to set these # headers since *this* library must deal with the # consequences. this also means that when the supporting # libraries are updated to recognize other forms, then this # code should be changed (removed or updated). # we only want a Content-Encoding of "identity" since we don't # support encodings such as x-gzip or x-deflate. if not skip_accept_encoding: self.putheader('Accept-Encoding', 'identity') # we can accept "chunked" Transfer-Encodings, but no others # NOTE: no TE header implies *only* "chunked" #self.putheader('TE', 'chunked') # if TE is supplied in the header, then it must appear in a # Connection header. #self.putheader('Connection', 'TE') else: # For HTTP/1.0, the server will assume "not chunked" pass def _validate_method(self, method): """Validate a method name for putrequest.""" # prevent http header injection match = _contains_disallowed_method_pchar_re.search(method) if match: msg = ( "method can't contain control characters. {method!r} " "(found at least {match_group!r})" ).format(method=method, match_group=match.group()) raise ValueError(msg) def putheader(self, header, value): """Send a request header line to the server. For example: h.putheader('Accept', 'text/html') """ if self.__state != _CS_REQ_STARTED: raise CannotSendHeader() header = '%s' % header if not _is_legal_header_name(header): raise ValueError('Invalid header name %r' % (header,)) value = '%s' % value if _is_illegal_header_value(value): raise ValueError('Invalid header value %r' % (value,)) str = '%s: %s' % (header, value) self._output(str) def endheaders(self): """Indicate that the last header line has been sent to the server.""" if self.__state == _CS_REQ_STARTED: self.__state = _CS_REQ_SENT else: raise CannotSendHeader() self._send_output() def request(self, method, url, body=None, headers={}): """Send a complete request to the server.""" try: self._send_request(method, url, body, headers) except socket.error, v: # trap 'Broken pipe' if we're allowed to automatically reconnect if v.args[0] != 32 or not self.auto_open: raise # try one more time self._send_request(method, url, body, headers) def _send_request(self, method, url, body, headers): # honour explicitly requested Host: and Accept-Encoding headers header_names = dict.fromkeys([k.lower() for k in headers]) skips = {} if 'host' in header_names: skips['skip_host'] = 1 if 'accept-encoding' in header_names: skips['skip_accept_encoding'] = 1 self.putrequest(method, url, **skips) if body and ('content-length' not in header_names): thelen=None try: thelen=str(len(body)) except TypeError, te: # If this is a file-like object, try to # fstat its file descriptor import os try: thelen = str(os.fstat(body.fileno()).st_size) except (AttributeError, OSError): # Don't send a length if this failed if self.debuglevel > 0: print "Cannot stat!!" if thelen is not None: self.putheader('Content-Length',thelen) for hdr, value in headers.iteritems(): self.putheader(hdr, value) self.endheaders() if body: self.send(body) def getresponse(self): "Get the response from the server." # if a prior response has been completed, then forget about it. if self.__response and self.__response.isclosed(): self.__response = None # # if a prior response exists, then it must be completed (otherwise, we # cannot read this response's header to determine the connection-close # behavior) # # note: if a prior response existed, but was connection-close, then the # socket and response were made independent of this HTTPConnection # object since a new request requires that we open a whole new # connection # # this means the prior response had one of two states: # 1) will_close: this connection was reset and the prior socket and # response operate independently # 2) persistent: the response was retained and we await its # isclosed() status to become true. # if self.__state != _CS_REQ_SENT or self.__response: raise ResponseNotReady() if self.debuglevel > 0: response = self.response_class(self.sock, self.debuglevel, strict=self.strict, method=self._method) else: response = self.response_class(self.sock, strict=self.strict, method=self._method) response.begin() assert response.will_close != _UNKNOWN self.__state = _CS_IDLE if response.will_close: # this effectively passes the connection to the response self.close() else: # remember this, so we can tell when it is complete self.__response = response return response class HTTP: "Compatibility class with httplib.py from 1.5." _http_vsn = 10 _http_vsn_str = 'HTTP/1.0' debuglevel = 0 _connection_class = HTTPConnection def __init__(self, host='', port=None, strict=None): "Provide a default host, since the superclass requires one." # some joker passed 0 explicitly, meaning default port if port == 0: port = None # Note that we may pass an empty string as the host; this will throw # an error when we attempt to connect. Presumably, the client code # will call connect before then, with a proper host. self._setup(self._connection_class(host, port, strict)) def _setup(self, conn): self._conn = conn # set up delegation to flesh out interface self.send = conn.send self.putrequest = conn.putrequest self.endheaders = conn.endheaders self.set_debuglevel = conn.set_debuglevel conn._http_vsn = self._http_vsn conn._http_vsn_str = self._http_vsn_str self.file = None def connect(self, host=None, port=None): "Accept arguments to set the host/port, since the superclass doesn't." if host is not None: self._conn._set_hostport(host, port) self._conn.connect() def getfile(self): "Provide a getfile, since the superclass' does not use this concept." return self.file def putheader(self, header, *values): "The superclass allows only one value argument." self._conn.putheader(header, '\r\n\t'.join(values)) def getreply(self): """Compat definition since superclass does not define it. Returns a tuple consisting of: - server status code (e.g. '200' if all goes well) - server "reason" corresponding to status code - any RFC822 headers in the response from the server """ try: response = self._conn.getresponse() except BadStatusLine, e: ### hmm. if getresponse() ever closes the socket on a bad request, ### then we are going to have problems with self.sock ### should we keep this behavior? do people use it? # keep the socket open (as a file), and return it self.file = self._conn.sock.makefile('rb', 0) # close our socket -- we want to restart after any protocol error self.close() self.headers = None return -1, e.line, None self.headers = response.msg self.file = response.fp return response.status, response.reason, response.msg def close(self): self._conn.close() # note that self.file == response.fp, which gets closed by the # superclass. just clear the object ref here. ### hmm. messy. if status==-1, then self.file is owned by us. ### well... we aren't explicitly closing, but losing this ref will ### do it self.file = None try: import ssl except ImportError: pass else: class HTTPSConnection(HTTPConnection): "This class allows communication via SSL." default_port = HTTPS_PORT def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): HTTPConnection.__init__(self, host, port, strict, timeout) self.key_file = key_file self.cert_file = cert_file def connect(self): "Connect to a host on a given (SSL) port." sock = socket.create_connection((self.host, self.port), self.timeout) if self._tunnel_host: self.sock = sock self._tunnel() self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file) __all__.append("HTTPSConnection") class HTTPS(HTTP): """Compatibility with 1.5 httplib interface Python 1.5.2 did not have an HTTPS class, but it defined an interface for sending http requests that is also useful for https. """ _connection_class = HTTPSConnection def __init__(self, host='', port=None, key_file=None, cert_file=None, strict=None): # provide a default host, pass the X509 cert info # urf. compensate for bad input. if port == 0: port = None self._setup(self._connection_class(host, port, key_file, cert_file, strict)) # we never actually use these for anything, but we keep them # here for compatibility with post-1.5.2 CVS. self.key_file = key_file self.cert_file = cert_file def FakeSocket (sock, sslobj): warnings.warn("FakeSocket is deprecated, and won't be in 3.x. " + "Use the result of ssl.wrap_socket() directly instead.", DeprecationWarning, stacklevel=2) return sslobj class HTTPException(Exception): # Subclasses that define an __init__ must call Exception.__init__ # or define self.args. Otherwise, str() will fail. pass class NotConnected(HTTPException): pass class InvalidURL(HTTPException): pass class UnknownProtocol(HTTPException): def __init__(self, version): self.args = version, self.version = version class UnknownTransferEncoding(HTTPException): pass class UnimplementedFileMode(HTTPException): pass class IncompleteRead(HTTPException): def __init__(self, partial, expected=None): self.args = partial, self.partial = partial self.expected = expected def __repr__(self): if self.expected is not None: e = ', %i more expected' % self.expected else: e = '' return 'IncompleteRead(%i bytes read%s)' % (len(self.partial), e) def __str__(self): return repr(self) class ImproperConnectionState(HTTPException): pass class CannotSendRequest(ImproperConnectionState): pass class CannotSendHeader(ImproperConnectionState): pass class ResponseNotReady(ImproperConnectionState): pass class BadStatusLine(HTTPException): def __init__(self, line): self.args = line, self.line = line class LineTooLong(HTTPException): def __init__(self, line_type): HTTPException.__init__(self, "got more than %d bytes when reading %s" % (_MAXLINE, line_type)) # for backwards compatibility error = HTTPException class LineAndFileWrapper: """A limited file-like object for HTTP/0.9 responses.""" # The status-line parsing code calls readline(), which normally # get the HTTP status line. For a 0.9 response, however, this is # actually the first line of the body! Clients need to get a # readable file object that contains that line. def __init__(self, line, file): self._line = line self._file = file self._line_consumed = 0 self._line_offset = 0 self._line_left = len(line) def __getattr__(self, attr): return getattr(self._file, attr) def _done(self): # called when the last byte is read from the line. After the # call, all read methods are delegated to the underlying file # object. self._line_consumed = 1 self.read = self._file.read self.readline = self._file.readline self.readlines = self._file.readlines def read(self, amt=None): if self._line_consumed: return self._file.read(amt) assert self._line_left if amt is None or amt > self._line_left: s = self._line[self._line_offset:] self._done() if amt is None: return s + self._file.read() else: return s + self._file.read(amt - len(s)) else: assert amt <= self._line_left i = self._line_offset j = i + amt s = self._line[i:j] self._line_offset = j self._line_left -= amt if self._line_left == 0: self._done() return s def readline(self): if self._line_consumed: return self._file.readline() assert self._line_left s = self._line[self._line_offset:] self._done() return s def readlines(self, size=None): if self._line_consumed: return self._file.readlines(size) assert self._line_left L = [self._line[self._line_offset:]] self._done() if size is None: return L + self._file.readlines() else: return L + self._file.readlines(size) def test(): """Test this module. A hodge podge of tests collected here, because they have too many external dependencies for the regular test suite. """ import sys import getopt opts, args = getopt.getopt(sys.argv[1:], 'd') dl = 0 for o, a in opts: if o == '-d': dl = dl + 1 host = 'www.python.org' selector = '/' if args[0:]: host = args[0] if args[1:]: selector = args[1] h = HTTP() h.set_debuglevel(dl) h.connect(host) h.putrequest('GET', selector) h.endheaders() status, reason, headers = h.getreply() print 'status =', status print 'reason =', reason print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works class HTTP11(HTTP): _http_vsn = 11 _http_vsn_str = 'HTTP/1.1' h = HTTP11('www.python.org') h.putrequest('GET', 'http://www.python.org/~jeremy/') h.endheaders() h.getreply() h.close() try: import ssl except ImportError: pass else: for host, selector in (('sourceforge.net', '/projects/python'), ): print "https://%s%s" % (host, selector) hs = HTTPS() hs.set_debuglevel(dl) hs.connect(host) hs.putrequest('GET', selector) hs.endheaders() status, reason, headers = hs.getreply() print 'status =', status print 'reason =', reason print "read", len(hs.getfile().read()) print if headers: for header in headers.headers: print header.strip() print if __name__ == '__main__': test()
Save
cmd:
run