You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/06/12 23:29:20 UTC

[jira] [Commented] (THRIFT-3851) Golang thrift continually adds the x/thrift content type

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

ASF GitHub Bot commented on THRIFT-3851:
----------------------------------------

GitHub user connorgorman opened a pull request:

    https://github.com/apache/thrift/pull/1026

    THRIFT-3851

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/connorgorman/thrift master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/1026.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1026
    
----
commit 1265a71216a439f8361373233c179e151222c681
Author: Connor Gorman <cg...@medallia.com>
Date:   2016-06-12T22:52:07Z

    THRIFT-3851

----


> Golang thrift continually adds the x/thrift content type 
> ---------------------------------------------------------
>
>                 Key: THRIFT-3851
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3851
>             Project: Thrift
>          Issue Type: Bug
>            Reporter: Connor Gorman
>
> {code}
> func (p *THttpClient) Flush() error {
> 	// Close any previous response body to avoid leaking connections.
> 	p.closeResponse()
> 	req, err := http.NewRequest("POST", p.url.String(), p.requestBuffer)
> 	if err != nil {
> 		return NewTTransportExceptionFromError(err)
> 	}
> 	p.header.Add("Content-Type", "application/x-thrift")
> 	req.Header = p.header
> 	response, err := p.client.Do(req)
> 	if err != nil {
> 		return NewTTransportExceptionFromError(err)
> 	}
> 	if response.StatusCode != http.StatusOK {
> 		// Close the response to avoid leaking file descriptors. closeResponse does
> 		// more than just call Close(), so temporarily assign it and reuse the logic.
> 		p.response = response
> 		p.closeResponse()
> 		// TODO(pomack) log bad response
> 		return NewTTransportException(UNKNOWN_TRANSPORT_EXCEPTION, "HTTP Response code: "+strconv.Itoa(response.StatusCode))
> 	}
> 	p.response = response
> 	return nil
> }
> {code}
> {code} 	p.header.Add("Content-Type", "application/x-thrift") {code}
> This adds the content-type to the httpClient which is then assigned to every request. This causes the header to get larger and larger causing some servers to reject requests due to header size (e.g. Apache Aurora)



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