示例#1
0
				self.loginfo("do_fwd: can't decode json: %s" % str(e));
				continue

			curi=NIname(uri)
			curi.validate_ni_url()
			metadata = NetInfMetaData(curi.get_canonical_ni_url())
			self.loginfo("Metadata I got: %s" % str(json_report))
			metadata.insert_resp_metadata(json_report)

			# if I've the role GET_RES and there's locators then 
			# follow those now
			if ct_msg == None and self.check_role(GET_RES):
				self.loginfo("I'm a GET_RES type of node - going to try follow")
				self.loginfo("meta: %s" % str(json_report))
				# check for locators
				locators = metadata.get_loclist()
				self.loginfo("locs: %s" % str(locators))
				# try follow locators
				for loc in locators:
					self.loginfo("GET_RES following: %s" % loc)

					# Send GET request to destination server
					try:
						# Set up HTTP form data for netinf fwd'd get request
						http_object = urllib2.urlopen(loc, "", 1)
					except Exception, e:
						self.loginfo("do_fwd: to %s http exception: %s" % (loc,str(e)));
						continue
					# Get HTTP result code
					http_result = http_object.getcode()
					if http_result != 200: