Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

about http return header

Can anyone tell what's the meaning of these http return headers and how and when to generate these headers?

DateFiuse GMTj
Last-ModifiedFiuse GMTj
WWW-AuthenticateF
LocationF
ConnectionFclose
Cache-controlFno-cache

Your help is grealy appreciated.


0
yaoming
Asked:
yaoming
  • 3
  • 3
  • 3
  • +1
1 Solution
 
ssnkumarCommented:
This header is the response header generated by a web server, when the browser asked for some request.
But, the first line has to the "HTTP version Code Phrase". I am not seeing it in the header you have posted. Since that line is missing, I don't think you have posted the complete header!
Last-Modified.... will tell the client that the page requested was last modified on that date/time. This is useful for sites which keeps updating the contents (like News sites). The web client maintains a cache and can take the page from there itself, if the page is not modified. Else it requests for a fresh page.
WWW-Authenticate.....tells the client that authentication is needed.
Connection: close
This is part of the request HTTP header, not of response header.

-Narendra
0
 
yaomingAuthor Commented:
hi,
can you tell me how to get last modified time using C/C++
and how the server determines whether the web client maintains a cache or not and how does it implemented using a programming language?

Thanx For Your Help!
0
 
msa2003Commented:
It looks like you used non-windows-1252 codepage to enter your question, so I can't read it. Couldn't you re-enter it in U. S. english?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
yaomingAuthor Commented:
hi,msa2003,
thanx for your help.
I have known the answers to most of the questions that i asked.
I'm now developing a simple web server using C and C++ which can process get,head method and basic authentication.

Can you tell me how the basic authentication is realized?
 
0
 
ssnkumarCommented:
Do you want to know the last modified time of the file on your system OR the syntax of the header in HTTP/1.1?
Which is the OS you are using?

-Narendra
0
 
msa2003Commented:
Re yaoming: see RFC-2068, section 11.1:

The "basic" authentication scheme is based on the model that the user agent must authenticate itself with a user-ID and a password for each realm. The realm value should be considered an opaque string which can only be compared for equality with other realms on that server.
The server will service the request only if it can validate the user-ID and password for the protection space of the Request-URI. There are no optional authentication parameters. Upon receipt of an unauthorized request for a URI within the protection space, the server MAY respond with a challenge like the following:

          WWW-Authenticate: Basic realm="WallyWorld"

   where "WallyWorld" is the string assigned by the server to identify the protection space of the Request-URI. To receive authorization, the client sends the userid and password, separated by a single colon (":") character, within a base64  encoded string in the credentials.

          basic-credentials = "Basic" SP basic-cookie
          basic-cookie   = <base64 [7] encoding of user-pass, except not limited to 76 char/line>
          user-pass   = userid ":" password
          userid      = *<TEXT excluding ":">
          password    = *TEXT

   Userids might be case sensitive.

   If the user agent wishes to send the userid "Aladdin" and password "open sesame", it would use the following header field:

          Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

   I think it is clear enough.
0
 
yaomingAuthor Commented:
hi,can you tell me how can i encode base64 string to normal string? any code available?

0
 
ssnkumarCommented:
You will need a decoder which can do that. In Linux machine, uuencode/uudecode will do that. Similar thing must be available on windows too.

-Narendra
0
 
msa2003Commented:
The base64 encoding method is ckearly described in RFC-822 (as I remember).

It is complex enough. It is difficult to place it here because the description contains two large encoding tables.

You may read RFC-822 for details or I could write a DLL (sorry, but I think that it will take some additional points because it is another question).

base64 encoding is used to encode raw 8-bit values using only the symbols of Latin alphabet. They are 62 alphabet symbols (including capitals) and two additional ("+" and "/") - overall 64. 64 values is 6 bits, so we need to transform a series of 8-bit values to 6-bit. 3 bytes is equal to 24 bits or 4 6-bit values. So we are taking 24-bit triplet (which is easy using 32-bit programming) and splitting it to 4 6-bit values. The next, we are taking the corresponding symbols from the encoding table (whit contains 64 entries) and writting it to output.

Decoder is more complex, but I think you do not need a decoder.

Encoder results could be tested with any mail program or UUE encoder/decoder which could be found easily via Internet.
0
 
jmcgOwnerCommented:
Nothing has happened on this question in over 10 months. It's time for cleanup!

My recommendation, which I will post in the Cleanup topic area, is to
accept answer by ssnkumar (good help from msa2003, too, but too few points...).

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now