diff options
author | Erlang/OTP <[email protected]> | 2011-06-22 14:16:22 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2011-06-22 14:16:22 +0200 |
commit | 9cb4040e4aeed40a52f174a7c4d9106e38572605 (patch) | |
tree | b0d3caca47d76422becf4c1a2a82d687191e0b9c /lib/inets/src/http_client/httpc.erl | |
parent | 5eec30647ab41ad9a0c9911d2e4e300ecb501333 (diff) | |
parent | e2249b9878d396663a115628de16b1b1efde0afc (diff) | |
download | otp-9cb4040e4aeed40a52f174a7c4d9106e38572605.tar.gz otp-9cb4040e4aeed40a52f174a7c4d9106e38572605.tar.bz2 otp-9cb4040e4aeed40a52f174a7c4d9106e38572605.zip |
Merge branch 'bmk/inets/inets57_integration2' into maint-r14
* bmk/inets/inets57_integration2:
Fixed non-related test case (ticket_6035).
Corrected appup-file (missing ',').
Fixed ipv6 support detection.
(httpc) test case cleanups.
Uppdated appup-file.
Fixed IPv6 test case selection. That is if a IPv6 test case should be run or not.
Stopping httpc client...
Added test cases for httpd.
Clients started stand-alone not properly handled.
Clients started stand-alone not properly handled.
Temporary solution for profile_name stuff. What about Pids???
SSL with IPv6 now works "in principle".
[httpc] Remove unnecessary usage of iolist_to_binary when processing body (for PUT and POST). Filipe David Manana OTP-9317
Set proper version (5.7).
Set proper version (5.7).
Updated release notes.
Peer/sockname resolv doesn't work with IPv6 addrs in HTTP. OTP-9343
OTP-9342: FTP client doesn't work with IPv6 OTP-9342: IpFamily config option was not handled OTP-9342: Release notes remain... OTP-9342: <credit>attila rajmund nohl</credit>
Diffstat (limited to 'lib/inets/src/http_client/httpc.erl')
-rw-r--r-- | lib/inets/src/http_client/httpc.erl | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index 6ffa5e8ba5..fe8e93af1f 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -64,17 +64,16 @@ default_profile() -> profile_name(?DEFAULT_PROFILE) -> httpc_manager; +profile_name(Profile) when is_pid(Profile) -> + Profile; profile_name(Profile) -> - profile_name("httpc_manager_", Profile). + Prefix = lists:flatten(io_lib:format("~w_", [?MODULE])), + profile_name(Prefix, Profile). profile_name(Prefix, Profile) when is_atom(Profile) -> list_to_atom(Prefix ++ atom_to_list(Profile)); -profile_name(Prefix, Profile) when is_pid(Profile) -> - ProfileStr0 = - string:strip(string:strip(erlang:pid_to_list(Profile), left, $<), right, $>), - F = fun($.) -> $_; (X) -> X end, - ProfileStr = [F(C) || C <- ProfileStr0], - list_to_atom(Prefix ++ "pid_" ++ ProfileStr). +profile_name(_Prefix, Profile) when is_pid(Profile) -> + Profile. %%-------------------------------------------------------------------------- @@ -115,9 +114,11 @@ request(Url, Profile) -> %% {keyfile, path()} | {password, string()} | {cacertfile, path()} | %% {ciphers, string()} %% Options - [Option] -%% Option - {sync, Boolean} | {body_format, BodyFormat} | -%% {full_result, Boolean} | {stream, To} | -%% {headers_as_is, Boolean} +%% Option - {sync, Boolean} | +%% {body_format, BodyFormat} | +%% {full_result, Boolean} | +%% {stream, To} | +%% {headers_as_is, Boolean} %% StatusLine = {HTTPVersion, StatusCode, ReasonPhrase}</v> %% HTTPVersion = string() %% StatusCode = integer() @@ -518,17 +519,15 @@ mk_chunkify_fun(ProcessBody) -> eof -> {ok, <<"0\r\n\r\n">>, eof_body}; {ok, Data, NewAcc} -> - {ok, mk_chunk_bin(Data), NewAcc} + Chunk = [ + integer_to_list(iolist_size(Data), 16), + "\r\n", + Data, + "\r\n"], + {ok, Chunk, NewAcc} end end. -mk_chunk_bin(Data) -> - Bin = iolist_to_binary(Data), - iolist_to_binary([hex_size(Bin), "\r\n", Bin, "\r\n"]). - -hex_size(Bin) -> - hd(io_lib:format("~.16B", [size(Bin)])). - handle_answer(RequestId, false, _) -> {ok, RequestId}; @@ -552,9 +551,7 @@ return_answer(Options, {{"HTTP/0.9",_,_}, _, BinBody}) -> {ok, Body}; return_answer(Options, {StatusLine, Headers, BinBody}) -> - Body = maybe_format_body(BinBody, Options), - case proplists:get_value(full_result, Options, true) of true -> {ok, {StatusLine, Headers, Body}}; |