pirDOL commented on issue #2575:
URL: https://github.com/apache/brpc/issues/2575#issuecomment-2003523529
@chenBright 根据HttpHeader接口来看,只有SetHeader和AppendHeader,两个接口都不能构造出http
server返回响应报文中有多个set-cookie的场景,可以改用如下命令mockserver
```python
#!/noah/bin/python
import socket
def handle_request(client_socket):
request = client_socket.recv(1024)
response = 'HTTP/1.1 200 OK\r\n'
response += 'Set-Cookie: a=b;\r\n'
response += 'Set-Cookie: c=d;\r\n'
response += 'Content-Type: text/plain\r\n'
response += 'Content-Length: 4\r\n'
response += '\r\n'
response += 'echo'
client_socket.sendall(response.encode())
client_socket.close()
def start_server(port):
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind(('0.0.0.0', port))
server_socket.listen(5)
print('Server is listening on port {port}...')
while True:
client_socket, client_address = server_socket.accept()
print('Accepted connection from {client_address}')
handle_request(client_socket)
if __name__ == '__main__':
PORT = 1024
start_server(PORT)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]