GetHeaderField() public méthode

public GetHeaderField ( string header ) : string
header string
Résultat string
Exemple #1
0
 /// <summary>Handle an authentication failure and possibly return a new response.</summary>
 /// <remarks>Handle an authentication failure and possibly return a new response.</remarks>
 /// <param name="conn">the connection that failed.</param>
 /// <returns>new authentication method to try.</returns>
 internal static HttpAuthMethod ScanResponse(HttpURLConnection conn)
 {
     string hdr = conn.GetHeaderField(HttpSupport.HDR_WWW_AUTHENTICATE);
     if (hdr == null || hdr.Length == 0)
     {
         return NONE;
     }
     int sp = hdr.IndexOf(' ');
     if (sp < 0)
     {
         return NONE;
     }
     string type = Sharpen.Runtime.Substring(hdr, 0, sp);
     if (Sharpen.Runtime.EqualsIgnoreCase(HttpAuthMethod.Basic.NAME, type))
     {
         return new HttpAuthMethod.Basic();
     }
     else
     {
         if (Sharpen.Runtime.EqualsIgnoreCase(HttpAuthMethod.Digest.NAME, type))
         {
             return new HttpAuthMethod.Digest(Sharpen.Runtime.Substring(hdr, sp + 1));
         }
         else
         {
             return NONE;
         }
     }
 }
Exemple #2
0
		/// <exception cref="System.IO.IOException"></exception>
		protected internal virtual void ValidateImpl(HttpURLConnection u, string p, string
			 version, string name)
		{
			string v;
			v = u.GetHeaderField(p + JETS3T_CRYPTO_VER);
			if (v == null)
			{
				v = string.Empty;
			}
			if (!version.Equals(v))
			{
				throw new IOException(MessageFormat.Format(JGitText.Get().unsupportedEncryptionVersion
					, v));
			}
			v = u.GetHeaderField(p + JETS3T_CRYPTO_ALG);
			if (v == null)
			{
				v = string.Empty;
			}
			if (!name.Equals(v))
			{
				throw new IOException(JGitText.Get().unsupportedEncryptionAlgorithm + v);
			}
		}