Re: Problem With proxi.cgi

2016-01-21 Thread Christopher Schultz
Luciano,

On 1/20/16 1:57 AM, Luciano Martin Galletti wrote:
> But when i call the proxy from my application in openlayers 
> the html file is under:
> C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples\js\ac
> 
> and i call the proxy in this way:
> OpenLayers.ProxyHost = "../../cgi-bin/proxy.cgi?url=";
> 
> i recieve:
> HTTP Status 502 - type Status report
> message 
> description This server received an invalid response from a server it 
> consulted when acting as a proxy or gateway.
> Apache Tomcat/7.0.67
>
> Why?

Are you using proxi.cgi internally by your own web application? Or are
you trying to proxy requests from a remote client to another server? (Or
Both?)

-chris

>> From: gallett...@hotmail.com
>> To: users@tomcat.apache.org
>> Subject: RE: Problem With proxi.cgi
>> Date: Wed, 20 Jan 2016 06:52:51 +
>>
>> yes
>>
>> C:\Program Files\Apache Software Foundation\Tomcat 
>> 7.0\webapps\examples\WEB-INF\cgi
>>
>> and 
>>  http://localhost:8080/examples/cgi-bin/proxy.cgi
>> now i see the openlayers website :)
>>
>> Thanks
>>
>>> Subject: Re: Problem With proxi.cgi
>>> To: users@tomcat.apache.org
>>> From: ma...@apache.org
>>> Date: Tue, 19 Jan 2016 22:45:46 +
>>>
>>> On 19/01/2016 19:21, Luciano Martin Galletti wrote:
>>>> Sorry was a typo error read this
>>>>
>>>> Ok now i've web.xml under 
>>>> C:\Program Files\Apache Software Foundation\Tomcat 
>>>> 7.0\webapps\examples\WEB-INF
>>>>  
>>>> and context.xml under 
>>>> C:\Program Files\Apache Software Foundation\Tomcat 
>>>> 7.0\webapps\examples\META-INF
>>>>  
>>>> but same problem of before i read the file .cgi as text 
>>>> on http://localhost:8080/examples/cgi/proxy.cgi
>>>
>>> And what is the full path of the CGI file?
>>>
>>> It should be:
>>> C:\Program Files\Apache Software Foundation\Tomcat
>>> 7.0\webapps\examples\WEB-INF\cgi\proxy.cgi
>>>
>>> And then you use:
>>> http://localhost:8080/examples/cgi-bin/proxy.cgi
>>>
>>> to access it.
>>>
>>> Mark
>>>
>>>
>>>>
>>>>
>>>>> From: gallett...@hotmail.com
>>>>> To: users@tomcat.apache.org
>>>>> Subject: RE: Problem With proxi.cgi
>>>>> Date: Tue, 19 Jan 2016 19:16:36 +
>>>>>
>>>>> Ok now i've web.xml under 
>>>>> C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples
>>>>>
>>>>> and context.xml under 
>>>>> C:\Program Files\Apache Software Foundation\Tomcat 
>>>>> 7.0\webapps\examples\META-INF
>>>>>
>>>>> but same problem of before i read the file .cgi as text 
>>>>> on http://localhost:8080/examples/cgi/proxy.cgi
>>>>>
>>>>>
>>>>>> From: chuck.caldar...@unisys.com
>>>>>> To: users@tomcat.apache.org
>>>>>> Subject: RE: Problem With proxi.cgi
>>>>>> Date: Tue, 19 Jan 2016 18:54:40 +
>>>>>>
>>>>>>> From: Luciano Martin Galletti [mailto:gallett...@hotmail.com] 
>>>>>>> Subject: RE: Problem With proxi.cgi
>>>>>>
>>>>>>> Yes both xml files are inside 
>>>>>>
>>>>>> Be precise; exactly which xml files are you referring to?
>>>>>>
>>>>>>> C:\Program Files\Apache Software Foundation\Tomcat 
>>>>>>> 7.0\webapps\examples\WEB-INF
>>>>>>
>>>>>> As Mark already stated, the context.xml file should be under META-INF, 
>>>>>> not WEB-INF.
>>>>>>
>>>>>>  - Chuck
>>>>>>
>>>>>>
>>>>>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
>>>>>> MATERIAL and is thus for use only by the intended recipient. If you 
>>>>>> received this in error, please contact the sender and delete the e-mail 
>>>>>> and its attachments from all computers.
>>>>>>
>>>>>>
>>>>>> -
>>>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>>>>
>>>>> 
>>>>  
>>>>
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>
> 
> 

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Problem With proxi.cgi

2016-01-19 Thread Mark Thomas
On 19/01/2016 19:21, Luciano Martin Galletti wrote:
> Sorry was a typo error read this
> 
> Ok now i've web.xml under 
> C:\Program Files\Apache Software Foundation\Tomcat 
> 7.0\webapps\examples\WEB-INF
>  
> and context.xml under 
> C:\Program Files\Apache Software Foundation\Tomcat 
> 7.0\webapps\examples\META-INF
>  
> but same problem of before i read the file .cgi as text 
> on http://localhost:8080/examples/cgi/proxy.cgi

And what is the full path of the CGI file?

It should be:
C:\Program Files\Apache Software Foundation\Tomcat
7.0\webapps\examples\WEB-INF\cgi\proxy.cgi

And then you use:
http://localhost:8080/examples/cgi-bin/proxy.cgi

to access it.

Mark


>
> 
>> From: gallett...@hotmail.com
>> To: users@tomcat.apache.org
>> Subject: RE: Problem With proxi.cgi
>> Date: Tue, 19 Jan 2016 19:16:36 +
>>
>> Ok now i've web.xml under 
>> C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples
>>
>> and context.xml under 
>> C:\Program Files\Apache Software Foundation\Tomcat 
>> 7.0\webapps\examples\META-INF
>>
>> but same problem of before i read the file .cgi as text 
>> on http://localhost:8080/examples/cgi/proxy.cgi
>>
>>
>>> From: chuck.caldar...@unisys.com
>>> To: users@tomcat.apache.org
>>> Subject: RE: Problem With proxi.cgi
>>> Date: Tue, 19 Jan 2016 18:54:40 +
>>>
>>>> From: Luciano Martin Galletti [mailto:gallett...@hotmail.com] 
>>>> Subject: RE: Problem With proxi.cgi
>>>
>>>> Yes both xml files are inside 
>>>
>>> Be precise; exactly which xml files are you referring to?
>>>
>>>> C:\Program Files\Apache Software Foundation\Tomcat 
>>>> 7.0\webapps\examples\WEB-INF
>>>
>>> As Mark already stated, the context.xml file should be under META-INF, not 
>>> WEB-INF.
>>>
>>>  - Chuck
>>>
>>>
>>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
>>> MATERIAL and is thus for use only by the intended recipient. If you 
>>> received this in error, please contact the sender and delete the e-mail and 
>>> its attachments from all computers.
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>
> 
> 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Problem With proxi.cgi

2016-01-19 Thread Caldarale, Charles R
> From: Luciano Martin Galletti [mailto:gallett...@hotmail.com] 
> Subject: RE: Problem With proxi.cgi

> Yes both xml files are inside 

Be precise; exactly which xml files are you referring to?

> C:\Program Files\Apache Software Foundation\Tomcat 
> 7.0\webapps\examples\WEB-INF

As Mark already stated, the context.xml file should be under META-INF, not 
WEB-INF.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
Sorry was a typo error read this

Ok now i've web.xml under 
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples\WEB-INF
 
and context.xml under 
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples\META-INF
 
but same problem of before i read the file .cgi as text 
on http://localhost:8080/examples/cgi/proxy.cgi

> From: gallett...@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: Problem With proxi.cgi
> Date: Tue, 19 Jan 2016 19:16:36 +
> 
> Ok now i've web.xml under 
> C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples
> 
> and context.xml under 
> C:\Program Files\Apache Software Foundation\Tomcat 
> 7.0\webapps\examples\META-INF
> 
> but same problem of before i read the file .cgi as text 
> on http://localhost:8080/examples/cgi/proxy.cgi
> 
> 
> > From: chuck.caldar...@unisys.com
> > To: users@tomcat.apache.org
> > Subject: RE: Problem With proxi.cgi
> > Date: Tue, 19 Jan 2016 18:54:40 +
> > 
> > > From: Luciano Martin Galletti [mailto:gallett...@hotmail.com] 
> > > Subject: RE: Problem With proxi.cgi
> > 
> > > Yes both xml files are inside 
> > 
> > Be precise; exactly which xml files are you referring to?
> > 
> > > C:\Program Files\Apache Software Foundation\Tomcat 
> > > 7.0\webapps\examples\WEB-INF
> > 
> > As Mark already stated, the context.xml file should be under META-INF, not 
> > WEB-INF.
> > 
> >  - Chuck
> > 
> > 
> > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> > MATERIAL and is thus for use only by the intended recipient. If you 
> > received this in error, please contact the sender and delete the e-mail and 
> > its attachments from all computers.
> > 
> > 
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> > 
> 
  

RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
Ok now i've web.xml under 
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples

and context.xml under 
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples\META-INF

but same problem of before i read the file .cgi as text 
on http://localhost:8080/examples/cgi/proxy.cgi


> From: chuck.caldar...@unisys.com
> To: users@tomcat.apache.org
> Subject: RE: Problem With proxi.cgi
> Date: Tue, 19 Jan 2016 18:54:40 +
> 
> > From: Luciano Martin Galletti [mailto:gallett...@hotmail.com] 
> > Subject: RE: Problem With proxi.cgi
> 
> > Yes both xml files are inside 
> 
> Be precise; exactly which xml files are you referring to?
> 
> > C:\Program Files\Apache Software Foundation\Tomcat 
> > 7.0\webapps\examples\WEB-INF
> 
> As Mark already stated, the context.xml file should be under META-INF, not 
> WEB-INF.
> 
>  - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> MATERIAL and is thus for use only by the intended recipient. If you received 
> this in error, please contact the sender and delete the e-mail and its 
> attachments from all computers.
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
yes

C:\Program Files\Apache Software Foundation\Tomcat 
7.0\webapps\examples\WEB-INF\cgi

and 
 http://localhost:8080/examples/cgi-bin/proxy.cgi
now i see the openlayers website :)

Thanks

> Subject: Re: Problem With proxi.cgi
> To: users@tomcat.apache.org
> From: ma...@apache.org
> Date: Tue, 19 Jan 2016 22:45:46 +
> 
> On 19/01/2016 19:21, Luciano Martin Galletti wrote:
> > Sorry was a typo error read this
> > 
> > Ok now i've web.xml under 
> > C:\Program Files\Apache Software Foundation\Tomcat 
> > 7.0\webapps\examples\WEB-INF
> >  
> > and context.xml under 
> > C:\Program Files\Apache Software Foundation\Tomcat 
> > 7.0\webapps\examples\META-INF
> >  
> > but same problem of before i read the file .cgi as text 
> > on http://localhost:8080/examples/cgi/proxy.cgi
> 
> And what is the full path of the CGI file?
> 
> It should be:
> C:\Program Files\Apache Software Foundation\Tomcat
> 7.0\webapps\examples\WEB-INF\cgi\proxy.cgi
> 
> And then you use:
> http://localhost:8080/examples/cgi-bin/proxy.cgi
> 
> to access it.
> 
> Mark
> 
> 
> >
> > 
> >> From: gallett...@hotmail.com
> >> To: users@tomcat.apache.org
> >> Subject: RE: Problem With proxi.cgi
> >> Date: Tue, 19 Jan 2016 19:16:36 +
> >>
> >> Ok now i've web.xml under 
> >> C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples
> >>
> >> and context.xml under 
> >> C:\Program Files\Apache Software Foundation\Tomcat 
> >> 7.0\webapps\examples\META-INF
> >>
> >> but same problem of before i read the file .cgi as text 
> >> on http://localhost:8080/examples/cgi/proxy.cgi
> >>
> >>
> >>> From: chuck.caldar...@unisys.com
> >>> To: users@tomcat.apache.org
> >>> Subject: RE: Problem With proxi.cgi
> >>> Date: Tue, 19 Jan 2016 18:54:40 +
> >>>
> >>>> From: Luciano Martin Galletti [mailto:gallett...@hotmail.com] 
> >>>> Subject: RE: Problem With proxi.cgi
> >>>
> >>>> Yes both xml files are inside 
> >>>
> >>> Be precise; exactly which xml files are you referring to?
> >>>
> >>>> C:\Program Files\Apache Software Foundation\Tomcat 
> >>>> 7.0\webapps\examples\WEB-INF
> >>>
> >>> As Mark already stated, the context.xml file should be under META-INF, 
> >>> not WEB-INF.
> >>>
> >>>  - Chuck
> >>>
> >>>
> >>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> >>> MATERIAL and is thus for use only by the intended recipient. If you 
> >>> received this in error, please contact the sender and delete the e-mail 
> >>> and its attachments from all computers.
> >>>
> >>>
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> >>> For additional commands, e-mail: users-h...@tomcat.apache.org
> >>>
> >>  
> >   
> > 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
But when i call the proxy from my application in openlayers 
the html file is under:
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples\js\ac

and i call the proxy in this way:
OpenLayers.ProxyHost = "../../cgi-bin/proxy.cgi?url=";

i recieve:
HTTP Status 502 - type Status report
message 
description This server received an invalid response from a server it consulted 
when acting as a proxy or gateway.
Apache Tomcat/7.0.67Why?

> From: gallett...@hotmail.com
> To: users@tomcat.apache.org
> Subject: RE: Problem With proxi.cgi
> Date: Wed, 20 Jan 2016 06:52:51 +
> 
> yes
> 
> C:\Program Files\Apache Software Foundation\Tomcat 
> 7.0\webapps\examples\WEB-INF\cgi
> 
> and 
>  http://localhost:8080/examples/cgi-bin/proxy.cgi
> now i see the openlayers website :)
> 
> Thanks
> 
> > Subject: Re: Problem With proxi.cgi
> > To: users@tomcat.apache.org
> > From: ma...@apache.org
> > Date: Tue, 19 Jan 2016 22:45:46 +
> > 
> > On 19/01/2016 19:21, Luciano Martin Galletti wrote:
> > > Sorry was a typo error read this
> > > 
> > > Ok now i've web.xml under 
> > > C:\Program Files\Apache Software Foundation\Tomcat 
> > > 7.0\webapps\examples\WEB-INF
> > >  
> > > and context.xml under 
> > > C:\Program Files\Apache Software Foundation\Tomcat 
> > > 7.0\webapps\examples\META-INF
> > >  
> > > but same problem of before i read the file .cgi as text 
> > > on http://localhost:8080/examples/cgi/proxy.cgi
> > 
> > And what is the full path of the CGI file?
> > 
> > It should be:
> > C:\Program Files\Apache Software Foundation\Tomcat
> > 7.0\webapps\examples\WEB-INF\cgi\proxy.cgi
> > 
> > And then you use:
> > http://localhost:8080/examples/cgi-bin/proxy.cgi
> > 
> > to access it.
> > 
> > Mark
> > 
> > 
> > >
> > > 
> > >> From: gallett...@hotmail.com
> > >> To: users@tomcat.apache.org
> > >> Subject: RE: Problem With proxi.cgi
> > >> Date: Tue, 19 Jan 2016 19:16:36 +
> > >>
> > >> Ok now i've web.xml under 
> > >> C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples
> > >>
> > >> and context.xml under 
> > >> C:\Program Files\Apache Software Foundation\Tomcat 
> > >> 7.0\webapps\examples\META-INF
> > >>
> > >> but same problem of before i read the file .cgi as text 
> > >> on http://localhost:8080/examples/cgi/proxy.cgi
> > >>
> > >>
> > >>> From: chuck.caldar...@unisys.com
> > >>> To: users@tomcat.apache.org
> > >>> Subject: RE: Problem With proxi.cgi
> > >>> Date: Tue, 19 Jan 2016 18:54:40 +
> > >>>
> > >>>> From: Luciano Martin Galletti [mailto:gallett...@hotmail.com] 
> > >>>> Subject: RE: Problem With proxi.cgi
> > >>>
> > >>>> Yes both xml files are inside 
> > >>>
> > >>> Be precise; exactly which xml files are you referring to?
> > >>>
> > >>>> C:\Program Files\Apache Software Foundation\Tomcat 
> > >>>> 7.0\webapps\examples\WEB-INF
> > >>>
> > >>> As Mark already stated, the context.xml file should be under META-INF, 
> > >>> not WEB-INF.
> > >>>
> > >>>  - Chuck
> > >>>
> > >>>
> > >>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE 
> > >>> PROPRIETARY MATERIAL and is thus for use only by the intended 
> > >>> recipient. If you received this in error, please contact the sender and 
> > >>> delete the e-mail and its attachments from all computers.
> > >>>
> > >>>
> > >>> -
> > >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > >>> For additional commands, e-mail: users-h...@tomcat.apache.org
> > >>>
> > >>
> > > 
> > > 
> > 
> > 
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> > 
> 
  

Re: Problem With proxi.cgi

2016-01-19 Thread Mark Thomas
On 19/01/2016 14:32, Luciano Martin Galletti wrote:
> I’m tryng to use a proxy.cgi for my app developed in openlayer.
> 
> 
> But when i try to use the url of the cgi i can read the test of the file 
> proxy.cgi and it’s not executed.
> 
> 
> I’ve modified the server.xml adding:

That should be web.xml for your application.

> 
> 
> 
> cgi
> org.apache.catalina.servlets.CGIServlet
> 
>   debug
>   0
> 
> 
>   cgiPathPrefix
>   WEB-INF/cgi
> 
>  5
> 
> 
> 
> 
> and:
> 
> 
> 
> cgi
> /cgi-bin/*
> 
> 
> 
> 
> and i put the proxy.cgi in the folder WEB-INF/cgi of my app! while server.xml 
> and context.xml in the folder of my application on server.

You should leave server.xml where Tomcat installs it.

Application specific context.xml files should be under META-INF

> in context.xml i’ve added:
> 
>/> 

Which context.xml file?

Mark


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Problem With proxi.cgi

2016-01-19 Thread Mark Thomas
On 19/01/2016 14:54, Luciano Martin Galletti wrote:
> yes i edited web.xml and not server.xml. 
> Server.xml is n C:/tomcat7.0/conf and i didn't touch it
> 
> i added context.xml that contain this:
>  
> in the folder where is my application

That context.xml file needs to be inside a META-INF folder.
META-INF should be at the root of your web application.

Mark


> 
> when i go on proxy.cgi i can read all the content as a text :(
> "
> !C:/Python27/python.exe -u 
> 
> 
> """This is a blind proxy that we use to get around browser
> restrictions that prevent the Javascript from loading pages not on the
> same server as the Javascript.  This has several problems: it's less
> efficient, it might break some sites, and it's a security risk because
> people can use this proxy to browse the web and possibly do bad stuff
> with it.  It only loads pages via http and https, but it can load any
> content type. It supports GET and POST requests."""
> 
> import urllib2
> import cgi
> import sys, os
> 
> # Designed to prevent Open Proxy type stuff.
> 
> allowedHosts = ['www.openlayers.org', 'openlayers.org', 
> 'labs.metacarta.com', 'world.freemap.in', 
> 'prototype.openmnnd.org', 'geo.openplans.org',
> 'sigma.openplans.org', 'demo.opengeo.org',
> 'www.openstreetmap.org', 'sample.azavea.com',
> 'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080', 
> 'vmap0.tiles.osgeo.org', 'www.openrouteservice.org', 
> 'localhost:8080']
> 
> method = os.environ["REQUEST_METHOD"]
> 
> if method == "POST":
> qs = os.environ["QUERY_STRING"]
> d = cgi.parse_qs(qs)
> if d.has_key("url"):
> url = d["url"][0]
> else:
> url = "http://www.openlayers.org;
> else:
> fs = cgi.FieldStorage()
> url = fs.getvalue('url', "http://www.openlayers.org;)
> 
> try:
> host = url.split("/")[2]
> if allowedHosts and not host in allowedHosts:
> print "Status: 502 Bad Gateway"
> print "Content-Type: text/plain"
> print
> print "This proxy does not allow you to access that location (%s)." % 
> (host,)
> print
> print os.environ
>   
> elif url.startswith("http://;) or url.startswith("https://;):
> 
> if method == "POST":
> length = int(os.environ["CONTENT_LENGTH"])
> headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
> body = sys.stdin.read(length)
> r = urllib2.Request(url, body, headers)
> y = urllib2.urlopen(r)
> else:
> y = urllib2.urlopen(url)
> 
> # print content type header
> i = y.info()
> if i.has_key("Content-Type"):
> print "Content-Type: %s" % (i["Content-Type"])
> else:
>     print "Content-Type: text/plain"
> print
> 
> print y.read()
> 
> y.close()
> else:
> print "Content-Type: text/plain"
> print
> print "Illegal request."
> 
> except Exception, E:
> print "Status: 500 Unexpected Error"
> print "Content-Type: text/plain"
> print 
> print "Some unexpected error occurred. Error text was:", E "
> 
>> Subject: Re: Problem With proxi.cgi
>> To: users@tomcat.apache.org
>> From: ma...@apache.org
>> Date: Tue, 19 Jan 2016 14:44:40 +
>>
>> On 19/01/2016 14:32, Luciano Martin Galletti wrote:
>>> I’m tryng to use a proxy.cgi for my app developed in openlayer.
>>>
>>>
>>> But when i try to use the url of the cgi i can read the test of the file 
>>> proxy.cgi and it’s not executed.
>>>
>>>
>>> I’ve modified the server.xml adding:
>>
>> That should be web.xml for your application.
>>
>>>
>>>
>>> 
>>> cgi
>>> 
>>> org.apache.catalina.servlets.CGIServlet
>>> 
>>>   debug
>>>   0
>>> 
>>> 
>>>   cgiPathPrefix
>>>   WEB-INF/cgi
>>> 
>>>  5
>>> 
>>>
>>>
>>>
>>> and:
>>>
>>>
>>> 
>>> cgi
>>> /cgi-bin/*
>>> 
>>>
>>>
>>>
>>> and i put the proxy.cgi in the folder WEB-INF/cgi of my app! while 
>>> server.xml and context.xml in the folder of my application on server.
>>
>> You should leave server.xml where Tomcat installs it.
>>
>> Application specific context.xml files should be under META-INF
>>
>>> in context.xml i’ve added:
>>>
>>>   >> /> 
>>
>> Which context.xml file?
>>
>> Mark
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> 


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
I’m tryng to use a proxy.cgi for my app developed in openlayer.


But when i try to use the url of the cgi i can read the test of the file 
proxy.cgi and it’s not executed.


I’ve modified the server.xml adding:



cgi
org.apache.catalina.servlets.CGIServlet

  debug
  0


  cgiPathPrefix
  WEB-INF/cgi

 5




and:



cgi
/cgi-bin/*




and i put the proxy.cgi in the folder WEB-INF/cgi of my app! while server.xml 
and context.xml in the folder of my application on server.


in context.xml i’ve added:

   



but if i go on http://localhost:8080/examples/ac/proxy.cgi

i read:









Some text can go here... Maybe explaining your project.




Query result





​

RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
i don't know if this help to understand where is the problem but in log file 
i've:

gen 19, 2016 4:00:40 PM org.apache.catalina.core.ApplicationContext log
INFORMAZIONI: Marking servlet cgi as unavailable
gen 19, 2016 4:00:40 PM org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet [cgi] in web application [/examples] threw load() exception
java.lang.SecurityException: Restricted class 
org.apache.catalina.servlets.CGIServlet
at 
org.apache.catalina.core.DefaultInstanceManager.checkAccess(DefaultInstanceManager.java:529)
at 
org.apache.catalina.core.DefaultInstanceManager.checkAccess(DefaultInstanceManager.java:520)
at 
org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:490)
at 
org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5327)
at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5617)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at 
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
at 
org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1975)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

gen 19, 2016 4:00:40 PM org.apache.catalina.core.ApplicationContext log
INFORMAZIONI: Marking servlet cgi as unavailable
gen 19, 2016 4:00:40 PM org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet [cgi] in web application [] threw load() exception
java.lang.SecurityException: Restricted class 
org.apache.catalina.servlets.CGIServlet
at 
org.apache.catalina.core.DefaultInstanceManager.checkAccess(DefaultInstanceManager.java:529)
at 
org.apache.catalina.core.DefaultInstanceManager.checkAccess(DefaultInstanceManager.java:520)
at 
org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:490)
at 
org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5327)
at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5617)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at 
org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
at 
org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1975)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)



  

RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
yes i edited web.xml and not server.xml. 
Server.xml is n C:/tomcat7.0/conf and i didn't touch it

i added context.xml that contain this:
 
in the folder where is my application

when i go on proxy.cgi i can read all the content as a text :(
"
!C:/Python27/python.exe -u 


"""This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript.  This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and possibly do bad stuff
with it.  It only loads pages via http and https, but it can load any
content type. It supports GET and POST requests."""

import urllib2
import cgi
import sys, os

# Designed to prevent Open Proxy type stuff.

allowedHosts = ['www.openlayers.org', 'openlayers.org', 
'labs.metacarta.com', 'world.freemap.in', 
'prototype.openmnnd.org', 'geo.openplans.org',
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.azavea.com',
'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080', 
'vmap0.tiles.osgeo.org', 'www.openrouteservice.org', 
'localhost:8080']

method = os.environ["REQUEST_METHOD"]

if method == "POST":
qs = os.environ["QUERY_STRING"]
d = cgi.parse_qs(qs)
if d.has_key("url"):
url = d["url"][0]
else:
url = "http://www.openlayers.org;
else:
fs = cgi.FieldStorage()
url = fs.getvalue('url', "http://www.openlayers.org;)

try:
host = url.split("/")[2]
if allowedHosts and not host in allowedHosts:
print "Status: 502 Bad Gateway"
print "Content-Type: text/plain"
print
print "This proxy does not allow you to access that location (%s)." % 
(host,)
print
print os.environ
  
elif url.startswith("http://;) or url.startswith("https://;):

if method == "POST":
length = int(os.environ["CONTENT_LENGTH"])
headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
body = sys.stdin.read(length)
r = urllib2.Request(url, body, headers)
y = urllib2.urlopen(r)
else:
y = urllib2.urlopen(url)

# print content type header
i = y.info()
if i.has_key("Content-Type"):
print "Content-Type: %s" % (i["Content-Type"])
else:
print "Content-Type: text/plain"
print

print y.read()

y.close()
else:
print "Content-Type: text/plain"
print
    print "Illegal request."

except Exception, E:
print "Status: 500 Unexpected Error"
print "Content-Type: text/plain"
print 
print "Some unexpected error occurred. Error text was:", E "

> Subject: Re: Problem With proxi.cgi
> To: users@tomcat.apache.org
> From: ma...@apache.org
> Date: Tue, 19 Jan 2016 14:44:40 +
> 
> On 19/01/2016 14:32, Luciano Martin Galletti wrote:
> > I’m tryng to use a proxy.cgi for my app developed in openlayer.
> > 
> > 
> > But when i try to use the url of the cgi i can read the test of the file 
> > proxy.cgi and it’s not executed.
> > 
> > 
> > I’ve modified the server.xml adding:
> 
> That should be web.xml for your application.
> 
> > 
> > 
> > 
> > cgi
> > 
> > org.apache.catalina.servlets.CGIServlet
> > 
> >   debug
> >   0
> > 
> > 
> >   cgiPathPrefix
> >   WEB-INF/cgi
> > 
> >  5
> > 
> > 
> > 
> > 
> > and:
> > 
> > 
> > 
> > cgi
> > /cgi-bin/*
> > 
> > 
> > 
> > 
> > and i put the proxy.cgi in the folder WEB-INF/cgi of my app! while 
> > server.xml and context.xml in the folder of my application on server.
> 
> You should leave server.xml where Tomcat installs it.
> 
> Application specific context.xml files should be under META-INF
> 
> > in context.xml i’ve added:
> > 
> >> /> 
> 
> Which context.xml file?
> 
> Mark
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
yes 

if i go on: http://localhost:8080/examples/cgi-bin/proxy.cgi
HTTP Status 404 - type Status report
message 
description The requested resource is not available.

while if i go on: http://localhost:8080/examples/cgi/proxy.cgi

i read :

#!/Python27/python.exe -u

"""This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript.  This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and possibly do bad stuff
with it.  It only loads pages via http and https, but it can load any
content type. It supports GET and POST requests."""

import urllib2
import cgi
import sys, os

# Designed to prevent Open Proxy type stuff.

allowedHosts = ['www.openlayers.org', 'openlayers.org', 
'labs.metacarta.com', 'world.freemap.in', 
'prototype.openmnnd.org', 'geo.openplans.org',
'sigma.openplans.org', 'demo.opengeo.org',
'www.openstreetmap.org', 'sample.azavea.com',
'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080', 
'vmap0.tiles.osgeo.org', 'www.openrouteservice.org', 
'localhost:8080']

method = os.environ["REQUEST_METHOD"]

if method == "POST":
qs = os.environ["QUERY_STRING"]
d = cgi.parse_qs(qs)
if d.has_key("url"):
url = d["url"][0]
else:
url = "http://www.openlayers.org;
else:
fs = cgi.FieldStorage()
url = fs.getvalue('url', "http://www.openlayers.org;)


etc etc


> Subject: Re: Problem With proxi.cgi
> To: users@tomcat.apache.org
> From: ch...@christopherschultz.net
> Date: Tue, 19 Jan 2016 11:15:46 -0500
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Luciano,
> 
> On 1/19/16 11:05 AM, Luciano Martin Galletti wrote:
> > Yes both xml files are inside C:\Program Files\Apache Software
> > Foundation\Tomcat 7.0\webapps\examples\WEB-INF while proxy.cgi is
> > in C:\Program Files\Apache Software Foundation\Tomcat
> > 7.0\webapps\examples\WEB-INF\cgi
> 
> If proxy.cgi is in examples/WEB-INF/cgi, then your URL needs to be:
> 
>   http://localhost:8080/examples/cgi-bin/proxy.cgi
> 
> You had:
> 
>   http://localhost:8080/examples/ac/proxy.cgi
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
> 
> iEYEARECAAYFAlaeYTIACgkQ9CaO5/Lv0PA0fQCfVTF8IUdPdA1OO7OiuJSHzbGm
> vSYAn1sc3luSGzNAcWMokuf0+puWfh8T
> =rSzQ
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
  

RE: Problem With proxi.cgi

2016-01-19 Thread Luciano Martin Galletti
Yes both xml files are inside 
C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples\WEB-INF
while proxy.cgi is in C:\Program Files\Apache Software Foundation\Tomcat 
7.0\webapps\examples\WEB-INF\cgi




> Subject: Re: Problem With proxi.cgi
> To: users@tomcat.apache.org
> From: ma...@apache.org
> Date: Tue, 19 Jan 2016 15:33:26 +
> 
> On 19/01/2016 14:54, Luciano Martin Galletti wrote:
> > yes i edited web.xml and not server.xml. 
> > Server.xml is n C:/tomcat7.0/conf and i didn't touch it
> > 
> > i added context.xml that contain this:
> >  > /> 
> > in the folder where is my application
> 
> That context.xml file needs to be inside a META-INF folder.
> META-INF should be at the root of your web application.
> 
> Mark
> 
> 
> > 
> > when i go on proxy.cgi i can read all the content as a text :(
> > "
> > !C:/Python27/python.exe -u 
> > 
> > 
> > """This is a blind proxy that we use to get around browser
> > restrictions that prevent the Javascript from loading pages not on the
> > same server as the Javascript.  This has several problems: it's less
> > efficient, it might break some sites, and it's a security risk because
> > people can use this proxy to browse the web and possibly do bad stuff
> > with it.  It only loads pages via http and https, but it can load any
> > content type. It supports GET and POST requests."""
> > 
> > import urllib2
> > import cgi
> > import sys, os
> > 
> > # Designed to prevent Open Proxy type stuff.
> > 
> > allowedHosts = ['www.openlayers.org', 'openlayers.org', 
> > 'labs.metacarta.com', 'world.freemap.in', 
> > 'prototype.openmnnd.org', 'geo.openplans.org',
> > 'sigma.openplans.org', 'demo.opengeo.org',
> > 'www.openstreetmap.org', 'sample.azavea.com',
> > 'v2.suite.opengeo.org', 'v-swe.uni-muenster.de:8080', 
> > 'vmap0.tiles.osgeo.org', 'www.openrouteservice.org', 
> > 'localhost:8080']
> > 
> > method = os.environ["REQUEST_METHOD"]
> > 
> > if method == "POST":
> > qs = os.environ["QUERY_STRING"]
> > d = cgi.parse_qs(qs)
> > if d.has_key("url"):
> > url = d["url"][0]
> > else:
> > url = "http://www.openlayers.org;
> > else:
> > fs = cgi.FieldStorage()
> > url = fs.getvalue('url', "http://www.openlayers.org;)
> > 
> > try:
> > host = url.split("/")[2]
> > if allowedHosts and not host in allowedHosts:
> > print "Status: 502 Bad Gateway"
> > print "Content-Type: text/plain"
> > print
> > print "This proxy does not allow you to access that location (%s)." 
> > % (host,)
> > print
> > print os.environ
> >   
> > elif url.startswith("http://;) or url.startswith("https://;):
> > 
> > if method == "POST":
> > length = int(os.environ["CONTENT_LENGTH"])
> > headers = {"Content-Type": os.environ["CONTENT_TYPE"]}
> > body = sys.stdin.read(length)
> > r = urllib2.Request(url, body, headers)
> > y = urllib2.urlopen(r)
> > else:
> > y = urllib2.urlopen(url)
> > 
> > # print content type header
> > i = y.info()
> > if i.has_key("Content-Type"):
> > print "Content-Type: %s" % (i["Content-Type"])
> > else:
> > print "Content-Type: text/plain"
> > print
> > 
> > print y.read()
> > 
> > y.close()
> > else:
> > print "Content-Type: text/plain"
> > print
> > print "Illegal request."
> > 
> > except Exception, E:
> > print "Status: 500 Unexpected Error"
> > print "Content-Type: text/plain"
> > print 
> > print "Some unexpected error occurred. Error text was:", E "
> > 
> >> Subject: Re: Problem With proxi.cgi
> >> To: users@tomcat.apache.org
> >> From: ma...@apache.org
> >> Date: Tue, 19 Jan 2016 14:44:40 +
> >>
> >> On 19/01/2016 14:32, Luciano Martin Galletti wrote:
> >>> I’m tryng to use a proxy.cgi for my

Re: Problem With proxi.cgi

2016-01-19 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Luciano,

On 1/19/16 11:05 AM, Luciano Martin Galletti wrote:
> Yes both xml files are inside C:\Program Files\Apache Software
> Foundation\Tomcat 7.0\webapps\examples\WEB-INF while proxy.cgi is
> in C:\Program Files\Apache Software Foundation\Tomcat
> 7.0\webapps\examples\WEB-INF\cgi

If proxy.cgi is in examples/WEB-INF/cgi, then your URL needs to be:

  http://localhost:8080/examples/cgi-bin/proxy.cgi

You had:

  http://localhost:8080/examples/ac/proxy.cgi

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlaeYTIACgkQ9CaO5/Lv0PA0fQCfVTF8IUdPdA1OO7OiuJSHzbGm
vSYAn1sc3luSGzNAcWMokuf0+puWfh8T
=rSzQ
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org