Skip to content

Commit b514735

Browse files
Likitha ShettyPrachi Damle
authored andcommitted
[EC2 Query API] AuthorizeSecurityGroupIngress fails with 'Server.InternalError 431 Invalid protocol' error.
https://reviews.apache.org/r/8468 Before making the AuthorizeSecurityGroupIngress CloudStack API call, parse the string arguments 'FromPort' and 'ToPort' as an integer.
1 parent bea669d commit b514735

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

awsapi/src/com/cloud/bridge/service/EC2RestServlet.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,11 +762,13 @@ private void authorizeSecurityGroupIngress( HttpServletRequest request, HttpServ
762762
else break;
763763

764764
String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort" );
765-
if (null != fromPort && 0 < fromPort.length) perm.setProtocol( fromPort[0] );
765+
if ( null != fromPort && 0 < fromPort.length)
766+
perm.setFromPort( Integer.parseInt( fromPort[0]));
766767

767768
String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort" );
768-
if (null != toPort && 0 < toPort.length) perm.setProtocol( toPort[0] );
769-
769+
if ( null != toPort && 0 < toPort.length)
770+
perm.setToPort( Integer.parseInt( toPort[0]));
771+
770772
// -> list: IpPermissions.n.IpRanges.m.CidrIp
771773
int mCount = 1;
772774
do

0 commit comments

Comments
 (0)