New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added check for existing cainfo config setting #213

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@jrowen

jrowen commented Mar 26, 2015

The current behavior on Windows is to set always reset cainfo to the default package file, regardless of whether the user has already specified a value for the parameter. This update adds a check to verify that cainfo has not already been set before setting to the default.

This is a re-submission of #199.

@hadley

This comment has been minimized.

Member

hadley commented May 4, 2015

Are you sure this is actually a problem? getOption("httr_config") comes after the default setting so it will override.

@jrowen

This comment has been minimized.

jrowen commented May 4, 2015

Prior to this change, I see the following output on my Windows machine.

> library(httr)
> reset_config()
> set_config(httr::config(cainfo="mycert.cer"))
> httr:::default_config()
Config: 
List of 8
 $ followlocation:TRUE
 $ maxredirs     :10
 $ encoding      :"gzip"
 $ useragent     :"curl/7.39.0 Rcurl/1.95.4.5 httr/0.6.1"
 $ writer        :List of 1
  ..$ buffer: NULL
  ..- attr(*, "class")="write_memory" "write_function"
 $ cainfo        :"C:/Users/jrowen/Documents/R/win-library/3.1/httr/cacert.pem"
 $ cainfo        :"mycert.cer"
 $ httpheader    :"application/json, text/xml, application/xml, */*"
  ..- attr(*, "names")="Accept"

The first cainfo option appears to be the one used. After applying this code update, as expected, I only see the second cainfo option.

@hadley

This comment has been minimized.

Member

hadley commented May 4, 2015

Hmmmmm, it does seem like the first option is used instead of the last:

GET("http://httpbin.org/user-agent", config(useragent = "a", useragent = "b"))

I'd rather fix that general problem than the specific cainfo prob.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment