Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > get or post?

Reply
Thread Tools

get or post?

 
 
Eric Bednarz
Guest
Posts: n/a
 
      01-26-2010
"Evertjan." <(E-Mail Removed)> writes:

> Scott Sauyet wrote on 25 jan 2010 in comp.lang.javascript:
>
>> "Evertjan." <(E-Mail Removed)> wrote:


>>> The new page can never know if the page request is
>>> 1 a result of a bona fide form-get
>>> or
>>> 2 just from a link contaning an URL with querystring.

>>
>> I'm not sure that is a meaningful distinction. At the HTTP level,
>> both are GET requests, so even the server doesn't distinguish this.

>
> No, they could also be POST requests at ther same time.


I would like an example of an HTTP request that simultaneously uses the
HTTP GET and POST methods.
 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      01-26-2010
Eric Bednarz schreef:
> "Evertjan." <(E-Mail Removed)> writes:
>
>> Scott Sauyet wrote on 25 jan 2010 in comp.lang.javascript:
>>
>>> "Evertjan." <(E-Mail Removed)> wrote:

>
>>>> The new page can never know if the page request is
>>>> 1 a result of a bona fide form-get
>>>> or
>>>> 2 just from a link contaning an URL with querystring.
>>> I'm not sure that is a meaningful distinction. At the HTTP level,
>>> both are GET requests, so even the server doesn't distinguish this.

>> No, they could also be POST requests at ther same time.

>
> I would like an example of an HTTP request that simultaneously uses the
> HTTP GET and POST methods.


Here is one:

<form action="whatever.php?id=12" Method="POST" name="testform">
Firstname: <input type="text" name="firstname">
<input type="submit">
</form>

Then from PHP (whatever.php):
-------------------------------
<pre>
GET contains:
<?php
print_r($_GET);
?>
POST contains:
<?php
print_r($_POST);
?>
</pre>
-------------------------------

It is a bit weird I admit, but it works just fine.


Regards,
Erwin Moller

--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
 
Reply With Quote
 
 
 
 
Scott Sauyet
Guest
Posts: n/a
 
      01-26-2010
On Jan 26, 5:55*am, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.com> wrote:
> Eric Bednarz schreef:
>> I would like an example of an HTTP request that simultaneously uses the
>> HTTP GET and POST methods.

>
> Here is one:
>
> <form action="whatever.php?id=12" Method="POST" name="testform">
> Firstname: <input type="text" name="firstname">
> <input type="submit">
> </form>
> [ ... ]
> It is a bit weird I admit, but it works just fine.


Well, this still is an HTTP POST request. PHP interprets the query
string of the URL as GET variables, but it is not a GET request.

-- Scott
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      01-26-2010
Eric Bednarz wrote on 26 jan 2010 in comp.lang.javascript:

>>> See, there is a way

>>
>> No there is not.


Here you skip the explanation of the above "no ..."

> I read that


my sentence?

> as wanting to know the request method, and I would think
> that a HTTP server cannot resolve a resource and send response headers
> without knowing that.


What HTTP-server [is there such an animal?]?

What Resource?

Why should a server without serverside programming ability [if that is what
you mean by HTTP-server], do anything with the POST content of the request
header?

> and send response headers without knowing that.


The request querystring has no special request or response headers.

The POST content is in the request header, not in the response header.

I think!!!

> I wonder what you read.


Where? In the Header?



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      01-26-2010
Scott Sauyet wrote on 26 jan 2010 in comp.lang.javascript:

> On Jan 26, 5:55am, Erwin Moller
> <Since_humans_read_this_I_am_spammed_too_m...@spam yourself.com> wrote:
>> Eric Bednarz schreef:
>>> I would like an example of an HTTP request that simultaneously uses the
>>> HTTP GET and POST methods.

>>
>> Here is one:
>>
>> <form action="whatever.php?id=12" Method="POST" name="testform">
>> Firstname: <input type="text" name="firstname">
>> <input type="submit">
>> </form>
>> [ ... ]
>> It is a bit weird I admit, but it works just fine.

>
> Well, this still is an HTTP POST request. PHP interprets the query
> string of the URL as GET variables, but it is not a GET request.


So we should define a GET request in the OQ sense just as a any request
that is not a HTTP POST request [disregarding the HEAD request which has no
clientside coding ability]?

You could do that, but what would be the use for the OP?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
Scott Sauyet
Guest
Posts: n/a
 
      01-26-2010
On Jan 26, 2:16*pm, "Evertjan." <(E-Mail Removed)> wrote:
> Scott Sauyet wrote on 26 jan 2010 in comp.lang.javascript:
>> On Jan 26, 5:55am, Erwin Moller
>> Well, this still is an HTTP POST request. *PHP interprets the query
>> string of the URL as GET variables, but it is not a GET request.

>
> So we should define a GET request in the OQ sense just as a any request
> that is not a HTTP POST request [disregarding the HEAD request which has no
> clientside coding ability]?


No, but there is a specific verb given in the HTTP specification that
is used for each request. If that request responds with a page, there
is no client-side way from that page to know what verb was used; of
course additional server-side help can easily be supplied. That's
what I said in my original response.

> You could do that, but what would be the use for the OP?


I don't know what the OP needs, but if it's to know, for instance,
that the current page is in response to a POST request, I believe that
this is not possible in general without server-side help.

-- Scott
 
Reply With Quote
 
Eric Bednarz
Guest
Posts: n/a
 
      01-26-2010
"Evertjan." <(E-Mail Removed)> writes:

> Eric Bednarz wrote on 26 jan 2010 in comp.lang.javascript:


>> I read that

>
> my sentence?


The OP’s question:

| Is there a way to know if the current page is a result of a get or
| post?

>> as wanting to know the request method, and I would think
>> that a HTTP server cannot resolve a resource and send response headers
>> without knowing that.

>
> What HTTP-server


I don’t know which HTTP server the OP uses.

> What Resource?


The resource that tentatively wants to know if it is a result of a GET
or POST request.

> Why should a server without serverside programming ability [if that is what
> you mean by HTTP-server],


By HTTP server I mean a server that services HTTP requests.

> do anything with the POST content of the request
> header?


¿Que?

>> and send response headers without knowing that.

>
> The request querystring has no special request or response headers.


I think that this might be a pretty silly discussion.

> The POST content is in the request header,


I thought that POST data is send in the message body of the request.

> not in the response header.


I should better just have written ‘a response’.

The request method is stated in the request header, and is hopefully
accessible by server-side script (e.g. by the already mentioned
REQUEST_METHOD environment variable). Both response header and message
body may or may not depend on it.
 
Reply With Quote
 
The Natural Philosopher
Guest
Posts: n/a
 
      01-27-2010
Evertjan. wrote:
> Thomas 'PointedEars' Lahn wrote on 25 jan 2010 in comp.lang.javascript:
>> Scott Sauyet wrote:
>>
>>> Thomas 'PointedEars' Lahn wrote:
>>>>> Is there a way to know if the current page is a result of a get or
>>>>> post?
>>>> Yes.

>> ^^^^
>>> No.
>>>
>>> At least, assuming you're discussing doing this from Javascript in a
>>> web browser. For any POST you perform, the server could send a
>>> redirect to a GET.
>>>
>>> If you have control on the server-side, you could echo the request
>>> type into a JS variable; in PHP it might be
>>>
>>> var httpMethod = "<?php echo $_SERVER['REQUEST_METHOD']; ?>"

>> See, there is a way

>
> No there is not.
>
> The new page can never know


anythinmg. new pages are not intelligent, nor even computing engyns

Straw man. The ELF shot you.
 
Reply With Quote
 
The Natural Philosopher
Guest
Posts: n/a
 
      01-27-2010
Scott Sauyet wrote:
> On Jan 25, 4:00 pm, "Evertjan." <(E-Mail Removed)> wrote:
>> The new page can never know if the page request is
>> 1 a result of a bona fide form-get
>> or
>> 2 just from a link contaning an URL with querystring.

>
> I'm not sure that is a meaningful distinction. At the HTTP level,
> both are GET requests, so even the server doesn't distinguish this.
>


It does

> -- Scott

 
Reply With Quote
 
The Natural Philosopher
Guest
Posts: n/a
 
      01-27-2010
Eric Bednarz wrote:
> "Evertjan." <(E-Mail Removed)> writes:
>
>> Scott Sauyet wrote on 25 jan 2010 in comp.lang.javascript:
>>
>>> "Evertjan." <(E-Mail Removed)> wrote:

>
>>>> The new page can never know if the page request is
>>>> 1 a result of a bona fide form-get
>>>> or
>>>> 2 just from a link contaning an URL with querystring.
>>> I'm not sure that is a meaningful distinction. At the HTTP level,
>>> both are GET requests, so even the server doesn't distinguish this.

>> No, they could also be POST requests at ther same time.

>
> I would like an example of an HTTP request that simultaneously uses the
> HTTP GET and POST methods.


I do it somewhat regularly..

VERY possible with javascript.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
-Re: Re: Serious cache problem - Page_Load get never get called !!! Ryan Park ASP .Net 0 01-04-2005 06:09 PM
Serious cache problem - Page_Load get never get called !!! Ryan Park ASP .Net 2 01-03-2005 05:52 PM
Re: use anonymous but get get an authentication box Curt_C [MVP] ASP .Net 2 09-21-2004 06:39 PM
use anonymous but get get an authentication box =?Utf-8?B?U2hhcmlm?= ASP .Net 0 09-21-2004 01:01 PM



Advertisments