[#29911] [Bug #3231] Digest Does Not Build — Charlie Savage <redmine@...>

Bug #3231: Digest Does Not Build

19 messages 2010/05/01

[#29920] [Feature #3232] Loops (while/until) should return last statement value if any, like if/unless — Benoit Daloze <redmine@...>

Feature #3232: Loops (while/until) should return last statement value if any, like if/unless

9 messages 2010/05/01

[#29997] years in Time.utc — Xavier Noria <fxn@...>

Does anyone have a precise statement about the years supported by

13 messages 2010/05/04

[#30010] [Bug #3248] extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly — Luis Lavena <redmine@...>

Bug #3248: extension 'tk' is finding tclConfig.sh and tkConfig.sh incorrectly

9 messages 2010/05/05

[#30226] [Bug #3288] Segmentation fault - activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:88 — Szymon Jeż <redmine@...>

Bug #3288: Segmentation fault - activesupport-3.0.0.beta3/lib/active_support/callbacks.rb:88

10 messages 2010/05/13

[#30358] tk doesn't startup well in doze — Roger Pack <rogerdpack2@...>

Currently with 1.9.x and tk 8.5,the following occurs

12 messages 2010/05/22

[ruby-core:30392] Supporting RFC 5789

From: Guilherme Silveira <guilherme.silveira@...>
Date: 2010-05-24 16:06:03 UTC
List: ruby-core #30392
I am sending a patch and Changelog file for trunk (should be the same
patch for 1.8) supporting the PATCH verb defined on the approved RFC
5789. Here is the link for such RFC:

http://tools.ietf.org/html/rfc5789

Patch should be used to partially update resources over the web using
a media type that gives enough information for such procedure.

The patch adds a new PATCH class, similar to POST. It also defines a
patch method to Net::HTTP instance. Finally, the code from post was
refactored out into a send_entity method, because patch and post
tunneling behavior are the same, with the only difference on which
http method being used.

Do I need to send something else?

Regards

Guilherme Silveira
Caelum | Ensino e Inova艫o
http://www.caelum.com.br/

Attachments (2)

ChangeLogPatch (516 Bytes, application/octet-stream)
ruby-patch-verb.patch (1.78 KB, text/x-diff)
Index: lib/net/http.rb
===================================================================
--- lib/net/http.rb	(revision 27994)
+++ lib/net/http.rb	(working copy)
@@ -966,17 +966,14 @@
     # "application/x-www-form-urlencoded" by default.
     #
     def post(path, data, initheader = nil, dest = nil, &block) # :yield: +body_segment+
-      res = nil
-      request(Post.new(path, initheader), data) {|r|
-        r.read_body dest, &block
-        res = r
-      }
-      unless @newimpl
-        res.value
-        return res, res.body
-      end
-      res
+      send_entity(path, data, initheader, dest, Post, &block)
     end
+    
+    # Sends a PATCH request to the +path+ and gets a response,
+    # as an HTTPResponse object.
+    def patch(path, data, initheader = nil, dest = nil, &block) # :yield: +body_segment+
+      send_entity(path, data, initheader, dest, Patch, &block)
+    end
 
     def put(path, data, initheader = nil)   #:nodoc:
       res = request(Put.new(path, initheader), data)
@@ -1176,6 +1173,21 @@
 
     private
 
+    # Executes a request which uses a representation
+    # and returns its body.
+    def send_entity(path, data, initheader, dest, type, &block)
+      res = nil
+      request(type.new(path, initheader), data) {|r|
+        r.read_body dest, &block
+        res = r
+      }
+      unless @newimpl
+        res.value
+        return res, res.body
+      end
+      res
+    end
+
     def transport_request(req)
       begin_transport req
       req.exec @socket, @curr_http_version, edit_path(req.path)
@@ -1832,6 +1844,16 @@
     end
 
     #
+    # PATCH method --- RFC5789
+    #
+
+    class Patch < HTTPRequest
+      METHOD = 'PATCH'
+      REQUEST_HAS_BODY = true
+      RESPONSE_HAS_BODY = true
+    end
+    
+    #
     # WebDAV methods --- RFC2518
     #
 

In This Thread

Prev Next