Skip to content

Fix typos #1752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
runs-on: ubuntu-16.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public interface AsyncHttpClientConfig {
String[] getEnabledCipherSuites();

/**
* @return if insecured cipher suites must be filtered out (only used when not explicitly passing enabled cipher suites)
* @return if insecure cipher suites must be filtered out (only used when not explicitly passing enabled cipher suites)
*/
boolean isFilterInsecureCipherSuites();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface ResumableListener {
void onBytesReceived(ByteBuffer byteBuffer) throws IOException;

/**
* Invoked when all the bytes has been sucessfully transferred.
* Invoked when all the bytes has been successfully transferred.
*/
void onAllBytesReceived();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,15 @@ private SslHandler createSslHandler(String peerHost, int peerPort) {

public Future<Channel> updatePipelineForHttpTunneling(ChannelPipeline pipeline, Uri requestUri) {

Future<Channel> whenHanshaked = null;
Future<Channel> whenHandshaked = null;

if (pipeline.get(HTTP_CLIENT_CODEC) != null)
pipeline.remove(HTTP_CLIENT_CODEC);

if (requestUri.isSecured()) {
if (!isSslHandlerConfigured(pipeline)) {
SslHandler sslHandler = createSslHandler(requestUri.getHost(), requestUri.getExplicitPort());
whenHanshaked = sslHandler.handshakeFuture();
whenHandshaked = sslHandler.handshakeFuture();
pipeline.addBefore(INFLATER_HANDLER, SSL_HANDLER, sslHandler);
}
pipeline.addAfter(SSL_HANDLER, HTTP_CLIENT_CODEC, newHttpClientCodec());
Expand All @@ -368,7 +368,7 @@ public Future<Channel> updatePipelineForHttpTunneling(ChannelPipeline pipeline,

pipeline.remove(AHC_HTTP_HANDLER);
}
return whenHanshaked;
return whenHandshaked;
}

public SslHandler addSslHandler(ChannelPipeline pipeline, Uri uri, String virtualHost, boolean hasSocksProxyHandler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public abstract class FileLikePart extends PartBase {
* @param charset the charset encoding for this part
* @param fileName the fileName
* @param contentId the content id
* @param transfertEncoding the transfer encoding
* @param transferEncoding the transfer encoding
*/
public FileLikePart(String name, String contentType, Charset charset, String fileName, String contentId, String transfertEncoding) {
public FileLikePart(String name, String contentType, Charset charset, String fileName, String contentId, String transferEncoding) {
super(name,
computeContentType(contentType, fileName),
charset,
contentId,
transfertEncoding);
transferEncoding);
this.fileName = fileName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public String toString() {
" name=" + getName() +
" contentType=" + getContentType() +
" charset=" + getCharset() +
" tranferEncoding=" + getTransferEncoding() +
" transferEncoding=" + getTransferEncoding() +
" contentId=" + getContentId() +
" dispositionType=" + getDispositionType();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected boolean handleCallback(Callback callback) {
/*
* This method is called from the handle(Callback[]) method when the specified callback
* did not match any of the known callback classes. It looks for the callback method
* having the specified method name with one of the suppported parameter types.
* having the specified method name with one of the supported parameter types.
* If found, it invokes the callback method on the object and returns true.
* If not, it returns false.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class StringBuilderPool {
private final ThreadLocal<StringBuilder> pool = ThreadLocal.withInitial(() -> new StringBuilder(512));

/**
* BEWARE: MUSN'T APPEND TO ITSELF!
* BEWARE: MUSTN'T APPEND TO ITSELF!
*
* @return a pooled StringBuilder
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ public void asyncOptionsTest() throws Throwable {

final AtomicReference<HttpHeaders> responseHeaders = new AtomicReference<>();

// Some responses contain the TRACE method, some do not - account for both
// FIXME: Actually refactor this test to account for both cases
final String[] expected = {"GET", "HEAD", "OPTIONS", "POST"};
final String[] expectedWithTrace = {"GET", "HEAD", "OPTIONS", "POST", "TRACE"};
Future<String> f = client.prepareOptions("http://www.apache.org/").execute(new AsyncHandlerAdapter() {

@Override
Expand All @@ -455,10 +458,16 @@ public String onCompleted() {
HttpHeaders h = responseHeaders.get();
assertNotNull(h);
String[] values = h.get(ALLOW).split(",|, ");
assertNotNull(values);
assertEquals(values.length, expected.length);
assertNotNull(values);
// Some responses contain the TRACE method, some do not - account for both
assert(values.length == expected.length || values.length == expectedWithTrace.length);
Arrays.sort(values);
assertEquals(values, expected);
// Some responses contain the TRACE method, some do not - account for both
if(values.length == expected.length) {
assertEquals(values, expected);
} else {
assertEquals(values, expectedWithTrace);
}
}));
}

Expand Down
4 changes: 2 additions & 2 deletions client/src/test/java/org/asynchttpclient/BasicAuthTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void setUpGlobal() throws Exception {
server2.start();
port2 = connector2.getLocalPort();

// need noAuth server to verify the preemptive auth mode (see basicAuthTestPreemtiveTest)
// need noAuth server to verify the preemptive auth mode (see basicAuthTestPreemptiveTest)
serverNoAuth = new Server();
ServerConnector connectorNoAuth = addHttpConnector(serverNoAuth);
serverNoAuth.setHandler(new SimpleHandler());
Expand Down Expand Up @@ -170,7 +170,7 @@ public Integer onCompleted() {
}

@Test
public void basicAuthTestPreemtiveTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
public void basicAuthTestPreemptiveTest() throws IOException, ExecutionException, TimeoutException, InterruptedException {
try (AsyncHttpClient client = asyncHttpClient()) {
// send the request to the no-auth endpoint to be able to verify the
// auth header is really sent preemptively for the initial call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ public void onThrowable(Throwable t) {
}

@Test
public void nonBlockingNestedRequetsFromIoThreadAreFine() throws Throwable {
public void nonBlockingNestedRequestsFromIoThreadAreFine() throws Throwable {
withClient().run(client ->
withServer(server).run(server -> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void testMaxTotalConnectionsExceedingException() throws IOException {

@Test(groups = "online")
public void testMaxTotalConnections() throws Exception {
String[] urls = new String[]{"https://google.com", "https://github.com"};
String[] urls = new String[]{"https://www.google.com", "https://www.youtube.com"};

final CountDownLatch latch = new CountDownLatch(2);
final AtomicReference<Throwable> ex = new AtomicReference<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @author Benjamin Hanzelmann
*/
public class PropertiesBasedResumableProcesserTest {
public class PropertiesBasedResumableProcessorTest {

@Test
public void testSaveLoad() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static protected class SimpleStreamedAsyncHandler implements StreamedAsyncHandle

@Override
public State onStream(Publisher<HttpResponseBodyPart> publisher) {
LOGGER.debug("SimpleStreamedAsyncHandleronCompleted onStream");
LOGGER.debug("SimpleStreamedAsyncHandlerOnCompleted onStream");
publisher.subscribe(subscriber);
return State.CONTINUE;
}
Expand All @@ -105,7 +105,7 @@ public void onThrowable(Throwable t) {

@Override
public State onBodyPartReceived(HttpResponseBodyPart bodyPart) {
LOGGER.debug("SimpleStreamedAsyncHandleronCompleted onBodyPartReceived");
LOGGER.debug("SimpleStreamedAsyncHandlerOnCompleted onBodyPartReceived");
throw new AssertionError("Should not have received body part");
}

Expand All @@ -121,7 +121,7 @@ public State onHeadersReceived(HttpHeaders headers) {

@Override
public SimpleStreamedAsyncHandler onCompleted() {
LOGGER.debug("SimpleStreamedAsyncHandleronCompleted onSubscribe");
LOGGER.debug("SimpleStreamedAsyncHandlerOnCompleted onSubscribe");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class ChunkingTest extends AbstractBasicTest {

// So we can just test the returned data is the image,
// and doesn't contain the chunked delimeters.
// and doesn't contain the chunked delimiters.
@Test
public void testBufferLargerThanFileWithStreamBodyGenerator() throws Throwable {
doTestWithInputStreamBodyGenerator(new BufferedInputStream(Files.newInputStream(LARGE_IMAGE_FILE.toPath()), 400000));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest req, H
total += count;
}
resp.setStatus(200);
resp.addHeader("X-TRANFERED", String.valueOf(total));
resp.addHeader("X-TRANSFERRED", String.valueOf(total));
resp.getOutputStream().flush();
resp.getOutputStream().close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public void basicPutFileTest() throws Exception {
final AtomicReference<Throwable> throwable = new AtomicReference<>();
final AtomicReference<HttpHeaders> hSent = new AtomicReference<>();
final AtomicReference<HttpHeaders> hRead = new AtomicReference<>();
final AtomicInteger bbReceivedLenght = new AtomicInteger(0);
final AtomicLong bbSentLenght = new AtomicLong(0L);
final AtomicInteger bbReceivedLength = new AtomicInteger(0);
final AtomicLong bbSentLength = new AtomicLong(0L);

final AtomicBoolean completed = new AtomicBoolean(false);

Expand All @@ -120,11 +120,11 @@ public void onResponseHeadersReceived(HttpHeaders headers) {
}

public void onBytesReceived(byte[] b) {
bbReceivedLenght.addAndGet(b.length);
bbReceivedLength.addAndGet(b.length);
}

public void onBytesSent(long amount, long current, long total) {
bbSentLenght.addAndGet(amount);
bbSentLength.addAndGet(amount);
}

public void onRequestResponseCompleted() {
Expand All @@ -142,8 +142,8 @@ public void onThrowable(Throwable t) {
assertEquals(response.getStatusCode(), 200);
assertNotNull(hRead.get());
assertNotNull(hSent.get());
assertEquals(bbReceivedLenght.get(), file.length(), "Number of received bytes incorrect");
assertEquals(bbSentLenght.get(), file.length(), "Number of sent bytes incorrect");
assertEquals(bbReceivedLength.get(), file.length(), "Number of received bytes incorrect");
assertEquals(bbSentLength.get(), file.length(), "Number of sent bytes incorrect");
}
}

Expand All @@ -153,8 +153,8 @@ public void basicPutFileBodyGeneratorTest() throws Exception {
final AtomicReference<Throwable> throwable = new AtomicReference<>();
final AtomicReference<HttpHeaders> hSent = new AtomicReference<>();
final AtomicReference<HttpHeaders> hRead = new AtomicReference<>();
final AtomicInteger bbReceivedLenght = new AtomicInteger(0);
final AtomicLong bbSentLenght = new AtomicLong(0L);
final AtomicInteger bbReceivedLength = new AtomicInteger(0);
final AtomicLong bbSentLength = new AtomicLong(0L);

final AtomicBoolean completed = new AtomicBoolean(false);

Expand All @@ -172,11 +172,11 @@ public void onResponseHeadersReceived(HttpHeaders headers) {
}

public void onBytesReceived(byte[] b) {
bbReceivedLenght.addAndGet(b.length);
bbReceivedLength.addAndGet(b.length);
}

public void onBytesSent(long amount, long current, long total) {
bbSentLenght.addAndGet(amount);
bbSentLength.addAndGet(amount);
}

public void onRequestResponseCompleted() {
Expand All @@ -194,8 +194,8 @@ public void onThrowable(Throwable t) {
assertEquals(response.getStatusCode(), 200);
assertNotNull(hRead.get());
assertNotNull(hSent.get());
assertEquals(bbReceivedLenght.get(), file.length(), "Number of received bytes incorrect");
assertEquals(bbSentLenght.get(), file.length(), "Number of sent bytes incorrect");
assertEquals(bbReceivedLength.get(), file.length(), "Number of received bytes incorrect");
assertEquals(bbSentLength.get(), file.length(), "Number of sent bytes incorrect");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public int write(ByteBuffer src) {
public void transferWithCopy() throws Exception {
for (int bufferLength = 1; bufferLength < MAX_MULTIPART_CONTENT_LENGTH_ESTIMATE + 1; bufferLength++) {
try (MultipartBody multipartBody = buildMultipart()) {
long tranferred = transferWithCopy(multipartBody, bufferLength);
assertEquals(tranferred, multipartBody.getContentLength());
long transferred = transferWithCopy(multipartBody, bufferLength);
assertEquals(transferred, multipartBody.getContentLength());
}
}
}
Expand All @@ -132,8 +132,8 @@ public void transferWithCopy() throws Exception {
public void transferZeroCopy() throws Exception {
for (int bufferLength = 1; bufferLength < MAX_MULTIPART_CONTENT_LENGTH_ESTIMATE + 1; bufferLength++) {
try (MultipartBody multipartBody = buildMultipart()) {
long tranferred = transferZeroCopy(multipartBody, bufferLength);
assertEquals(tranferred, multipartBody.getContentLength());
long transferred = transferZeroCopy(multipartBody, bufferLength);
assertEquals(transferred, multipartBody.getContentLength());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ private class TestFileLikePart extends FileLikePart {
this(name, contentType, charset, contentId, null);
}

TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transfertEncoding) {
this(name, contentType, charset, contentId, transfertEncoding, null);
TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transferEncoding) {
this(name, contentType, charset, contentId, transferEncoding, null);
}

TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transfertEncoding, String fileName) {
super(name, contentType, charset, fileName, contentId, transfertEncoding);
TestFileLikePart(String name, String contentType, Charset charset, String contentId, String transferEncoding, String fileName) {
super(name, contentType, charset, fileName, contentId, transferEncoding);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.testng.annotations.Test;

import java.net.UnknownHostException;
import java.net.ConnectException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicReference;
Expand Down Expand Up @@ -70,11 +71,14 @@ public void onEmptyListenerTest() throws Exception {
}
}

@Test(timeOut = 60000, expectedExceptions = UnknownHostException.class)
@Test(timeOut = 60000, expectedExceptions = {UnknownHostException.class, ConnectException.class})
public void onFailureTest() throws Throwable {
try (AsyncHttpClient c = asyncHttpClient()) {
c.prepareGet("ws://abcdefg").execute(new WebSocketUpgradeHandler.Builder().build()).get();
} catch (ExecutionException e) {

String expectedMessage = "DNS name not found";
assertTrue(e.getCause().toString().contains(expectedMessage));
throw e.getCause();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* {@link ThrottleRequestFilter} by allowing rate limiting per second in addition to the
* number of concurrent connections.
* <p>
* The <code>maxWaitMs</code> argument is respected accross both permit acquistions. For
* The <code>maxWaitMs</code> argument is respected across both permit acquisitions. For
* example, if 1000 ms is given, and the filter spends 500 ms waiting for a connection,
* it will only spend another 500 ms waiting for the rate limiter.
*/
Expand Down Expand Up @@ -44,9 +44,9 @@ public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
}

long startOfWait = System.currentTimeMillis();
attemptConcurrencyPermitAcquistion(ctx);
attemptConcurrencyPermitAcquisition(ctx);

attemptRateLimitedPermitAcquistion(ctx, startOfWait);
attemptRateLimitedPermitAcquisition(ctx, startOfWait);
} catch (InterruptedException e) {
throw new FilterException(String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler()));
}
Expand All @@ -56,7 +56,7 @@ public <T> FilterContext<T> filter(FilterContext<T> ctx) throws FilterException
.build();
}

private <T> void attemptRateLimitedPermitAcquistion(FilterContext<T> ctx, long startOfWait) throws FilterException {
private <T> void attemptRateLimitedPermitAcquisition(FilterContext<T> ctx, long startOfWait) throws FilterException {
long wait = getMillisRemainingInMaxWait(startOfWait);

if (!rateLimiter.tryAcquire(wait, TimeUnit.MILLISECONDS)) {
Expand All @@ -65,7 +65,7 @@ private <T> void attemptRateLimitedPermitAcquistion(FilterContext<T> ctx, long s
}
}

private <T> void attemptConcurrencyPermitAcquistion(FilterContext<T> ctx) throws InterruptedException, FilterException {
private <T> void attemptConcurrencyPermitAcquisition(FilterContext<T> ctx) throws InterruptedException, FilterException {
if (!available.tryAcquire(maxWaitMs, TimeUnit.MILLISECONDS)) {
throw new FilterException(String.format("No slot available for processing Request %s with AsyncHandler %s", ctx.getRequest(),
ctx.getAsyncHandler()));
Expand Down
Loading