help
help
- Subject: help
- From: florian <email@hidden>
- Date: Fri, 13 Jan 2012 12:05:31 -0800
On 13 Jan 2012, at 12:04, email@hidden wrote:
> Send Macnetworkprog mailing list submissions to
> email@hidden
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/macnetworkprog
> or, via email, send a message with subject or body 'help' to
> email@hidden
>
> You can reach the person managing the list at
> email@hidden
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Macnetworkprog digest..."
>
>
> Today's Topics:
>
> 1. Re: File Uploading to HTTP server using CFHTTPMessage API
> fails (Jens Alfke)
> 2. Re: File Uploading to HTTP server using CFHTTPMessage API
> fails (Jens Alfke)
> 3. Re: File Uploading to HTTP server using CFHTTPMessage API
> fails (DEBAPRIO BANIK)
> 4. Re: File Uploading to HTTP server using CFHTTPMessage API
> fails (Jens Alfke)
> 5. Re: File Uploading to HTTP server using CFHTTPMessage API
> fails (DEBAPRIO BANIK)
> 6. Re: File Uploading to HTTP server using CFHTTPMessage API
> fails (Quinn "The Eskimo!")
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 12 Jan 2012 21:29:06 -0800
> From: Jens Alfke <email@hidden>
> Subject: Re: File Uploading to HTTP server using CFHTTPMessage API
> fails
> To: DEBAPRIO BANIK <email@hidden>
> Cc: Mac Network Programming <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
> Skipped content of type multipart/alternative-------------- next part --------------
> A non-text attachment was scrubbed...
> Name: smime.p7s
> Type: application/pkcs7-signature
> Size: 4885 bytes
> Desc: not available
> Url : http://lists.apple.com/mailman/private/macnetworkprog/attachments/20120112/e31f72b5/smime.bin
>
> ------------------------------
>
> Message: 2
> Date: Thu, 12 Jan 2012 21:55:40 -0800
> From: Jens Alfke <email@hidden>
> Subject: Re: File Uploading to HTTP server using CFHTTPMessage API
> fails
> To: DEBAPRIO BANIK <email@hidden>
> Cc: Mac Network Programming <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
>
> On Jan 12, 2012, at 9:37 PM, DEBAPRIO BANIK wrote:
>
>> I cannot point the input stream to a file. The request body should have the bytes for the XML followed by the file data bytes.
>> Can i create a temporary file appending XML bytes and file data bytes and the point the input stream to that file.
>
> [First, please reply to the list, not just to me.]
>
> The option you suggest will work, but it‚ll be slow for large files. If you don‚t care about large files, you might as well just assemble the response data in memory and set it as the HTTPBody property.
>
> If you do need to handle huge files and don‚t want to copy the file, you could create your own NSInputStream subclass that when read first returns the XML data, and then opens a private input stream on the file and returns data from that.
>
> ˜Jens
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.apple.com/mailman/private/macnetworkprog/attachments/20120112/8e69edf4/attachment.html
>
> ------------------------------
>
> Message: 3
> Date: Fri, 13 Jan 2012 11:37:11 +0530
> From: DEBAPRIO BANIK <email@hidden>
> Subject: Re: File Uploading to HTTP server using CFHTTPMessage API
> fails
> To: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
> Hi Jens,
>
> Unable to find any API's for setting the headers of the http request with
> NSURL.
> Why API's for uploading the file to the server needs to go through
> NSInputStream? Its output from client perspective. So
> isn't the API's are bit odd !
>
> If you have any sample code where a http request is created, body is set
> and send to the server, will be great help.
>
> With Regards
>
> On Fri, Jan 13, 2012 at 11:25 AM, Jens Alfke <email@hidden> wrote:
>
>>
>> On Jan 12, 2012, at 9:37 PM, DEBAPRIO BANIK wrote:
>>
>> I cannot point the input stream to a file. The request body should have
>> the bytes for the XML followed by the file data bytes.
>> Can i create a temporary file appending XML bytes and file data bytes and
>> the point the input stream to that file.
>>
>>
>> [First, please reply to the list, not just to me.]
>>
>> The option you suggest will work, but it‚ll be slow for large files. If
>> you don‚t care about large files, you might as well just assemble the
>> response data in memory and set it as the HTTPBody property.
>>
>> If you do need to handle huge files and don‚t want to copy the file, you
>> could create your own NSInputStream subclass that when read first returns
>> the XML data, and then opens a private input stream on the file and returns
>> data from that.
>>
>> ˜Jens
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.apple.com/mailman/private/macnetworkprog/attachments/20120113/4331adc4/attachment.html
>
> ------------------------------
>
> Message: 4
> Date: Thu, 12 Jan 2012 22:43:36 -0800
> From: Jens Alfke <email@hidden>
> Subject: Re: File Uploading to HTTP server using CFHTTPMessage API
> fails
> To: DEBAPRIO BANIK <email@hidden>
> Cc: email@hidden
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
>
> On Jan 12, 2012, at 10:07 PM, DEBAPRIO BANIK wrote:
>
>> Unable to find any API's for setting the headers of the http request with NSURL.
>
> Look at NSMutableURLRequest. It has methods like -setValue:forHTTPHeaderField:.
>
>> Why API's for uploading the file to the server needs to go through NSInputStream? Its output from client perspective. So
>> isn't the API's are bit odd !
>
> Because the connection needs to _read_ from the stream to send the data to the socket.
> Think of it this way: The NSURLConnection is on the other side of the stream from you. From your perspective you‚d write to it, but from its perspective it reads from it.
>
>> If you have any sample code where a http request is created, body is set and send to the server, will be great help.
>
>
> Apple‚s docs have plenty of code like that. Read the „URL Loading System Programming Guide‰.
>
> ˜Jens
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.apple.com/mailman/private/macnetworkprog/attachments/20120112/b7ad7108/attachment.html
>
> ------------------------------
>
> Message: 5
> Date: Fri, 13 Jan 2012 13:01:10 +0530
> From: DEBAPRIO BANIK <email@hidden>
> Subject: Re: File Uploading to HTTP server using CFHTTPMessage API
> fails
> To: Jens Alfke <email@hidden>
> Cc: email@hidden
> Message-ID:
> <email@hidden>
> Content-Type: text/plain; charset="windows-1252"
>
> I have implemented the download logic already and we connect to the same
> url for downloading as well.
> For downloading i use 'GET'. So in this case should the upload be a 'PUT
> request?'
>
> On Fri, Jan 13, 2012 at 12:37 PM, Jens Alfke <email@hidden> wrote:
>
>>
>> On Jan 12, 2012, at 11:00 PM, DEBAPRIO BANIK wrote:
>>
>> One last thing. For uploading file to http server, can the http method be
>> 'GET'? Or should it be always 'PUT'?
>>
>>
>> Most likely POST. But if the URL you‚re sending the request to becomes the
>> URL from which that file can be retrieved later, that‚s a PUT.
>>
>> ˜Jens
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://lists.apple.com/mailman/private/macnetworkprog/attachments/20120113/c0d25c71/attachment.html
>
> ------------------------------
>
> Message: 6
> Date: Fri, 13 Jan 2012 13:56:15 +0000
> From: "Quinn \"The Eskimo!\"" <email@hidden>
> Subject: Re: File Uploading to HTTP server using CFHTTPMessage API
> fails
> To: Mac Network Programming <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=windows-1252
>
>
> On 13 Jan 2012, at 05:55, Jens Alfke wrote:
>
>> [lots of good advice]
>>
>> If you do need to handle huge files and don‚t want to copy the file, you could create your own NSInputStream subclass that when read first returns the XML data, and then opens a private input stream on the file and returns data from that.
>
> This is the right idea, but you can't implement it as an NSInputStream subclass because there's no supported way to implemented an NSInputStream subclass that runs asynchronously. Instead we recommend you use a stream pair, as shown by the POST code in the SimpleURLConnections sample code.
>
> <http://developer.apple.com/library/ios/#samplecode/SimpleURLConnections/>
>
> Share and Enjoy
> --
> Quinn "The Eskimo!" <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Macnetworkprog mailing list
> email@hidden
> http://lists.apple.com/mailman/listinfo/macnetworkprog
>
> End of Macnetworkprog Digest, Vol 9, Issue 3
> ********************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden