@@ -416,10 +416,12 @@ class CWE(models.Model):
416416
417417class Endpoint (models .Model ):
418418 protocol = models .CharField (null = True , blank = True , max_length = 10 ,
419- help_text = "The communication protocl such as 'http', 'ftp', etc." )
419+ help_text = "The communication protocol such as 'http', 'ftp', etc." )
420420 host = models .CharField (null = True , blank = True , max_length = 500 ,
421421 help_text = "The host name or IP address, you can also include the port number. For example"
422422 "'127.0.0.1', '127.0.0.1:8080', 'localhost', 'yourdomain.com'." )
423+ fqdn = models .CharField (null = True , blank = True , max_length = 500 )
424+ port = models .IntegerField (null = True , blank = True , help_text = "The network port associated with the endpoint." )
423425 path = models .CharField (null = True , blank = True , max_length = 500 ,
424426 help_text = "The location of the resource, it should start with a '/'. For example"
425427 "/endpoint/420/edit" )
@@ -438,14 +440,19 @@ def __unicode__(self):
438440 from urlparse import uses_netloc
439441
440442 netloc = self .host
443+ fqdn = self .fqdn
444+ port = self .port
441445 scheme = self .protocol
442446 url = self .path if self .path else ''
443447 query = self .query
444448 fragment = self .fragment
445449
450+ if port :
451+ netloc += ':%s' % port
452+
446453 if netloc or (scheme and scheme in uses_netloc and url [:2 ] != '//' ):
447454 if url and url [:1 ] != '/' : url = '/' + url
448- if scheme :
455+ if scheme and scheme in uses_netloc and url [: 2 ] != '//' :
449456 url = '//' + (netloc or '' ) + url
450457 else :
451458 url = (netloc or '' ) + url
0 commit comments