File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,9 @@ def GET(self, **params):
113113 '''
114114 resp = []
115115
116+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
116117 conn = cherrypy .request .headers .get ('Host' ).split (':' )
117- if int (conn [1 ]) != int (self .attr .get ('prometheus' )):
118+ if len ( conn ) == 2 and int (conn [1 ]) != int (self .attr .get ('prometheus' )):
118119 self .logger .error (MSG ['EndpointNotSupportedForPort' ].
119120 format (cherrypy .request .script_name , str (conn [1 ])))
120121 raise cherrypy .HTTPError (400 , ERR [400 ])
Original file line number Diff line number Diff line change @@ -281,8 +281,9 @@ def GET(self, **params):
281281 """
282282 resp = []
283283
284+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
284285 conn = cherrypy .request .headers .get ('Host' ).split (':' )
285- if int (conn [1 ]) != int (self .port ):
286+ if len ( conn ) == 2 and int (conn [1 ]) != int (self .port ):
286287 self .logger .error (MSG ['EndpointNotSupportedForPort' ].
287288 format (cherrypy .request .script_name , str (conn [1 ])))
288289 raise cherrypy .HTTPError (400 , ERR [400 ])
@@ -327,6 +328,13 @@ def POST(self):
327328 ''' Process POST. tools.json_in.force is set to False for
328329 compatability between versions of grafana < 3 and version 3.'''
329330
331+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
332+ conn = cherrypy .request .headers .get ('Host' ).split (':' )
333+ if len (conn ) == 2 and int (conn [1 ]) != int (self .port ):
334+ self .logger .error (MSG ['EndpointNotSupportedForPort' ].
335+ format (cherrypy .request .script_name , str (conn [1 ])))
336+ raise cherrypy .HTTPError (400 , ERR [400 ])
337+
330338 # /api/query
331339 if 'query' in cherrypy .request .script_name :
332340
Original file line number Diff line number Diff line change @@ -149,8 +149,9 @@ def GET(self, **params):
149149 '''
150150 resp = []
151151
152+ self .logger .trace (f"Request headers:{ str (cherrypy .request .headers )} " )
152153 conn = cherrypy .request .headers .get ('Host' ).split (':' )
153- if int (conn [1 ]) != int (self .port ):
154+ if len ( conn ) == 2 and int (conn [1 ]) != int (self .port ):
154155 self .logger .error (MSG ['EndpointNotSupportedForPort' ].
155156 format (cherrypy .request .script_name , str (conn [1 ])))
156157 raise cherrypy .HTTPError (400 , ERR [400 ])
You can’t perform that action at this time.
0 commit comments