protocol-http1 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of protocol-http1 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/protocol/http1/connection.rb +2 -1
- data/lib/protocol/http1/reason.rb +97 -0
- data/lib/protocol/http1/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f944a898dfe09f16d8a2fc6ea2272ce989ea740a13b14d4ecd3b760435dd842c
         | 
| 4 | 
            +
              data.tar.gz: fae9e2c5a83cfb5c7ea24f6e29031a4876ca03f1e7153000649a2d10bbc4c804
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8ee87a749c191cf0edb310b086d1ee8aa5edb84e2aa706dba825d87e3a53a03fe7b26ec28b7906c6fd4c1e8568b14e0a3b281ad8da679a750e1f2ae50940c016
         | 
| 7 | 
            +
              data.tar.gz: ce9765e03174a8b7d8fc136a4b9ff5523aca8780335ffedd227ef0d5f528d4cd62065f82a3340103239e741639360e2d2a6e08b133e5712eaa747bf2e195aab3
         | 
| @@ -20,6 +20,7 @@ | |
| 20 20 |  | 
| 21 21 | 
             
            require 'protocol/http/headers'
         | 
| 22 22 |  | 
| 23 | 
            +
            require_relative 'reason'
         | 
| 23 24 | 
             
            require_relative 'error'
         | 
| 24 25 |  | 
| 25 26 | 
             
            require_relative 'body/chunked'
         | 
| @@ -120,7 +121,7 @@ module Protocol | |
| 120 121 | 
             
            				write_headers(headers)
         | 
| 121 122 | 
             
            			end
         | 
| 122 123 |  | 
| 123 | 
            -
            			def write_response(version, status, headers, reason =  | 
| 124 | 
            +
            			def write_response(version, status, headers, reason = Reason::DESCRIPTIONS[status])
         | 
| 124 125 | 
             
            				# Safari WebSockets break if no reason is given.
         | 
| 125 126 | 
             
            				@stream.write("#{version} #{status} #{reason}\r\n")
         | 
| 126 127 |  | 
| @@ -0,0 +1,97 @@ | |
| 1 | 
            +
            # Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
         | 
| 2 | 
            +
            # 
         | 
| 3 | 
            +
            # Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 4 | 
            +
            # of this software and associated documentation files (the "Software"), to deal
         | 
| 5 | 
            +
            # in the Software without restriction, including without limitation the rights
         | 
| 6 | 
            +
            # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 7 | 
            +
            # copies of the Software, and to permit persons to whom the Software is
         | 
| 8 | 
            +
            # furnished to do so, subject to the following conditions:
         | 
| 9 | 
            +
            # 
         | 
| 10 | 
            +
            # The above copyright notice and this permission notice shall be included in
         | 
| 11 | 
            +
            # all copies or substantial portions of the Software.
         | 
| 12 | 
            +
            # 
         | 
| 13 | 
            +
            # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 14 | 
            +
            # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 15 | 
            +
            # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 16 | 
            +
            # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 17 | 
            +
            # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 18 | 
            +
            # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 19 | 
            +
            # THE SOFTWARE.
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            require 'protocol/http/error'
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            module Protocol
         | 
| 24 | 
            +
            	module HTTP1
         | 
| 25 | 
            +
            		module Reason
         | 
| 26 | 
            +
            			DESCRIPTIONS = {
         | 
| 27 | 
            +
            				100 => "Continue",
         | 
| 28 | 
            +
            				101 => "Switching Protocols",
         | 
| 29 | 
            +
            				102 => "Processing",
         | 
| 30 | 
            +
            				103 => "Early Hints",
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            				200 => "OK",
         | 
| 33 | 
            +
            				201 => "Created",
         | 
| 34 | 
            +
            				202 => "Accepted",
         | 
| 35 | 
            +
            				203 => "Non-Authoritative Information",
         | 
| 36 | 
            +
            				204 => "No Content",
         | 
| 37 | 
            +
            				205 => "Reset Content",
         | 
| 38 | 
            +
            				206 => "Partial Content",
         | 
| 39 | 
            +
            				207 => "Multi-Status",
         | 
| 40 | 
            +
            				208 => "Already Reported",
         | 
| 41 | 
            +
            				226 => "IM Used",
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            				300 => "Multiple Choices",
         | 
| 44 | 
            +
            				301 => "Moved Permanently",
         | 
| 45 | 
            +
            				302 => "Found",
         | 
| 46 | 
            +
            				303 => "See Other",
         | 
| 47 | 
            +
            				304 => "Not Modified",
         | 
| 48 | 
            +
            				305 => "Use Proxy",
         | 
| 49 | 
            +
            				
         | 
| 50 | 
            +
            				# no longer used, but included for completeness
         | 
| 51 | 
            +
            				306 => "Switch Proxy",
         | 
| 52 | 
            +
            				307 => "Temporary Redirect",
         | 
| 53 | 
            +
            				308 => "Permanent Redirect",
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            				400 => "Bad Request",
         | 
| 56 | 
            +
            				401 => "Unauthorized",
         | 
| 57 | 
            +
            				402 => "Payment Required",
         | 
| 58 | 
            +
            				403 => "Forbidden",
         | 
| 59 | 
            +
            				404 => "Not Found",
         | 
| 60 | 
            +
            				405 => "Method Not Allowed",
         | 
| 61 | 
            +
            				406 => "Not Acceptable",
         | 
| 62 | 
            +
            				407 => "Proxy Authentication Required",
         | 
| 63 | 
            +
            				408 => "Request Timeout",
         | 
| 64 | 
            +
            				409 => "Conflict",
         | 
| 65 | 
            +
            				410 => "Gone",
         | 
| 66 | 
            +
            				411 => "Length Required",
         | 
| 67 | 
            +
            				412 => "Precondition Failed",
         | 
| 68 | 
            +
            				413 => "Payload Too Large",
         | 
| 69 | 
            +
            				414 => "URI Too Long",
         | 
| 70 | 
            +
            				415 => "Unsupported Media Type",
         | 
| 71 | 
            +
            				416 => "Range Not Satisfiable",
         | 
| 72 | 
            +
            				417 => "Expectation Failed",
         | 
| 73 | 
            +
            				421 => "Misdirected Request",
         | 
| 74 | 
            +
            				422 => "Unprocessable Entity",
         | 
| 75 | 
            +
            				423 => "Locked",
         | 
| 76 | 
            +
            				424 => "Failed Dependency",
         | 
| 77 | 
            +
            				426 => "Upgrade Required",
         | 
| 78 | 
            +
            				428 => "Precondition Required",
         | 
| 79 | 
            +
            				429 => "Too Many Requests",
         | 
| 80 | 
            +
            				431 => "Request Header Fields Too Large",
         | 
| 81 | 
            +
            				451 => "Unavailable for Legal Reasons",
         | 
| 82 | 
            +
             | 
| 83 | 
            +
            				500 => "Internal Server Error",
         | 
| 84 | 
            +
            				501 => "Not Implemented",
         | 
| 85 | 
            +
            				502 => "Bad Gateway",
         | 
| 86 | 
            +
            				503 => "Service Unavailable",
         | 
| 87 | 
            +
            				504 => "Gateway Timeout",
         | 
| 88 | 
            +
            				505 => "HTTP Version Not Supported",
         | 
| 89 | 
            +
            				506 => "Variant Also Negotiates",
         | 
| 90 | 
            +
            				507 => "Insufficient Storage",
         | 
| 91 | 
            +
            				508 => "Loop Detected",
         | 
| 92 | 
            +
            				510 => "Not Extended",
         | 
| 93 | 
            +
            				511 => "Network Authentication Required"
         | 
| 94 | 
            +
            			}.freeze
         | 
| 95 | 
            +
            		end
         | 
| 96 | 
            +
            	end
         | 
| 97 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: protocol-http1
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.8.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Samuel Williams
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2019- | 
| 11 | 
            +
            date: 2019-06-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: protocol-http
         | 
| @@ -101,6 +101,7 @@ files: | |
| 101 101 | 
             
            - lib/protocol/http1/body/remainder.rb
         | 
| 102 102 | 
             
            - lib/protocol/http1/connection.rb
         | 
| 103 103 | 
             
            - lib/protocol/http1/error.rb
         | 
| 104 | 
            +
            - lib/protocol/http1/reason.rb
         | 
| 104 105 | 
             
            - lib/protocol/http1/version.rb
         | 
| 105 106 | 
             
            - protocol-http1.gemspec
         | 
| 106 107 | 
             
            homepage: https://github.com/socketry/protocol-http1
         |