2828
2929``` python
3030name = x509.Name([
31- x509.NameAttribute(NameOID.COUNTRY_NAME , self ._profile[' country' ]), # 随机国家 (JP/TW/DE/NL/SG)
31+ x509.NameAttribute(NameOID.COUNTRY_NAME , self ._profile[' country' ]),
3232 x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME , self ._profile[' state' ]),
3333 x509.NameAttribute(NameOID.LOCALITY_NAME , self ._profile[' city' ]),
3434 x509.NameAttribute(NameOID.ORGANIZATION_NAME , self ._profile[' org' ]),
3535 x509.NameAttribute(NameOID.COMMON_NAME , self ._profile[' cn' ])
3636])
37- # ... 证书签发逻辑 ...
3837```
3938
4039生成的 ` ca.crt ` 需要被系统/浏览器信任,才能使后续的域名证书被接受。
@@ -106,17 +105,14 @@ elif 'GenerateContent' in path:
106105
107106### 响应解码流程 (` ResponseHandler.handle_response ` )
108107
109- ``` python
110108``` python
111109async def handle_response (self , data , host , path , headers ):
112- # 使用 memoryview 优化内存复制
113110 decoded, completed = self ._unchunk(bytes (data))
114111 decoded = self ._inflate(decoded)
115112 result = self ._extract_content(decoded)
116113 result[' done' ] = completed
117114 return result
118115```
119- ```
120116
121117#### 1. Chunked 解码 (` _unchunk ` )
122118
@@ -175,7 +171,6 @@ elif len(payload) > 2:
175171
176172通过分析包含 Function Call 的响应,发现参数使用递归嵌套数组表示:
177173
178- ``` python
179174``` python
180175def _parse_tool_args (self , args ):
181176 extractors = {
@@ -193,7 +188,6 @@ def _parse_tool_args(self, args):
193188 if extractor:
194189 result[name] = extractor(value)
195190```
196- ```
197191
198192value 数组长度与数据类型的映射关系:
199193
0 commit comments