Skip to content

Instantly share code, notes, and snippets.

@qrilka
Last active August 29, 2015 14:00
Show Gist options
  • Save qrilka/11397619 to your computer and use it in GitHub Desktop.
Save qrilka/11397619 to your computer and use it in GitHub Desktop.
httpc and chunked
#!/usr/bin/env escript
main(_Args) ->
application:start(sasl),
inets:start(),
R = httpc:request(get, {"http://www.csm-testcenter.org/cgi-bin/eicar.com?transfer=chunked",
[]}, [], [{sync, false}, {receiver, self()},{stream,self}]),
loop().
loop() ->
receive
X ->
io:format("~n-------------------MSG:~n ~p~n-------------------~n", [X]),
loop()
after 1000 ->
io:format("TIMEOUT~n", [])
end.
$ ./httpc-test.escript
./httpc-test.escript:6: Warning: variable 'R' is unused
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.37.0>},
{name,alarm_handler},
{mfargs,{alarm_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,sasl_safe_sup}
started: [{pid,<0.38.0>},
{name,overload},
{mfargs,{overload,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.36.0>},
{name,sasl_safe_sup},
{mfargs,
{supervisor,start_link,
[{local,sasl_safe_sup},sasl,safe]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,sasl_sup}
started: [{pid,<0.39.0>},
{name,release_handler},
{mfargs,{release_handler,start_link,[]}},
{restart_type,permanent},
{shutdown,2000},
{child_type,worker}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
application: sasl
started_at: nonode@nohost
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,inets_sup}
started: [{pid,<0.45.0>},
{name,ftp_sup},
{mfargs,{ftp_sup,start_link,[]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,httpc_profile_sup}
started: [{pid,<0.48.0>},
{name,httpc_manager},
{mfargs,
{httpc_manager,start_link,
[default,only_session_cookies,inets]}},
{restart_type,permanent},
{shutdown,4000},
{child_type,worker}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,httpc_sup}
started: [{pid,<0.47.0>},
{name,httpc_profile_sup},
{mfargs,
{httpc_profile_sup,start_link,
[[{httpc,{default,only_session_cookies}}]]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,httpc_sup}
started: [{pid,<0.49.0>},
{name,httpc_handler_sup},
{mfargs,{httpc_handler_sup,start_link,[]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,inets_sup}
started: [{pid,<0.46.0>},
{name,httpc_sup},
{mfargs,
{httpc_sup,start_link,
[[{httpc,{default,only_session_cookies}}]]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,inets_sup}
started: [{pid,<0.50.0>},
{name,httpd_sup},
{mfargs,{httpd_sup,start_link,[[]]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,inets_sup}
started: [{pid,<0.51.0>},
{name,tftp_sup},
{mfargs,{tftp_sup,start_link,[[]]}},
{restart_type,permanent},
{shutdown,infinity},
{child_type,supervisor}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
application: inets
started_at: nonode@nohost
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,inet_gethost_native_sup}
started: [{pid,<0.54.0>},{mfa,{inet_gethost_native,init,[[]]}}]
=PROGRESS REPORT==== 29-Apr-2014::15:33:54 ===
supervisor: {local,kernel_safe_sup}
started: [{pid,<0.53.0>},
{name,inet_gethost_native_sup},
{mfargs,{inet_gethost_native,start_link,[]}},
{restart_type,temporary},
{shutdown,1000},
{child_type,worker}]
-------------------MSG:
{http,{#Ref<0.0.0.110>,stream_start,
[{"connection","Keep-Alive"},
{"date","Tue, 29 Apr 2014 11:33:55 GMT"},
{"transfer-encoding","chunked"},
{"server","Apache"},
{"content-type","application/octet-stream"},
{"keep-alive","timeout=15, max=100"}]}}
-------------------
-------------------MSG:
{http,{#Ref<0.0.0.110>,stream_end,
[{"connection","Keep-Alive"},
{"date","Tue, 29 Apr 2014 11:33:55 GMT"},
{"server","Apache"},
{"content-length","68"},
{"content-type","application/octet-stream"},
{"keep-alive","timeout=15, max=100"}]}}
-------------------
TIMEOUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment