Exemplo n.º 1
0
	def test_Method_FullURL_UsernamePasswordCGIArgs_Protocol(self):
		"Accepted URL Format"
		r = "BIBBLE foo://toor:[email protected]/bla?this&that=other PROTO/3.3"
		try:
			foo=requestLine(r)
		except "BadRequest":
			foo= "Line is not parseable - does not match:\nMETHOD proto://(user(:passwd)?@)?domain/url proto/ver"
		print foo
Exemplo n.º 2
0
 def test_Method_FullURL_UsernamePasswordCGIArgs_Protocol(self):
     "Accepted URL Format"
     r = "BIBBLE foo://toor:[email protected]/bla?this&that=other PROTO/3.3"
     try:
         foo = requestLine(r)
     except "BadRequest":
         foo = "Line is not parseable - does not match:\nMETHOD proto://(user(:passwd)?@)?domain/url proto/ver"
     print foo
Exemplo n.º 3
0
 def test_AcceptedForms(self):
     requests = []
     for REQ in requests:
         print "Parsing request:", REQ
         try:
             foo = requestLine(REQ)
         except "BadRequest":
             foo = "Line is not parseable - does not match:\nMETHOD proto://(user(:passwd)?@)?domain/url proto/ver"
         print foo
         print
Exemplo n.º 4
0
	def test_AcceptedForms(self):
		requests = [
			
			
			 ]
		for REQ in requests:
			print "Parsing request:", REQ
			try:
				foo=requestLine(REQ)
			except "BadRequest":
				foo= "Line is not parseable - does not match:\nMETHOD proto://(user(:passwd)?@)?domain/url proto/ver"
			print foo
			print
Exemplo n.º 5
0
	def test_http09_minimal(self):
		"Rejected URL Format"
		r = "/"
                foo=requestLine(r)
Exemplo n.º 6
0
		result =  result + self.reqprotocol + "://"
		if self.user:
			result =  result + self.user
			if self.passwd:
				result =  result + ":" + self.passwd
			result = result + "@"
		result =  result + self.domain
		result =  result + self.url +" "
		result =  result + self.protocol + "/"
		result =  result + self.version
		return result

if __name__ =="__main__":
		# These are the only format requests we accept.
		# All others are rejected
		requests = [
			"BIBBLE foo://toor:[email protected]/bla?this&that=other PROTO/3.3",
			"BIBBLE foo://[email protected]/bla?this&that=other PROTO/3.3",
			"BIBBLE foo://server.bigcompany.com/bla?this&that=other PROTO/3.3",
			"BIBBLE foo://server.bigcompany.com/ PROTO/3.3",
			"foo://server.bigcompany.com/ PROTO/3.3"
			 ]
		for REQ in requests:
			print "Parsing request:", REQ
			try:
				foo=requestLine(REQ)
			except "BadRequest":
				foo= "Line is not parseable - does not match:\nMETHOD proto://(user(:passwd)?@)?domain/url proto/ver"
			print foo
			print
Exemplo n.º 7
0
 def test_http09_minimal(self):
     "Rejected URL Format"
     r = "/"
     foo = requestLine(r)
Exemplo n.º 8
0
        result = result + self.reqprotocol + "://"
        if self.user:
            result = result + self.user
            if self.passwd:
                result = result + ":" + self.passwd
            result = result + "@"
        result = result + self.domain
        result = result + self.url + " "
        result = result + self.protocol + "/"
        result = result + self.version
        return result

if __name__ == "__main__":
    # These are the only format requests we accept.
    # All others are rejected
    requests = [
        "BIBBLE foo://toor:[email protected]/bla?this&that=other PROTO/3.3",
        "BIBBLE foo://[email protected]/bla?this&that=other PROTO/3.3",
        "BIBBLE foo://server.bigcompany.com/bla?this&that=other PROTO/3.3",
        "BIBBLE foo://server.bigcompany.com/ PROTO/3.3",
        "foo://server.bigcompany.com/ PROTO/3.3"
    ]
    for REQ in requests:
        print "Parsing request:", REQ
        try:
            foo = requestLine(REQ)
        except "BadRequest":
            foo = "Line is not parseable - does not match:\nMETHOD proto://(user(:passwd)?@)?domain/url proto/ver"
        print foo
        print