[squeak-dev] Re: Using WebClient

Andreas Raab andreas.raab at gmx.de
Wed Jun 2 03:31:55 UTC 2010


Hi Germán -

Sorry I missed this discussion earlier. First of all, looking at the 
page should give you all the information you need to derive the basic 
parameters for the html form submission (see [1]). The "action" 
attribute of the form tag will tell you the URL for the request; the 
"method" attribute will tell you what HTTP method to use (GET/POST; 
default is GET) and the "enctype" attribute what encoding to use 
(default is application/x-www-form-urlencoded).

Armed with this information you can set up your HTTP request properly. 
I've started to add utility methods for this in WebClient (fetch the 
latest version straight from http://squeaksource.com/WebClient). With 
this version you can now do some simple form submissions like Googling 
for Squeak in English:

	WebClient
		htmlSubmit: 'http://www.google.com/search'
		fields: {
			'hl' -> 'en'.
			'q' -> 'Squeak'
		}

Unfortunately, it currently doesn't support multipart/form-data since I 
have no experience with these encodings. If you figure it out, drop me a 
note (or better: some code :-) for how to do it, and I'll add it.

[1] http://www.google.com/search?q=html+form+tag

Cheers,
   - Andreas

On 6/1/2010 6:48 PM, Germán Arduino wrote:
> Thanks by the response Bill.
>
> I investigated a bit more and found Tamper, a firefox extension to
> view and modify HTTP/HTTPS headers and post parameters.
>
> Then I discovered that this form that I need to deal with, use
> multipart/form-data and I must deal also with boundaries
> (http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html). I'm reading
> a bit more to fully understand this stuff and may be the WebClient is
> usable as is or I can modify it to this sort of use. I will comment
> when have more news.
>
> Thanks again by the help.
>
> Germán.
>
>
>
> 2010/6/1 Schwab,Wilhelm K<bschwab-ZyIy6kptTSJkZI0wD67Jjg at public.gmane.org>:
>> You can do a simple "man in the middle attack" on yourself.  One approach would be to set up your own web server, serve the page with the form to a "real" browser and see what it sends when you submit the form.  There is probably also a way to do it with a proxy of some sort, either off the shelf or one you write to log traffic both ways, and then you quickly get a picture of how the conversation works.  A network sniffer might be another option.
>>
>> I have had to do things like this with either network or serial port traffic at various times.  A few years back, an engineer with a medical device manufacturer was late delivering something that we happened to need at a time that was inconvenient for him.  The solution: blame the confusion on the customer (me), of course, and hope that he could later give us something that might make things "easier" on us (which would be a working version of their new software).  It got pretty ridiculous shortly before he had to admit that it didn't work.  The funny thing was that their demo program for the "new protocol" was using something that looked exactly like the old one :)  I was able to show that because I wrote a replacement for their device and connected their program to it: it was obviously not doing what he was claiming.
>>
>> Bill
>>
>> ________________________________________
>> From: pharo-project-bounces-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org [pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of Germán Arduino [garduino-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org]
>> Sent: Monday, May 31, 2010 1:39 PM
>> To: Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
>> Cc: The general-purpose Squeak developers list
>> Subject: Re: [Pharo-project] Using WebClient
>>
>> Talking of post method, I tried to capture it with Firebug to
>> understand what data post with WebClient, but no way until now.
>>
>> Exist some trick to obtain the exact content of the data to post only
>> debuggin the web page?
>>
>> Cheers.
>>
>>
>> 2010/5/29 Germán Arduino<garduino-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>:
>>> I think that is a post method in this case, but can't make it work (yet).
>>>
>>> 2010/5/29 Schwab,Wilhelm K<bschwab-ZyIy6kptTSJkZI0wD67Jjg at public.gmane.org>:
>>>> It's been a long time, but won't the button cause the browser to send a post or get (whichever action is specified in the form) to the server?  It might be enough to decide the content of that and send it over the socket.  I am probably thinking in CGI terms, which might not be what you need.
>>>>
>>>>
>>>> ________________________________________
>>>> From: pharo-project-bounces-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org [pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of Stéphane Ducasse [stephane.ducasse at inria.fr]
>>>> Sent: Saturday, May 29, 2010 4:14 PM
>>>> To: Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
>>>> Subject: Re: [Pharo-project] Using WebClient
>>>>
>>>> if you get answers from squeak-dev let us know.
>>>>
>>>>
>>>> Stef
>>>>
>>>>
>>>> On May 29, 2010, at 10:02 PM, Germán Arduino wrote:
>>>>
>>>>> Hi:
>>>>>
>>>>> I'm trying to automate some operations on a web page that requires
>>>>> authentication.
>>>>>
>>>>> I managed to arrive to the form that I need to process, authenticated
>>>>> without problems.
>>>>>
>>>>> But I can't figure out how to process the button (is a button of this type:
>>>>>
>>>>> <input class="lButton" style="" name="submit_search"
>>>>> value="Create File" type="submit">  )  to execute the Create File action.
>>>>>
>>>>> The form have two dates (that I can calculate and fill in) but I can't
>>>>> to imagine how to process the submit button programmatically.
>>>>>
>>>>> Any hint will be appreciated.
>>>>>
>>>>> Cheers.
>>>>>
>>>>> --
>>>>> =================================================
>>>>> Germán S. Arduino<gsa @ arsol.net>     Twitter: garduino
>>>>> Arduino Software&  Web Hosting   http://www.arduinosoftware.com
>>>>> PasswordsPro  http://www.passwordspro.com
>>>>> =================================================
>>>>>
>>>>> _______________________________________________
>>>>> Pharo-project mailing list
>>>>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
>>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>> _______________________________________________
>>>> Pharo-project mailing list
>>>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
>>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>>
>>>
>>>
>>>
>>> --
>>> =================================================
>>> Germán S. Arduino<gsa @ arsol.net>     Twitter: garduino
>>> Arduino Software&  Web Hosting   http://www.arduinosoftware.com
>>> PasswordsPro  http://www.passwordspro.com
>>> =================================================
>>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project-bM+ny+RY8h+a+bCvCPl5/gCzwTLBPCX0 at public.gmane.org
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>




More information about the Squeak-dev mailing list