vxi-discuss



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trouble with remote fetching and builtin grammars



Greetings all.

I have implemented most of the PROMPT, REC and TEL APIs without 
too much difficulty but the OS and builtin grammars have been 
giving me a little trouble.

Are builtin grammars supported by openVXI in any way, or should
we intercept requests to load a grammar of type "builtin:..." and
load something appropriate ourselves?

Does the testVXI do any remote fetching for <grammar>, <audio>, 
<submit> or anything?
I could not find any relevant code...

I therefore took advantage of the Xerces lib and, in the VXI OS 
code, did something of the form:

	XMLURL theURL = XMLURL(theURI.c_str()); 
        XMLURL::Protocols protocol = theURL.getProtocol();
        
        switch (protocol) {
                case XMLURL::File:
		// Open file...
                       
                        break;
                case XMLURL::HTTP:

                    XMLByte buf[BUF_SIZE];
		UnixHTTPURLInputStream
		urlIS(theURL);
		// read in bytes ...
					
		break;
	}

This works well for simple files.  In the case of CGIs, no 
parameters are ever passed.  Is there a mechanism to accomplish this
that I have missed?

I added some code in VXIosOpenUrl to prepend the query arguments 
("queryargs") retrieved from the urlInfo object to the URI.  I 
am using a tag in the vxml file similar to :

<submit method="get" next="http://myhost.com/mycgi.cgi"; />

Which now causes openVXI to submit a URI to the Xerces code that looks
like:

http://myhost.com/mycgi.cgi?param1=one&param2=two

But the parameters are never passed to the cgi.  This is confirmed by 
the apache logs :

[12/Mar/2001:14:27:17 -0800] "GET /cgi-bin/xfer.cgi HTTP/1.0" 200 189

I have made a modification to the xerces code - as far as I can tell it
simply ignores the query elements that are stored within the XMLURL object
it is passed during the call to the UnixHTTPURLInputStream constructor.  
Were the modifications necessary or is there a better method?

I have included the diff between the original version of 
xerces-c-src1_4_0/src/util/NetAccessors/Socket/UnixHTTPURLInputStream.cpp
and my own, for anyone interested.

123,124c123,124
<     char*               pathAsCharStar = XMLString::transcode(path);
<     ArrayJanitor<char>  janBuf2(pathAsCharStar);
---
>     char*               temppathAsCharStar = XMLString::transcode(path);
>     ArrayJanitor<char>  janBuf2(temppathAsCharStar);
131a132,150
>     // PAT'S HACK -- Add the query to the path if exists
>     const XMLCh*	query = urlSource.getQuery();
>     char*		queryAsCharStar = XMLString::transcode(query);
>     ArrayJanitor<char>  janBuf4(queryAsCharStar);
> 
>     char* pathAsCharStar = new char[strlen(temppathAsCharStar) +
strlen(queryAsCharStar) + 2];
>     ArrayJanitor<char>  janBuf5(pathAsCharStar);
> 
>     if (query)
>     {
> 	sprintf(pathAsCharStar, "%s?%s", temppathAsCharStar, queryAsCharStar);
> 	fprintf(stderr, "Full UnixHTTPURL is %s", pathAsCharStar);
>     }
>     else
>     {
> 	sprintf(pathAsCharStar, "%s", temppathAsCharStar);
>     }
>     // END Pat's hack.
> 	

Thanks,
Pat Deegan, TGFLinux







This page is maintained by Alan W Black (awb@cs.cmu.edu)
speechinfo.org is hosted on a machine donated by VA Linux Systems
VA Linux Systems