From 6675c44672a187f11af8d936e59642dee6a56028 Mon Sep 17 00:00:00 2001
From: chandrusf
Date: Wed, 21 Mar 2007 00:26:40 +0000
Subject: [PATCH] Patch provided by Eric Merritt to support WebDAV requests
---
README | 7 +++++--
src/ibrowse.erl | 4 ++--
src/ibrowse_http_client.erl | 23 +++++++++++++++--------
src/ibrowse_lib.erl | 10 ++++++++--
vsn.mk | 2 +-
5 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/README b/README
index 4129e02..6a441c0 100644
--- a/README
+++ b/README
@@ -1,8 +1,9 @@
-$Id: README,v 1.7 2007/01/26 10:02:59 chandrusf Exp $
+$Id: README,v 1.8 2007/03/21 00:26:40 chandrusf Exp $
ibrowse is a HTTP client. The following are a list of features.
- RFC2616 compliant (AFAIK)
- - supports GET, POST, OPTIONS, HEAD, PUT, DELETE, TRACE only
+ - supports GET, POST, OPTIONS, HEAD, PUT, DELETE, TRACE,
+ MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, MOVE and COPY
- Understands HTTP/0.9, HTTP/1.0 and HTTP/1.1
- Understands chunked encoding
- Can generate requests using Chunked Transfer-Encoding
@@ -21,6 +22,8 @@ Comments to : Chandrashekhar.Mullaparthi@t-mobile.co.uk
CONTRIBUTIONS & CHANGE HISTORY
==============================
+06-03-2007 - Eric Merritt sent a patch to support WebDAV requests.
+
12-01-2007 - Derek Upham sent in a bug fix. The reset_state function was not
behaving correctly when the transfer encoding was not chunked.
diff --git a/src/ibrowse.erl b/src/ibrowse.erl
index 196575d..231974c 100644
--- a/src/ibrowse.erl
+++ b/src/ibrowse.erl
@@ -58,7 +58,7 @@
%% driver isn't actually used.
-module(ibrowse).
--vsn('$Id: ibrowse.erl,v 1.2 2005/12/08 12:05:07 chandrusf Exp $ ').
+-vsn('$Id: ibrowse.erl,v 1.3 2007/03/21 00:26:41 chandrusf Exp $ ').
-behaviour(gen_server).
%%--------------------------------------------------------------------
@@ -157,7 +157,7 @@ set_dest(Host,Port,Opts) ->
%% headerList() = [{header(), value()}]
%% header() = atom() | string()
%% value() = term()
-%% method() = get | post | head | options | put | delete | trace
+%% method() = get | post | head | options | put | delete | trace | mkcol | propfind | proppatch | lock | unlock | move | copy
%% Status = string()
%% ResponseHeaders = [respHeader()]
%% respHeader() = {headerName(), headerValue()}
diff --git a/src/ibrowse_http_client.erl b/src/ibrowse_http_client.erl
index 7b35ac4..4495e61 100644
--- a/src/ibrowse_http_client.erl
+++ b/src/ibrowse_http_client.erl
@@ -6,7 +6,7 @@
%%% Created : 11 Oct 2003 by Chandrashekhar Mullaparthi
%%%-------------------------------------------------------------------
-module(ibrowse_http_client).
--vsn('$Id: ibrowse_http_client.erl,v 1.9 2007/01/26 10:02:59 chandrusf Exp $ ').
+-vsn('$Id: ibrowse_http_client.erl,v 1.10 2007/03/21 00:26:41 chandrusf Exp $ ').
-behaviour(gen_server).
%%--------------------------------------------------------------------
@@ -993,13 +993,20 @@ fmt_val(Term) -> io_lib:format("~p", [Term]).
crnl() -> "\r\n".
-method(get) -> "GET";
-method(post) -> "POST";
-method(head) -> "HEAD";
-method(options) -> "OPTIONS";
-method(put) -> "PUT";
-method(delete) -> "DELETE";
-method(trace) -> "TRACE".
+method(get) -> "GET";
+method(post) -> "POST";
+method(head) -> "HEAD";
+method(options) -> "OPTIONS";
+method(put) -> "PUT";
+method(delete) -> "DELETE";
+method(trace) -> "TRACE";
+method(mkcol) -> "MKCOL";
+method(propfind) -> "PROPFIND";
+method(proppatch) -> "PROPPATCH";
+method(lock) -> "LOCK";
+method(unlock) -> "UNLOCK";
+method(move) -> "MOVE";
+method(copy) -> "COPY".
%% From RFC 2616
%%
diff --git a/src/ibrowse_lib.erl b/src/ibrowse_lib.erl
index 344f780..8180b9f 100644
--- a/src/ibrowse_lib.erl
+++ b/src/ibrowse_lib.erl
@@ -5,7 +5,7 @@
%% @doc Module with a few useful functions
-module(ibrowse_lib).
--vsn('$Id: ibrowse_lib.erl,v 1.3 2005/12/08 12:05:07 chandrusf Exp $ ').
+-vsn('$Id: ibrowse_lib.erl,v 1.4 2007/03/21 00:26:41 chandrusf Exp $ ').
-author('chandru').
-ifdef(debug).
-compile(export_all).
@@ -98,6 +98,7 @@ month_int("Dec") -> 12.
%% StatusDescription = atom()
status_code(100) -> continue;
status_code(101) -> switching_protocols;
+status_code(102) -> processing;
status_code(200) -> ok;
status_code(201) -> created;
status_code(202) -> accepted;
@@ -105,6 +106,7 @@ status_code(203) -> non_authoritative_information;
status_code(204) -> no_content;
status_code(205) -> reset_content;
status_code(206) -> partial_content;
+status_code(207) -> multi_status;
status_code(300) -> multiple_choices;
status_code(301) -> moved_permanently;
status_code(302) -> found;
@@ -131,12 +133,16 @@ status_code(414) -> request_uri_too_long;
status_code(415) -> unsupported_media_type;
status_code(416) -> requested_range_not_satisfiable;
status_code(417) -> expectation_failed;
+status_code(422) -> unprocessable_entity;
+status_code(423) -> locked;
+status_code(424) -> failed_dependency;
status_code(500) -> internal_server_error;
status_code(501) -> not_implemented;
status_code(502) -> bad_gateway;
status_code(503) -> service_unavailable;
status_code(504) -> gateway_timeout;
status_code(505) -> http_version_not_supported;
+status_code(507) -> insufficient_storage;
status_code(X) when is_list(X) -> status_code(list_to_integer(X));
status_code(_) -> unknown_status_code.
@@ -146,6 +152,6 @@ status_code(_) -> unknown_status_code.
%% N = integer() - the number to represent as hex
dec2hex(M,N) -> dec2hex(M,N,[]).
-dec2hex(0,N,Ack) -> Ack;
+dec2hex(0,_N,Ack) -> Ack;
dec2hex(M,N,Ack) -> dec2hex(M-1,N bsr 4,[d2h(N band 15)|Ack]).
diff --git a/vsn.mk b/vsn.mk
index c39350e..30fd5d9 100644
--- a/vsn.mk
+++ b/vsn.mk
@@ -1,2 +1,2 @@
-IBROWSE_VSN = 1.2.4
+IBROWSE_VSN = 1.2.5