Skip to content

Commit 45c6773

Browse files
author
lionel.benychou
committed
trying to optionally use a simpler args parser #20
1 parent c519add commit 45c6773

15 files changed

Lines changed: 243 additions & 166 deletions

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Examples :
3939
curl("-k -X GET -H 'User-Agent: curl/7.49.1' -H 'Accept: */*' -H 'Host: localhost' -u foo:bar 'https://localhost:8443/private/login'");
4040
curl("-L -k -X GET -H 'User-Agent: curl/7.49.1' -H 'Accept: */*' -H 'Host: localhost' -u user:password 'https://localhost:8443/private/login'");
4141
curl("-k -X POST 'https://localhost:8443/public/json' -d '{\"var1\":\"val1\",\"var2\":\"val2\"}'");
42+
new Curl(with().simpleArgsParsing().build()).curl_("-k -G \"http://localhost:8200/v1/secret/booking-service/auth\"")
4243
```
4344

4445
It also works with a builder
@@ -65,6 +66,8 @@ You can also specify five additional curl options using jvm code :
6566
(warning, this will break the trust insecure behavior)
6667
* javaOptions.httpClientCustomizer lets you manipulate the HttpClientBuilder
6768
* javaOptions.contextTester allows to inspect the request resolved information (it is a Consumer of HttpContext)
69+
* javaOptions.simpleArgsParsing uses an alternative regex based args parsing
70+
to avoid StackOverflowErrors with very long payloads
6871

6972
```java
7073
curl()
@@ -96,6 +99,7 @@ Supported arguments (so far) :
9699
| dataurlencode | data-urlencode | true | Data to URLEncode |
97100
| L | location | false | follow redirects |
98101
| F | form | true | http multipart post data |
102+
| G | get | false | forces to use GET request method |
99103
| H | header | true | Header |
100104
| X | request | true | Http Method |
101105
| key | key | true | KEY |
@@ -106,7 +110,7 @@ Supported arguments (so far) :
106110
| o | output | true | write to file |
107111
| x | proxy | true | use the specified HTTP proxy |
108112
| U | proxy-user | true | authentication for proxy |
109-
| 1 | tlsv1 | false | use >= TLSv1 (SSL) |
113+
| 1 | tlsv1 | false | use > = TLSv1 (SSL) |
110114
| tlsv10 | tlsv1.0 | false | use TLSv1.0 (SSL) |
111115
| tlsv11 | tlsv1.1 | false | use TLSv1.1 (SSL) |
112116
| tlsv12 | tlsv1.2 | false | use TLSv1.2 (SSL) |

pom.xml

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>org.toile-libre.libe</groupId>
44
<artifactId>curl</artifactId>
5-
<version>0.0.44</version>
5+
<version>0.0.46</version>
66
<name>curl</name>
77
<description>Curl</description>
88
<url>https://github.com/libetl/curl</url>
@@ -50,7 +50,7 @@
5050
<plugins>
5151
<plugin>
5252
<artifactId>maven-compiler-plugin</artifactId>
53-
<version>3.14.0</version>
53+
<version>3.13.0</version>
5454
<configuration>
5555
<source>1.8</source>
5656
<target>1.8</target>
@@ -72,7 +72,7 @@
7272
<plugin>
7373
<groupId>org.apache.maven.plugins</groupId>
7474
<artifactId>maven-javadoc-plugin</artifactId>
75-
<version>3.11.2</version>
75+
<version>3.10.0</version>
7676
<configuration>
7777
<source>8</source>
7878
</configuration>
@@ -88,7 +88,7 @@
8888
<plugin>
8989
<groupId>org.apache.maven.plugins</groupId>
9090
<artifactId>maven-gpg-plugin</artifactId>
91-
<version>3.2.7</version>
91+
<version>3.2.5</version>
9292
<executions>
9393
<execution>
9494
<id>sign-artifacts</id>
@@ -99,15 +99,17 @@
9999
</execution>
100100
</executions>
101101
</plugin>
102-
<plugin>
103-
<groupId>org.sonatype.central</groupId>
104-
<artifactId>central-publishing-maven-plugin</artifactId>
105-
<version>0.7.0</version>
106-
<extensions>true</extensions>
107-
<configuration>
108-
<publishingServerId>central-sonatype</publishingServerId>
109-
</configuration>
110-
</plugin>
102+
<plugin>
103+
<groupId>org.sonatype.plugins</groupId>
104+
<artifactId>nexus-staging-maven-plugin</artifactId>
105+
<version>1.7.0</version>
106+
<extensions>true</extensions>
107+
<configuration>
108+
<serverId>ossrh</serverId>
109+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
110+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
111+
</configuration>
112+
</plugin>
111113
<plugin>
112114
<groupId>org.apache.maven.plugins</groupId>
113115
<artifactId>maven-release-plugin</artifactId>
@@ -156,20 +158,32 @@
156158
<dependency>
157159
<groupId>org.apache.httpcomponents.client5</groupId>
158160
<artifactId>httpclient5</artifactId>
159-
<version>5.4.2</version>
161+
<version>5.5.1</version>
160162
</dependency>
161163
<dependency>
162164
<groupId>org.javassist</groupId>
163165
<artifactId>javassist</artifactId>
164166
<version>3.30.2-GA</version>
165167
<scope>test</scope>
166168
</dependency>
167-
<dependency>
168-
<groupId>junit</groupId>
169-
<artifactId>junit</artifactId>
170-
<version>4.13.2</version>
171-
<scope>test</scope>
172-
</dependency>
169+
<dependency>
170+
<groupId>org.junit.jupiter</groupId>
171+
<artifactId>junit-jupiter-api</artifactId>
172+
<version>6.0.1</version>
173+
<scope>test</scope>
174+
</dependency>
175+
<dependency>
176+
<groupId>org.junit.jupiter</groupId>
177+
<artifactId>junit-jupiter-engine</artifactId>
178+
<version>6.0.1</version>
179+
<scope>test</scope>
180+
</dependency>
181+
<dependency>
182+
<groupId>org.junit.platform</groupId>
183+
<artifactId>junit-platform-engine</artifactId>
184+
<version>6.0.1</version>
185+
<scope>test</scope>
186+
</dependency>
173187
<dependency>
174188
<groupId>org.assertj</groupId>
175189
<artifactId>assertj-core</artifactId>
@@ -179,7 +193,7 @@
179193
<dependency>
180194
<groupId>org.springframework.boot</groupId>
181195
<artifactId>spring-boot-starter-security</artifactId>
182-
<version>3.4.3</version>
196+
<version>4.0.0</version>
183197
<scope>test</scope>
184198
<exclusions>
185199
<exclusion>
@@ -191,7 +205,7 @@
191205
<dependency>
192206
<groupId>org.springframework.boot</groupId>
193207
<artifactId>spring-boot-starter-web</artifactId>
194-
<version>3.4.3</version>
208+
<version>4.0.0</version>
195209
<scope>test</scope>
196210
<exclusions>
197211
<exclusion>
@@ -203,13 +217,13 @@
203217
<dependency>
204218
<groupId>org.springframework.boot</groupId>
205219
<artifactId>spring-boot-starter-jetty</artifactId>
206-
<version>3.4.3</version>
220+
<version>4.0.0</version>
207221
<scope>test</scope>
208222
</dependency>
209223
<dependency>
210224
<groupId>org.springframework.boot</groupId>
211225
<artifactId>spring-boot-starter</artifactId>
212-
<version>3.4.3</version>
226+
<version>4.0.0</version>
213227
<scope>test</scope>
214228
<exclusions>
215229
<exclusion>
@@ -221,7 +235,7 @@
221235
<dependency>
222236
<groupId>org.springframework</groupId>
223237
<artifactId>spring-context</artifactId>
224-
<version>6.2.3</version>
238+
<version>7.0.1</version>
225239
<scope>test</scope>
226240
</dependency>
227241
<dependency>
@@ -251,19 +265,19 @@
251265
<dependency>
252266
<groupId>com.google.guava</groupId>
253267
<artifactId>guava</artifactId>
254-
<version>33.4.0-jre</version>
268+
<version>33.5.0-jre</version>
255269
<scope>test</scope>
256270
</dependency>
257271
<dependency>
258-
<groupId>com.fasterxml.jackson.core</groupId>
272+
<groupId>tools.jackson.core</groupId>
259273
<artifactId>jackson-core</artifactId>
260-
<version>2.18.3</version>
274+
<version>3.0.2</version>
261275
<scope>test</scope>
262276
</dependency>
263277
<dependency>
264-
<groupId>com.fasterxml.jackson.core</groupId>
278+
<groupId>tools.jackson.core</groupId>
265279
<artifactId>jackson-databind</artifactId>
266-
<version>2.18.3</version>
280+
<version>3.0.2</version>
267281
<scope>test</scope>
268282
</dependency>
269283
<dependency>

0 commit comments

Comments
 (0)