Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

525 wiersze
27 KiB

14 lat temu
14 lat temu
14 lat temu
14 lat temu
14 lat temu
14 lat temu
14 lat temu
14 lat temu
  1. ibrowse is a HTTP client. The following are a list of features.
  2. - RFC2616 compliant (AFAIK)
  3. - supports GET, POST, OPTIONS, HEAD, PUT, DELETE, TRACE,
  4. MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, MOVE and COPY
  5. - Understands HTTP/0.9, HTTP/1.0 and HTTP/1.1
  6. - Understands chunked encoding
  7. - Can generate requests using Chunked Transfer-Encoding
  8. - Pools of connections to each webserver
  9. - Pipelining support
  10. - Download to file
  11. - Asynchronous requests. Responses are streamed to a process
  12. - Basic authentication
  13. - Supports proxy authentication
  14. - Can talk to Secure webservers using SSL
  15. - any other features in the code not listed here :)
  16. ibrowse is available under two different licenses. LGPL or the BSD license.
  17. Comments to : Chandrashekhar.Mullaparthi@gmail.com
  18. Version : 2.1.4
  19. Latest version : git://github.com/cmullaparthi/ibrowse.git
  20. CONTRIBUTORS
  21. ============
  22. The following people have helped maked ibrowse better by reporting bugs,
  23. supplying patches and also asking for new features. Please write to me if you
  24. have contributed and I've missed you out.
  25. In alphabetical order:
  26. Adam Kocoloski
  27. Andrew Tunnell-Jones
  28. Anthony Molinaro
  29. Benoit Chesneau
  30. Chris Newcombe
  31. Dan Kelley
  32. Derek Upham
  33. Eric Merritt
  34. Erik Reitsma
  35. Filipe David Manana
  36. Geoff Cant
  37. Jeroen Koops
  38. Jo�o Lopes
  39. Karol Skocik
  40. Kostis Sagonas
  41. Matthew Reilly
  42. Oscar Hellstr�m
  43. Paul J. Davis
  44. Peter Kristensen
  45. Ram Krishnan
  46. Richard Cameron
  47. Ryan Zezeski
  48. Sean Hinde
  49. Seth Falcon
  50. Steve Vinoski
  51. Thomas Lindgren
  52. Youn�s Hafri
  53. fholzhauser (https://github.com/fholzhauser/)
  54. tholschuh (https://github.com/tholschuh/)
  55. CONTRIBUTIONS & CHANGE HISTORY
  56. ==============================
  57. 09-02-2011 - v2.1.4
  58. * Fixed a bug reported by Ryan Zezeski with the
  59. save_response_to_file option.
  60. https://github.com/cmullaparthi/ibrowse/issues#issue/33
  61. 16-01-2011 - v2.1.3
  62. * Fixed issues with streaming and chunked responses when using
  63. the 'caller controls socket' feature. See following links for
  64. details. Contributed by Filipe David Manana.
  65. https://github.com/cmullaparthi/ibrowse/pull/24
  66. https://github.com/cmullaparthi/ibrowse/pull/25
  67. https://github.com/cmullaparthi/ibrowse/pull/27
  68. https://github.com/cmullaparthi/ibrowse/pull/28
  69. https://github.com/cmullaparthi/ibrowse/pull/29
  70. * Fix for issue 32 reported by fholzhauser
  71. https://github.com/cmullaparthi/ibrowse/issues#issue/32
  72. * Fixed some dialyzer warnings. Thanks to Kostis for reporting
  73. them.
  74. 20-12-2010 - v2.1.2
  75. * Pipelining wasn't working when used in conjunction with the
  76. {stream_to, {self(), once}} option. Bug report by
  77. Filipe David Manana.
  78. 10-12-2010 - v2.1.1
  79. * Fix for https://github.com/cmullaparthi/ibrowse/issues/issue/20
  80. by Filipe David Manana
  81. * Fix for https://github.com/cmullaparthi/ibrowse/issues/issue/21
  82. by Filipe David Manana
  83. * Fix for https://github.com/cmullaparthi/ibrowse/issues/issue/23
  84. by Filipe David Manana
  85. * Fix for bugs when using SSL by Jo�o Lopes
  86. 25-10-2010 - v2.1.0
  87. * Fixed build on OpenSolaris. Bug report and patch from
  88. tholschuh.
  89. http://github.com/cmullaparthi/ibrowse/issues/issue/10
  90. * Fixed behaviour of inactivity_timeout option. Reported by
  91. Jo�o Lopes.
  92. http://github.com/cmullaparthi/ibrowse/issues/issue/11
  93. * Prevent atom table pollution when bogus URLs are input to
  94. ibrowse. Bug report by Jo�o Lopes.
  95. http://github.com/cmullaparthi/ibrowse/issues/issue/13
  96. * Automatically do Chunked-Transfer encoding of request body
  97. when the body is generated by a fun. Patch provided by
  98. Filipe David Manana.
  99. http://github.com/cmullaparthi/ibrowse/issues/issue/14
  100. * Depending on input options, ibrowse sometimes included multiple
  101. Content-Length headers. Bug reported by Paul J. Davis
  102. http://github.com/cmullaparthi/ibrowse/issues/issue/15
  103. * Deal with webservers which do not provide a Reason-Phrase on the
  104. response Status-Line. Patch provided by Jeroen Koops.
  105. http://github.com/cmullaparthi/ibrowse/issues/issue/16
  106. * Fixed http://github.com/cmullaparthi/ibrowse/issues/issue/17
  107. This was reported by Filipe David Manana.
  108. * Fixed http://github.com/cmullaparthi/ibrowse/issues/issue/19
  109. This was reported by Dan Kelley and Filipe David Manana.
  110. * Added ibrowse:stream_close/1 to close the connection
  111. associated with a certain response stream. Patch provided by
  112. Jo�o Lopes.
  113. * Prevent port number being included in the Host header when port
  114. 443 is intended. Bug reported by Andrew Tunnell-Jones
  115. 24-09-2010 - v2.0.1
  116. * Removed a spurious io:format statement
  117. 22-09-2010 - v2.0.0.
  118. * Added option preserve_chunked_encoding. This allows the
  119. caller to get the raw HTTP response when the
  120. Transfer-Encoding is Chunked. This feature was requested
  121. by Benoit Chesneau who wanted to write a HTTP proxy using
  122. ibrowse.
  123. * Fixed bug with the {stream_to, {Pid, once}} option. Bug
  124. report and lot of help from Filipe David Manana. Thank
  125. you Filipe.
  126. * The {error, conn_failed} and {error, send_failed} return
  127. values are now of the form {error, {conn_failed, Err}}
  128. and {error, {send_failed, Err}}. This is so that the
  129. specific socket error can be returned to the caller. I
  130. think it looks a bit ugly, but that is the best
  131. compromise I could come up with.
  132. * Added application configuration parameters
  133. default_max_sessions and default_max_pipeline_size. These
  134. were previously hard coded to 10.
  135. * Versioning of ibrowse now follows the Semantic Versioning
  136. principles. See http://semver.org. Thanks to Anthony
  137. Molinaro for nudging me in this direction.
  138. * The connect_timeout option now only applies to the
  139. connection setup phase. In previous versions, the time
  140. taken to setup the connection was deducted from the
  141. specified timeout value for the request.
  142. 17-07-2010 - * Merged change made by Filipe David Manana to use the base64
  143. module for encoding/decoding.
  144. 11-06-2010 - * Removed use of deprecated concat_binary. Patch supplied by
  145. Steve Vinoski
  146. 10-06-2010 - * Fixed bug in https requests not going via the proxy
  147. 12-05-2010 - * Added support for the CONNECT method to tunnel HTTPS through
  148. a proxy. When a https URL is requested through a proxy,
  149. ibrowse will automatically use the CONNECT method to first
  150. setup a tunnel through the proxy. Once this succeeds, the
  151. actual request is dispatched. Successfully tested with the
  152. new SSL implementation in R13B-03
  153. * Added SSL support for direct connections.
  154. See ibrowse:spawn_worker_process/1 and
  155. ibrowse:spawn_link_worker_process/1
  156. * Added option to return raw status line and raw unparsed headers
  157. 23-04-2010 - * Fixes to URL parsing by Karol Skocik
  158. 08-11-2009 - * Added option headers_as_is
  159. 04-10-2009 - * Patch from Kostis Sagonas to cleanup some code and suppress
  160. dialyzer warnings
  161. 24-09-2009 - * When a filename was supplied with the 'save_response_to_file'
  162. option, the option was being ignored. Bug report from
  163. Adam Kocoloski
  164. 05-09-2009 - * Introduced option to allow caller to set socket options.
  165. 29-07-2009 - * The ETS table created for load balancing of requests was not
  166. being deleted which led to the node not being able to create
  167. any more ETS tables if queries were made to many number of
  168. webservers. ibrowse now deletes the ETS table it creates once the
  169. last connection to a webserver is dropped.
  170. Reported by Seth Falcon.
  171. * Spurious data being returned at end of body in certain cases of
  172. chunked encoded responses from the server.
  173. Reported by Chris Newcombe.
  174. 03-07-2009 - Added option {stream_to, {Pid, once}} which allows the caller
  175. to control when it wants to receive more data. If this option
  176. is used, the call ibrowse:stream_next(Req_id) should be used
  177. to get more data.
  178. - Patch submitted by Steve Vinoski to remove compiler warnings
  179. about the use of obsolete guards
  180. 29-06-2009 - * Fixed following issues reported by Oscar Hellstr�m
  181. - Use {active, once} instead of {active, true}
  182. - Fix 'dodgy' timeout handling
  183. - Use binaries internally instead of lists to reduce memory
  184. consumption on 64 bit platforms. The default response format
  185. is still 'list' to maintain backwards compatibility. Use the
  186. option {response_format, binary} to get responses as binaries.
  187. * Fixed chunking bug (reported by Adam Kocoloski)
  188. * Added new option {inactivity_timeout, Milliseconds} to timeout
  189. requests if no data is received on the link for the specified
  190. interval. Useful when responses are large and links are flaky.
  191. * Added ibrowse:all_trace_off/0 to turn off all tracing
  192. * Change to the way responses to asynchronous requests are
  193. returned. The following messages have been removed.
  194. * {ibrowse_async_response, Req_id, {chunk_start, Chunk_size}}
  195. * {ibrowse_async_response, Req_id, chunk_end}
  196. * Fixed Makefiles as part of Debian packaging
  197. (thanks to Thomas Lindgren)
  198. * Moved repository from Sourceforge to Github
  199. 11-06-2009 - * Added option to control size of streamed chunks. Also added
  200. option for the client to receive responses in binary format.
  201. 21-05-2008 - * Fixed bug in reading some options from the ibrowse.conf file.
  202. Reported by Erik Reitsma on the erlyaws mailing list
  203. * Fixed bug when cleaning up closing connections
  204. 27-03-2008 - * Major rewrite of the load balancing feature. Additional module,
  205. ibrowse_lb.erl, introduced to achieve this.
  206. * Can now get a handle to a connection process which is not part of
  207. the load balancing pool. Useful when an application is making
  208. requests to a webserver which are time consuming (such as
  209. uploading a large file). Such requests can be put on a separate
  210. connection, and all other smaller/quicker requests can use the
  211. load balancing pool. See ibrowse:spawn_worker_process/2 and
  212. ibrowse:spawn_link_worker_process/2
  213. * Ram Krishnan sent a patch to enable a client to send a lot of
  214. data in a request by providing a fun which is invoked by the
  215. connection handling process. This fun can fetch the data from
  216. any where. This is useful when trying to upload a large file
  217. to a webserver.
  218. * Use the TCP_NODELAY option on every socket by default
  219. * Rudimentary support for load testing of ibrowse. Undocumented,
  220. but see ibrowse_test:load_test/3. Use the source, Luke!
  221. * New function ibrowse:show_dest_status/2 to view state of
  222. connections/pipelines to a web server
  223. 20-02-2008 - Ram Krishnan sent another patch for another hidden bug in the
  224. save_response_to_file feature.
  225. 07-02-2008 - Ram Krishnan (kriyative _at_ gmail dot com) sent a simple patch to
  226. enable specifying the filename in the save_response_to_file option.
  227. When testing the patch, I realised that my original implementation
  228. of this feature was quite flaky and a lot of corner cases were
  229. not covered. Fixed all of them. Thanks Ram!
  230. 17-10-2007 - Matthew Reilly (matthew dot reilly _at_ sipphone dot com)
  231. sent a bug report and a fix. If the chunk trailer spans two TCP
  232. packets, then ibrowse fails to recognise that the chunked transfer
  233. has ended.
  234. 29-08-2007 - Bug report by Peter Kristensen(ptx _at_ daimi dot au dot dk).
  235. ibrowse crashes when the webserver returns just the Status line
  236. and nothing else.
  237. 28-06-2007 - Added host_header option to enable connection to secure sites
  238. via stunnel
  239. 20-04-2007 - Geoff Cant sent a patch to remove URL encoding for digits in
  240. ibrowse_lib:url_encode/1.
  241. ibrowse had a dependency on the inets application because the
  242. ibrowse_http_client.erl invoked httpd_util:encode_base64/1. This
  243. dependency is now removed and the encode_base64/1 has been
  244. implemented in ibrowse_lib.erl
  245. 06-03-2007 - Eric Merritt sent a patch to support WebDAV requests.
  246. 12-01-2007 - Derek Upham sent in a bug fix. The reset_state function was not
  247. behaving correctly when the transfer encoding was not chunked.
  248. 13-11-2006 - Youn�s Hafri reported a bug where ibrowse was not returning the
  249. temporary filename when the server was closing the connection
  250. after sending the data (as in HTTP/1.0).
  251. Released ibrowse under the BSD license
  252. 12-10-2006 - Chris Newcombe reported bug in dealing with requests where no
  253. body is expected in the response. The first request would succeed
  254. and the next request would hang.
  255. 24-May-2006 - Sean Hinde reported a bug. Async responses with pipelining was
  256. returning the wrong result.
  257. 08-Dec-2005 - Richard Cameron (camster@citeulike.org). Patch to ibrowse to
  258. prevent port number being included in the Host header when port
  259. 80 is intended.
  260. 22-Nov-2005 - Added ability to generate requests using the Chunked
  261. Transfer-Encoding.
  262. 08-May-2005 - Youn�s Hafri made a CRUX LINUX port of ibrowse.
  263. http://yhafri.club.fr/crux/index.html
  264. Here are some usage examples. Enjoy!
  265. 5> ibrowse:start().
  266. {ok,<0.94.0>}
  267. %% A simple GET
  268. 6> ibrowse:send_req("http://intranet/messenger/", [], get).
  269. {ok,"200",
  270. [{"Server","Microsoft-IIS/5.0"},
  271. {"Content-Location","http://intranet/messenger/index.html"},
  272. {"Date","Fri, 17 Dec 2004 15:16:19 GMT"},
  273. {"Content-Type","text/html"},
  274. {"Accept-Ranges","bytes"},
  275. {"Last-Modified","Fri, 17 Dec 2004 08:38:21 GMT"},
  276. {"Etag","\"aa7c9dc313e4c41:d77\""},
  277. {"Content-Length","953"}],
  278. "<html>\r\n\r\n<head>\r\n<title>Messenger</title>\r\n<meta name=\"GENERATOR\" content=\"Microsoft FrontPage 5.0\">\r\n<meta name=\"ProgId\" content=\"FrontPage.Editor.Document\">\r\n<meta name=\"description\" content=\"Messenger Home Page\">\r\n</head>\r\n\r\n<frameset border=\"0\" frameborder=\"0\" rows=\"60,*\">\r\n <frame src=\"/messenger/images/topnav.html\" name=\"mFrameTopNav\" scrolling=\"NO\" target=\"mFrameMain\">\r\n <frameset cols=\"18%,*\">\r\n <frameset rows=\"*,120\">\r\n <frame src=\"index-toc.html\" name=\"mFrameTOC\" target=\"mFrameMain\" scrolling=\"auto\" noresize=\"true\">\r\n <frame src=\"/shared/search/namesearch.html\" name=\"mFrameNameSearch\" scrolling=\"NO\" target=\"mFrameMain\">\r\n </frameset>\r\n <frame src=\"home/16-12-04-xmascardsmms.htm\" name=\"mFrameMain\" scrolling=\"auto\" target=\"mFrameMain\" id=\"mFrameMain\">\r\n </frameset>\r\n <noframes>\r\n <body>\r\n\r\n <p><i>This site requires a browser that can view frames.</i></p>\r\n\r\n </body>\r\n </noframes>\r\n</frameset>\r\n\r\n</html>"}
  279. %% =============================================================================
  280. %% A GET using a proxy
  281. 7> ibrowse:send_req("http://www.google.com/", [], get, [],
  282. [{proxy_user, "XXXXX"},
  283. {proxy_password, "XXXXX"},
  284. {proxy_host, "proxy"},
  285. {proxy_port, 8080}], 1000).
  286. {ok,"302",
  287. [{"Date","Fri, 17 Dec 2004 15:22:56 GMT"},
  288. {"Content-Length","217"},
  289. {"Content-Type","text/html"},
  290. {"Set-Cookie",
  291. "PREF=ID=f58155c797f96096:CR=1:TM=1103296999:LM=1103296999:S=FiWdtAqQvhQ0TvHq; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"},
  292. {"Server","GWS/2.1"},
  293. {"Location",
  294. "http://www.google.co.uk/cxfer?c=PREF%3D:TM%3D1103296999:S%3Do8bEY2FIHwdyGenS&prev=/"},
  295. {"Via","1.1 netapp01 (NetCache NetApp/5.5R2)"}],
  296. "<HTML><HEAD><TITLE>302 Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A HREF=\"http://www.google.co.uk/cxfer?c=PREF%3D:TM%3D1103296999:S%3Do8bEY2FIHwdyGenS&amp;prev=/\">here</A>.\r\n</BODY></HTML>\r\n"}
  297. %% =============================================================================
  298. %% A GET response saved to file. A temporary file is created and the
  299. %% filename returned. The response will only be saved to file is the
  300. %% status code is in the 200 range. The directory to download to can
  301. %% be set using the application env var 'download_dir' - the default
  302. %% is the current working directory.
  303. 8> ibrowse:send_req("http://www.erlang.se/", [], get, [],
  304. [{proxy_user, "XXXXX"},
  305. {proxy_password, "XXXXX"},
  306. {proxy_host, "proxy"},
  307. {proxy_port, 8080},
  308. {save_response_to_file, true}], 1000).
  309. {error,req_timedout}
  310. %% =============================================================================
  311. 9> ibrowse:send_req("http://www.erlang.se/", [], get, [],
  312. [{proxy_user, "XXXXX"},
  313. {proxy_password, "XXXXX"},
  314. {proxy_host, "proxy"},
  315. {proxy_port, 8080},
  316. {save_response_to_file, true}], 5000).
  317. {ok,"200",
  318. [{"Transfer-Encoding","chunked"},
  319. {"Date","Fri, 17 Dec 2004 15:24:36 GMT"},
  320. {"Content-Type","text/html"},
  321. {"Server","Apache/1.3.9 (Unix)"},
  322. {"Via","1.1 netapp01 (NetCache NetApp/5.5R2)"}],
  323. {file,"/Users/chandru/code/ibrowse/src/ibrowse_tmp_file_1103297041125854"}}
  324. %% =============================================================================
  325. %% Setting size of connection pool and pipeline size. This sets the
  326. %% number of maximum connections to this server to 10 and the pipeline
  327. %% size to 1. Connections are setup a required.
  328. 11> ibrowse:set_dest("www.hotmail.com", 80, [{max_sessions, 10},
  329. {max_pipeline_size, 1}]).
  330. ok
  331. %% =============================================================================
  332. %% Example using the HEAD method
  333. 56> ibrowse:send_req("http://www.erlang.org", [], head).
  334. {ok,"200",
  335. [{"Date","Mon, 28 Feb 2005 04:40:53 GMT"},
  336. {"Server","Apache/1.3.9 (Unix)"},
  337. {"Last-Modified","Thu, 10 Feb 2005 09:31:23 GMT"},
  338. {"Etag","\"8d71d-1efa-420b29eb\""},
  339. {"Accept-ranges","bytes"},
  340. {"Content-Length","7930"},
  341. {"Content-Type","text/html"}],
  342. []}
  343. %% =============================================================================
  344. %% Example using the OPTIONS method
  345. 62> ibrowse:send_req("http://www.sun.com", [], options).
  346. {ok,"200",
  347. [{"Server","Sun Java System Web Server 6.1"},
  348. {"Date","Mon, 28 Feb 2005 04:44:39 GMT"},
  349. {"Content-Length","0"},
  350. {"P3p",
  351. "policyref=\"http://www.sun.com/p3p/Sun_P3P_Policy.xml\", CP=\"CAO DSP COR CUR ADMa DEVa TAIa PSAa PSDa CONi TELi OUR SAMi PUBi IND PHY ONL PUR COM NAV INT DEM CNT STA POL PRE GOV\""},
  352. {"Set-Cookie",
  353. "SUN_ID=X.X.X.X:169191109565879; EXPIRES=Wednesday, 31-Dec-2025 23:59:59 GMT; DOMAIN=.sun.com; PATH=/"},
  354. {"Allow",
  355. "HEAD, GET, PUT, POST, DELETE, TRACE, OPTIONS, MOVE, INDEX, MKDIR, RMDIR"}],
  356. []}
  357. %% =============================================================================
  358. %% Example of using Asynchronous requests
  359. 18> ibrowse:send_req("http://www.google.com", [], get, [],
  360. [{proxy_user, "XXXXX"},
  361. {proxy_password, "XXXXX"},
  362. {proxy_host, "proxy"},
  363. {proxy_port, 8080},
  364. {stream_to, self()}]).
  365. {ibrowse_req_id,{1115,327256,389608}}
  366. 19> flush().
  367. Shell got {ibrowse_async_headers,{1115,327256,389608},
  368. "302",
  369. [{"Date","Thu, 05 May 2005 21:06:41 GMT"},
  370. {"Content-Length","217"},
  371. {"Content-Type","text/html"},
  372. {"Set-Cookie",
  373. "PREF=ID=b601f16bfa32f071:CR=1:TM=1115327201:LM=1115327201:S=OX5hSB525AMjUUu7; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"},
  374. {"Server","GWS/2.1"},
  375. {"Location",
  376. "http://www.google.co.uk/cxfer?c=PREF%3D:TM%3D1115327201:S%3DDS9pDJ4IHcAuZ_AS&prev=/"},
  377. {"Via",
  378. "1.1 hatproxy01 (NetCache NetApp/5.6.2)"}]}
  379. Shell got {ibrowse_async_response,{1115,327256,389608},
  380. "<HTML><HEAD><TITLE>302 Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A HREF=\"http://www.google.co.uk/cxfer?c=PREF%3D:TM%3D1115327201:S%3DDS9pDJ4IHcAuZ_AS&amp;prev=/\">here</A>.\r\n</BODY></HTML>\r\n"}
  381. Shell got {ibrowse_async_response_end,{1115,327256,389608}}
  382. ok
  383. %% =============================================================================
  384. %% Another example of using async requests
  385. 24> ibrowse:send_req("http://yaws.hyber.org/simple_ex2.yaws", [], get, [],
  386. [{proxy_user, "XXXXX"},
  387. {proxy_password, "XXXXX"},
  388. {proxy_host, "proxy"},
  389. {proxy_port, 8080},
  390. {stream_to, self()}]).
  391. {ibrowse_req_id,{1115,327430,512314}}
  392. 25> flush().
  393. Shell got {ibrowse_async_headers,{1115,327430,512314},
  394. "200",
  395. [{"Date","Thu, 05 May 2005 20:58:08 GMT"},
  396. {"Content-Length","64"},
  397. {"Content-Type","text/html;charset="},
  398. {"Server",
  399. "Yaws/1.54 Yet Another Web Server"},
  400. {"Via",
  401. "1.1 hatproxy01 (NetCache NetApp/5.6.2)"}]}
  402. Shell got {ibrowse_async_response,{1115,327430,512314},
  403. "<html>\n\n\n<h1> Yesssssss </h1>\n\n<h2> Hello again </h2>\n\n\n</html>\n"}
  404. Shell got {ibrowse_async_response_end,{1115,327430,512314}}
  405. %% =============================================================================
  406. %% Example of request which fails when using the async option. Here
  407. %% the {ibrowse_req_id, ReqId} is not returned. Instead the error code is
  408. %% returned.
  409. 68> ibrowse:send_req("http://www.earlyriser.org", [], get, [], [{stream_to, self()}]).
  410. {error,conn_failed}
  411. %% Example of request using both Proxy-Authorization and authorization by the final webserver.
  412. 17> ibrowse:send_req("http://www.erlang.se/lic_area/protected/patches/erl_756_otp_beam.README",
  413. [], get, [],
  414. [{proxy_user, "XXXXX"},
  415. {proxy_password, "XXXXX"},
  416. {proxy_host, "proxy"},
  417. {proxy_port, 8080},
  418. {basic_auth, {"XXXXX", "XXXXXX"}}]).
  419. {ok,"200",
  420. [{"Accept-Ranges","bytes"},
  421. {"Date","Thu, 05 May 2005 21:02:09 GMT"},
  422. {"Content-Length","2088"},
  423. {"Content-Type","text/plain"},
  424. {"Server","Apache/1.3.9 (Unix)"},
  425. {"Last-Modified","Tue, 03 May 2005 15:08:18 GMT"},
  426. {"ETag","\"1384c8-828-427793e2\""},
  427. {"Via","1.1 hatproxy01 (NetCache NetApp/5.6.2)"}],
  428. "Patch Id:\t\terl_756_otp_beam\nLabel:\t\t\tinets patch\nDate:\t\t\t2005-05-03\nTrouble Report Id:\tOTP-5513, OTP-5514, OTP-5516, OTP-5517, OTP-5521, OTP-5537\nSeq num:\t\tseq9806\nSystem:\t\t\totp\nRelease:\t\tR10B\nOperating System:\tall\nArchitecture:\t\tall\nErlang machine:\t\tBEAM\nApplication:\t\tinets-4.4\nFiles:\t\t\tall\n\nDescription:\n\n OTP-5513 The server did not handle HTTP-0.9 messages with an implicit\n\t version.\n\n OTP-5514 An internal server timeout killed the request handling\n\t process without sending a message back to the client. As this\n\t timeout only affects a single request it has been set to\n\t infinity (if the main server process dies the request\n\t handling process will also die and the client will receive an\n\t error). This might make a client that does not use a timeout\n\t hang for a longer period of time, but that is an expected\n\t behavior!\n\n OTP-5516 That a third party closes the http servers accept socket is\n\t recoverable for inets, hence intes will only produce an info\n\t report as there was no error in inets but measures where\n\t taken to avoid failure due to errors elsewhere.\n\n OTP-5517 The HTTP client proxy settings where ignored. Bug introduced\n\t in inets-4.3.\n\n OTP-5521 Inets only sent the \"WWW-Authenticate\" header at the first\n\t attempt to get a page, if the user supplied the wrong\n\t user/password combination the header was not sent again. This\n\t forces the user to kill the browser entirely after a failed\n\t login attempt, before the user may try to login again. Inets\n\t now always send the authentication header.\n\n OTP-5537 A major rewrite of big parts of the HTTP server code was\n\t performed. There where many things that did not work\n\t satisfactory. Cgi script handling can never have worked\n\t properly and the cases when it did sort of work, a big\n\t unnecessary delay was enforced. Headers where not always\n\t treated as expected and HTTP version handling did not work,\n\t all responses where sent as version HTTP/1.1 no matter what.\n\n\n"}
  429. %% =============================================================================
  430. %% Example of a TRACE request. Very interesting! yaws.hyber.org didn't
  431. %% support this. Nor did www.google.com. But good old BBC supports
  432. %% this.
  433. 35> 37> ibrowse:send_req("http://www.bbc.co.uk/", [], trace, [],
  434. [{proxy_user, "XXXXX"},
  435. {proxy_password, "XXXXX"},
  436. {proxy_host, "proxy"},
  437. {proxy_port, 8080}]).
  438. {ok,"200",
  439. [{"Transfer-Encoding","chunked"},
  440. {"Date","Thu, 05 May 2005 21:40:27 GMT"},
  441. {"Content-Type","message/http"},
  442. {"Server","Apache/2.0.51 (Unix)"},
  443. {"Set-Cookie",
  444. "BBC-UID=7452e72a29424c5b0b232c7131c7d9395d209b7170e8604072e0fcb3630467300; expires=Mon, 04-May-09 21:40:27 GMT; path=/; domain=bbc.co.uk;"},
  445. {"Set-Cookie",
  446. "BBC-UID=7452e72a29424c5b0b232c7131c7d9395d209b7170e8604072e0fcb3630467300; expires=Mon, 04-May-09 21:40:27 GMT; path=/; domain=bbc.co.uk;"},
  447. {"Via","1.1 hatproxy01 (NetCache NetApp/5.6.2)"}],
  448. "TRACE / HTTP/1.1\r\nHost: www.bbc.co.uk\r\nConnection: keep-alive\r\nX-Forwarded-For: 172.24.28.29\r\nVia: 1.1 hatproxy01 (NetCache NetApp/5.6.2)\r\nCookie: BBC-UID=7452e72a29424c5b0b232c7131c7d9395d209b7170e8604072e0fcb3630467300\r\n\r\n"}