Revision c9d0fa8a

b/lib/http/__init__.py
111 111
  """
112 112

  
113 113

  
114
class _HttpSocketTimeout(Exception):
114
class HttpSocketTimeout(Exception):
115 115
  """Internal exception for socket timeouts.
116 116

  
117 117
  This should only be used for internal error reporting.
......
265 265

  
266 266
      event = WaitForSocketCondition(poller, sock, wait_for_event, timeout)
267 267
      if event is None:
268
        raise _HttpSocketTimeout()
268
        raise HttpSocketTimeout()
269 269

  
270 270
      if (op == SOCKOP_RECV and
271 271
          event & (select.POLLNVAL | select.POLLHUP | select.POLLERR)):
......
355 355
                                           self.ssl_cert_pem)
356 356

  
357 357

  
358
class _HttpSocketBase(object):
358
class HttpSocketBase(object):
359 359
  """Base class for HTTP server and client.
360 360

  
361 361
  """
......
708 708
    logging.debug("HTTP POST data: %s", self.request_post_data)
709 709

  
710 710

  
711
class HttpServer(_HttpSocketBase):
711
class HttpServer(HttpSocketBase):
712 712
  """Generic HTTP server class
713 713

  
714 714
  Users of this class must subclass it and override the HandleRequest function.
......
733 733
                            it with our certificate
734 734

  
735 735
    """
736
    _HttpSocketBase.__init__(self)
736
    HttpSocketBase.__init__(self)
737 737

  
738 738
    self.mainloop = mainloop
739 739
    self.local_address = local_address
......
874 874
    self.resp_body = None
875 875

  
876 876

  
877
class HttpClientRequestExecutor(_HttpSocketBase):
877
class HttpClientRequestExecutor(HttpSocketBase):
878 878
  # Default headers
879 879
  DEFAULT_HEADERS = {
880 880
    HTTP_USER_AGENT: HTTP_GANETI_VERSION,
......
906 906
    @param req: Request object
907 907

  
908 908
    """
909
    _HttpSocketBase.__init__(self)
909
    HttpSocketBase.__init__(self)
910 910

  
911 911
    self.request = req
912 912

  
......
1226 1226
      try:
1227 1227
        sent = SocketOperation(self.poller, self.sock, SOCKOP_SEND, data,
1228 1228
                               self.WRITE_TIMEOUT)
1229
      except _HttpSocketTimeout:
1229
      except HttpSocketTimeout:
1230 1230
        raise _HttpClientError("Timeout while sending request")
1231 1231
      except socket.error, err:
1232 1232
        raise _HttpClientError("Error sending request: %s" % err)
......
1248 1248
      try:
1249 1249
        data = SocketOperation(self.poller, self.sock, SOCKOP_RECV, 4096,
1250 1250
                               self.READ_TIMEOUT)
1251
      except _HttpSocketTimeout:
1251
      except HttpSocketTimeout:
1252 1252
        raise _HttpClientError("Timeout while reading response")
1253 1253
      except socket.error, err:
1254 1254
        raise _HttpClientError("Error while reading response: %s" % err)
......
1284 1284
        if not SocketOperation(self.poller, self.sock, SOCKOP_RECV, 1,
1285 1285
                               self.CLOSE_TIMEOUT):
1286 1286
          return
1287
      except (socket.error, _HttpClientError, _HttpSocketTimeout):
1287
      except (socket.error, _HttpClientError, HttpSocketTimeout):
1288 1288
        # Ignore errors at this stage
1289 1289
        pass
1290 1290

  
......
1292 1292
    try:
1293 1293
      SocketOperation(self.poller, self.sock, SOCKOP_SHUTDOWN,
1294 1294
                      socket.SHUT_RDWR, self.WRITE_TIMEOUT)
1295
    except _HttpSocketTimeout:
1295
    except HttpSocketTimeout:
1296 1296
      raise _HttpClientError("Timeout while shutting down connection")
1297 1297
    except socket.error, err:
1298 1298
      raise _HttpClientError("Error while shutting down connection: %s" % err)

Also available in: Unified diff