Re: Uploading files to http server
Re: Uploading files to http server
- Subject: Re: Uploading files to http server
- From: Mark Thomas <email@hidden>
- Date: Thu, 29 Jun 2006 19:48:53 +0100
- Organization: Coderus Ltd
Thanks, I did start having a look using :-)
sudo tcpdump -XXX -i en0 tcp
But I presently cannot see how you can increase the capture size as max'ing
out at 96 bytes - any thoughts how to increase this ?, as I would like to
see the whole packet, doing man tcpdump doesn't give any clues.
I tried your
Mark-Thomas-Computer:~ coderus$ sudo tcpdump -Atq -s 0 192.168.1.2
tcpdump: parse error
Mark.
> Hi Mark - the best thing to do is peek for yourself at what's
> happening in the particular connection you're using. The contents of
> a POST can vary depending on header flags set by the client, and on
> what the particular recipient expects to see. For instance sometimes
> the contents are a single file and sometimes it is multi-part.
>
> Use tcpdump which comes standard with your Mac. Assuming your host (a
> router if I recall from your earlier post) is at 192.168.1.1:
>
> sudo tcpdump -Atq -s 0 192.168.1.1
>
> Will probably get you a nice peek at all the traffic coming to and
> fro. "Exercise" your post to see exactly what it looks like under
> the hood.
>
> Daniel
>
>
> On Jun 29, 2006, at 12:47 PM, Mark Thomas wrote:
>
>> Hi,
>> I was wondering if anybody has any pointers on what actually is
>> happening
>> under the hood in HTTP POST land, Are just the contents just
>> sent ?, or
>> encoded in some fashion. Or is just a
>>
>> HTTP POST Header stuff
>> And then
>> Filename=<filename>&sendfile=<contents-of-file>
>>
>> Just got my WWDC ticket so see you all there.
>>
>> Thanks for any pointers
>> Mark.
>>
>> ------------------------------------------
>>
>> Thanks for the pointers, Sorry I should have not been vague on my api
>> reference but if I wanted to roll my own, as I had to revert to
>> writing my
>> own URL class to get around bugs in earlier OS releases using CF :-
>> (, I'm
>> hoping to throw this away in the next major release because mostly
>> everything which was an issue for us is now sorted
>>
>> But in the meantime,
>>
>> I've look at the rfc, and it wasn't 100% clear on what is needed
>> to do,
>> should I encode the file contents when I send it up, as was hoping
>> I could
>> just send the binary data, but I guess it won't be that straight
>> forward.
>>
>> As the input tags just says
>>
>> <input type='file' name='filename' id="filename" size='56'>
>>
>> but I assume more than 56 bytes are actually uploaded though.
>>
>> Thanks
>> Mark.
>>
>>> This is typically done with a POST or PUT HTTP request; the server
>>> needs to be configured to handle the request, and the server
>>> determines which kind of request is needed.
>>>
>>> On the client side, you can either use NSURLRequest + NSURLConnection
>>> or CFHTTPMessage + CFHTTPStream to get the work done, depending on
>>> which library you'd rather work with and what features you need. The
>>> NS classes require Objective-C and provide caching, automatic proxy
>>> configuration, and authentication support. The CF pieces have no
>>> Objective-C dependency and require some extra code to get proxies and
>>> authentication working. In either case, you just need to set the
>>> request's method to POST (or PUT, depending on the server), and then
>>> supply the data to be uploaded. The uploaded data can be specified
>>> either as data in memory or as a stream to be opened and read as the
>>> POST is transmitted.
>>>
>>> Hope that helps,
>>> REW
>>>
>>>
>>> On Jun 26, 2006, at 10:04 AM, Mark Thomas wrote:
>>>
>>>> Hi,
>>>> Does anybody know, how you would go about uploading files to a
>>>> http server
>>>> programmatically. I understand via html page marking an input field
>>>> as type
>>>> file, which is POST'ed via the action field.
>>>>
>>>> I understand that all this does it load the file contents and then
>>>> sets
>>>> this for the data of the field in the POST request - I think, does
>>>> this
>>>> sound right or am I missing something more basic here. Are there
>>>> also any
>>>> API's which do this as I see the basic ones, but nothing which is
>>>> file based
>>>> I think.
>>>>
>>>> I need to do this as I need to upload a firmware file to router
>>>> which is
>>>> running a http server to receive the file and then apply it.
>>>>
>>>> Thanks for any help and guidance.
>>>>
>>>> Thanks
>>>> Mark.
>>>>
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Macnetworkprog mailing list (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> 40apple.com
>>>>
>>>> This email sent to email@hidden
>>>
>>>
>>>
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Macnetworkprog mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> sweater.com
>>
>> This email sent to email@hidden
>
>
>
_______________________________________________
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