[ 
https://issues.apache.org/jira/browse/TS-1570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14234423#comment-14234423
 ] 

Alan M. Carroll edited comment on TS-1570 at 12/4/14 6:11 PM:
--------------------------------------------------------------

I found a few issues with the new patch. The two main ones were

1) You must not `strlen` on a MIME field, they may not be NULL terminated. It's 
also pointless since the get value call returns the length, you can just use 
that directly.

2) The point of using ats_ip_parse is to not do the address parsing again, so 
it's not useful to do both.

I've attached a suggested alternate patch. The primary difference is that I've 
tweaked ats_ip_parse to explicitly return the remainder of the input (that 
wasn't parsed as an IP address). I also cleaned up the port processing a bit.  
See what you think.

P.S. It's handier for me if all the patches have the ".diff" extension, e.g. 
"patch-3.diff" vs. "patch.diff3". Thanks!


was (Author: amc):
I found a few issues with the new patch. The two main ones were

1) You must not `strlen` on a MIME field, they may not be NULL terminated. It's 
also pointless since the get value call returns the length, you can just use 
that directly.

2) The point of using ats_ip_parse is to not do the address parsing again, so 
it's not useful to do both.

I've attached a suggested alternate patch. The primary difference is that I've 
tweaked ats_ip_parse to explicitly return the remainder of the input (that 
wasn't parsed as an IP address). I also cleaned up the port processing a bit.  
See what you think.

> remap doesn't reject request whose Host has extra characters after port (like 
> "test.com:80xxx")
> -----------------------------------------------------------------------------------------------
>
>                 Key: TS-1570
>                 URL: https://issues.apache.org/jira/browse/TS-1570
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: HTTP
>    Affects Versions: 3.3.0
>            Reporter: Conan Wang
>            Assignee: Cynthia Gu
>            Priority: Minor
>             Fix For: 5.3.0
>
>         Attachments: patch.diff, patch.diff1, patch.diff2, patch.diff3, 
> ts-1570-amc.diff
>
>
> remap.config:    map http://test.com  http://1.1.1.1
> The request with Host: 'test.com:80xxx' or 'test.com:xxx' will get passed. 
> Such host is not filtered strictly. 
> Just report, didn't have big problem for me though.
> curl http://127.0.0.1:8080/ -H "Host: test.com:80xxx"
> or curl -x 127.0.0.1:8080 http://test.com:80xxx/ -v



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to