vy / hrrs Goto Github PK
View Code? Open in Web Editor NEWRecord, transform, and replay HTTP requests in Java EE and Spring applications.
License: Apache License 2.0
Record, transform, and replay HTTP requests in Java EE and Spring applications.
License: Apache License 2.0
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
Version: 0.7.1
Operating system: windows 10
JDK: 11.0.16.1
Stacktraces, errors, etc. relevant applications logs.
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();
}
…
}
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
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());
}
}
Get following exception in running distiller.
Exception in thread "main" com.google.inject.ConfigurationException: Guice configuration errors:
Requested by:
1 : Distiller.(Distiller.java:55)
_ for 2nd parameter
while locating Distiller
Learn more:
https://github.com/google/guice/wiki/MISSING_IMPLEMENTATION
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
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)
If current request infomation is:
post http://www.abc.com/queryWithTheSameParamA?a=a1&b=b1
Form Data: a=a1&c=c1
Is the current formParameter.get("a") has'nt the item "a1"?
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.
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());
}
}
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
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");
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.