webmachine 0.3.0 → 0.4.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.
- data/Gemfile +12 -10
- data/Guardfile +1 -1
- data/README.md +1 -1
- data/examples/application.rb +35 -0
- data/lib/webmachine.rb +4 -3
- data/lib/webmachine/adapter.rb +36 -0
- data/lib/webmachine/adapters/mongrel.rb +18 -12
- data/lib/webmachine/adapters/rack.rb +26 -7
- data/lib/webmachine/adapters/webrick.rb +20 -16
- data/lib/webmachine/application.rb +108 -0
- data/lib/webmachine/chunked_body.rb +2 -2
- data/lib/webmachine/configuration.rb +24 -14
- data/lib/webmachine/decision/conneg.rb +9 -10
- data/lib/webmachine/decision/flow.rb +25 -28
- data/lib/webmachine/decision/fsm.rb +21 -22
- data/lib/webmachine/decision/helpers.rb +3 -3
- data/lib/webmachine/dispatcher.rb +18 -10
- data/lib/webmachine/dispatcher/route.rb +54 -17
- data/lib/webmachine/errors.rb +1 -1
- data/lib/webmachine/headers.rb +2 -2
- data/lib/webmachine/media_type.rb +2 -2
- data/lib/webmachine/request.rb +78 -3
- data/lib/webmachine/resource.rb +3 -2
- data/lib/webmachine/resource/authentication.rb +4 -3
- data/lib/webmachine/resource/callbacks.rb +4 -3
- data/lib/webmachine/resource/encodings.rb +4 -3
- data/lib/webmachine/response.rb +3 -2
- data/lib/webmachine/streaming.rb +4 -4
- data/lib/webmachine/version.rb +1 -1
- data/spec/webmachine/adapter_spec.rb +40 -0
- data/spec/webmachine/adapters/mongrel_spec.rb +22 -0
- data/spec/webmachine/adapters/rack_spec.rb +34 -8
- data/spec/webmachine/adapters/webrick_spec.rb +18 -0
- data/spec/webmachine/application_spec.rb +73 -0
- data/spec/webmachine/dispatcher/route_spec.rb +59 -2
- data/spec/webmachine/dispatcher_spec.rb +17 -5
- data/spec/webmachine/request_spec.rb +158 -1
- data/webmachine.gemspec +6 -27
- metadata +304 -112
- data/spec/tests.org +0 -80
data/spec/tests.org
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
* 2,2 Basic Rules
|
2
|
-
- HTTP/1.1 header field values can be folded onto multiple lines if
|
3
|
-
the continuation line begins with a space or horizontal tab. All
|
4
|
-
linear white space, including folding, has the same semantics as
|
5
|
-
SP. A recipient MAY replace any linear white space with a single
|
6
|
-
SP before interpreting the field value or forwarding the message
|
7
|
-
downstream.
|
8
|
-
- Many HTTP/1.1 header field values consist of words separated by
|
9
|
-
LWS or special characters. These special characters MUST be in a
|
10
|
-
quoted string to be used within a parameter value (as defined in
|
11
|
-
section 3.6).
|
12
|
-
* 3.1 HTTP Version
|
13
|
-
- Note that the major and minor numbers MUST be treated as separate
|
14
|
-
integers and that each MAY be incremented higher than a single
|
15
|
-
digit.
|
16
|
-
- Leading zeros MUST be ignored by recipients and MUST NOT be sent.
|
17
|
-
- An application that sends a request or response message that
|
18
|
-
includes HTTP-Version of "HTTP/1.1" MUST be at least conditionally
|
19
|
-
compliant with this specification.
|
20
|
-
- Applications that are at least conditionally compliant with this
|
21
|
-
specification SHOULD use an HTTP-Version of "HTTP/1.1" in their
|
22
|
-
messages, and MUST do so for any message that is not compatible
|
23
|
-
with HTTP/1.0.
|
24
|
-
- Since the protocol version indicates the protocol capability of
|
25
|
-
the sender, a proxy/gateway MUST NOT send a message with a version
|
26
|
-
indicator which is greater than its actual version. If a higher
|
27
|
-
version request is received, the proxy/gateway MUST either
|
28
|
-
downgrade the request version, or respond with an error, or switch
|
29
|
-
to tunnel behavior.
|
30
|
-
- Due to interoperability problems with HTTP/1.0 proxies discovered
|
31
|
-
since the publication of RFC 2068 [33], caching proxies MUST,
|
32
|
-
gateways MAY, and tunnels MUST NOT upgrade the request to the
|
33
|
-
highest version they support. The proxy/gateway's response to that
|
34
|
-
request MUST be in the same major version as the request.
|
35
|
-
* 3.2 URIs
|
36
|
-
** General Syntax
|
37
|
-
- Servers MUST be able to handle the URI of any resource they serve.
|
38
|
-
- Servers SHOULD be able to handle URIs of unbounded length if they
|
39
|
-
provide GET-based forms that could generate such URIs.
|
40
|
-
- A server SHOULD return 414 (Request-URI Too Long) status if a URI
|
41
|
-
is longer than the server can handle
|
42
|
-
** http URL
|
43
|
-
- If the abs_path is not present in the URL, it MUST be given as
|
44
|
-
"/" when used as a Request-URI for a resource.
|
45
|
-
- If a proxy receives a fully qualified domain name, the proxy MUST
|
46
|
-
NOT change the host name.
|
47
|
-
** URI Comparison
|
48
|
-
- When comparing two URIs to decide if they match or not, a client
|
49
|
-
SHOULD use a case-sensitive octet-by-octet comparison of the
|
50
|
-
entire URIs, with these exceptions:
|
51
|
-
- A port that is empty or not given is equivalent to the default
|
52
|
-
port for that URI-reference
|
53
|
-
- Comparisons of host names MUST be case-insensitive
|
54
|
-
- Comparisons of scheme names MUST be case-insensitive
|
55
|
-
- An empty abs_path is equivalent to an abs_path of "/"
|
56
|
-
* 3.3 Date/Time Formats
|
57
|
-
** 3.3.1 Full Date
|
58
|
-
Formats: (RFC 822/1123, RFC850/1036, asctime())
|
59
|
-
|
60
|
-
- HTTP/1.1 clients and servers that parse the date value MUST
|
61
|
-
accept all three formats (for compatibility with HTTP/1.0),
|
62
|
-
though they MUST only generate the RFC 1123 format for
|
63
|
-
representing HTTP-date values in header fields.
|
64
|
-
- All HTTP date/time stamps MUST be represented in GMT (UTC),
|
65
|
-
without exception... This is indicated in the first two formats by
|
66
|
-
the inclusion of "GMT" as the three-letter abbreviation for time
|
67
|
-
zone, and MUST be assumed when reading the asctime format.
|
68
|
-
- HTTP-date is case sensitive and MUST NOT include additional LWS
|
69
|
-
beyond that specifically included as SP in the grammar.
|
70
|
-
* 3.4 Character Sets
|
71
|
-
- HTTP uses the same definition of the term “character set” as that
|
72
|
-
described for MIME.
|
73
|
-
- Character set tokens are defined by the IANA Character Set registry.
|
74
|
-
- ...any token that has a predefined value within the IANA Character
|
75
|
-
Set registry MUST represent the character set defined by that
|
76
|
-
registry.
|
77
|
-
- Applications SHOULD limit their use of character sets to those
|
78
|
-
defined by the IANA registry.
|
79
|
-
** 3.4.1 Missing Charset
|
80
|
-
-
|