How do you upload file with HTTP - and do not translate CRLF to CR.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How do you upload file with HTTP - and do not translate CRLF to CR.

Terry Raymond
Hi

I have a web application that uploads a file using the
HTTP file widget. The problem I am having is that VW translates
the CRLF to CRs according to its normal file stream behavior.

However, I don't want this done. This is a file transfer,
I would like to simply take the received stream and write
it to a file with minimal processing. Has anyone done this?

Thanks.

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How do you upload file with HTTP - and do not translate CRLFto CR.

Kogan, Tamara
You may consider to use your HttpBuildHandler class and change the stream for attachments.
I attached an example how to specify your HttpBuildHandler in HttpReadingOptions. See #testReadingAttachments

The code is based on vw77.

Tamara Kogan
Smalltalk development,
Cincom Systems
 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Terry Raymond
> Sent: Monday, October 04, 2010 5:15 PM
> To: VWNC
> Subject: [vwnc] How do you upload file with HTTP - and do not
> translate CRLFto CR.
>
> Hi
>
> I have a web application that uploads a file using the
> HTTP file widget. The problem I am having is that VW translates
> the CRLF to CRs according to its normal file stream behavior.
>
> However, I don't want this done. This is a file transfer,
> I would like to simply take the received stream and write
> it to a file with minimal processing. Has anyone done this?
>
> Thanks.
>
> Terry
>  
> ===========================================================
> Terry Raymond
> Crafted Smalltalk
> 80 Lazywood Ln.
> Tiverton, RI  02878
> (401) 624-4517      [hidden email]
> <http://www.craftedsmalltalk.com>
> ===========================================================
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

1004HttpBuilderExtension.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How do you upload file with HTTP - and do not translate CRLFto CR.

Terry Raymond
Tamara

Thank you for your reply. Focusing on the HttpBuildHandler
was quite helpful.

I ended up changing #decodeBody: so it would not decode the
body if it was a file attachment.

decodeBody: aBody

        | ce |
        (aBody isMultipart
                or: [ aBody isBinary
                        or: [aBody byteSource isNil
                                or: [aBody parent isFileAttachment ]]]) ifTrue: [^aBody].
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        (((ce := aBody parent contentEncoding) notNil
                        and: [ce notEmpty])
                                or: [self decodeContents not])
                ifFalse: [self setBodySource: aBody]

Terry
 
===========================================================
Terry Raymond
Crafted Smalltalk
80 Lazywood Ln.
Tiverton, RI  02878
(401) 624-4517      [hidden email]
<http://www.craftedsmalltalk.com>
===========================================================

> -----Original Message-----
> From: Kogan, Tamara [mailto:[hidden email]]
> Sent: Monday, October 04, 2010 5:58 PM
> To: Terry Raymond; VWNC
> Subject: RE: [vwnc] How do you upload file with HTTP - and do not translate CRLFto CR.
>
> You may consider to use your HttpBuildHandler class and change the stream for attachments.
> I attached an example how to specify your HttpBuildHandler in HttpReadingOptions. See
> #testReadingAttachments
>
> The code is based on vw77.
>
> Tamara Kogan
> Smalltalk development,
> Cincom Systems
>
>
> > -----Original Message-----
> > From: [hidden email]
> > [mailto:[hidden email]] On Behalf Of Terry Raymond
> > Sent: Monday, October 04, 2010 5:15 PM
> > To: VWNC
> > Subject: [vwnc] How do you upload file with HTTP - and do not
> > translate CRLFto CR.
> >
> > Hi
> >
> > I have a web application that uploads a file using the
> > HTTP file widget. The problem I am having is that VW translates
> > the CRLF to CRs according to its normal file stream behavior.
> >
> > However, I don't want this done. This is a file transfer,
> > I would like to simply take the received stream and write
> > it to a file with minimal processing. Has anyone done this?
> >
> > Thanks.
> >
> > Terry
> >
> > ===========================================================
> > Terry Raymond
> > Crafted Smalltalk
> > 80 Lazywood Ln.
> > Tiverton, RI  02878
> > (401) 624-4517      [hidden email]
> > <http://www.craftedsmalltalk.com>
> > ===========================================================
> >
> > _______________________________________________
> > vwnc mailing list
> > [hidden email]
> > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> >

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc