?
Solved

HTTP_ACCEPT header issue.

Posted on 2003-03-20
11
Medium Priority
?
302 Views
Last Modified: 2012-05-04
Hi Experts,

    Basically, i need to catch a specific mime type from the client (i just have to detect it once), I'm currently using PHP (but the issue is not specific to php) and HTTP_ACCEPT header.

    ( ACCEPT: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* ) is what i need...

    Issue comes with MSIE for Mac which only send the 'accept all'
    ( ACCEPT:*/* )

    (Probably there is other browsers which send only that but i dont need them for the moment...)

    I want the list of supported mimes instead of this unusable 'accept all'...

    So i need a solution, a specific header to send, or a particular Metatag in a page, or whatever else which will work (ASP and co. welcome)...

    I allready crawled over google, google.groups and several technicals support without success (i've allready seen this question but no answer).

    I know there is problably no solution for this problem, so i ask here to experts for any working hack/workaround for this issue.

    *Please, forget about browser settings change, registry key, or any client side modification*

Thanks for any answer
M.
0
Comment
Question by:manix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 4

Accepted Solution

by:
Wakie earned 2000 total points
ID: 8178336
Hi manix,

You may find this useless, but in ASP you can acheive this with the following piece of code:

<%=Request.ServerVariables("HTTP_ACCEPT")%>

...and, test the resulted output here:

http://www.teenwriting.net/wakie/http-accept.asp

Regards,
Wakie.
0
 
LVL 2

Author Comment

by:manix
ID: 8181585
Hi Wakie,
   Thanks for answer, this looks exactly like the ASP translation of the PHP function i use to retrieve the header, maybe useful if i achieve the issue and plane an ASP version.
   But it seems that it wont force IE on Mac to send the wanted header...

Thanks
M.
0
 
LVL 2

Expert Comment

by:bobsledbob
ID: 8185662

RFC2936 seems to be what you're looking for...

http://www.faqs.org/rfcs/rfc2936.html


It includes a javascript example on how to detect mime-types.  I'm thinking using javascript is likely your best and most cross-portable bet.

0
Bringing Advanced Authentication to the SMB Market

WatchGuard announces the acquisition of advanced authentication provider, Datablink, with one mission – to bring secure authentication to SMB, mid-market, and distributed enterprises with a cloud-based solution, ideal for resale via their established channel & MSSP community.

 
LVL 4

Expert Comment

by:Wakie
ID: 8185692
Hi manix,

ok, in PHP there's a function that might be able to help you called get_browser. Use it like so:

$browser = get_browser();
echo list_array ((array) $browser);

This will then return all the values you could theoretically use. HTH.

Regards,
Wakie.
0
 
LVL 2

Author Comment

by:manix
ID: 8451305
Hi xperts, sorry of long time without news, HD died...

Well,

bobsledbob first, thanks for the answer, but in fact, i am trying to code a server side detection exactly to avoid a client-side (javascript, activeX...) detection, that i can allready do, but which is not very reliable...

Wakie again, thanks for the effort, if there is no good answer i will give u points...
In fact get_browser isnt good here, because its based on a server static file (browscap.ini) which does not considers the real capacities of the client (ie: if a specific plug in is installed or not...)

Thanks all,
Still waiting for the miracle...
M.
0
 
LVL 4

Expert Comment

by:Wakie
ID: 8452955
Hi manix,

As soon as a connection is made between the http server and the web browser, the web browser tells the server what it wants immediately and along with that demand it passes its "Accept" header.

Unfortunately, there is no way for the server to say "i want to force you to give me a list of the supported components you can read" before the client gives its request.

But you may like to take a look at the following function.

function mimelist() {
        $mimetypes = $_SERVER["HTTP_ACCEPT"];
        $mimetypes = str_replace(" ", "", $mimetypes);
        $ar = explode(",", $mimetypes);
        return $ar;
}

I hope that helps.

Regards,
Wakie.
0
 
LVL 4

Expert Comment

by:Wakie
ID: 8549061
Hi manix,

How's progress?
0
 
LVL 2

Author Comment

by:manix
ID: 8549971
Hi wakie, standby...

Still waiting for a real answer ;)

Your function mimelist may be useful, but as i only check for a presence of a particular mimetype i just use a strpos on the HTTP_ACCEPT.

My real problem is not to retrieve the mimetypes from the http_accept nor retrieve the http_accept ( i'm really not a php newbie believe me ;)

My real problem is that on certain platform the http_accept is sent but with a value of "*/*", kind of "hello, i accept everything, try" instead of the supported mimetypes list that i need.

I've no problem programming, i'm just searching for a (dirty) trick that might be known by other experts  to "force" the clients to send the correct list instead of this fake "*/*" .......

I just need a server side trick, whatever it is.

As i said in demand:

"I know there is problably no solution for this problem, so i ask here to experts for any working hack/workaround for this issue."


I'll wait the end of the month and then give u points if there is no working trick submitted...
thanks
M.
0
 
LVL 2

Author Comment

by:manix
ID: 8586415
Nobody, really ???
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9115266
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 2

Author Comment

by:manix
ID: 9115403
Sorry, i just forgot this question...

Nobody answered, because there is probably no answer

So i give points to the first...

0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question