On Mar 2, 2006, at 8:36 PM, James Edward Gray II wrote:

> Can a Net::HTTP guru comment on this message:
>
> [ruby-talk:182360]
>
> How we found a bug here?

Well, I've looked into this some more myself.  I do believe this is a  
bug.  Here's the code in the current Net::HTTP causing the issue,  
starting on line 1507:

   unless content_type()
     warn 'net/http: warning: Content-Type did not set; using  
application/x-www-form-urlencoded' if $VERBOSE
     set_content_type 'application/x-www-form-urlencoded'
   end

However, here is the definition of content_type(), starting on line  
1366:

   def content_type
     "#{main_type()}/#{sub_type()}"
   end

It is impossible for that to return a false value, so the unless  
class is never triggered.  I'm not 100% sure what the intended  
behavior is, but would changing the unless as follows be better?

   unless content_type() == "/"
     # ...
   end

James Edward Gray II