Univention Bugzilla – Attachment 4231 Details for
Bug 26268
UMCP: Weitere MIME-Types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Unterstüzung von anderen MIME-Types (UMC Web-Server)
http-get.patch (text/plain), 2.28 KB, created by
Andreas Büsching
on 2012-02-28 09:25 CET
(
hide
)
Description:
Unterstüzung von anderen MIME-Types (UMC Web-Server)
Filename:
MIME Type:
Creator:
Andreas Büsching
Created:
2012-02-28 09:25 CET
Size:
2.28 KB
patch
obsolete
>Index: univention-management-console-web-server >=================================================================== >--- univention-management-console-web-server (Revision 31019) >+++ univention-management-console-web-server (Arbeitskopie) >@@ -32,6 +32,7 @@ > # <http://www.gnu.org/licenses/>. > > import cherrypy >+import httplib > import os > import threading > import Queue >@@ -42,8 +43,9 @@ > import tempfile > import time > import threading >+import urllib >+import urlparse > import uuid >-import httplib > > import notifier > from daemon.runner import DaemonRunner, DaemonRunnerStopFailureError, DaemonRunnerStartFailureError >@@ -349,6 +351,8 @@ > except ValueError: > self._log('error', 'cannot parse JSON body') > raise cherrypy.HTTPError(httplib.BAD_REQUEST, 'Invalid JSON document') >+ else: >+ json = '' > > # create new UMCP request > req = self.get_request( cherrypy.request, json ) >@@ -371,6 +375,10 @@ > return '<html><body><textarea>' + simplejson.dumps(response.body) + '</textarea></body></html>' > else: > return simplejson.dumps(response.body) >+ elif response.mimetype != umcp.MIMETYPE_JSON: >+ update_session_cookie(cherrypy.response.cookie, sessionid) >+ cherrypy.response.headers[ 'Content-Type' ] = response.mimetype >+ return response.body > > # something bad happened > self._log('error', 'response status code: %s' % response.status) >@@ -433,7 +441,8 @@ > requestprefix = '/command' > > def get_request(self, request, json): >- args = request.path_info >+ parse_result = urlparse.urlparse( request.path_info ) >+ args = parse_result.path > > if args.startswith( self.requestprefix ): > args = args[ len(self.requestprefix)+1 : ] >@@ -442,9 +451,14 @@ > self._log('error', 'get_request: args is empty') > raise cherrypy.HTTPError(httplib.NOT_FOUND) > >- req = umcp.Command( [ args ], options = json.get( 'options', {} ) ) >- if 'flavor' in json: >- req.flavor = json[ 'flavor' ] >+ if cherrypy.request.method == 'POST': >+ req = umcp.Command( [ args ], options = json.get( 'options', {} ) ) >+ if 'flavor' in json: >+ req.flavor = json[ 'flavor' ] >+ elif cherrypy.request.method == 'GET': >+ req = umcp.Command( [ args ], options = {} ) >+ for key, value in urlparse.parse_qsl( cherrypy.request.query_string ): >+ req.options[ key ] = urllib.unquote( value ) > > return req >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 26268
:
4230
| 4231 |
4232