code: int version()
    {
      if (_version > 0) {
        return _version;
      }
  
      CharSegment protocol = getProtocolBuffer();
      if (protocol.equals("HTTP/1.1")) {
        _version = HTTP_1_1;
        return HTTP_1_1;
      }
      else if (protocol.equals("HTTP/1.0")) {
        _version = HTTP_1_0;
        return _version;
      }
      else if (protocol.equals("HTTP/0.9")) {
        _version = HTTP_0_9;
        return HTTP_0_9;
      }
      else if (protocol.length() < 8) {
        _version = HTTP_0_9;
        return _version;
      }
  
      int i = protocol.indexOf('/');
      int len = protocol.length();
      int major = 0;
      for (i++; i < len; i++) {
        char ch = protocol.charAt(i);
  
        if ('0' <= ch && ch <= '9')
          major = 10 * major + ch - '0';
        else if (ch == '.')
          break;
        else {
          _version = HTTP_1_0;
          return _version;
        }
      }
  
      int minor = 0;
      for (i++; i < len; i++) {
        char ch = protocol.charAt(i);
  
        if ('0' <= ch && ch <= '9')
          minor = 10 * minor + ch - '0';
        else
          break;
      }
  
      _version = 256 * major + minor;
  
      return _version;
    }
docs: Returns the HTTP version of the request based on getProtocol().