Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-540

connectTimeoutMS (and probably others) option ignored unless in lower case

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.1.2
    • Affects Version/s: 1.0.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      CentOS 6.x / x86-64

      glibc 2.12 / gcc 4.4.7

      When specifying the connectTimeoutMS option e.g

      mongodb://localhost/test?connectTimeoutMS=100

      This option is ignored and the default of 10000 is used.

      This is due to this option being added internally under the name as specified (i.e mixed case) but when it is being checked for in mongoc-client.c::mongoc_client_connect_tcp() it is being searched for in lower case, i.e we have

      94 if ((options = mongoc_uri_get_options (uri)) &&
      95 bson_iter_init_find (&iter, options, "connecttimeoutms") &&

      Above line is the problem.

      96 BSON_ITER_HOLDS_INT32 (&iter)) {
      97 if (!(connecttimeoutms = bson_iter_int32(&iter)))

      { 98 MONGOC_DEFAULT_CONNECTTIMEOUTMS); 99 connecttimeoutms = MONGOC_DEFAULT_CONNECTTIMEOUTMS; 100 }

      101 }

      Using ?connecttimeoutms=100 works as expected. This will maybe effect more things, I haven't really looked further.

      I'm not sure what the intention is here. All the MongoDB documentation uses mixed case.

      Cheers,
      Andrew

            Assignee:
            Unassigned Unassigned
            Reporter:
            ac000 Andrew Clayton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: