Closed crquan closed 9 years ago
Hi,
This is what I see when I turn on tracing for an endpoint. And I'm not aware of a website which supports the TRACE method.
2> ibrowse:trace_on("www.google.com", 80).
ok
4> ibrowse:send_req("http://www.google.com", [], get).
2015-8-5_7:0:50:976 -- (www.google.com:80) - Connecting...
2015-8-5_7:0:51:30 -- (www.google.com:80) - Connected! Socket: #Port<0.764>
2015-8-5_7:0:51:30 -- (www.google.com:80) - Sending request:
--- Request Begin ---
GET / HTTP/1.1
Host: www.google.com
Content-Length: 0
--- Request End ---
2015-8-5_7:0:51:30 -- (www.google.com:80) - Sending request body:
--- Request Body Begin ---
--- Request Body End ---
2015-8-5_7:0:51:71 -- (www.google.com:80) - Data recvd in state: get_header. Size: 527. <<"HTTP/1.1 302 Found\r\nCache-Control: private\r\nContent-Type: text/html; charset=UTF-8\r\nLocation: http://www.google.co.uk/?gfe_rd=cr&ei=TabBVYOpFomI7Aat5bqwCQ\r\nContent-Length: 261\r\nDate: Wed, 05 Aug 2015 05:59:41 GMT\r\nServer: GFE/2.0\r\nAlternate-Protocol: 80:quic,p=0\r\n\r\n<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<TITLE>302 Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A HREF=\"http://www.google.co.uk/?gfe_rd=cr&ei=TabBVYOpFomI7Aat5bqwCQ\">here</A>.\r\n</BODY></HTML>\r\n">>
2015-8-5_7:0:51:72 -- (www.google.com:80) - Recvd Header Data -> HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.co.uk/?gfe_rd=cr&ei=TabBVYOpFomI7Aat5bqwCQ
Content-Length: 261
Date: Wed, 05 Aug 2015 05:59:41 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic,p=0
----
2015-8-5_7:0:51:72 -- (www.google.com:80) - Recvd headers
--- Headers Begin ---
HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.co.uk/?gfe_rd=cr&ei=TabBVYOpFomI7Aat5bqwCQ
Content-Length: 261
Date: Wed, 05 Aug 2015 05:59:41 GMT
Server: GFE/2.0
Alternate-Protocol: 80:quic,p=0
--- Headers End ---
2015-8-5_7:0:51:73 -- (www.google.com:80) - HttpVsn: "HTTP/1.1" StatusCode: "302" Headers_1 -> [{"Cache-Control","private"},{"Content-Type","text/html; charset=UTF-8"},{"Location","http://www.google.co.uk/?gfe_rd=cr&ei=TabBVYOpFomI7Aat5bqwCQ"},{"Content-Length","261"},{"Date","Wed, 05 Aug 2015 05:59:41 GMT"},{"Server","GFE/2.0"},{"Alternate-Protocol","80:quic,p=0"}]
2015-8-5_7:0:51:73 -- (www.google.com:80) - Recvd Content-Length of 261
{ok,"302",
[{"Cache-Control","private"},
{"Content-Type","text/html; charset=UTF-8"},
{"Location",
"http://www.google.co.uk/?gfe_rd=cr&ei=TabBVYOpFomI7Aat5bqwCQ"},
{"Content-Length","261"},
{"Date","Wed, 05 Aug 2015 05:59:41 GMT"},
{"Server","GFE/2.0"},
{"Alternate-Protocol","80:quic,p=0"}],
"<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\">\n<TITLE>302 Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A HREF=\"http://www.google.co.uk/?gfe_rd=cr&ei=TabBVYOpFomI7Aat5bqwCQ\">here</A>.\r\n</BODY></HTML>\r\n"}
5> 2015-8-5_7:1:1:76 -- (www.google.com:80) - Inactivity timeout triggered. Shutting down connection
When I ran ibrowse:trace_on/0 I expect it turn on tracing for all connections? but it does nothing
106> ibrowse:trace_on().
{trace,true}
if I do ibrowse:trace_on/2 today that indeed works, not sure why it wasn't working yesterday.
but then what is ibrowse:trace_on/0 ?
It is only for turning on trace for the 'ibrowse' process. It used to have more trace messages, but there is hardly any at the moment so the trace_on/0 and trace_off/0 calls are actually redundant.
from erlang shell I did ibrowse:trace_on() or call trace_on/2 with specific host:port, then do ibrowse:send_seq(...) I can't see any difference, where I expect it print in verbose mode on what kind of request headers & body were sent, but can see nothing,
I did some online search but couldn't find an example http://erlang.org/pipermail/erlang-questions/2013-June/074248.html
where in the example of trace, this sounds like trace as http verb, I get "Error 405 : Method Not Allowed", do you still have another web site support this trace as verb?