Thanks Oleg, but I found the issue...it definitely seems to be a problem on the server side. It turns out someone had reported a similar issue on the mailing list (Bug 20744). Somehow I had missed it in my previous searches. The problem is that whatever package or classes the server is using to handle multipart requests doesn't like the "Content-transfer-encoding" header. So while there could still be an issue with the request generated by HttpClient, I really think it is a server problem in this case.
Thanks in any case for your repsonse! Aaron -----Ursprüngliche Nachricht----- Von: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 25. Juni 2003 20:59 An: Commons HttpClient Project Betreff: RE: Extra newline when using ByteArrayPartSource and FilePart Aaron, I am afraid it is premature to draw such a conclusion. I will double-check that it is not a bug in HttpClient and get back to you as soon as I can. Oleg On Tue, 2003-06-24 at 18:15, Fa. MSG Hr. Liebling wrote: > After looking at the spec, the actual request looks ok (there should be 2 > newlines). any other ideas as to why I'm getting a newline at the beginning > of the uploaded file once it's saved on the server? Unfortunately, I don't > have access to the server or server code to debug it, I can only see the > resulting file. > > Thanks! > > Aaron > > I'm uploading a file from an array of bytes using > ByteArrayPartSource and FilePart. The upload > succeeds, but when I view the file on the server side, > I see that an extra \r\n (^M or newline) has been > preprended to it. > > My code sample is as follows: > > byte[] bytes = baOS.toByteArray(); > > ByteArrayPartSource baPS = > new > ByteArrayPartSource(mpRequest.getFileSystemName(paramName), > bytes); > > FilePart filePart = new FilePart(paramName,baPS); > mppMethod.addPart(filePart); > > From the wire, the request looks like: > > "POST > > /RightSite/ssi4_logged_in?rndn=70518498&operation=import_object&DMW_ON_ERROR > =relogon_http&embedded=true&type=dm_folder&DMW_DOCBASE=muc_d_corp_01&id=0b00 > 91bb80193a03&enableIndex=true&object_name=WACKER-NOC2-Build%2BDeploy-2003041 > 1.doc&a_full_text=FALSE&r_object_type=corp00_o_superdoc&wa_language_code=en_ > US&a_content_type=msw8%3B1&subject=BETA1&doc_format=msw8&title=BETA1&entry=p > rocess_index&automaticIndex=false > HTTP/1.1[\r][\n]" > "accept: application/vnd.ms-excel, application/msword, > application/vnd.ms-powerpoint, image/gif, > image/x-xbitmap, image/jpeg, image/pjpeg, */*[\r][\n]" > "accept-language: de[\r][\n]" > "accept-encoding: gzip, deflate[\r][\n]" > "user-agent: Mozilla/4.0 (compatible; MSIE 6.0; > Windows NT 4.0)[\r][\n]" > "connection: Keep-Alive[\r][\n]" > "cache-control: no-cache[\r][\n]" > "WL-PATH-PREPEND: /extranet[\r][\n]" > "WL-Proxy-SSL: false[\r][\n]" > "X-WebLogic-Force-Cookie: true[\r][\n]" > "WL-Proxy-Client-IP: 193.19.4.32[\r][\n]" > "Proxy-Path-Translated: > /RightSite/ssi4_logged_in[\r][\n]" > "X-WebLogic-Request-ClusterInfo: true[\r][\n]" > "Host: zmucdoc1:8040[\r][\n]" > "Cookie: $Version=0; DMW_AUTHORIZATION=FALSE[\r][\n]" > "Cookie: $Version=0; > jrunsessionid=1056462816518120373; $Path=/[\r][\n]" > "Cookie: $Version=0; storedLocale=en-us; > $Path=/[\r][\n]" > "Cookie: $Version=0; storedDBName=muc_d_corp_01; > $Path=/[\r][\n]" > "Cookie: $Version=0; storedUserName=lieblin-ex; > $Path=/[\r][\n]" > "Cookie: $Version=0; storedDomainName=; > $Path=/[\r][\n]" > "Cookie: $Version=0; > DMW_SESSIONID=2117204380119467_18_1056245705; > $Path=/[\r][\n]" > "Cookie: $Version=0; DMW_DOCBASE=muc_d_corp_01; > $Path=/[\r][\n]" > "Content-Length: 127752[\r][\n]" > "Content-Type: multipart/form-data; > boundary=----------------314159265358979323846[\r][\n]" > "[\r][\n]" > > "----------------314159265358979323846" > "[\r][\n]" > "Content-Disposition: form-data; name=" > > "DMW_FILENAME" > > filename=" > > "WACKER-NOC2-Build+Deploy-20030411.doc" > > "[\r][\n]" > "Content-Type: " > "application/octet-stream" > "[\r][\n]" > "Content-Transfer-Encoding: " > "binary" > "[\r][\n]" > "[\r][\n]" > "[0x11]...binary data here" > > Thanks! > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]