{"record":{"id":"bf329752887a2560","repo":"sqlmapproject/sqlmap","slug":"hostname-bytes-are-neither-ascii-nor-utf-8","errorCode":null,"errorMessage":"hostname bytes are neither ASCII nor UTF-8","messagePattern":"hostname bytes are neither ASCII nor UTF-8","errorType":"exception","errorClass":"H2Error","httpStatus":null,"severity":"error","filePath":"lib/request/http2.py","lineNumber":563,"sourceCode":"\n\ndef _read_frame(sock, max_frame_size=DEFAULT_MAX_FRAME_SIZE):\n    length, ftype, flags, sid = decode_frame_header(_recv_exact(sock, 9))\n    if length > max_frame_size:\n        raise H2ProtocolError(\"received frame exceeds local maximum frame size\")\n    payload = _recv_exact(sock, length) if length else b\"\"\n    return ftype, flags, sid, payload\n\n\ndef _idna_host(host):\n    if isinstance(host, bytes):\n        try:\n            host = host.decode(\"ascii\")\n        except UnicodeDecodeError:\n            try:\n                host = host.decode(\"utf-8\")\n            except UnicodeDecodeError:\n                raise H2Error(\"hostname bytes are neither ASCII nor UTF-8\")\n    if not isinstance(host, text_type):\n        host = text_type(host)\n    if host.startswith(\"[\") and host.endswith(\"]\"):\n        host = host[1:-1]\n    if not host:\n        raise H2Error(\"hostname is required\")\n    if \":\" in host:  # IPv6 literal, optionally with a zone identifier\n        return host\n    try:\n        return host.encode(\"idna\").decode(\"ascii\")\n    except (UnicodeError, AttributeError):\n        raise H2Error(\"invalid internationalized hostname %r\" % host)\n\n\ndef _format_authority_host(host):\n    host = _idna_host(host)\n    if \":\" in host:\n        return \"[%s]\" % host","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/request/http2.py#L545-L581","documentation":"Error \"hostname bytes are neither ASCII nor UTF-8\" thrown in sqlmapproject/sqlmap.","triggerScenarios":"Thrown at lib/request/http2.py:563 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}