# cherrypy.test.test_http module

Tests for managing HTTP issues (malformed requests, etc).

class cherrypy.test.test_http.HTTPTests(methodName='runTest')

  Bases: `CPWebCase`

  _classSetupFailed = False
  _class_cleanups = []
  make_connection()
  static setup_server()
  test_garbage_in()
  test_http_over_https()
  test_malformed_header()
  test_malformed_request_line()
  test_no_content_length()
  test_post_filename_with_special_characters()

    Testing that we can handle filenames with special characters.

    This was reported as a bug in:

    - https://github.com/cherrypy/cherrypy/issues/1146/

    - https://github.com/cherrypy/cherrypy/issues/1397/

    - https://github.com/cherrypy/cherrypy/issues/1694/

  test_post_multipart()
  test_request_line_split_issue_1220()

cherrypy.test.test_http.encode_filename(filename)

  Given a filename to be used in a multipart/form-data, encode the name.

  Return the key and encoded filename.

cherrypy.test.test_http.encode_multipart_formdata(files)

  Return (content_type, body) ready for httplib.HTTP instance.

  files: a sequence of (name, filename, value) tuples for multipart uploads. filename can be a string or a tuple (‘filename string’, ‘encoding’)

cherrypy.test.test_http.is_ascii(text)

  Return True if the text encodes as ascii.