Comment 3 for bug 452347

Revision history for this message
Ugo Riboni (uriboni) wrote :

Well, you have a point there, the docs say that we need str objects already. So yes, it is technically a misuse of the API.

However, with most other functions passing the wrong type in most cases will result in exceptions or in very identifiable bad behaviour that can be very easily traced back to a misuse in the API.

In this case the bad behaviour is confusing and hard to trace back to API misuse. It took me various hours to find out what was really going on, and I had to debug into the http client and use wireshark.

Also, sending unicode is a violation of the HTTP specification. In my opinion a good implementation of HTTP should never allow the user to do things that violate the specification. Therefore, the client should either do an implicit conversion like I implemented in my patch, or it should raise an exception early when the user try to pass something to the API that would result in a violation of the spec and not allow him to continue.