Skip to content

Commit de63139

Browse files
author
Timo Schmid
committed
Changes for distributing
new package wcf bsd license setup.py
1 parent 1109741 commit de63139

18 files changed

Lines changed: 430 additions & 70 deletions

LICENSE.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2011, Timo Schmid <[email protected]>
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
* Neither the name of the ERMW GmbH nor the names of its contributors
14+
may be used to endorse or promote products derived from this software
15+
without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

WcfPlugin.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
# vim: set ts=4 sw=4 tw=79 fileencoding=utf-8:
2+
from __future__ import absolute_import
3+
from StringIO import StringIO
4+
import array
5+
16
from bluec0re import ICallback
27

8+
from wcf.records import Record, print_records, dump_records
9+
from wcf.xml2records import Parser
10+
11+
312
def encode_decode(headers, data):
4-
from records import Record, print_records, dump_records
5-
from StringIO import StringIO
613

714
if not data:
815
return headers, data
916

1017

1118
if 'X-WCF-Encode' in headers:
12-
from xml2records import Parser
1319
p = Parser()
1420
p.feed(data)
1521
data = dump_records(p.records)
@@ -39,7 +45,6 @@ def __str__(self):
3945
return type(self).__name__
4046

4147
def processProxyMessage(self, *args, **kwargs):
42-
import array
4348
messageIsRequest = args[1]
4449
message = args[10]
4550

parse.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
11
#!/usr/bin/env python2
2+
# Copyright (c) 2011, Timo Schmid <[email protected]>
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions
7+
# are met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above copyright
12+
# notice, this list of conditions and the following disclaimer in the
13+
# documentation and/or other materials provided with the distribution.
14+
# * Neither the name of the ERMW GmbH nor the names of its contributors
15+
# may be used to endorse or promote products derived from this software
16+
# without specific prior written permission.
17+
#
18+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
229

330
if __name__ == '__main__':
431
import sys
5-
from records import Record,print_records
32+
from wcf.records import Record,print_records
633
fp = sys.stdin
734
if len(sys.argv) > 1:
835
filename = sys.argv[1]

proxy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python2
2+
3+
# modfied version of Suzuki Hisaos Tiny HTTP Proxy
4+
# NOT STABLE
25

36
__doc__ = """Tiny HTTP Proxy.
47
@@ -94,6 +97,7 @@ def do_GET(self):
9497
target_netloc = netloc
9598
scm, netloc, _, _, _, _ = urlparse.urlparse(os.getenv('http_proxy'), 'http')
9699
else:
100+
netloc = '10.10.100.1:58451'
97101
del self.headers['Proxy-Connection']
98102

99103
if self._connect_to(netloc, soc):

setup.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import os
2+
from setuptools import setup
3+
4+
setup(
5+
name = "wcf-binary parser",
6+
version = "0.4",
7+
author = "Timo Schmid",
8+
author_email = "[email protected]",
9+
description = ("A library for transforming wcf-binary data from and to xml"),
10+
license = "BSD",
11+
keywords = "wcf wcf-binary xml",
12+
url = "",
13+
packages=['wcf', 'tests'],
14+
long_description="",
15+
test_suite="tests.alltests.Suite",
16+
classifiers=[
17+
"Development Status :: 4 - Beta",
18+
"Topic :: Utilities",
19+
"License :: OSI Approved :: BSD License",
20+
"Programming Language :: Python :: 2",
21+
"Topic :: Internet :: WWW/HTTP",
22+
"Topic :: Software Development :: Libraries :: Python Modules",
23+
24+
],
25+
)

tests.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import alltests

tests/alltests.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env python2
2+
# vim: set ts=4 sw=4 tw=79 fileencoding=utf-8:
3+
4+
from __future__ import absolute_import
5+
import logging
6+
import doctest
7+
import unittest
8+
9+
from wcf.records import *
10+
11+
test_bin = (
12+
"56020b0173040b0161065608440a1e0082993a687474703a2f2f646f6373"
13+
"2e6f617369732d6f70656e2e6f72672f77732d73782f77732d7472757374"
14+
"2f3230303531322f5253542f4973737565441aad5db293d4bc0ba547b9dc"
15+
"cb2f140fd0c3442c442aab1401440c1e0082993c687474703a2f2f646377"
16+
"733a35383435312f44617465762f4672616d65776f726b2f52656d6f7465"
17+
"536572766963654d6f64656c2f456e61626c657201560e41057472757374"
18+
"14526571756573745365637572697479546f6b656e0407436f6e74657874"
19+
"982c757569642d34393037636538322d303630372d346263302d62643861"
20+
"2d6531633937663165323862372d32320905747275737430687474703a2f"
21+
"2f646f63732e6f617369732d6f70656e2e6f72672f77732d73782f77732d"
22+
"74727573742f3230303531324105747275737409546f6b656e5479706599"
23+
"41687474703a2f2f646f63732e6f617369732d6f70656e2e6f72672f7773"
24+
"2d73782f77732d736563757265636f6e766572736174696f6e2f32303035"
25+
"31322f736374410574727573740b52657175657374547970659936687474"
26+
"703a2f2f646f63732e6f617369732d6f70656e2e6f72672f77732d73782f"
27+
"77732d74727573742f3230303531322f497373756541057472757374074b"
28+
"657953697a658b0001410574727573740e42696e61727945786368616e67"
29+
"650674aaa60306d402aad8029e364e544c4d5353500001000000b7b218e2"
30+
"0a000a002d00000005000500280000000601b11d0000000f434c57533157"
31+
"45425345525649439f0145010101").decode('hex')
32+
33+
class TransformTest(unittest.TestCase):
34+
35+
def runTest(self):
36+
from StringIO import StringIO
37+
sio = StringIO(test_bin)
38+
new = dump_records(Record.parse(sio))
39+
40+
self.assertEqual(test_bin, new)
41+
42+
class Suite(unittest.TestSuite):
43+
44+
def __init__(self, *args, **kwargs):
45+
super(Suite, self).__init__(*args, **kwargs)
46+
47+
self.addTest(doctest.DocTestSuite(base))
48+
self.addTest(doctest.DocTestSuite(elements))
49+
self.addTest(doctest.DocTestSuite(attributes))
50+
self.addTest(doctest.DocTestSuite(text))
51+
self.addTest(TransformTest())
52+
53+
if __name__ == '__main__':
54+
unittest.main()

MyHTMLParser.py renamed to wcf/MyHTMLParser.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""A parser for HTML and XHTML."""
2+
# This file is a modified Version from htmlparser.HTMLParser
3+
# in this version tag and attribute names aren't converted to
4+
# lowercase
25

36
# This file is based on sgmllib.py, but the API is slightly different.
47

wcf/__init__.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# vim: set ts=4 sw=4 tw=79 fileencoding=utf-8:
2+
# Copyright (c) 2011, Timo Schmid <[email protected]>
3+
# All rights reserved.
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions
7+
# are met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above copyright
12+
# notice, this list of conditions and the following disclaimer in the
13+
# documentation and/or other materials provided with the distribution.
14+
# * Neither the name of the ERMW GmbH nor the names of its contributors
15+
# may be used to endorse or promote products derived from this software
16+
# without specific prior written permission.
17+
#
18+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+

0 commit comments

Comments
 (0)