[Zoo-discuss] ZOORequest class is missing

Fenoy Gerald gerald.fenoy at geolabs.fr
Wed May 24 02:56:30 PDT 2017


François,
thanks for the feedbacks.

Strange, the id field should never take such kind of value.

You can find attached a patch that I would like to invite you to try on your platform to see if it fixes the issue. In case the issue is with the psInternet pointer itself, then it won’t solve anything.

I hope to hear back from you.

Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cookie.patch
Type: application/octet-stream
Size: 1636 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/zoo-discuss/attachments/20170524/7ec60b4f/attachment.obj>
-------------- next part --------------


Gérald Fenoy
http://wiki.osgeo.org/wiki/User:Djay

> Le 24 mai 2017 à 11:19, François Dodé <dode.francois at gmail.com> a écrit :
> 
> Gerald,
> 
> I think the problem should be created by the function header_write_data in the file ulinet.c
> 
> In case of presence of "Set-Cookie" in the headers red, it stores the cookie identifier in CCookie it's done with :
> sprintf(CCookie[psInternet->id],"%s",tmp);
> 
> And the CCookie variable is set like this :
> #define MAX_REQ 50
> static char CCookie[MAX_REQ][1024];
> 
> 
> I logged the value of psInternet->id and this value is random. For exemple I get :
> [DEBUG - ulinet] Variable psInternet->id: 1041416742
> And this value are not include between 0 and 50 and cause a segmentation fault.
> 
> Best regards
> 
> 2017-05-24 10:21 GMT+02:00 François Dodé <dode.francois at gmail.com>:
> Hello Gerald,
> 
> Thank you when I set the cookie it's work but it's not expected processing.
> Sorry for being not clear.
> 
> For exemple when I do the GET request with CURL it's working without set a cookie in the headers request:
> curl -v "http://<host>/crv/<key>/doSomething?p1=ZH&p2=ZH&p3=3&p4=46.6947&p5=-2.8564"
> 
> Here the log :
> 
> * About to connect() to <host> port 80 (#0)                                                         
> 
> *   Trying xxx.xxx.xxx.xxx... connected                                                                             
> 
> * Connected to <host> (xxx.xxx.xxx.xxx) port 80 (#0)                                                 
> 
> > GET /crv/<key>/doSomething?p1=ZH&p2=ZH&p3=3&p4=46.6947&p5=-2.8564 HTTP/1.1 
> 
> > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 
> 
> > Host: <host>                                                                                     
> 
> > Accept: */*                                                                                                      
> 
> >                                                                                                                  
> 
> < HTTP/1.1 200 OK                                                                                                  
> 
> < Server: nginx                                                                                                    
> 
> < Date: Wed, 24 May 2017 07:53:24 GMT                                                                              
> 
> < Content-Type: text/html; charset=utf-8                                                                           
> 
> < Vary: Accept-Encoding                                                                                            
> 
> < Set-Cookie: route=abe6a29b89be7b9be8f1bf07ea11b863; Path=/                                                       
> 
> < X-Powered-By: Express                                                                                            
> 
> < Content-Length: 29                                                                                               
> 
> < X-Cache: xxxxxxxx                                                                    
> 
> < X-Cache-Lookup: xxxxxxxxx                                                  
> 
> < Connection: keep-alive                                                                                           
> 
> <                                                                                                                  
> 
> * Connection #0 to host <host> left intact                                                          
> 
> * Closing connection #0
> 
> 
> 
> The cookie is set in the response header and the first time I request the service, no cookies are set.                                                           So in the JS file I have just to do that : ZOO.Request.Get(url, params)
> 
> But it's fails due to an segmentation fault when the ulinet set the response header at line "Set-Cookie: "
> 
> I add log in the ulinet programs for show this :
> 
> * About to connect() to <host> port 80 (#0)
> 
> *   Trying xxx.xxx.xxx.xxx... connected
> 
> * Connected to <host> (xxx.xxx.xxx.xxx) port 80 (#0)
> 
> > GET /crv/<key>/doSomething?p1=ZH&p2=ZH&p3=3&p4=46.6947&p5=-2.8564 HTTP/1.1
> 
> User-Agent: ZooWPSClient
> 
> Host: <host>
> 
> Accept: */*
> 
>  
> 
> < HTTP/1.1 200 OK
> 
> [DEBUG - ulinet] In function header_write_data
> 
> < Server: nginx
> 
> [DEBUG - ulinet] In function header_write_data
> 
> < Date: Wed, 24 May 2017 08:09:39 GMT
> 
> [DEBUG - ulinet] In function header_write_data
> 
> < Content-Type: text/html; charset=utf-8
> 
> [DEBUG - ulinet] In function header_write_data
> 
> < Vary: Accept-Encoding
> 
> [DEBUG - ulinet] In function header_write_data
> 
> * Added cookie route="abe6a29b89be7b9be8f1bf07ea11b863" for domain <host>, path /, expire 0
> 
> < Set-Cookie: route=abe6a29b89be7b9be8f1bf07ea11b863; Path=/
> 
> [DEBUG - ulinet] In function header_write_data
> 
> [DEBUG - ulinet] Variable tmp: route=abe6a29b89be7b9be8f1bf07ea11b863
> 
> [DEBUG - ulinet] the line before sprintf(CCookie[psInternet->id],"",tmp);
> 
> 
> I hope it's help you for understand the issue.
> 
> Best regards                            
> 
> 2017-05-23 14:01 GMT+02:00 Fenoy Gerald <gerald.fenoy at geolabs.fr>:
> François,
> you should try using the revision 828.
> 
> You should consider using the new version of ZOO-API.js it contains.
> 
> There were no support for passing any headers to GET request from the js ZOO-API.
> 
> I have modified the ZOO-API to enable this support.
> 
> Still, note that defining conf["lenv"]["cookie"] is required only for services that are supposed to produce a session environment and a linked Cookie is generated and returned to the client application. So it is not the way to pass headers to your requests from the js ZOO-API.
> 
> You can use the following syntaxe from your js code:
> 
> var i=ZOO.Request.Get("http://www.gogle.com/",{"toto":"toto"},{"Cookie": "XXX=XXXXXXXX01"});
> 
> or
> 
> var i=ZOO.Request.Get("http://www.gogle.com/",{"toto":"toto"},["Cookie: XXX=XXXXXXXX01;"]);
> 
> I hope it helps.
> 
> Gérald Fenoy
> http://wiki.osgeo.org/wiki/User:Djay
> 
> > Le 23 mai 2017 à 10:39, François Dodé <dode.francois at gmail.com> a écrit :
> >
> > Hello,
> >
> > Thank you. I tested this revision but it fails. I have a segmentation error.
> > The line where the program fail is 97 :
> > sprintf(CCookie[psInternet->id],"%s",tmp);
> > The value in the tmp variable is correct.
> >
> > Maybe I do wrong when I declare the cookie in the JS file.
> > In the JS file I add this line :
> > conf["lenv"]["cookie"]="XXX=XXX1000000; path=/";
> >
> > and after that I do the ZOO.Request.Get
> >
> >
> >
> > Also in the ulinet.h, the prototype was not change to :
> >
> >
> > bool setProxiesForProtcol(CURL*,const char*);
> >
> >
> >
> > Best regards
> >
> >
> > 2017-05-22 21:33 GMT+02:00 Fenoy Gerald <gerald.fenoy at geolabs.fr>:
> > Thanks for your feedback.
> >
> > The previous ulinet.c version was containing an error. Please can you give revision 827 a try ?
> >
> > I suppose it will solve your issue.
> >
> > Best regards,
> >
> >
> > Gérald Fenoy
> > http://wiki.osgeo.org/wiki/User:Djay
> >
> > > Le 22 mai 2017 à 17:36, François Dodé <dode.francois at gmail.com> a écrit :
> > >
> > > Thank you for your presicions.
> > >
> > > I have noticed an issue in the file ulinet.c of 825 revision :
> > > The env variable is undeclared in the function header_write_data but use in line 96.
> > > For test I set : char env[256]
> > > I don't know if it's the right correction but I when I do GET request on web service who send cookies to the client the ZOORequest failed.
> > >
> > > 2017-05-22 14:56 GMT+02:00 Fenoy Gerald <gerald.fenoy at geolabs.fr>:
> > > François,
> > > sorry for being not clear.
> > >
> > > In the file ZOOMakefile.opts (generated by the configure script, so you may also edit ZOOMakefile.opts.in in case you run the ./configure command again) you should add to you CFLAGS definition the following option: -DMSG_LAF_VERBOSE. Then remove any ulinet.o already built and run make again.
> > >
> > > I hope it helps.
> > >
> > > Best regards,
> > >
> > > Gérald Fenoy
> > > http://wiki.osgeo.org/wiki/User:Djay
> > >
> > > > Le 22 mai 2017 à 14:52, François Dodé <dode.francois at gmail.com> a écrit :
> > > >
> > > > Hello,
> > > >
> > > > Thank you.
> > > > I tested to add MSG_LAF_VERBOSE= -DMSG_LAF_VERBOSE in the zoo-kernel Makefile but it's not working.
> > > >
> > > > In the main.cfg I put this in the main section:
> > > > logPath = /var/log/zoo/out.log
> > > > But nothing is log when I use the ZOO.Request.Get in the script hello.js :
> > > > ./zoo_loader.cgi "Request=Execute&service=WPS&Identifier=hellojs&version=1.0.0&DataInputs=S=test"
> > > >
> > > >
> > > >
> > > > Best regards
> > > >
> > > >
> > > >
> > > > 2017-05-22 10:21 GMT+02:00 Fenoy Gerald <gerald.fenoy at geolabs.fr>:
> > > > Hello François,
> > > > sorry for late reply.
> > > >
> > > > In case you want to debug the CURL call used for every internal HTTP request and the one coming from the JS ZOO-API call, then you can define the MSG_LAF_VERBOSE variable at compilation time to produce a debug version. Once you have added the -DMSG_LAF_VERBOSE in your Makefile, simply remove the ulinet.o and run the make command again.
> > > >
> > > > In case you need only to debug the result returned by the ZOO-API call, then you can simply use the alert function from the ZOO-API to display debug messages in your web server error log file. In case you want to handle exception you can then use basic try / catch blocks.
> > > >
> > > > I hope it helps.
> > > >
> > > > ps: I have noticed that the discussion is not available to the public, you may think of answering this email using the ZOO-Discuss mailing list. What you are asking may be of interest to other also.
> > > >
> > > > Gérald Fenoy
> > > > http://wiki.osgeo.org/wiki/User:Djay
> > > >
> > > > > Le 20 mai 2017 à 19:26, François Dodé <dode.francois at gmail.com> a écrit :
> > > > >
> > > > > Hello Gerald,
> > > > >
> > > > > Thanks a lot for your help. Now it's work perfectly with the new revision.
> > > > > I think I had an old revision.
> > > > >
> > > > > Another question, how can I get log from the ZOORequest and handle exceptions ?
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Dodé François
> > > > >
> > > > > 2017-05-17 14:55 GMT+02:00 Fenoy Gerald <gerald.fenoy at geolabs.fr>:
> > > > > Hello François,
> > > > > thanks for the feedbacks about this issue.
> > > > >
> > > > > May I ask you to build a new ZOO-Kernel using the revision 825 [1] ? This version should solve this issue.
> > > > >
> > > > > I hope to hear back from you.
> > > > >
> > > > > Best regards,
> > > > >
> > > > > [1] http://www.zoo-project.org/trac/changeset/825
> > > > >
> > > > > > Le 17 mai 2017 à 10:25, François Dodé <dode.francois at gmail.com> a écrit :
> > > > > >
> > > > > > Hello Gerald,
> > > > > >
> > > > > > Thank you for your quick response.
> > > > > > Maybe it's my install of mozjs. I run the ZOO on CentOs 6 and I had to build this library.
> > > > > > Here is the library :
> > > > > > http://ftp.mozilla.org/pub/js/js185-1.0.0.tar.gz
> > > > > >
> > > > > > I add the request GET in the script hello.js.
> > > > > > My Javascript process call the ZOO.Request.Get like this :
> > > > > > ZOO.Request.Get("http://www.google.fr/")
> > > > > > I put the result in the alert() function.
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > Dodé François
> > > > > >
> > > > > >
> > > > > > 2017-05-12 19:42 GMT+02:00 Fenoy Gerald <gerald.fenoy at geolabs.fr>:
> > > > > > Hello François,
> > > > > > ZOORequest shall be defined at runtime by the ZOO-Kernel [1].
> > > > > >
> > > > > > Are you sure the issue comes from call to ZOO.Request.Get ?
> > > > > >
> > > > > > Can you please provide more details about your JavScript service ?
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > [1] http://www.zoo-project.org/trac/browser/trunk/zoo-project/zoo-kernel/service_internal_js.c#L152
> > > > > >
> > > > > > > Le 12 mai 2017 à 16:06, François Dodé <dode.francois at gmail.com> a écrit :
> > > > > > >
> > > > > > > Hello,
> > > > > > >
> > > > > > > I want to make a GET request with the ZOO-api but I have the following error :
> > > > > > > <ows:Exception exceptionCode="InternalError">
> > > > > > >     <ows:ExceptionText>ZOO Kernel failed to process your request, receiving signal 11 = SIGSEGV</ows:ExceptionText>
> > > > > > >  </ows:Exception>
> > > > > > >
> > > > > > > In the ZOO-api.js in the function ZOO.Request.Get(url, params) it returns a class named ZOORequest but this class doesn't exist.
> > > > > > >
> > > > > > > Have you a solution ?
> > > > > > >
> > > > > > > Best regards
> > > > > > > _______________________________________________
> > > > > > > Zoo-discuss mailing list
> > > > > > > Zoo-discuss at lists.osgeo.org
> > > > > > > https://lists.osgeo.org/mailman/listinfo/zoo-discuss
> > > > > >
> > > > > >
> > > > > >
> > > > > > Gérald Fenoy
> > > > > > http://wiki.osgeo.org/wiki/User:Djay
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > Gérald Fenoy
> > > > > http://wiki.osgeo.org/wiki/User:Djay
> > > > >
> > > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Zoo-discuss mailing list
> > > > Zoo-discuss at lists.osgeo.org
> > > > https://lists.osgeo.org/mailman/listinfo/zoo-discuss
> > >
> > >
> > > _______________________________________________
> > > Zoo-discuss mailing list
> > > Zoo-discuss at lists.osgeo.org
> > > https://lists.osgeo.org/mailman/listinfo/zoo-discuss
> >
> >
> 
> 
> 



More information about the Zoo-discuss mailing list