Re: wget request methods GET vs. POST vs. PUT vs. etc.

From: DENNIS BYRNE <asdcb1@uaa.alaska.edu>
Date: Sun Mar 28 2004 - 22:06:36 AKST

in my defense=3A

=5Bdbyrne=4025-128-58-66 part3=5D=24 man wget =7C grep post
       =C2=B7 Save the server headers with the file=2C perhaps for post=
-
processing=2E

what version do you have=3F I have GNU Wget 1=2E8=2E2=2E

Dennis Byrne

----- Original Message -----
From=3A Troy Melhase =3Ctroy=40gci=2Enet=3E
Date=3A Sunday=2C March 28=2C 2004 8=3A53 pm
Subject=3A Re=3A wget request methods GET vs=2E POST vs=2E PUT vs=2E etc=2E=

=3E On Sunday 28 March 2004 07=3A59 pm=2C DENNIS BYRNE wrote=3A
=3E =3E wget http=3A//url -postvars searchterm =22alaska=22 display =22ci=
ties=22
=3E =

=3E from the wget man page on my system=3A
=3E =

=3E --post-data=3Dstring
=3E --post-file=3Dfile
=3E Use POST as the method for all HTTP requests and send =

=3E the specified
=3E data in the request body=2E =22--post-data=22 sends string=
 =

=3E as data=2C
=3E whereas =22--post-file=22 sends the contents of file=2E =

=3E Other than that=2C
=3E they work in exactly the same way=2E
=3E =

=3E Please be aware that Wget needs to know the size of the =

=3E POST data
=3E in advance=2E Therefore the argument to =22--post-file=22 =

=3E must be a reg-
=3E ular file=3B specifying a FIFO or something like =

=3E /dev/stdin won=27t
=3E work=2E It=27s not quite clear how to work around this =

=3E limitation inherent in HTTP/1=2E0=2E Although HTTP/1=2E1 =

=3E introduces chunked trans-
=3E fer that doesn=27t require knowing the request length in =

=3E advance=2C a
=3E client can=27t use chunked unless it knows it=27s talking =

=3E to an
=3E HTTP/1=2E1 server=2E And it can=27t know that until it =

=3E receives a
=3E response=2C which in turn requires the request to have =

=3E been completed
=3E -- a chicken-and-egg problem=2E
=3E =

=3E Note=3A if Wget is redirected after the POST request is =

=3E completed=2C it
=3E will not send the POST data to the redirected URL=2E =

=3E This is because
=3E URLs that process POST often respond with a redirection =

=3E to a regu-
=3E lar page (although that=27s technically disallowed)=2C =

=3E which does not
=3E desire or accept POST=2E It is not yet clear that this =

=3E behavior is
=3E optimal=3B if it doesn=27t work out=2C it will be changed=2E=

=3E =

=3E This example shows how to log to a server using POST =

=3E and then pro-
=3E ceed to download the desired pages=2C presumably only =

=3E accessible to
=3E authorized users=3A
=3E =

=3E =23 Log in to the server=2E This can be done only =

=3E once=2E wget --save-cookies cookies=2Etxt =5C
=3E --post-data =27user=3Dfoo=26password=3Dbar=27 =
=5C
=3E http=3A//server=2Ecom/auth=2Ephp
=3E =

=3E =23 Now grab the page or pages we care about=2E
=3E wget --load-cookies cookies=2Etxt =5C
=3E -p http=3A//server=2Ecom/interesting/article=2E=
php
=3E =

=3E =

=3E -- =

=3E Troy Melhase=2C troy=40gci=2Enet
=3E --
=3E I am the Christian the Devil warned you about=2E
=3E =

=3E =

=3E =

=3E

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sun Mar 28 22:06:19 2004

This archive was generated by hypermail 2.1.8 : Sun Mar 28 2004 - 22:06:19 AKST