Really all you need to do is send your response back like you would any response, just 
without the HTML formatting.  If you wanted to be a bit more "correct", you could 
change the content-type of the respose so that it is not 'text/html'.  (In your case, 
you might just make one up like 'application/x-brians-spiffy-protocol' or whatever you 
think is appropriate preceded with 'x-'.)  Or, if you wanted to debug it using a web 
browser, you could simply use 'text/plain', and your browser will display the raw 
result.

It is important to note that Apache is an HTTP server, not an "HTML server".  It is 
capable of serving any sort of serial content.

So anyway, since it looks like you're using a registry script, you would merely start 
your output with :
print "Content-type: " . $my_content_type . "\n\n"; # note the 2 newlines!

and then proceed directly to your proprietary output.

Make sense?

David

At 9.21 -0400 9/25/2000, B. Burke wrote:
>Here is an example of what I'm looking to do.
>
>GET /perl/app.pl?MODE=search&CITY=Dallas&STATE=TX&ID=195302 HTTP/1.0
>Accept: text/html
>User-Agent:  MyTestClient1.0
>From:  nowhere.com
>
>I want to replace the HTML request above with something like this:
>
>|MODE=search|CITY=Dallas|STATE=TX|ID=195302|
>
>I can hard code the handler to do GET's against only one script.  The request
>format
>is VERY similiar to the arguments in a GET (all I really have to do is
>translate the pipe).
>I think for the response, all I need to do is remove the headers entirely,
>and I can format
>the script output to conform to our API (I don't need protocol headers for
>requests nor
>for responses).
>
>I've been able to basically remove the response headers by removing the
>functionality
>of ap_sen_header_field() before compiling Apache, but it would be nice to
>have a
>more eloquent solution through mod_perl.
>
>Thanks,
>Brian
>
>
>Matt Sergeant wrote:
>
>> On Mon, 25 Sep 2000, B. Burke wrote:
>>
>> >
>> > I'm using Apache/1.3.11 with mod_perl/1.22 on an AIX platform to serve
>> > as an application server, with persistent ties into a MySQL database.
>> >
>> > My company is using an in-house socket API for data transfers.  The
>> > request messages in our API are somewhat similiar to an HTML GET
>> > request, in that we use tagged, delimited fields (pipe delimited
>> > instead of & delimited).
>> >
>> > I have written a socket server gateway to act as a protocol converter,
>> > to convert our API's requests into HTML GET's (and also convert the
>> > HTML output into our API's response format).
>> >
>> > My question is this.  Is it possible using mod_perl for me to
>> > incorporate the protocol conversion into Apache itself?  In other
>> > words, can I strip out the need for HTML headers, and rewrite the
>> > format of GET requests to comply with our proprietary API? I don't
>> > know if this is something that I can do through mod_perl, or if I will
>> > have to dig deeper into C and recompile a new server.
>> >
>> > Any help or ideas will be mucho appreciated!
>>
>> I don't think you'll actually have to re-write anything. Although an
>> example of a transaction would be most helpful. All you have to do is
>> setup mod_perl to handle the connection, Apache _should_ be able to handle
>> the request if it looks enough like a GET request, and you should be able
>> to respond to it with little enough information, provided your responses
>> are also similar to HTTP responses (HTTP response code followed optionally
>> by headers then the body).
>>
>> --
>> <Matt/>
>>
>> Fastnet Software Ltd. High Performance Web Specialists
>> Providing mod_perl, XML, Sybase and Oracle solutions
>> Email for training and consultancy availability.
>> http://sergeant.org | AxKit: http://axkit.org

Reply via email to