aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMicael Karlberg <bmk@erlang.org>2012-01-13 13:52:03 +0100
committerMicael Karlberg <bmk@erlang.org>2012-01-13 13:52:03 +0100
commit4f9b2b2b2917ffca17be3a897674ffe76011237f (patch)
treea483aa129cea271102bc80b1ce58a943260a0d74 /lib
parentb1d6a39529229a98ce57f2121cbe080702e82adc (diff)
parentaaf8fc6097d612f688ca6bc2374669e4f4a08a4d (diff)
downloadotp-4f9b2b2b2917ffca17be3a897674ffe76011237f.tar.gz
otp-4f9b2b2b2917ffca17be3a897674ffe76011237f.tar.bz2
otp-4f9b2b2b2917ffca17be3a897674ffe76011237f.zip
Merge branch 'bmk/inets/httpc/streaming_404/r14/OTP-9860' into bmk/inets/inets573_integration
Conflicts: lib/inets/doc/src/notes.xml lib/inets/src/inets_app/inets.appup.src
Diffstat (limited to 'lib')
-rw-r--r--lib/inets/doc/src/notes.xml8
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl15
-rw-r--r--lib/inets/src/inets_app/inets.appup.src25
-rw-r--r--lib/inets/vsn.mk2
4 files changed, 26 insertions, 24 deletions
diff --git a/lib/inets/doc/src/notes.xml b/lib/inets/doc/src/notes.xml
index 34f93586e1..487b9c6c00 100644
--- a/lib/inets/doc/src/notes.xml
+++ b/lib/inets/doc/src/notes.xml
@@ -69,6 +69,14 @@
<p>Own Id: OTP-9847</p>
</item>
+ <item>
+ <p>[httpc] The client incorrectly streams 404 responses.
+ The documentation specifies that only 200 and 206 responses
+ shall be streamed. </p>
+ <p>Shane Evens</p>
+ <p>Own Id: OTP-9860</p>
+ </item>
+
</list>
</section>
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 4ae2275f70..7784060a2b 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -157,12 +157,12 @@ info(Pid) ->
%% memory in vain.)
%%--------------------------------------------------------------------
%% Request should not be streamed
-stream(BodyPart, Request = #request{stream = none}, _) ->
+stream(BodyPart, #request{stream = none} = Request, _) ->
?hcrt("stream - none", []),
{BodyPart, Request};
%% Stream to caller
-stream(BodyPart, Request = #request{stream = Self}, Code)
+stream(BodyPart, #request{stream = Self} = Request, Code)
when ((Code =:= 200) orelse (Code =:= 206)) andalso
((Self =:= self) orelse (Self =:= {self, once})) ->
?hcrt("stream - self", [{stream, Self}, {code, Code}]),
@@ -170,17 +170,10 @@ stream(BodyPart, Request = #request{stream = Self}, Code)
{Request#request.id, stream, BodyPart}),
{<<>>, Request};
-stream(BodyPart, Request = #request{stream = Self}, 404)
- when (Self =:= self) orelse (Self =:= {self, once}) ->
- ?hcrt("stream - self with 404", [{stream, Self}]),
- httpc_response:send(Request#request.from,
- {Request#request.id, stream, BodyPart}),
- {<<>>, Request};
-
%% Stream to file
%% This has been moved to start_stream/3
%% We keep this for backward compatibillity...
-stream(BodyPart, Request = #request{stream = Filename}, Code)
+stream(BodyPart, #request{stream = Filename} = Request, Code)
when ((Code =:= 200) orelse (Code =:= 206)) andalso is_list(Filename) ->
?hcrt("stream - filename", [{stream, Filename}, {code, Code}]),
case file:open(Filename, [write, raw, append, delayed_write]) of
@@ -192,7 +185,7 @@ stream(BodyPart, Request = #request{stream = Filename}, Code)
end;
%% Stream to file
-stream(BodyPart, Request = #request{stream = Fd}, Code)
+stream(BodyPart, #request{stream = Fd} = Request, Code)
when ((Code =:= 200) orelse (Code =:= 206)) ->
?hcrt("stream to file", [{stream, Fd}, {code, Code}]),
case file:write(Fd, BodyPart) of
diff --git a/lib/inets/src/inets_app/inets.appup.src b/lib/inets/src/inets_app/inets.appup.src
index f3228b9e82..84217eac78 100644
--- a/lib/inets/src/inets_app/inets.appup.src
+++ b/lib/inets/src/inets_app/inets.appup.src
@@ -21,9 +21,9 @@
{"5.7.2",
[
{load_module, ftp, soft_purge, soft_purge, []},
- {update, httpc_handler, {advanced, upgrade_from_pre_4_7_3},
+ {update, httpc_handler, {advanced, upgrade_from_pre_5_7_3},
soft_purge, soft_purge, []},
- {update, httpc_manager, {advanced, upgrade_from_pre_4_7_3},
+ {update, httpc_manager, {advanced, upgrade_from_pre_5_7_3},
soft_purge, soft_purge, [httpc_handler]}
]
},
@@ -37,9 +37,9 @@
{load_module, httpd_request, soft_purge, soft_purge, []},
{load_module, mod_responsecontrol, soft_purge, soft_purge, []},
{load_module, httpd_response, soft_purge, soft_purge, [mod_responsecontrol]},
- {update, httpc_handler, {advanced, upgrade_from_pre_4_7_3},
+ {update, httpc_handler, {advanced, upgrade_from_pre_5_7_3},
soft_purge, soft_purge, []},
- {update, httpc_manager, {advanced, upgrade_from_pre_4_7_3},
+ {update, httpc_manager, {advanced, upgrade_from_pre_5_7_3},
soft_purge, soft_purge, [httpc_handler]}
]
},
@@ -54,19 +54,20 @@
{load_module, http_util, soft_purge, soft_purge, []},
{load_module, mod_responsecontrol, soft_purge, soft_purge, []},
{load_module, httpd_response, soft_purge, soft_purge, [mod_responsecontrol]},
- {update, httpc_handler, {advanced, upgrade_from_pre_4_7_3},
+ {update, httpc_handler, {advanced, upgrade_from_pre_5_7_3},
soft_purge, soft_purge, []},
- {update, httpc_manager, {advanced, upgrade_from_pre_4_7_3},
+ {update, httpc_manager, {advanced, upgrade_from_pre_5_7_3},
soft_purge, soft_purge, [httpc_handler]}
]
+ }
],
[
{"5.7.2",
[
{load_module, ftp, soft_purge, soft_purge, []},
- {update, httpc_handler, {advanced, downgrade_to_pre_4_7_3},
+ {update, httpc_handler, {advanced, downgrade_to_pre_5_7_3},
soft_purge, soft_purge, []},
- {update, httpc_manager, {advanced, downgrade_to_pre_4_7_3},
+ {update, httpc_manager, {advanced, downgrade_to_pre_5_7_3},
soft_purge, soft_purge, [httpc_handler]}
]
},
@@ -80,9 +81,9 @@
{load_module, httpd_request, soft_purge, soft_purge, []},
{load_module, mod_responsecontrol, soft_purge, soft_purge, []},
{load_module, httpd_response, soft_purge, soft_purge, [mod_responsecontrol]},
- {update, httpc_handler, {advanced, downgrade_to_pre_4_7_3},
+ {update, httpc_handler, {advanced, downgrade_to_pre_5_7_3},
soft_purge, soft_purge, []},
- {update, httpc_manager, {advanced, downgrade_to_pre_4_7_3},
+ {update, httpc_manager, {advanced, downgrade_to_pre_5_7_3},
soft_purge, soft_purge, [httpc_handler]}
]
},
@@ -97,9 +98,9 @@
{load_module, http_util, soft_purge, soft_purge, []},
{load_module, mod_responsecontrol, soft_purge, soft_purge, []},
{load_module, httpd_response, soft_purge, soft_purge, [mod_responsecontrol]},
- {update, httpc_handler, {advanced, downgrade_to_pre_4_7_3},
+ {update, httpc_handler, {advanced, downgrade_to_pre_5_7_3},
soft_purge, soft_purge, []},
- {update, httpc_manager, {advanced, downgrade_to_pre_4_7_3},
+ {update, httpc_manager, {advanced, downgrade_to_pre_5_7_3},
soft_purge, soft_purge, [httpc_handler]}
]
}
diff --git a/lib/inets/vsn.mk b/lib/inets/vsn.mk
index e34500b3ab..50c7915cb2 100644
--- a/lib/inets/vsn.mk
+++ b/lib/inets/vsn.mk
@@ -2,7 +2,7 @@
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2001-2011. All Rights Reserved.
+# Copyright Ericsson AB 2001-2012. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in