[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2] Recon server check that the HTTP request succeeded before usin
From: |
Kim Minh Kaplan |
Subject: |
[PATCH 2] Recon server check that the HTTP request succeeded before using the response (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix) |
Date: |
Wed, 25 Mar 2009 14:03:09 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Recon server check that the HTTP request succeeded before using the response.
Kim Minh.
diff -r b49747d1b1d0 -r 38b920ada3e2 reconComm.ml
--- a/reconComm.ml Wed Mar 25 12:08:39 2009 +0000
+++ b/reconComm.ml Wed Mar 25 12:14:08 2009 +0000
@@ -65,6 +65,8 @@
with
Not_found -> false
+let http_status_ok_regexp = Str.regexp "^HTTP/[0-9]+\\.[0-9]+ 2"
+
let get_keystrings_via_http addr hashes =
let s = Unix.socket
~domain:Unix.PF_INET
@@ -84,7 +86,10 @@
(String.length msg));
cout#write_string msg;
cout#flush;
- ignore (input_line cin#inchan); (* read "HTTP" line *)
+ (* read "HTTP" line and make sure the status is 2xx *)
+ let status = input_line cin#inchan in
+ if not (Str.string_match http_status_ok_regexp status 0) then
+ failwith status;
let _headers = Wserver.parse_headers Map.empty cin#inchan in
let keystrings =
CMarshal.unmarshal_list ~f:CMarshal.unmarshal_string cin
- [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix, Kim Minh Kaplan, 2009/03/25
- Re: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix, Yaron Minsky, 2009/03/25
- [PATCH 1] Fix non tail recursion in sksdump (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix), Kim Minh Kaplan, 2009/03/25
- [PATCH 2] Recon server check that the HTTP request succeeded before using the response (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix),
Kim Minh Kaplan <=
- [PATCH 3] Use Unix.domain_of_sockaddr instead of hardcoded PF_INET or PF_UNIX (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix), Kim Minh Kaplan, 2009/03/25
- [PATCH 4] Servers can listen on multiple addresses simultaneously (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix), Kim Minh Kaplan, 2009/03/25
- [PATCH 5] Use all available addresses of partners (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix), Kim Minh Kaplan, 2009/03/25
- [PATCH 4] Servers can listen on multiple addresses simultaneously (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix), Kim Minh Kaplan, 2009/03/26
- [PATCH 6] Fix DNS staleness (was: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix), Kim Minh Kaplan, 2009/03/28
- Re: [Sks-devel] [PATCH] Bundle IPv6, DNS fixes, sks dump fix, Phil Pennock, 2009/03/25