hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "e kocbiyik (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (HTTPCLIENT-1722) file upload with MultipartEntityBuilder "Software caused connection abort: socket write error"
Date Wed, 17 Feb 2016 08:59:18 GMT

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1722?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

e kocbiyik closed HTTPCLIENT-1722.
----------------------------------
    Resolution: Duplicate

> file upload with MultipartEntityBuilder "Software caused connection abort: socket write
error"
> ----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1722
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1722
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient, HttpMime
>            Reporter: e kocbiyik
>
> I am trying file upload with httpPost request (by MultipartEntityBuilder) in java. But
i get a Software caused connection abort: socket write error.
> Here is my httpPost body (in wireShark)
> ------WebKitFormBoundaryWphJNFngxYSpEvNO
> Content-Disposition: form-data; name="csrf_token"
> csrf:sjwzV6dOZaNFwc0jWVrNNcFvhM7uv3BK00vZ0hCgEUzi2cG7r7Arx0Q3UZKlXeaR
> ------WebKitFormBoundaryWphJNFngxYSpEvNO
> Content-Disposition: form-data; name="imagefilename"; filename="HG255s-10V100R001C163B023_main.bin"
> Content-Type: application/octet-stream
> ²qz‹ÁOOõMÓâg‘Ç`:----This area is file's binary code------Êëá‡/oåup
> here is my code:
>  File file = new File(filePath);
>             String message = csrf_token;
>             MultipartEntityBuilder builder = MultipartEntityBuilder.create();
>             builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
>             builder.addBinaryBody("imagefilename", file, ContentType.DEFAULT_BINARY,
file.getName());
>             builder.addTextBody("csrf_token", message, ContentType.DEFAULT_BINARY);
> //
>             HttpEntity entity = builder.build();
>             httpPost.setEntity(entity);
>             HttpResponse response = httpClient.execute(httpPost);
> error;
> java.net.SocketException: Software caused connection abort: socket write error
> 	at java.net.SocketOutputStream.socketWrite0(Native Method)
> 	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
> 	at java.net.SocketOutputStream.write(SocketOutputStream.java:159)
> 	at org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:181)
> 	at org.apache.http.impl.conn.LoggingSessionOutputBuffer.write(LoggingSessionOutputBuffer.java:74)
> 	at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:115)
> 	at org.apache.http.entity.mime.content.FileBody.writeTo(FileBody.java:121)
> 	at org.apache.http.entity.mime.AbstractMultipartForm.doWriteTo(AbstractMultipartForm.java:134)
> 	at org.apache.http.entity.mime.AbstractMultipartForm.writeTo(AbstractMultipartForm.java:157)
> 	at org.apache.http.entity.mime.MultipartFormEntity.writeTo(MultipartFormEntity.java:103)
> 	at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:96)
> 	at org.apache.http.impl.client.EntityEnclosingRequestWrapper$EntityWrapper.writeTo(EntityEnclosingRequestWrapper.java:108)
> 	at org.apache.http.impl.entity.EntitySerializer.serialize(EntitySerializer.java:117)
> 	at org.apache.http.impl.AbstractHttpClientConnection.sendRequestEntity(AbstractHttpClientConnection.java:265)
> 	at org.apache.http.impl.conn.AbstractClientConnAdapter.sendRequestEntity(AbstractClientConnAdapter.java:224)
> 	at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:237)
> 	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:122)
> 	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:647)
> 	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
> 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
> 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
> 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message