summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-05-19 22:35:57 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2014-05-19 22:36:41 +0200
commit2cc3b67af19a5f66a1ac211e4593ee0ef8403c1e (patch)
treee1ad7c35be8512255ad6f112d26c8641dfa3b369
parent897c677430a053df739d810554bb0320fedbc15b (diff)
downloadcontext-mirror-bot-2cc3b67af19a5f66a1ac211e4593ee0ef8403c1e.tar.gz
include contact info in user agent string
-rw-r--r--context_mirror_bot.ml15
1 files changed, 12 insertions, 3 deletions
diff --git a/context_mirror_bot.ml b/context_mirror_bot.ml
index d937c98..148dd37 100644
--- a/context_mirror_bot.ml
+++ b/context_mirror_bot.ml
@@ -26,7 +26,6 @@
******************************************************************************
*
* TODO
- * * curl user agent
* * logging
*
*****************************************************************************)
@@ -71,6 +70,10 @@ let sources =
page = "http://www.pragma-ade.com/download-1.htm";
url = "http://www.pragma-ade.com/context/current/cont-tmf.zip"; } ]
+(* owner and contact details for the user agent string *)
+let bot_owner = "Philipp Gesang"
+let owner_contact = "phg42.2a@gmail.com"
+
let repo_root = "/home/phg/src/mirror"
let repo_subdir = "context-git"
let repo_dir = Filename.concat repo_root repo_subdir
@@ -81,10 +84,9 @@ let ssh_id = "context_mirror_bot_id_rsa"
let ssh_id_dst = (Filename.concat repo_root ssh_id)
let static_files = [
("context-license.txt", "COPYING");
- ("context-readme.rst", "README")
+ ("context-readme.rst", "README.rst")
]
-
let gitconfig = Printf.sprintf "\
[core]
repositoryformatversion = 0
@@ -481,10 +483,17 @@ let prepare_dst () =
* source download
*****************************************************************************)
+let user_agent = Printf.sprintf
+ "Mirror Bot operated by %s <%s>"
+ bot_owner
+ owner_contact
+
+
let grab url writer =
let open Curl in
let c = init () in
set_url c url;
+ setopt c (CURLOPT_USERAGENT user_agent);
set_followlocation c true;
set_writefunction c writer;
perform c;