Top Description Inners Constructors Methods
org.eclipse.jgit.internal.transport.sshd.proxy

public final Class HttpParser

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Iterator, .List, org.eclipse.jgit.util.HttpSupport

A basic parser for HTTP response headers. Handles status lines and authentication headers (WWW-Authenticate, Proxy-Authenticate).
See Also
RFC 7230, RFC 7235

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
HttpParser.ParseException

An exception indicating some problem parsing HTPP headers.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static List<AuthenticationChallenge>

Returns:

a list of AuthenticationChallenges found.
getAuthenticationHeaders
(List<String>
The complete (header) lines of the HTTP response
reply
,
String
to look for (including the terminating ':'!)
authenticationHeader
)

Extract the authentication headers from the header lines.

private static int
parseChallenge(AuthenticationChallenge challenge, String header, int from)

private static void
public static StatusLine

Returns:

the StatusLine
parseStatusLine
(String
to parse
line
)

Parse a HTTP response status line.

private static String
scanQuotedString(String header, int from, int[] to)

private static int
skipWhiteSpace(String header, int i)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

HttpParserback to summary
private HttpParser()

Method Detail

getAuthenticationHeadersback to summary
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 in reply is the raw status line as received from the server. It is skipped. Line processing stops on the first empty line thereafter.

Parameters
reply:List<String>

The complete (header) lines of the HTTP response

authenticationHeader:String

to look for (including the terminating ':'!)

Returns:List<AuthenticationChallenge>

a list of AuthenticationChallenges found.

parseChallengeback to summary
private static int parseChallenge(AuthenticationChallenge challenge, String header, int from)
parseChallengesback to summary
private static void parseChallenges(List<AuthenticationChallenge> challenges, String header)
parseStatusLineback to summary
public static StatusLine parseStatusLine(String line) throws ParseException

Parse a HTTP response status line.

Parameters
line:String

to parse

Returns:StatusLine

the StatusLine

Exceptions
ParseException:
if the line cannot be parsed or has the wrong HTTP version
scanQuotedStringback to summary
private static String scanQuotedString(String header, int from, int[] to)
skipWhiteSpaceback to summary
private static int skipWhiteSpace(String header, int i)
org.eclipse.jgit.internal.transport.sshd.proxy back to summary

public Class HttpParser.ParseException

extends Exception
Class Inheritance

An exception indicating some problem parsing HTPP headers.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public
ParseException()

Creates a new ParseException without cause.

public
ParseException(Throwable
Throwable that caused this exception, or null if none
cause
)

Creates a new ParseException with the given cause.

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Constructor Detail

ParseExceptionback to summary
public ParseException()

Creates a new ParseException without cause.

ParseExceptionback to summary
public ParseException(Throwable cause)

Creates a new ParseException with the given cause.

Parameters
cause:Throwable

Throwable that caused this exception, or null if none