Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ruby/net-http
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.2
Choose a base ref
...
head repository: ruby/net-http
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on May 20, 2022

  1. res.response_body_permitted? is not defined

    `response_body_permitted?` is a method of request.
    znz authored and hsbt committed May 20, 2022
    Copy the full SHA
    9b91f08 View commit details
  2. Make the recommended name formal

    `HTTPServerException` is the name deprecated since years ago.
    nobu committed May 20, 2022
    Copy the full SHA
    b3028fe View commit details
  3. Merge pull request #60 from nobu/rename-HTTPClientException

    Make the recommended name formal
    nobu authored May 20, 2022
    Copy the full SHA
    1aaeb77 View commit details

Commits on May 23, 2022

  1. [DOC] Get rid of a RDoc bug

    RDoc overrides class name by the assigned name unexpectedly when
    assigned using a qualified class path.
    nobu committed May 23, 2022
    Copy the full SHA
    a7bded0 View commit details
  2. Merge pull request #61 from nobu/undoc-internals

    [DOC] Get rid of a RDoc bug
    nobu authored May 23, 2022
    Copy the full SHA
    17c911f View commit details

Commits on Jun 16, 2022

  1. Make Net::HTTPHeader#content_range return nil on non-byte units

    * Returning nil from the `content_range` method instead of raising an
      error when the unit in the content-range header is not "bytes".
    
    Fix https://bugs.ruby-lang.org/issues/11450
    
    Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
    shishir127 and nobu committed Jun 16, 2022
    Copy the full SHA
    0b5030d View commit details
  2. Merge pull request #63 from nobu/unknown-content-range-unit

    Make `Net::HTTPHeader#content_range` return nil on non-byte units
    nobu authored Jun 16, 2022
    Copy the full SHA
    196f3d7 View commit details

Commits on Jul 28, 2022

  1. fix a false-negative test

    * no_proxy is meant to operate on the destination address, not on the name of the proxy
    * if both end with `'.example'`, the test does not nail down the behaviour
    christian-van-rensen-tng committed Jul 28, 2022
    Copy the full SHA
    bb9a5cf View commit details
  2. Copy the full SHA
    f4951dc View commit details

Commits on Aug 24, 2022

  1. Remove ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE

    This list is out of date.  At least OpenBSD since 2013 does not
    allow one user to read the environment variables of a process
    run by another user.
    
    While we could try to keep the list updated, I think it's a bad
    idea to not use the user/password from the environment, even if
    another user on the system could read it.  If http_proxy exists
    in the environment, and other users can read it, it doesn't
    make it more secure for Ruby to ignore it.  You could argue that
    it encourages poor security practices, but net/http should provide
    mechanism, not policy.
    
    Fixes [Bug #18908]
    jeremyevans committed Aug 24, 2022
    Copy the full SHA
    1e45851 View commit details

Commits on Sep 22, 2022

  1. Net::HTTPResponse nil checking

    Fix nil handling in read_body and stream_check.
    
    Fixes: #70
    BrianHawley committed Sep 22, 2022
    Copy the full SHA
    36f916a View commit details

Commits on Sep 28, 2022

  1. Merge pull request #66 from jeremyevans/always-allow-env-18908

    Remove ENVIRONMENT_VARIABLE_IS_MULTIUSER_SAFE
    hsbt authored Sep 28, 2022
    Copy the full SHA
    3b8471d View commit details

Commits on Oct 13, 2022

  1. Raise ArgumentError with empty host url again.

      Fixup ruby/ruby@dd5118f
    
    ruby/ruby@1cda414
    
    Co-authored-by: Koichi Sasada <ko1@atdot.net>
    2 people authored and nobu committed Oct 13, 2022
    Copy the full SHA
    d03283d View commit details

Commits on Oct 21, 2022

  1. Revert "Replace Timeout.timeout in Net:HTTP#connect"

    This reverts commit 753cae3.
    hsbt committed Oct 21, 2022
    1
    Copy the full SHA
    98caa38 View commit details
  2. Merge pull request #74 from ruby/revert-10

    Revert "Replace Timeout.timeout in Net:HTTP#connect"
    hsbt authored Oct 21, 2022
    Copy the full SHA
    65aed40 View commit details

Commits on Oct 24, 2022

  1. Bump version to 0.3.0

    hsbt committed Oct 24, 2022
    Copy the full SHA
    9c752cc View commit details

Commits on Nov 9, 2022

  1. Copy the full SHA
    4a5732e View commit details

Commits on Nov 10, 2022

  1. Update lib/net/http.rb

    Co-authored-by: Peter Zhu <peter@peterzhu.ca>
    BurdetteLamar and peterzhu2118 authored Nov 10, 2022
    Copy the full SHA
    16d042f View commit details

Commits on Nov 11, 2022

  1. Merge pull request #76 from BurdetteLamar/http_doc

    [DOC] Prettify class hierarchies in Net::HTTP
    BurdetteLamar authored Nov 11, 2022
    Copy the full SHA
    f5d2887 View commit details

Commits on Nov 15, 2022

  1. Copy the full SHA
    6b30c53 View commit details

Commits on Nov 16, 2022

  1. Copy the full SHA
    4444e8c View commit details
  2. Update lib/net/http/request.rb

    Co-authored-by: Peter Zhu <peter@peterzhu.ca>
    BurdetteLamar and peterzhu2118 authored Nov 16, 2022
    Copy the full SHA
    e3c9011 View commit details

Commits on Nov 18, 2022

  1. Copy the full SHA
    53e3140 View commit details
  2. Copy the full SHA
    cee8adb View commit details
  3. Merge pull request #77 from BurdetteLamar/http_doc

        Revises most of class doc for Net::HTTP. (Does not modify sections "Following Redirection" and after.)
        Treats a few methods, including Net::HTTP.start.
        Adds to class docs for Net::HTTPRequest and Net::HTTPResponse.
    BurdetteLamar authored Nov 18, 2022
    Copy the full SHA
    a1b7031 View commit details
  4. Copy the full SHA
    0512b5b View commit details

Commits on Nov 19, 2022

  1. Merge pull request #78 from BurdetteLamar/http_doc

    [DOC] About the Examples moved to separate file
    BurdetteLamar authored Nov 19, 2022
    Copy the full SHA
    f70889c View commit details
  2. Copy the full SHA
    e924f12 View commit details

Commits on Nov 20, 2022

  1. Copy the full SHA
    995ff35 View commit details
  2. Copy the full SHA
    0af9fb9 View commit details

Commits on Nov 23, 2022

  1. Copy the full SHA
    ef0ef53 View commit details
  2. Copy the full SHA
    86b0514 View commit details
  3. Merge pull request #79 from BurdetteLamar/header_doc

    Expands class doc. Treats methods:
        #[]
        #[]=
        #add_field
        #get_fields
        #fetch
        #each_header
        #each_name
        #each_capitalized_name
    BurdetteLamar authored Nov 23, 2022
    Copy the full SHA
    5849e4e View commit details

Commits on Nov 26, 2022

  1. Fix test for Ruby head

    The error raised for broken coderanges was changed in ruby/ruby@571d21f
    and the test was fixed in that commit but not ported to this repo.
    peterzhu2118 committed Nov 26, 2022
    Copy the full SHA
    e6185dd View commit details
  2. Merge pull request #81 from ruby/pz-fix-3-2-test

    Fix test for Ruby head
    peterzhu2118 authored Nov 26, 2022
    Copy the full SHA
    9aa9f42 View commit details

Commits on Nov 27, 2022

  1. Copy the full SHA
    77c6878 View commit details

Commits on Nov 28, 2022

  1. Copy the full SHA
    a26f62a View commit details

Commits on Dec 1, 2022

  1. Copy the full SHA
    1ea5004 View commit details

Commits on Dec 4, 2022

  1. Copy the full SHA
    6600463 View commit details

Commits on Dec 5, 2022

  1. Bump version to 0.3.1

    hsbt committed Dec 5, 2022
    Copy the full SHA
    09a9ea1 View commit details

Commits on Dec 6, 2022

  1. [DOC] Fix call-seq for Net::HTTP.start

    The lack of a newline between the call-seq and the documentation was
    causing the documentation to be parsed as a call-seq.
    peterzhu2118 committed Dec 6, 2022
    Copy the full SHA
    1a212e2 View commit details

Commits on Dec 11, 2022

  1. Copy the full SHA
    9d9040f View commit details

Commits on Dec 12, 2022

  1. Copy the full SHA
    46e966b View commit details

Commits on Dec 14, 2022

  1. Copy the full SHA
    86b84eb View commit details
  2. Copy the full SHA
    d9d829c View commit details
  3. Copy the full SHA
    d394404 View commit details

Commits on Dec 15, 2022

  1. Copy the full SHA
    da626e4 View commit details
  2. Merge pull request #92 from BurdetteLamar/http_doc

    [DOC] Enhanced RDoc for Net::HTTP
    peterzhu2118 authored Dec 15, 2022
    Copy the full SHA
    553c8b9 View commit details

Commits on Dec 17, 2022

  1. Copy the full SHA
    6dfe6f4 View commit details

Commits on Dec 18, 2022

  1. Merge pull request #93 from BurdetteLamar/responses_doc

    [DOC] Adding links to references
    peterzhu2118 authored Dec 18, 2022
    Copy the full SHA
    f4ee096 View commit details
46 changes: 46 additions & 0 deletions .github/workflows/push_gem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish gem to rubygems.org

on:
push:
tags:
- 'v*'

permissions:
contents: read

jobs:
push:
if: github.repository == 'ruby/net-http'
runs-on: ubuntu-latest

environment:
name: rubygems.org
url: https://rubygems.org/gems/net-http

permissions:
contents: write
id-token: write

steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit

- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Set up Ruby
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
with:
bundler-cache: true
ruby-version: ruby

- name: Publish to RubyGems
uses: rubygems/release-gem@a25424ba2ba8b387abc8ef40807c2c85b96cbe32 # v1.1.1

- name: Create GitHub release
run: |
tag_name="$(git describe --tags --abbrev=0)"
gh release create "${tag_name}" --verify-tag --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 17 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
name: ubuntu
name: test

on: [push, pull_request]

jobs:
build:
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
with:
engine: cruby
min_version: 2.6

test:
needs: ruby-versions
name: test (${{ matrix.ruby }} / ${{ matrix.os }})
strategy:
matrix:
ruby: [ 3.1, '3.0', 2.7, 2.6, head ]
os: [ ubuntu-latest, macos-latest ]
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
@@ -20,3 +27,7 @@ jobs:
run: bundle install
- name: Run test
run: rake test
- name: Build
run: rake build
env:
LANG: C
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
/Gemfile.lock
6 changes: 3 additions & 3 deletions LICENSE.txt → BSDL
Original file line number Diff line number Diff line change
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56 changes: 56 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
You can redistribute it and/or modify it under either the terms of the
2-clause BSDL (see the file BSDL), or the conditions below:

1. You may make and give away verbatim copies of the source form of the
software without restriction, provided that you duplicate all of the
original copyright notices and associated disclaimers.

2. You may modify your copy of the software in any way, provided that
you do at least ONE of the following:

a. place your modifications in the Public Domain or otherwise
make them Freely Available, such as by posting said
modifications to Usenet or an equivalent medium, or by allowing
the author to include your modifications in the software.

b. use the modified software only within your corporation or
organization.

c. give non-standard binaries non-standard names, with
instructions on where to get the original software distribution.

d. make other distribution arrangements with the author.

3. You may distribute the software in object code or binary form,
provided that you do at least ONE of the following:

a. distribute the binaries and library files of the software,
together with instructions (in the manual page or equivalent)
on where to get the original distribution.

b. accompany the distribution with the machine-readable source of
the software.

c. give non-standard binaries non-standard names, with
instructions on where to get the original software distribution.

d. make other distribution arrangements with the author.

4. You may modify and include the part of the software into any other
software (possibly commercial). But some files in the distribution
are not written by the author, so that they are not under these terms.

For the list of those files and their copying conditions, see the
file LEGAL.

5. The scripts and library files supplied as input to or produced as
output from the software do not automatically fall under the
copyright of the software, but belong to whomever generated them,
and may be sold commercially, and may be aggregated with this
software.

6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -4,4 +4,5 @@ gemspec

gem "rake"
gem "test-unit"
gem "test-unit-ruby-core"
gem "webrick"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,8 @@

Net::HTTP provides a rich library which can be used to build HTTP
user-agents. For more details about HTTP see
[RFC2616](http://www.ietf.org/rfc/rfc2616.txt).
[RFC9110 HTTP Semantics](https://www.ietf.org/rfc/rfc9110.html) and
[RFC9112 HTTP/1.1](https://www.ietf.org/rfc/rfc9112.html).

Net::HTTP is designed to work closely with URI. URI::HTTP#host,
URI::HTTP#port and URI::HTTP#request_uri are designed to work with
7 changes: 0 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -7,11 +7,4 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList["test/**/test_*.rb"]
end

task :sync_tool do
require 'fileutils'
FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib"
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib"
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib"
end

task :default => :test
31 changes: 31 additions & 0 deletions doc/net-http/examples.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Examples here assume that <tt>net/http</tt> has been required
(which also requires +uri+):

require 'net/http'

Many code examples here use these example websites:

- https://jsonplaceholder.typicode.com.
- http://example.com.

Some examples also assume these variables:

uri = URI('https://jsonplaceholder.typicode.com/')
uri.freeze # Examples may not modify.
hostname = uri.hostname # => "jsonplaceholder.typicode.com"
path = uri.path # => "/"
port = uri.port # => 443

So that example requests may be written as:

Net::HTTP.get(uri)
Net::HTTP.get(hostname, '/index.html')
Net::HTTP.start(hostname) do |http|
http.get('/todos/1')
http.get('/todos/2')
end

An example that needs a modified URI first duplicates +uri+, then modifies the duplicate:

_uri = uri.dup
_uri.path = '/todos/1'
3 changes: 3 additions & 0 deletions doc/net-http/included_getters.rdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This class also includes (indirectly) module Net::HTTPHeader,
which gives access to its
{methods for getting headers}[rdoc-ref:Net::HTTPHeader@Getters].
Loading