no-cups
Last change
on this file since 89fe6da was
89fe6da,
checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago
|
Add 'length' keyword to IPPRequest constructor
|
-
Property mode set to
100755
|
File size:
1.0 KB
|
Line | |
---|
1 | #!/usr/bin/python |
---|
2 | |
---|
3 | import logging, BaseHTTPServer |
---|
4 | import ipprequest |
---|
5 | |
---|
6 | logging.basicConfig(level=logging.DEBUG) |
---|
7 | |
---|
8 | class GutenbachIPPHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
---|
9 | def handle_one_request(self): |
---|
10 | self.raw_requestline = self.rfile.readline() |
---|
11 | if not self.raw_requestline: |
---|
12 | self.close_connection = 1 |
---|
13 | return |
---|
14 | if not self.parse_request(): # An error code has been sent, just exit |
---|
15 | return |
---|
16 | self.handle_ipp() |
---|
17 | |
---|
18 | def handle_ipp(self): |
---|
19 | req = ipprequest.IPPRequest(request=self.rfile, |
---|
20 | length=self.headers.getheader('content-length', 0)) |
---|
21 | |
---|
22 | self.send_response(200, "o hai") |
---|
23 | self.send_header("Content-Type", "text/plain") |
---|
24 | self.send_header("Connection", "close") |
---|
25 | self.end_headers() |
---|
26 | self.wfile.write("I got ur request") |
---|
27 | |
---|
28 | if __name__ == '__main__': |
---|
29 | server_address = ('', 8000) |
---|
30 | httpd = BaseHTTPServer.HTTPServer(server_address, GutenbachIPPHandler) |
---|
31 | httpd.serve_forever() |
---|
Note: See
TracBrowser
for help on using the repository browser.