Reputation: 900
I'm trying to use BaseHttpServer in Python2.7 to make a simple HTTP SERVER, and the problem is when want to set multiple cookies on the browser via
self.send_header('Set-Cookie', 'A=LDJDSFLKSDJLDSF; \n B=545DS4SD54DSDS54')
everything after '\n' is not sent!!, it seems send_header drops anything after '\n' so the browser only receives 'A=LDJDSFLKSDJLDSF'!!!, any suggestions on how to solve this? is it a bug in Python2 BaseHttpServer? and thanks in advance.
Upvotes: 1
Views: 1949
Reputation: 599630
That's not valid in a header, and that's nothing to do with BaseHttpServer. You can only set one cookie in a single header; however, you can certainly send multiple headers. So:
self.send_header('Set-Cookie', 'A=LDJDSFLKSDJLDSF')
self.send_header('Set-Cookie', 'B=545DS4SD54DSDS54')
Upvotes: 4