git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] http: add support for specifying the SSL version

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Aug 13, 2015, 15:58 UTC
Message-ID
<CA+EOSBkSkvvBQDpxL_ygj+2haMk1U7T00-Xmxn8iyXcnV6RN5Q@mail.gmail.com>
In-Reply-To
<CAPig+cTug2Q3v1K5r76fhJ6OQY9V1e6MbiXQBGQJD51TCOGW=A@mail.gmail.com>
2015-08-13 17:47 GMT+02:00 Eric Sunshine <sunshine@sunshineco.com>:
Show 30 quoted lines
> On Thu, Aug 13, 2015 at 11:28 AM, Elia Pinto <gitter.spiros@gmail.com> wrote:
>> Teach git about a new option, "http.sslVersion", which permits one to
>> specify the SSL version  to use when negotiating SSL connections.  The
>> setting can be overridden by the GIT_SSL_VERSION environment
>> variable.
>>
>> Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
>> ---
>> This is the third version of the patch. The changes compared to the previous version are:
>
> Looks better. A few comments below...
>
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index c97c648..6e9359c 100644
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -364,9 +381,22 @@ static CURL *get_curl_handle(void)
>>         if (http_proactive_auth)
>>                 init_curl_http_auth(result);
>>
>> +       if (getenv("GIT_SSL_VERSION"))
>> +               ssl_version = getenv("GIT_SSL_VERSION");
>> +       if (ssl_version != NULL && *ssl_version) {
>> +               int i;
>> +               for ( i = 0; i < ARRAY_SIZE(sslversions); i++ ) {
>> +                       if (sslversions[i].name != NULL && *sslversions[i].name && !strcmp(ssl_version,sslversions[i].name)) {
>
> This sort of loop is normally either handled by indexing up to a limit
> (ARRAY_SIZE, in this case) or by iterating until hitting a sentinel
> (NULL, in this case). It is redundant to use both, as this code does.

I do not think. sslversions[i].name can be null, see how the structure is initialized. No ?

The other your observations written below are ok for me, but i will wait for your answer on this before you send another revision. Thank you very much.

Show 14 quoted lines
> The former (using ARRAY_SIZE) is typically employed when you know the
> number of items upfront, such as when the item list is local and
> compiled in; the latter (NULL sentinel) is typically used when
> receiving an item list as an argument to a function where you don't
> know the item count upfront (and the item count is not passed to the
> function as a separate argument).
>
> In this case, the item list is local and its size is known to the
> compiler, so that suggests using ARRAY_SIZE, and dropping the NULL
> sentinel.
>
> Style aside: This 'if' statement is very wide and likely should be
> wrapped over multiple lines (trying to keep the code within an
> 80-column limit).
ok.
Show 11 quoted lines
>
>> +                               curl_easy_setopt(result, CURLOPT_SSLVERSION,
>> +                                       sslversions[i].ssl_version);
>> +                               break;
>> +               }
>> +               if ( i == ARRAY_SIZE(sslversions) ) warning("unsupported ssl version %s: using default",
>> +                                                       ssl_version);
>
> Style:
> Drop spaces inside 'if' parentheses.
> Place warning() on its own line.
ok.
Show 11 quoted lines
>
>> +       }
>> +
>>         if (getenv("GIT_SSL_CIPHER_LIST"))
>>                 ssl_cipherlist = getenv("GIT_SSL_CIPHER_LIST");
>> -
>>         if (ssl_cipherlist != NULL && *ssl_cipherlist)
>>                 curl_easy_setopt(result, CURLOPT_SSL_CIPHER_LIST,
>>                                 ssl_cipherlist);
>> --
>> 2.5.0.234.gefc8a62.dirty
Previous: Eric SunshineNext: Eric Sunshine
Message 3 of 13 in “http: add support for specifying the SSL version”
  1. http: add support for specifying the SSL versionElia Pinto, Aug 13, 2015
  2. Eric SunshineAug 13, 2015
  3. Elia PintoAug 13, 2015
  4. Eric SunshineAug 13, 2015
  5. Elia PintoAug 13, 2015
  6. Eric SunshineAug 13, 2015
  7. Eric SunshineAug 13, 2015
  8. Torsten BögershausenAug 13, 2015
  9. Elia PintoAug 13, 2015
  10. Ilari LiusvaaraAug 13, 2015
  11. Elia PintoAug 13, 2015
  12. Junio C HamanoAug 14, 2015
  13. Elia PintoAug 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.