/** * Extract a HTTP header from the response. * * @param c * connection the header should be obtained from. * @param headerName * the header name * @return the header value * @throws java.io.IOException * communications error prevented obtaining the header. * @since 4.7 */ public static String responseHeader(final HttpConnection c, final String headerName) throws IOException { return c.getHeaderField(headerName); }
private boolean isGzipContent(HttpConnection c) { return ENCODING_GZIP.equals(c.getHeaderField(HDR_CONTENT_ENCODING)) || ENCODING_X_GZIP.equals(c.getHeaderField(HDR_CONTENT_ENCODING)); }
private PushConnection smartPush(String service, HttpConnection c, InputStream in) throws IOException, TransportException { readSmartHeaders(in, service); SmartHttpPushConnection p = new SmartHttpPushConnection(in); p.setPeerUserAgent(c.getHeaderField(HttpSupport.HDR_SERVER)); return p; }
@SuppressWarnings("resource") // Closed by caller private FetchConnection getConnection(HttpConnection c, InputStream in, String service) throws IOException { BaseConnection f; if (isSmartHttp(c, service)) { readSmartHeaders(in, service); f = new SmartHttpFetchConnection(in); } else { // Assume this server doesn't support smart HTTP fetch // and fall back on dumb object walking. f = newDumbConnection(in); } f.setPeerUserAgent(c.getHeaderField(HttpSupport.HDR_SERVER)); return (FetchConnection) f; }
/** * Extract a HTTP header from the response. * * @param c * connection the header should be obtained from. * @param headerName * the header name * @return the header value * @throws java.io.IOException * communications error prevented obtaining the header. * @since 4.7 */ public static String responseHeader(final HttpConnection c, final String headerName) throws IOException { return c.getHeaderField(headerName); }
private boolean isGzipContent(HttpConnection c) { return ENCODING_GZIP.equals(c.getHeaderField(HDR_CONTENT_ENCODING)) || ENCODING_X_GZIP.equals(c.getHeaderField(HDR_CONTENT_ENCODING)); }
&& conn.getHeaderField(HDR_WWW_AUTHENTICATE) != null) authMethod = HttpAuthMethod.scanResponse(conn, ignoreTypes); return conn; Integer.valueOf(status))); URIish newUri = redirect(conn.getHeaderField(HDR_LOCATION), Constants.INFO_REFS, redirects++); setURI(newUri);
currentUri = redirect(conn.getHeaderField(HDR_LOCATION), '/' + serviceName, redirects++); try {
final InputStream openInputStream(HttpConnection conn) throws IOException { InputStream input = conn.getInputStream(); if (ENCODING_GZIP.equals(conn.getHeaderField(HDR_CONTENT_ENCODING))) input = new GZIPInputStream(input); return input; }
private PushConnection smartPush(String service, HttpConnection c, InputStream in) throws IOException, TransportException { readSmartHeaders(in, service); SmartHttpPushConnection p = new SmartHttpPushConnection(in); p.setPeerUserAgent(c.getHeaderField(HttpSupport.HDR_SERVER)); return p; }
private PushConnection smartPush(String service, HttpConnection c, InputStream in) throws IOException, TransportException { readSmartHeaders(in, service); SmartHttpPushConnection p = new SmartHttpPushConnection(in); p.setPeerUserAgent(c.getHeaderField(HttpSupport.HDR_SERVER)); return p; }
if (status == SC_OK) { String contentLengthHeader = conn .getHeaderField(HDR_CONTENT_LENGTH); if (contentLengthHeader != null) { return Integer.parseInt(contentLengthHeader);
if (status == SC_OK) { String contentLengthHeader = conn .getHeaderField(HDR_CONTENT_LENGTH); if (contentLengthHeader != null) { return Integer.parseInt(contentLengthHeader);
@SuppressWarnings("resource") // Closed by caller private FetchConnection getConnection(HttpConnection c, InputStream in, String service) throws IOException { BaseConnection f; if (isSmartHttp(c, service)) { readSmartHeaders(in, service); f = new SmartHttpFetchConnection(in); } else { // Assume this server doesn't support smart HTTP fetch // and fall back on dumb object walking. f = newDumbConnection(in); } f.setPeerUserAgent(c.getHeaderField(HttpSupport.HDR_SERVER)); return (FetchConnection) f; }
&& conn.getHeaderField(HDR_WWW_AUTHENTICATE) != null) authMethod = HttpAuthMethod.scanResponse(conn, ignoreTypes); return conn;
@Override public FetchConnection openFetch() throws TransportException, NotSupportedException { final String service = SVC_UPLOAD_PACK; try { final HttpConnection c = connect(service); final InputStream in = openInputStream(c); try { BaseConnection f; if (isSmartHttp(c, service)) { readSmartHeaders(in, service); f = new SmartHttpFetchConnection(in); } else { // Assume this server doesn't support smart HTTP fetch // and fall back on dumb object walking. f = newDumbConnection(in); } f.setPeerUserAgent(c.getHeaderField(HttpSupport.HDR_SERVER)); return (FetchConnection) f; } finally { in.close(); } } catch (NotSupportedException err) { throw err; } catch (TransportException err) { throw err; } catch (IOException err) { throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err); } }
&& conn.getHeaderField(HDR_WWW_AUTHENTICATE) != null) authMethod = HttpAuthMethod.scanResponse(conn, ignoreTypes); return conn; Integer.valueOf(status))); URIish newUri = redirect(conn.getHeaderField(HDR_LOCATION), Constants.INFO_REFS, redirects++); setURI(newUri);
currentUri = redirect(conn.getHeaderField(HDR_LOCATION), '/' + serviceName, redirects++); try {