Using Cookie: with POST

Using Cookie: with POST

Post by Michael P. Haye » Wed, 19 Nov 1997 04:00:00



This is a multi-part message in MIME format.

------=_NextPart_000_008A_01BCF420.FE575B80
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I need to run a perl script going through Netscape-Enterprise/3.0C =
server.  A cookie is required to get access to the script.  The script =
needs to be run from a non-UI environment (i.e. talk to the server =
through a socket at port 80).  I am not sure how to pass the cookie as =
part of my request. The cookie that I have is a valid one (I think).=20

Here is a sample of what I've tried (messages returned from the server =
are underlined):

telnet machine_name 80
Trying 12.3.45.678
Connected to machine_name.
Escape character is '^]'

Cookie: name=3Dvalue
POST /script_name HTTP/1.0
Content-type: application/x-www-form-urlencoded
Content-length: 42

fld1=3Dval1

HTTP/1.1 400 Bad Request
Server: Netscape-Enterprise/3.0C
=20
Your browser sent a message this server could not understand.Connection =
closed by foreign host.

Any help would be greatly appreciated.

------=_NextPart_000_008A_01BCF420.FE575B80
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.71.1712.3"' name=3DGENERATOR>
</HEAD>
<BODY>
<DIV>I need to run a perl script going through Netscape-Enterprise/3.0C=20
server.&nbsp; A cookie is required to get access to the script.&nbsp; =
The script=20
needs to be run from a non-UI environment (i.e. talk to the server =
through a=20
socket at port 80).&nbsp; I am not sure how to pass the cookie as part =
of my=20
request.&nbsp;The cookie that I have is a valid one (I think). </DIV>
<DIV>&nbsp;</DIV>
<DIV>Here is a sample of what I've tried (messages returned from the =
server are=20
underlined):</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>telnet <EM>machine_name </EM>80</FONT></DIV>
<DIV><EM><FONT size=3D2></EM>Trying 12.3.45.678</FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Connected to machine_name.</FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Escape character is '^]'</FONT>&nbsp;</DIV>
<DIV><EM><FONT size=3D2></EM></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>Cookie: name=3Dvalue</FONT></DIV>
<DIV><FONT size=3D2>POST /script_name HTTP/1.0<BR>Content-type:=20
application/x-www-form-urlencoded<BR>Content-length: =
42</FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>fld1=3Dval1</FONT></DIV>
<DIV><EM><FONT size=3D2></EM></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2><STRONG><U>HTTP/1.1 400 Bad Request<BR>Server:=20
Netscape-Enterprise/3.0C<BR> <BR>Your browser sent a message this server =
could=20
not understand.Connection closed by foreign=20
host.</U></STRONG><BR></FONT>&nbsp;</DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV>Any help would be greatly appreciated.</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_008A_01BCF420.FE575B80--

 
 
 

Using Cookie: with POST

Post by Kurt J. Lanz » Wed, 19 Nov 1997 04:00:00



> I need to run a perl script going through Netscape-Enterprise/3.0C
> server.  A cookie is required to get access to the script.  The script
> needs to be run from a non-UI environment (i.e. talk to the server
> through a socket at port 80).  I am not sure how to pass the cookie as
> part of my request. The cookie that I have is a valid one (I think).

> Here is a sample of what I've tried (messages returned from the server
> are underlined):

> telnet machine_name 80
> Trying 12.3.45.678
> Connected to machine_name.
> Escape character is '^]'

> Cookie: name=value
> POST /script_name HTTP/1.0
> Content-type: application/x-www-form-urlencoded
> Content-length: 42

> fld1=val1

> HTTP/1.1 400 Bad Request
> Server: Netscape-Enterprise/3.0C

> Your browser sent a message this server could not
> understand.Connection closed by foreign host.

> Any help would be greatly appreciated.

The POST line *always* *always* *always* goes first!!!!!
RTFM on the HTTP spec! The POST LINE GOES FIRST!!!!!!!
--
Kurt J. Lanza


 
 
 

Using Cookie: with POST

Post by Michael P. Haye » Wed, 19 Nov 1997 04:00:00


I guess I should have also mentioned that I tried placing the Cookie: line
after/before every possible line.



>> I need to run a perl script going through Netscape-Enterprise/3.0C
>> server.  A cookie is required to get access to the script.  The script
>> needs to be run from a non-UI environment (i.e. talk to the server
>> through a socket at port 80).  I am not sure how to pass the cookie as
>> part of my request. The cookie that I have is a valid one (I think).

>> Here is a sample of what I've tried (messages returned from the server
>> are underlined):

>> telnet machine_name 80
>> Trying 12.3.45.678
>> Connected to machine_name.
>> Escape character is '^]'

>> Cookie: name=value
>> POST /script_name HTTP/1.0
>> Content-type: application/x-www-form-urlencoded
>> Content-length: 42

>> fld1=val1

>> HTTP/1.1 400 Bad Request
>> Server: Netscape-Enterprise/3.0C

>> Your browser sent a message this server could not
>> understand.Connection closed by foreign host.

>> Any help would be greatly appreciated.

>The POST line *always* *always* *always* goes first!!!!!
>RTFM on the HTTP spec! The POST LINE GOES FIRST!!!!!!!
>--
>Kurt J. Lanza


 
 
 

1. My linux+Apache+mod_perl cannot recognize"print "Set-Cookie: cookie-name = Unique; "

Just solved the problem of not recognizing print "Content-type:
text/plain\n\n";
But another problem still exists.
When the perl script contains following lines:
     print "Set-Cookie: cookie-name = Unique; ";
     print "domain = .$baseurl; ";
     print "path = /; ";
     print "expires = Thursday, 11-Dec-2100 00:00:00 GMT\n";
It just print out these lines on the web.
Still the same script runs perfect under windows+apache+cygwin.
Please tell me how to change the httpd.conf file just as the last question.
Thank you very much.

2. Speed of XFree86 3.1, NFS w/1.1.59

3. Can you log specific cookies with Apache %{cookie}i log format?

4. Solaris 1 more realtime than Solaris 2?

5. %{Cookie}n vs. %{Cookie}i

6. Help needed getting rid of window borders and window resize corners

7. apache,cookie and denying access to those whithout the cookie set

8. Password CGI: Add links within a password protected area

9. test SYN cookies (was Re: SYN cookies security bugfix?)

10. using Apache's API to access a cookie

11. Using cookies for access control

12. setting cookies using SSI's (Apache's mod_include)

13. User authentication using cookies. How??