Class HttpParser
java.lang.Object
org.eclipse.jgit.internal.transport.sshd.proxy.HttpParser
A basic parser for HTTP response headers. Handles status lines and
authentication headers (WWW-Authenticate, Proxy-Authenticate).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn exception indicating some problem parsing HTPP headers. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<AuthenticationChallenge>getAuthenticationHeaders(List<String> reply, String authenticationHeader) Extract the authentication headers from the header lines.private static intparseChallenge(AuthenticationChallenge challenge, String header, int from) private static voidparseChallenges(List<AuthenticationChallenge> challenges, String header) static StatusLineparseStatusLine(String line) Parse a HTTP response status line.private static StringscanQuotedString(String header, int from, int[] to) private static intskipWhiteSpace(String header, int i)
-
Constructor Details
-
HttpParser
private HttpParser()
-
-
Method Details
-
parseStatusLine
Parse a HTTP response status line.- Parameters:
line- to parse- Returns:
- the
StatusLine - Throws:
HttpParser.ParseException- if the line cannot be parsed or has the wrong HTTP version
-
getAuthenticationHeaders
public static List<AuthenticationChallenge> getAuthenticationHeaders(List<String> reply, String authenticationHeader) Extract the authentication headers from the header lines. It is assumed that the first element inreplyis the raw status line as received from the server. It is skipped. Line processing stops on the first empty line thereafter.- Parameters:
reply- The complete (header) lines of the HTTP responseauthenticationHeader- to look for (including the terminating ':'!)- Returns:
- a list of
AuthenticationChallenges found.
-
parseChallenges
-
parseChallenge
-
skipWhiteSpace
-
scanQuotedString
-