summaryrefslogtreecommitdiff
path: root/lib/chef/http.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove copyright dateslcg/remove-copyright-datesLamont Granquist2020-04-131-1/+1
| | | | | | | | Legally incredibly dubious, particularly since we don't follow it strictly as policy, and we have git history instead, which does it right. This is just a waste of time and a cargo cult. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Add chef-utils gem with various recipe DSL helpersLamont Granquist2019-11-081-1/+1
| | | | | | | | | | | | | This is the implementation of [RFC-087](https://github.com/chef-boneyard/chef-rfc/blob/master/rfc087-distro-sugar-helpers.md) although some of the specifics have been iterated on and changed. The documentation will be in the [README.md](https://github.com/chef/chef/tree/master/chef-utils/README.md) once this is merged. While this PR mostly moves chef-sugar utilities into core-chef via this chef-utils gem, the scope of the chef-utils gem should be considered larger than just that. As an example this PR moves the Mash class into this gem for reuse in ohai as well. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolProcLamont Granquist2019-07-051-1/+1
| | | | | | enforce pretzels. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/ClassCheckLamont Granquist2019-07-051-15/+15
| | | | | | convert kind_of? to is_a? Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/RegexpLiteralLamont Granquist2019-07-051-1/+1
| | | | | | | given how many regexps we have with /'s in the match this seems like a very good one. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Style/SymbolArrayLamont Granquist2019-07-021-1/+1
| | | | | | start enforcing using %i{} instead of arrays of symbols Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Layout/EmptyLineAfterGuardClauseLamont Granquist2019-07-021-0/+5
| | | | | | | i like this one, gives visual priority to returns or raises that are buried in the middle of things. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* This hits the ones that are most frequently required.lcg/require-idempotencyLamont Granquist2019-05-201-2/+2
| | | | | | | | | Stops the kernel from scanning through all the activated gems every time in order to resolve names into pathnames. See rubygems/rubygems#2762 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Convert require to require_relativeLamont Granquist2019-05-081-6/+6
| | | | | | | This gives a speed boost since rubygems does not have to scan through every gem in the gemset in order to find the file. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* change HTTPServerException to HTTPClientException for ruby 2.6Lamont Granquist2019-01-031-3/+3
| | | | | | includes backcompat for 2.5 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Fix a yard syntax errorTim Smith2018-08-231-1/+1
| | | | Signed-off-by: Tim Smith <tsmith@chef.io>
* Merge pull request #7006 from bugok/http_auth_header2Lamont Granquist2018-04-021-1/+13
|\ | | | | Stripping Authorization header upon redirects (second try)
| * Stripping 'Authorization' header upon redirects (second try)Noam Lerner2018-03-211-1/+13
| | | | | | | | Signed-off-by: Noam Lerner <noamler@fb.com>
* | mechanical conversion of most debug log statements to traceThom May2018-03-261-9/+9
|/ | | | Signed-off-by: Thom May <thom@chef.io>
* Revert "Stripping out Authorization header on redirect to a different host"Tim Smith2018-03-161-3/+1
| | | | This reverts commit 08b31872bf4094bbef474cae6de6c90fb4245a99.
* Stripping out Authorization header on redirect to a different hostNoam Lerner2018-03-141-1/+3
| | | | Signed-off-by: Noam Lerner <noamler@fb.com>
* speed up http func testslcg/speed-up-http-func-testsLamont Granquist2018-01-231-1/+1
| | | | | | | | | | For the truncated downloads the tiny server needs to hit its RequestTimeout in order to terminate the truncated request, so that is set to 1 second. Then also drop down the retries and the rest_timeout on the client side (but keep the rest_timeout to 2 to keep it above the tiny_server timeout) Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* allow injecting tempfiles into Chef::HTTPlcg/chef-http-inject-tempfileLamont Granquist2017-12-191-10/+10
| | | | | | | | | use this to inject the tempfile from Chef::FileContentManagement::Tempfile closes #2401 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* remove retry delays on protocol negotiationlcg/versioned-postsLamont Granquist2017-07-201-3/+0
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix retries on JSON POST requests when negotiating protocol versionLamont Granquist2017-07-201-7/+9
| | | | | | | | | | | | | | | | | | | | | | on the first pass through the JSON middleware it encodes the body. if there's a retry, it re-encodes the body as a string with all its metacharacters escaped. this is a particular issue when doing a first request that is a POST that requires negotiating the API version. when doing a GET it isn't a problem because there's no body payload -- but a POST or a PUT which requires a retry will get garbled and will cause a 500. this happens on hosted right now if trying to POST with a v2 API since hosted is only v1, so there's a retry to downgrade. i also made the same kind of changes to the streaming download requests, but since they're GETs its unclear to me if there was any impact there -- but middleware could have been double-mangling headers on a retry. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Retry API requests if using an unsupported versiontm/retryable_apiThom May2017-03-291-0/+39
| | | | Signed-off-by: Thom May <thom@chef.io>
* Fix a few bad copyrightsTim Smith2016-10-201-1/+1
| | | | | | I think this happened when we merged the Opscode and Chef copyrights Signed-off-by: Tim Smith <tsmith@chef.io>
* Rebuild HTTP headers on each retried requestShane da Silva2016-10-151-3/+2
| | | | | | | | | | | | | | Depending on how you configure your Chef client, it's possible that a later retry would have an authentication timestamp header (`X-OPS-TIMESTAMP`) that was more than 900 seconds old. Since the Chef server treats timestamps older than this threshold as unauthorized requests, you would potentially get seemingly spurious "401 Unauthorized" responses from the server. A solution is to generate the headers on each retry so that we have a new authentication timestamp for each retried request. Signed-off-by: Shane da Silva <shane@dasilva.io>
* rearrange private/public add @api privateLamont Granquist2016-08-181-11/+25
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* add an @api private commentLamont Granquist2016-08-181-0/+1
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* stray Lint/UselessAccessModifierlcg/more-more-copsLamont Granquist2016-08-171-2/+0
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fix Style/BlockDelimiters, Style/MultilineBlockLayout and 0.42.0 engine upgradeLamont Granquist2016-08-171-2/+0
| | | | Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* Update to latest chefstyleJohn Keiser2016-08-171-2/+0
|
* test Chef::HTTP and tweak cacheLamont Granquist2016-08-111-2/+6
| | | | | | this is mildly awful, but works around the String-vs-URI crap Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* cache correctlyLamont Granquist2016-08-091-3/+2
|
* make keepalives entirely optionalLamont Granquist2016-08-091-21/+32
| | | | turn on only for the cookbook synchronizer
* per-host/port cache of BasicClientLamont Granquist2016-08-091-1/+5
|
* memoize the BasicClientLamont Granquist2016-08-091-13/+16
|
* Remove deprecated Thread.exclusive around require call.Marin Jankovski2016-06-291-5/+5
|
* Merge pull request #4658 from chef/tm/remote_file_download_progress11.9Thom May2016-03-151-1/+31
|\ | | | | Remote file download progress
| * Enable progress output to be configuredtm/remote_file_download_progressThom May2016-03-041-6/+2
| | | | | | | | Add tests around progress output and tidy up
| * Merge branch 'remote-file-download-progress' of ↵Thom May2016-03-031-1/+35
| |\ | | | | | | | | | https://github.com/brandocorp/chef into tm/remote_file_download_progress
| | * fix broken specsBrandon Raabe2015-03-211-1/+1
| | |
| | * new doc formatter event, remove progress barBrandon Raabe2015-03-201-77/+32
| | |
| | * pass resource as an option to allow access to resource eventsBrandon Raabe2015-03-181-8/+20
| | |
| | * add progress interval, add ProgressBar classBrandon Raabe2015-03-151-2/+64
| | |
| | * read content length from the response and use to show overall statusBrandon Raabe2015-03-151-1/+4
| | |
* | | chefstyle Style/AndOr fixesLamont Granquist2016-03-141-1/+1
| | | | | | | | | | | | | | | this is part of our informal style guide, lets make it formal since clearly its not getting followed very well.
* | | add some @yield docsLamont Granquist2016-03-041-0/+3
| | | | | | | | | | | | added some FIXMEs because trying to sort out types for random undocumented code was making me completely aggro
* | | remove unused block argumentslcg/chefstyle-perfLamont Granquist2016-02-231-1/+1
|/ /
* | Make sure that we have a valid object before calling close!drag00n2016-02-161-1/+1
| | | | | | | | | | | | This fixes [#2171](https://github.com/opscode/chef/issues/2171) when a tempfile cannot be created or proper filesystem permissions do not exist. This allows the proper exception to be thrown.
* | pull rubocop 0.37.2 into chefstyleLamont Granquist2016-02-121-1/+1
| | | | | | | | | | this is from the same ruleset that we had, but the new code catches more conditions.
* | autofixing whitespace copsLamont Granquist2016-02-051-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4174 Style/SpaceInsideHashLiteralBraces 1860 Style/SpaceAroundOperators 1336 Style/SpaceInsideBlockBraces 1292 Style/AlignHash 997 Style/SpaceAfterComma 860 Style/SpaceAroundEqualsInParameterDefault 310 Style/EmptyLines 294 Style/IndentationConsistency 267 Style/TrailingWhitespace 238 Style/ExtraSpacing 212 Style/SpaceBeforeBlockBraces 166 Style/MultilineOperationIndentation 144 Style/TrailingBlankLines 120 Style/EmptyLineBetweenDefs 101 Style/IndentationWidth 82 Style/SpaceAroundBlockParameters 40 Style/EmptyLinesAroundMethodBody 29 Style/EmptyLinesAroundAccessModifier 1 Style/RescueEnsureAlignment
* | Update all auth email address from opscode.com and getchef.com to chef.io.Noah Kantrowitz2016-02-021-5/+5
| | | | | | Generated via git ls-files | xargs perl -pi -e "s/(Author.*?<[^@]+@)(?:opscode\\.com|getchef\\.com)(>)/\\1chef.io\\2/gi"
* | Copyright year update for 2016 and massive cleanup.Noah Kantrowitz2016-02-021-1/+1
| | | | | | Generated via git ls-files | xargs perl -pi -e "s/[Cc]opyright (?:\([Cc]\) )?((?\!$(date +%Y))\\d{4})(-\\d{4})?([, ][ \d]+)*(,|(?= ))/Copyright \\1-$(date +%Y),/g"