##
#!/usr/bin/perl --
use strict; use warnings;
use LWP;
my $ua = LWP::UserAgent->new;
$ua->show_progress(1);
my $req = HTTP::Request->new(
#~ OPTIONS => 'http://www.example.com/*',
#~ OPTIONS => 'http://www.iana.org/domains/example/*',
#~ OPTIONS => 'http://www.example.net/*',
OPTIONS => 'http://www.example.de/*',
);
$req->dump;
my $res = $ua->request( $req );
$res->dump;
__END__
OPTIONS http://www.example.de/*
(no content)
** OPTIONS http://www.example.de/* ==> 200 OK (1s)
HTTP/1.1 200 OK
Connection: close
Date: Mon, 05 Nov 2012 10:37:18 GMT
Server: Apache
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 0
Content-Type: text/plain
Client-Date: Mon, 05 Nov 2012 10:40:35 GMT
Client-Peer: 82.165.91.73:80
Client-Response-Num: 1
(no content)
####
#!/usr/bin/perl --
use strict; use warnings;
use LWP;
my $ua = LWP::UserAgent->new;
$ua->show_progress(1);
my $patch = q{
diff -ruN old/frobnicate new/frobnicate
--- old/frobnicate 2012-11-05 02:43:25.453125000 -0800
+++ new/frobnicate 2012-11-05 02:43:32.625000000 -0800
@@ -1 +1 @@
-ECHO is on.
+ECHO is off.
};
use Digest::SHA();
my $etag = Digest::SHA::sha1_hex($patch);
my $req = HTTP::Request->new(
PATCH => 'http://www.example.de/frobnicate',
HTTP::Headers->new(
'If-Match' => $etag,
Content_Type => 'application/example',
),
$patch,
);
$req->dump;
my $res = $ua->request( $req );
$res->dump;
__END__
PATCH http://www.example.de/frobnicate
If-Match: 3c7bd449ea9d806dd66f2da3f6535b020d9e0dd0
Content-Type: application/example
diff -ruN old/frobnicate new/frobnicate
--- old/frobnicate 2012-11-05 02:43:25.453125000 -0800
+++ new/frobnicate 2012-11-05 02:43:32.625000000 -0800
@@ -1 +1 @@
-ECHO is on.
+ECHO is off.\n
** PATCH http://www.example.de/frobnicate ==> 405 Method Not Allowed (1s)
HTTP/1.1 405 Method Not Allowed
Connection: close
Date: Mon, 05 Nov 2012 10:49:02 GMT
Server: Apache
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 233
Content-Type: text/html; charset=iso-8859-1
Client-Date: Mon, 05 Nov 2012 10:52:18 GMT
Client-Peer: 82.165.91.73:80
Client-Response-Num: 1
Title: 405 Method Not Allowed
405 Method Not Allowed
Method Not Allowed
The requested method PATCH is not allowed for the URL /frobnicate.
\n