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

ASF GitHub Bot commented on TS-3447:
------------------------------------

Github user SolidWallOfCode commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/181#discussion_r26573116
  
    --- Diff: plugins/experimental/buffer_upload/buffer_upload.cc ---
    @@ -753,6 +753,15 @@ attach_pvc_plugin(TSCont /* contp ATS_UNUSED */, 
TSEvent event, void *edata)
             memcpy(replacement_host_str, host_hdr_str_val, 
host_hdr_str_val_len);
             TSDebug(DEBUG_TAG, "Adding host to request url: %s", 
replacement_host_str);
     
    +        const char *colon = strstr(replacement_host_str, ":");
    +        if (colon != NULL && colon + 1 != NULL) {
    +          int port_str_val = atoi(colon + 1);
    +
    +          if (port_str_val != 80) {
    +            TSUrlPortSet(req_bufp, url_loc, port_str_val);
    +          }
    +          host_hdr_str_val_len -= strlen(colon);
    --- End diff --
    
    Why not {{host_hdr_str_val_len = colon - host_hdr_str_val_len;}} if you 
want to clip at the colon?


> Failing to remap POST requests if buffer_upload plugin is enabled and Host 
> header contains port number
> ------------------------------------------------------------------------------------------------------
>
>                 Key: TS-3447
>                 URL: https://issues.apache.org/jira/browse/TS-3447
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Plugins
>            Reporter: Ethan Lai
>             Fix For: 6.0.0
>
>
> We've experienced POST request mapping issues in some situation while 
> buffer_upload plugin is enabled.
> After cross reference, we found that Host header with port value cannot be 
> mapped correctly.
> Sample remap.config:
> {quote}
>   map http://www.example.com/       http://127.0.0.1:8001/
>   map http://www.example.com:8080/  http://127.0.0.1:8001/
> {quote}
> Sample plugin.config
> {quote}
>   buffer_upload.so conf/trafficserver/buffer_upload/buffer_upload.config
> {quote}
> Sample buffer_upload.config
> {quote}
>   use_disk_buffer         1
>   convert_url             0
>   chunk_size              1024
>   url_list_file           conf/trafficserver/buffer_upload/url_list.config
>   base_dir                var/buffer_upload_tmp
>   subdir_num              100
>   thread_num              10
>   mem_buffer_size         51000
> {quote}
> Sample buffer upload url_list.config
> {quote}
>   http://www.example.com/upload/upload.php
> {quote}
> Sample cmds & responses
> {quote}
>   curl http://www.example.com/test.php -X POST -d 'blah'
>   > map ok
>   curl http://www.example.com:8080/test.php
>   > map ok
>   curl http://www.example.com:8080/test.php -X POST -d 'blah'
>   > 404 Not Found! (Not Found on Accelerator)
> {quote}
> I've tried to correct this and will update with pull request shortly, thanks



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

Reply via email to