Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

HTTP Request Header and HTTP Response Header

Hi,

I would like to know difference and similarities, uses between HTTPRequestHeader and HTTPResponseHeader. When we have to use which one. What are the important practically used mentods.


Are  HTTP 1.1 Request/Response Headers are different from  HTTP Request/Response Header?
Please advise.
Currently HTTP is being used or HTTP1.1?

Do we ever practically need to use this Header stuff?

Any links resources ideas highly appreciated. Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

>>For things like HTML pages that the web server does on it's own, the web server sends the HTTP Response Header.  If your program code is returning a file to the client, it will probably have to send an appropriate HTTP Response Header itself.  

Can you please elaborate on above sentence.



>>>if you are implementing something on the client side (that needs to connect to standards based servers) or the server side (which needs to be accessed from standards based clients/browsers).


Can you please elaborate on client side implementation vs server side implementation  and how that effect choise between http1.1/1.0

Please advise
I'll allow Dave to elaborate on the sentence that you have queries on. As for what I was saying regarding clients and servers, all I was trying to do was to ask you why you are interested in this; are you writing code that will act as a client? Or are you writing code that will act as a server? If you're not actually writing code, and are just asking about this out of interest then don't worry about what I was asking, it should be enough just to know that there are provisions in the HTTP standards so that clients/servers of differing versions can still generally work together.
If your program is returning a file to your client that has a different MIME or Content Type than your program, you must send an appropriate Content-Type header.  The standard Content-Type is "text/html".  If your program is sending a JPG image to the client, you must first send a "Content-Type: image/jpeg" so the browser will know what to do with the file.
It appears that the client requests the HTTP version.  I don't know what happens if the server doesn't support it.  But then, HTTP/1.1 has been the current standard for a long time now since June 1999.

All of this information is in the Wikipedia article I linked above.
Avatar of gudii9

ASKER

>>If your program is returning a file to your client that has a different MIME or Content Type than your program, you must send an appropriate Content-Type header.



your program--> means java program like java servlet running on server like tomcat server right???

 client --->means the browser right like IE or Mozilla??


you must send an appropriate Content-Type header---->you mean to say the server must send right. Please advise
You have everything right except the last statement.  If you are using your program like *.jsp to send a file that is *.jpg to the client then your *.jsp program must send the "image/jpeg" content header itself.  Since the actual file does not match the 'type' of your *.jsp program file, you must send the correct header yourself.  That is because the server does not know that you are sending something other than a *.jsp file.
Avatar of gudii9

ASKER

>>>you must send the correct header yourself.


In the ResponseHeader right?


If yes then i understood about ResponseHeader.

In what situations we use RequestHeaders?

Please advise.
Clients send Request Headers.  Are you writing code to be used as a client that makes Requests to another server?