netclient ignores #set_redirect_mode method -- a test case
Richard Jones <[email protected]> Thu, 30 Jun 2005 13:59:28 +0100
| Newsgroups | gmane.comp.lang.ocaml.lib.net.devel |
|---|---|
| Message-ID | <[email protected]> |
Here is a test case which fails. In fact, it fails somewhat
differently from how I imagined. The program is below, followed by
the output.
Rich.
----------------------------------------------------------------------
(* Test netclient redirects. *)
let http =
let event_system = Unixqueue.create_unix_event_system () in
let http = new Http_client.pipeline in
http#set_event_system event_system;
(* Verbose mode so we can see what is sent and received. *)
http#set_options { http#get_options with
Http_client.verbose_status = true;
Http_client.verbose_request_header = true;
Http_client.verbose_response_header = true };
http
(* Get a URL which is known to redirect. *)
let url = "http://www.merjis.com" (* redirects to http://merjis.com/ *)
let () =
let msg = new Http_client.get url in
msg#set_redirect_mode Http_client.Do_not_redirect;
http#add msg;
while not msg#is_served do http#run () done
----------------------------------------------------------------------
rich@arctor:/tmp$ ocamlfind ocamlc -package netclient -linkpkg test.ml -o test
rich@arctor:/tmp$ ./test
HTTP request: GET / HTTP/1.1
HTTP request host: www.merjis.com:80
HTTP request content-length: 0
HTTP response code: 301
HTTP response code: Moved Permanently
HTTP response protocol: HTTP/1.1
HTTP response date: Thu, 30 Jun 2005 12:46:58 GMT
HTTP response server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15 mod_caml/1.
3.6
HTTP response location: http://merjis.com/
HTTP response transfer-encoding: chunked
HTTP response content-type: text/html; charset=iso-8859-1
HTTP request: GET / HTTP/1.1
HTTP request host: merjis.com:80
HTTP request content-length: 0
HTTP response code: 301
HTTP response code: Moved Permanently
HTTP response protocol: HTTP/1.1
HTTP response date: Thu, 30 Jun 2005 12:46:59 GMT
HTTP response server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15 mod_caml/1.
3.6
HTTP response location: http://merjis.com/
HTTP response transfer-encoding: chunked
HTTP response content-type: text/html; charset=iso-8859-1
HTTP request: GET / HTTP/1.1
HTTP request host: merjis.com:80
HTTP request content-length: 0
HTTP response code: 301
HTTP response code: Moved Permanently
HTTP response protocol: HTTP/1.1
HTTP response date: Thu, 30 Jun 2005 12:46:59 GMT
HTTP response server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15 mod_caml/1.
3.6
HTTP response location: http://merjis.com/
HTTP response transfer-encoding: chunked
HTTP response content-type: text/html; charset=iso-8859-1
HTTP request: GET / HTTP/1.1
HTTP request host: merjis.com:80
HTTP request content-length: 0
HTTP response code: 301
HTTP response code: Moved Permanently
HTTP response protocol: HTTP/1.1
HTTP response date: Thu, 30 Jun 2005 12:47:00 GMT
HTTP response server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-15 mod_caml/1.
3.6
HTTP response location: http://merjis.com/
HTTP response transfer-encoding: chunked
HTTP response content-type: text/html; charset=iso-8859-1
[repeated]
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click