Giter Club home page Giter Club logo

hrrs's People

Contributors

dependabot[bot] avatar patricklucas avatar vy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hrrs's Issues

Controller not mapping

Description

We are trying to test out HRRS but when starting the example application it seems unable to map the controller endpoints. We are however able to access the /hrrs endpoint

Configuration

Version: 0.7.1

Operating system: windows 10

JDK: 11.0.16.1

Logs

Stacktraces, errors, etc. relevant applications logs.

Implement flush() BufferedWriter in HttpRequestRecordWriterFileTarget

Will it be possible to add flush() method in HttpRequestRecordWriterTarget interface,
as you are using BufferedWriter in HttpRequestRecordWriterFileTarget class and I could not easily control it flushing strategy.

Another option will be – flush writer on enabled changed from true to false (simpler).

package com.vlkan.hrrs.api;
import java.io.Closeable;
public interface HttpRequestRecordWriterTarget extends Closeable {

void flush();

}

public class HttpRequestRecordWriterFileTarget implements HttpRequestRecordWriterTarget {

@OverRide
public void flush() throws IOException {
LOGGER.trace("flushing");
writer.flush();
}

}

Rolling recording file

We want to record constantly, eg for 1-7 days.
In class com.vlkan.hrrs.servlet.base64.Base64HrrsFilter constructor is using fixed writerTargetFile, which can grow large.
Will be nice to have writerTargetFile rolling, similar to log4j:
log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
log4j.appender.LOGFILE.File=hrrs.txt
log4j.appender.LOGFILE.MaxFileSize=10MB
log4j.appender.LOGFILE.MaxBackupIndex=20

Caused by: org.apache.http.ProtocolException: Content-Length header already present

Description

I use postman send request to my application api, the http request package auto add head "content-length". When use replayer module to run error like org.apache.http.ProtocolException: Content-Length header already present. detail info message is :

2023-04-12 09:59:08 [ERROR] [RateLimitedExecutor-0] com.vlkan.hrrs.replayer.http.ApacheHttpRequestRecordReplayer.replay:89 - failed replaying record (id=lgbnlb96_t3lc4)
org.apache.http.client.ClientProtocolException
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118)
	at com.vlkan.hrrs.replayer.http.ApacheHttpRequestRecordReplayer.execute(ApacheHttpRequestRecordReplayer.java:95)
	at com.vlkan.hrrs.replayer.http.ApacheHttpRequestRecordReplayer.replay(ApacheHttpRequestRecordReplayer.java:83)
	at com.vlkan.hrrs.replayer.cli.Replayer.lambda$consume$0(Replayer.java:147)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.http.ProtocolException: Content-Length header already present
	at org.apache.http.protocol.RequestContent.process(RequestContent.java:97)
	at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:133)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	... 7 more

I guess http client will auto add "content-length" header, to fix this bug , need filter the header simple code like (ApacheHttpRequestRecordReplayer.java) :

    private void addHttpUriRequestHeaders(HttpUriRequest request, HttpRequestRecord record) {
        for (HttpRequestHeader header : record.getHeaders()) {
            if("content-length".equals(header.getName())){
                continue;
            }
            request.setHeader(header.getName(), header.getValue());
        }
    }

No implementation for HttpRequestRecordWriter<?> was bound

Get following exception in running distiller.

Exception in thread "main" com.google.inject.ConfigurationException: Guice configuration errors:

  1. [Guice/MissingImplementation]: No implementation for HttpRequestRecordReader<?> was bound.

Requested by:
1 : Distiller.(Distiller.java:55)
_ for 2nd parameter
while locating Distiller

Learn more:
https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION

  1. [Guice/MissingImplementation]: No implementation for HttpRequestRecordWriter<?> was bound.

Requested by:
1 : Distiller.(Distiller.java:55)
_ for 3rd parameter
while locating Distiller

Learn more:
https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION

2 errors

======================
Full classname legend:

Distiller: "com.vlkan.hrrs.distiller.cli.Distiller"
HttpRequestRecordReader: "com.vlkan.hrrs.api.HttpRequestRecordReader"
HttpRequestRecordWriter: "com.vlkan.hrrs.api.HttpRequestRecordWriter"

End of classname legend:

    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1127)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1087)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1139)
    at com.vlkan.hrrs.distiller.cli.Distiller.main(Distiller.java:153)
    at com.vlkan.hrrs.distiller.base64.Base64Distiller.main(Base64Distiller.java:27)

Typo in README, and a suggestion for phrashing

There's a typo on L47 of README.md: it should be "per se", instead of "per see".

But I'd suggest removing it altogether because its removal will not decrease the information contained in the rest of the sentence, and it'll make the sentence easier to understand.

ApacheHttpRequestRecordReplayer is using "Content-length" header twice

For POST requests with binaries it tries to add second header Content-length and fails

private void addHttpUriRequestHeaders(HttpUriRequest request, HttpRequestRecord record) {
        for (HttpRequestHeader header : record.getHeaders()) {
            if (header.getName().equalsIgnoreCase("content-length")) {
                //skipping duplicate header
                continue;
            }
            request.setHeader(header.getName(), header.getValue());
        }
    }

See https://github.com/NIkonDSL/hrrs/pull/2/files

HRRS filter does not save request Form Data

HRRS filter does not save request Form Data,
eg login form Content-Type: application/x-www-form-urlencoded
form data not found in serialised text
username:myname
password:mypassword
submit:Login

httpclient-redirect-when-using-post-method

In my app there are few http POST redirects, will it be possible to handle redirects with http client?

Here are few links I found:
httpclient-redirect-when-using-post-method
httpclient-redirect-on-http-post

For example in com/vlkan/hrrs/replayer/http/ApacheHttpRequestRecordReplayer.java

@Inject
public ApacheHttpRequestRecordReplayer(
        Config config,
        ApacheHttpClientFactory httpClientFactory,
        MetricRegistry metricRegistry,
        JtlPrinter jtlPrinter) {
    this.httpClient = httpClientFactory.create();
    **httpClient.setRedirectStrategy(new org.apache.http.impl.client.LaxRedirectStrategy());**
    LOGGER.debug("instantiated");
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.