RE: Getting AuthCookie to return a wml page

2001-04-05 Thread Michael Smith

Thanks for the help Tim

Well in our situation we have a different server for wap -
(mobile.iii.co.uk) - so I can check what to send them back based on the
'Host:' header.  I do have a RewriteRule which checks for mobile devices
trying to connect the web site: 

RewriteCond %{HTTP_ACCEPT} text/vnd.wap.wml [NC]
RewriteCond %{HTTP_ACCEPT} !text/html 
RewriteRule ^/?$ http://mobile.iii.co.uk/wap/index.wml [L,R]

We do have an authenticated page on this site at the moment, which uses
standard HTTP Authentication. This was quite difficult to get working but it
does seem to work, except if you get your username and password incorrect,
when I think you get a text/html page and some spurious error appears on the
phone.

I don't really know that much about wap gateways and so forth, so wasn't
sure where the cookie would get stored.  I just hoped that it would work,
perhaps rather too optimistically!  I know that most sites that have a login
don't seem to use HTTP authentication - but maybe they add something on to
all the URLs.

I have scoured my code and am definitely not sending out the header that the
client is actually receiving.  The only place I can find the header is in
the apache source, inside http_protocol.c:

/* We should have named this send_canned_response, since it is used for any
 * response that can be generated by the server from the request record.
 * This includes all 204 (no content), 3xx (redirect), 4xx (client error),
 * and 5xx (server error) messages that have not been redirected to another
 * handler via the ErrorDocument feature.
 */
API_EXPORT(void) ap_send_error_response(request_rec *r, int recursive_error)

and indeed if I change the line in here, the header is changed
correspondingly.  However I seem to be unable to override this.

I am curious as to why login pages under AuthCookie do have a 403 status,
instead of a 200 status.  Is this necessary, or will OK do?  

Cheers

Mike



-Original Message-
From: tim fulcher [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 10:48 AM
To: [EMAIL PROTECTED]
Subject: Re: Getting AuthCookie to return a wml page



Delivering text/html to a wap browser will definitely make it choke a bit
:-)

If you are using the same access mechanism for both web & wap access then
you
have to sniff the client details to work out what to send back. Now you
*could*
look at the USER_AGENT string of the request and work off of that, but
frankly
that can get to be a real chore given the increasing diversity of wap
browsers.
(Yeah, you could match 'Nokia', 'UP' or 'Ericsson' to get most of them)
Alternatively, best to look at the Accept content type field in the request,
and
match on text/vnd.wap.wml for the WAP users. For them, you'll then need to
set
the header type of any response to be that mime type. I'd have thought
$r->content_type() should work, surely. You aren't using header_out()
somewhere
instead are you (IIRC the Eagle book says used content_type over this)

ps: I find the Phone.com UP SDK more informative when dealing with errors in
development. Of course, all the real phones deviate from the emulators
anyway,
but thats another story.

pps: out of curiosity, are you relying on the wap gateway to store the
cookie on
behalf of the wap browser or what ? I was under the impression that not all
wap
browsers could deal with cookies


Tim Fulcher



Michael Smith wrote:

> Dear All,
>
> I'm trying to use AuthCookie to return a wml page for those lucky people
on
> wap browsers.  I've got it all working nicely for normal web browsers, but
> am getting errors on wap (and the Nokia Wap Toolkit doesn't tell me very
> much about why it's an error).  One thing that looks a bit suspicious is
the
> Content-type line which comes our as text/html - in fact to be precise it
> comes out as:
>
> Content-Type: text/html; charset=iso-8859-1
>
> I've tried to override this with things like $r->content_type but to no
> avail.  It seems that there's a line in http_protocol.c (line 2667) which
is
> setting this (this response is harcoded there).
>
> Surely I ought to be able to override this ... in which case the obvious
> question is, how?
>
> Cheers
>
> Mike
>
> http://www.iii.co.uk
> Interactive Investor International is a leading UK Internet personal
> finance service that provides individuals with the capability to identify,
> compare, monitor and buy online a number of financial products and
services.
>
> Interactive Investor Trading Limited, a subsidiary of Interactive Investor
> International plc, is regulated by the SFA.

http://www.iii.co.uk 
Interactive Investor International is a leading UK Internet personal 
finance service that provides individuals with the capability to identify, 
compare, monitor and buy online a number of financial products and services.

Interactive Investor Trading Limited, a subsidiary of Interactive Investor 
International plc, is regulated by the SFA.



Re: Getting AuthCookie to return a wml page

2001-04-05 Thread tim fulcher


Delivering text/html to a wap browser will definitely make it choke a bit :-)

If you are using the same access mechanism for both web & wap access then you
have to sniff the client details to work out what to send back. Now you *could*
look at the USER_AGENT string of the request and work off of that, but frankly
that can get to be a real chore given the increasing diversity of wap browsers.
(Yeah, you could match 'Nokia', 'UP' or 'Ericsson' to get most of them)
Alternatively, best to look at the Accept content type field in the request, and
match on text/vnd.wap.wml for the WAP users. For them, you'll then need to set
the header type of any response to be that mime type. I'd have thought
$r->content_type() should work, surely. You aren't using header_out() somewhere
instead are you (IIRC the Eagle book says used content_type over this)

ps: I find the Phone.com UP SDK more informative when dealing with errors in
development. Of course, all the real phones deviate from the emulators anyway,
but thats another story.

pps: out of curiosity, are you relying on the wap gateway to store the cookie on
behalf of the wap browser or what ? I was under the impression that not all wap
browsers could deal with cookies


Tim Fulcher



Michael Smith wrote:

> Dear All,
>
> I'm trying to use AuthCookie to return a wml page for those lucky people on
> wap browsers.  I've got it all working nicely for normal web browsers, but
> am getting errors on wap (and the Nokia Wap Toolkit doesn't tell me very
> much about why it's an error).  One thing that looks a bit suspicious is the
> Content-type line which comes our as text/html - in fact to be precise it
> comes out as:
>
> Content-Type: text/html; charset=iso-8859-1
>
> I've tried to override this with things like $r->content_type but to no
> avail.  It seems that there's a line in http_protocol.c (line 2667) which is
> setting this (this response is harcoded there).
>
> Surely I ought to be able to override this ... in which case the obvious
> question is, how?
>
> Cheers
>
> Mike
>
> http://www.iii.co.uk
> Interactive Investor International is a leading UK Internet personal
> finance service that provides individuals with the capability to identify,
> compare, monitor and buy online a number of financial products and services.
>
> Interactive Investor Trading Limited, a subsidiary of Interactive Investor
> International plc, is regulated by the SFA.




Getting AuthCookie to return a wml page

2001-04-04 Thread Michael Smith

Dear All,

I'm trying to use AuthCookie to return a wml page for those lucky people on
wap browsers.  I've got it all working nicely for normal web browsers, but
am getting errors on wap (and the Nokia Wap Toolkit doesn't tell me very
much about why it's an error).  One thing that looks a bit suspicious is the
Content-type line which comes our as text/html - in fact to be precise it
comes out as:

Content-Type: text/html; charset=iso-8859-1

I've tried to override this with things like $r->content_type but to no
avail.  It seems that there's a line in http_protocol.c (line 2667) which is
setting this (this response is harcoded there).

Surely I ought to be able to override this ... in which case the obvious
question is, how?

Cheers

Mike




http://www.iii.co.uk 
Interactive Investor International is a leading UK Internet personal 
finance service that provides individuals with the capability to identify, 
compare, monitor and buy online a number of financial products and services.

Interactive Investor Trading Limited, a subsidiary of Interactive Investor 
International plc, is regulated by the SFA.