Re: [PR] Callbacks for Connection initialization [httpcomponents-client]
tippl commented on PR #555: URL: https://github.com/apache/httpcomponents-client/pull/555#issuecomment-2004716082 I've come across the idea for these metrics here micrometer-metrics/micrometer#1617, so I cannot say i'm the only one who wants these metrics, but the pool of people is certainly small. Which is why I wanted to make it fairly simple to implement into micrometer, so that I wouldn't have to make these ugly hacks myself and more people could use them. Your point about conflicting attributes is valid though. I'll update the PR when i have time. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] Callbacks for Connection initialization [httpcomponents-client]
ok2c commented on PR #555: URL: https://github.com/apache/httpcomponents-client/pull/555#issuecomment-2004622070 > Is there a reason for not being able to add the `HttpClientConnectionOperator` to the builder? > @tippl The are two reasons: 1. Internal interfaces ideally should leak into the public APIs. There is a few instances where it was necessary but I am reluctant to create more 2. `HttpClientConnectionOperator` would be mutually exclusive with several attributes of the builder: `SchemePortResolver`, `DnsResolver` and `TlsSocketStrategy`. That is just bad. > Especially since the only reason for extending in this case would be to access a protected constructor. If this is a feature the library provides, an user shouldn't use workarounds to use it at all. That is exactly the thing. This feature may be very important for your application but, dare I say, for majority of users it is completely irrelevant. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17828072#comment-17828072 ] Julian Reschke commented on HTTPCLIENT-2325: > No, it is not. It is defined by `Content-Transfer-Encoding` and can be binary. Note that this is specific to form-data, it is not an HTTP header field (and no, you did not say this). That said, you are right. When I wrote my comments I was thinking about "application/x-www-form-urlencoded" which of course is a different beast. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > Fix For: 5.4-alpha3 > > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Comment Edited] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17828072#comment-17828072 ] Julian Reschke edited comment on HTTPCLIENT-2325 at 3/18/24 6:10 PM: - bq. No, it is not. It is defined by `Content-Transfer-Encoding` and can be binary. Note that this is specific to form-data, it is not an HTTP header field (and no, you did not say this). That said, you are right. When I wrote my comments I was thinking about "application/x-www-form-urlencoded" which of course is a different beast. was (Author: reschke): > No, it is not. It is defined by `Content-Transfer-Encoding` and can be binary. Note that this is specific to form-data, it is not an HTTP header field (and no, you did not say this). That said, you are right. When I wrote my comments I was thinking about "application/x-www-form-urlencoded" which of course is a different beast. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > Fix For: 5.4-alpha3 > > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Resolved] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Oleg Kalnichevski resolved HTTPCLIENT-2325. --- Fix Version/s: 5.4-alpha3 Resolution: Fixed > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > Fix For: 5.4-alpha3 > > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17828069#comment-17828069 ] ASF subversion and git services commented on HTTPCLIENT-2325: - Commit 3b9bc89c2604c4e4ad509fb922e6c88ff101e13e in httpcomponents-client's branch refs/heads/master from Vladimir Sitnikov [ https://gitbox.apache.org/repos/asf?p=httpcomponents-client.git;h=3b9bc89c2 ] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests Previusly, "charset" parameter was added to the Content-Type header, however adding "charset=..." is not specified in RFC 7578, and it causes issues with (flawed?) HTTP servers. The change does not modify ContentType.MULTIPART_FORM_DATA, and it might have backward compatibility side-effects. See * https://github.com/apache/jmeter/issues/6250 * https://github.com/owasp-modsecurity/ModSecurity/commit/6e56950cdf258c9b39f12cf6eb014cb59797cfd3 * https://bz.apache.org/bugzilla/show_bug.cgi?id=61384 * https://github.com/akka/akka-http/issues/338 > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
ok2c merged PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] Callbacks for Connection initialization [httpcomponents-client]
tippl commented on PR #555: URL: https://github.com/apache/httpcomponents-client/pull/555#issuecomment-2004560033 > One can subclass `PoolingHttpClientConnectionManager` and pass a custom `HttpClientConnectionOperator` through the protected super constructor. Is there a reason for not being able to add the `HttpClientConnectionOperator` to the builder? To me it feels counterproductive. Past several releases of this library have been focused on making the Builder be the main/only way to create a `PoolingHttpClientConnectionManager`. Adding an useful feature that is locked behind not being able to use the Builder at all, having to extend the `PoolingHttpClientConnectionManager`, and then configuring it all manually without the builder feels like a step back. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827974#comment-17827974 ] Oleg Kalnichevski commented on HTTPCLIENT-2325: --- > The contents of form data is US-ASCII (always) No, it is not. It is defined by `Content-Transfer-Encoding` and can be binary. Oleg > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > Time Spent: 1h 40m > Remaining Estimate: 0h > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] Callbacks for Connection initialization [httpcomponents-client]
ok2c commented on PR #555: URL: https://github.com/apache/httpcomponents-client/pull/555#issuecomment-2003798399 > So there is no way to actually create a PoolingHttpClientConnectionManager with a custom HttpClientConnectionOperator, either by itself or through the Builder. One can subclass `PoolingHttpClientConnectionManager` and pass a custom `HttpClientConnectionOperator` through the protected super constructor. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
ok2c commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528452045 ## httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartEntityBuilder.java: ## @@ -253,12 +253,13 @@ MultipartFormEntity buildEntity() { if (charsetCopy == null && contentType != null) { charsetCopy = contentType.getCharset(); } -final List paramsList = new ArrayList<>(2); -paramsList.add(new BasicNameValuePair("boundary", boundaryCopy)); -if (charsetCopy != null) { -paramsList.add(new BasicNameValuePair("charset", charsetCopy.name())); -} -final NameValuePair[] params = paramsList.toArray(EMPTY_NAME_VALUE_ARRAY); +// Previusly, "charset" parameter was added to the Content-Type header, however adding "charset=..." +// is not specified in RFC 7578, and it causes issues with (flawed?) HTTP servers. +// For instance: +// https://github.com/owasp-modsecurity/ModSecurity/commit/6e56950cdf258c9b39f12cf6eb014cb59797cfd3 +// https://github.com/akka/akka-http/issues/338 +// https://bz.apache.org/bugzilla/show_bug.cgi?id=61384 +final NameValuePair[] params = new NameValuePair[]{new BasicNameValuePair("boundary", boundaryCopy)}; Review Comment: > > If you still think the code comment should be removed, I can easily do that. It would make the maintenance harder though. @vlsi Please remove that comment and move it to the commit message if you like. Those who cannot work with the commit history should not be committing to the repository. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827948#comment-17827948 ] Julian Reschke commented on HTTPCLIENT-2325: bq. vladimirsitnikov It may well be used as the default charset in case one has not been explicitly set on any of the parts. That would be a bug in the recipient. The contents of form data is US-ASCII (always). Encding/escaping non-ASCII characters happens a layer above. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > Time Spent: 1.5h > Remaining Estimate: 0h > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
michael-o commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528412914 ## httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartEntityBuilder.java: ## @@ -253,12 +253,13 @@ MultipartFormEntity buildEntity() { if (charsetCopy == null && contentType != null) { charsetCopy = contentType.getCharset(); } -final List paramsList = new ArrayList<>(2); -paramsList.add(new BasicNameValuePair("boundary", boundaryCopy)); -if (charsetCopy != null) { -paramsList.add(new BasicNameValuePair("charset", charsetCopy.name())); -} -final NameValuePair[] params = paramsList.toArray(EMPTY_NAME_VALUE_ARRAY); +// Previusly, "charset" parameter was added to the Content-Type header, however adding "charset=..." +// is not specified in RFC 7578, and it causes issues with (flawed?) HTTP servers. +// For instance: +// https://github.com/owasp-modsecurity/ModSecurity/commit/6e56950cdf258c9b39f12cf6eb014cb59797cfd3 +// https://github.com/akka/akka-http/issues/338 +// https://bz.apache.org/bugzilla/show_bug.cgi?id=61384 +final NameValuePair[] params = new NameValuePair[]{new BasicNameValuePair("boundary", boundaryCopy)}; Review Comment: Agreed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
vlsi commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528370944 ## httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartEntityBuilder.java: ## @@ -253,12 +253,13 @@ MultipartFormEntity buildEntity() { if (charsetCopy == null && contentType != null) { charsetCopy = contentType.getCharset(); } -final List paramsList = new ArrayList<>(2); -paramsList.add(new BasicNameValuePair("boundary", boundaryCopy)); -if (charsetCopy != null) { -paramsList.add(new BasicNameValuePair("charset", charsetCopy.name())); -} -final NameValuePair[] params = paramsList.toArray(EMPTY_NAME_VALUE_ARRAY); +// Previusly, "charset" parameter was added to the Content-Type header, however adding "charset=..." +// is not specified in RFC 7578, and it causes issues with (flawed?) HTTP servers. +// For instance: +// https://github.com/owasp-modsecurity/ModSecurity/commit/6e56950cdf258c9b39f12cf6eb014cb59797cfd3 +// https://github.com/akka/akka-http/issues/338 +// https://bz.apache.org/bugzilla/show_bug.cgi?id=61384 +final NameValuePair[] params = new NameValuePair[]{new BasicNameValuePair("boundary", boundaryCopy)}; Review Comment: I can easily imagine somebody could try re-adding `charset` property here. It would be insufficient to have the comment **only** in the commit message as the person who edits the file will not see "somebody did remove charset from here previously". --- Exactly the same story in JMeter: 1) `multipartEntityBuilder.setContent(...)` removed in 2017 in https://bz.apache.org/bugzilla/show_bug.cgi?id=61384#c15 2) `multipartEntityBuilder.setContent(...)` added in 2023 in https://github.com/apache/jmeter/pull/5987 --- If you still think the code comment should be removed, I can easily do that. It would make the maintenance harder though. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
michael-o commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528368485 ## httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartEntityBuilder.java: ## @@ -253,12 +253,13 @@ MultipartFormEntity buildEntity() { if (charsetCopy == null && contentType != null) { charsetCopy = contentType.getCharset(); } -final List paramsList = new ArrayList<>(2); -paramsList.add(new BasicNameValuePair("boundary", boundaryCopy)); -if (charsetCopy != null) { -paramsList.add(new BasicNameValuePair("charset", charsetCopy.name())); -} -final NameValuePair[] params = paramsList.toArray(EMPTY_NAME_VALUE_ARRAY); +// Previusly, "charset" parameter was added to the Content-Type header, however adding "charset=..." +// is not specified in RFC 7578, and it causes issues with (flawed?) HTTP servers. +// For instance: +// https://github.com/owasp-modsecurity/ModSecurity/commit/6e56950cdf258c9b39f12cf6eb014cb59797cfd3 +// https://github.com/akka/akka-http/issues/338 +// https://bz.apache.org/bugzilla/show_bug.cgi?id=61384 +final NameValuePair[] params = new NameValuePair[]{new BasicNameValuePair("boundary", boundaryCopy)}; Review Comment: This should not be here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
michael-o commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528366507 ## httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java: ## @@ -88,7 +88,7 @@ public void testMultipartCustomContentType() throws Exception { .setLaxMode() .buildEntity(); Assertions.assertNotNull(entity); -Assertions.assertEquals("application/xml; boundary=blah-blah; charset=UTF-8", entity.getContentType()); +Assertions.assertEquals("application/xml; charset=UTF-8; boundary=blah-blah", entity.getContentType()); Review Comment: > Please clarify what do you mean here. I kept the test to verify the behaviour for the code that did use weird content types for multipart previously. This remains as-is. Just a side comment. No change required. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
vlsi commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528356852 ## httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java: ## @@ -99,7 +99,7 @@ public void testMultipartContentTypeParameter() throws Exception { new BasicNameValuePair("charset", "ascii"))) .buildEntity(); Assertions.assertNotNull(entity); -Assertions.assertEquals("multipart/form-data; boundary=yada-yada; charset=US-ASCII", entity.getContentType()); +Assertions.assertEquals("multipart/form-data; boundary=yada-yada; charset=ascii", entity.getContentType()); Review Comment: The charset was explicitly configured via `ontentType.MULTIPART_FORM_DATA.withParameters(...new BasicNameValuePair("charset", "ascii")`. If the user explicitly creates content type with charset, they might know what they are doing, so there's no point in removing the charset. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
vlsi commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528354232 ## httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java: ## @@ -88,7 +88,7 @@ public void testMultipartCustomContentType() throws Exception { .setLaxMode() .buildEntity(); Assertions.assertNotNull(entity); -Assertions.assertEquals("application/xml; boundary=blah-blah; charset=UTF-8", entity.getContentType()); +Assertions.assertEquals("application/xml; charset=UTF-8; boundary=blah-blah", entity.getContentType()); Review Comment: Please clarify what do you mean here. I kept the test to verify the behaviour for the code that did use weird content types for multipart previously. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
vlsi commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528350724 ## httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartEntityBuilder.java: ## @@ -253,12 +253,13 @@ MultipartFormEntity buildEntity() { if (charsetCopy == null && contentType != null) { charsetCopy = contentType.getCharset(); } -final List paramsList = new ArrayList<>(2); -paramsList.add(new BasicNameValuePair("boundary", boundaryCopy)); -if (charsetCopy != null) { -paramsList.add(new BasicNameValuePair("charset", charsetCopy.name())); -} -final NameValuePair[] params = paramsList.toArray(EMPTY_NAME_VALUE_ARRAY); +// Previusly, "charset" parameter was added to the Content-Type header, however adding "charset=..." +// is not specified in RFC 7578, and it causes issues with (flawed?) HTTP servers. +// For instance: +// https://github.com/owasp-modsecurity/ModSecurity/commit/6e56950cdf258c9b39f12cf6eb014cb59797cfd3 +// https://github.com/akka/akka-http/issues/338 +// https://bz.apache.org/bugzilla/show_bug.cgi?id=61384 +final NameValuePair[] params = new NameValuePair[]{new BasicNameValuePair("boundary", boundaryCopy)}; Review Comment: I've updated the commit message -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
Re: [PR] HTTPCLIENT-2325 Avoid adding "; charset=" for multipart/form-data requests [httpcomponents-client]
michael-o commented on code in PR #556: URL: https://github.com/apache/httpcomponents-client/pull/556#discussion_r1528332718 ## httpclient5/src/main/java/org/apache/hc/client5/http/entity/mime/MultipartEntityBuilder.java: ## @@ -253,12 +253,13 @@ MultipartFormEntity buildEntity() { if (charsetCopy == null && contentType != null) { charsetCopy = contentType.getCharset(); } -final List paramsList = new ArrayList<>(2); -paramsList.add(new BasicNameValuePair("boundary", boundaryCopy)); -if (charsetCopy != null) { -paramsList.add(new BasicNameValuePair("charset", charsetCopy.name())); -} -final NameValuePair[] params = paramsList.toArray(EMPTY_NAME_VALUE_ARRAY); +// Previusly, "charset" parameter was added to the Content-Type header, however adding "charset=..." +// is not specified in RFC 7578, and it causes issues with (flawed?) HTTP servers. +// For instance: +// https://github.com/owasp-modsecurity/ModSecurity/commit/6e56950cdf258c9b39f12cf6eb014cb59797cfd3 +// https://github.com/akka/akka-http/issues/338 +// https://bz.apache.org/bugzilla/show_bug.cgi?id=61384 +final NameValuePair[] params = new NameValuePair[]{new BasicNameValuePair("boundary", boundaryCopy)}; Review Comment: This belongs into the commit message ## httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java: ## @@ -88,7 +88,7 @@ public void testMultipartCustomContentType() throws Exception { .setLaxMode() .buildEntity(); Assertions.assertNotNull(entity); -Assertions.assertEquals("application/xml; boundary=blah-blah; charset=UTF-8", entity.getContentType()); +Assertions.assertEquals("application/xml; charset=UTF-8; boundary=blah-blah", entity.getContentType()); Review Comment: Regardless of your change, I question this test because a multipart request shall start with `multipart/` type... ## httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java: ## @@ -130,7 +130,7 @@ public void testMultipartCustomContentTypeUsingAddParameter() { eb.buildEntity(); final MultipartFormEntity entity = eb.buildEntity(); Assertions.assertNotNull(entity); -Assertions.assertEquals("multipart/related; boundary=yada-yada; charset=US-ASCII; my=stuff", +Assertions.assertEquals("multipart/related; boundary=yada-yada; charset=ascii; my=stuff", entity.getContentType()); Review Comment: Same for these two... ## httpclient5/src/test/java/org/apache/hc/client5/http/entity/mime/TestMultipartEntityBuilder.java: ## @@ -99,7 +99,7 @@ public void testMultipartContentTypeParameter() throws Exception { new BasicNameValuePair("charset", "ascii"))) .buildEntity(); Assertions.assertNotNull(entity); -Assertions.assertEquals("multipart/form-data; boundary=yada-yada; charset=US-ASCII", entity.getContentType()); +Assertions.assertEquals("multipart/form-data; boundary=yada-yada; charset=ascii", entity.getContentType()); Review Comment: The charset shouldn't appear at all, no? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827906#comment-17827906 ] Michael Osipov commented on HTTPCLIENT-2325: not for me, all parts have enough metadata to be selfsustained. I consider the behavior or {{text/*}} with out charset just undefined except the type has implicit semantics. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Comment Edited] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827900#comment-17827900 ] Michael Osipov edited comment on HTTPCLIENT-2325 at 3/18/24 10:17 AM: -- [~olegk], I do not agree with that. The request content type header has no influence on the part content type, they are completely disjoint. What makes you think that? was (Author: michael-o): [~olegk], I do not agree with that. The request content type header has on influence on the part content type, they are completely disjoint. What makes you think that? > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827905#comment-17827905 ] Oleg Kalnichevski commented on HTTPCLIENT-2325: --- > What makes you think that? [~michael-o] Common sense. Oleg > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827902#comment-17827902 ] Michael Osipov commented on HTTPCLIENT-2325: [~vladimirsitnikov], I agree with you that it makes no sense, but shouldn't cause any harm and should be just ignored. So even if it sent and a server chokes it is a bug. Please raise a PR for that, as said by Oleg. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827900#comment-17827900 ] Michael Osipov commented on HTTPCLIENT-2325: [~olegk], I do not agree with that. The request content type header has on influence on the part content type, they are completely disjoint. What makes you think that? > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827898#comment-17827898 ] Oleg Kalnichevski commented on HTTPCLIENT-2325: --- [~vladimirsitnikov] It may well be used as the default charset in case one has not been explicitly set on any of the parts. Oleg > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827896#comment-17827896 ] Vladimir Sitnikov commented on HTTPCLIENT-2325: --- E.g. see https://github.com/spring-projects/spring-framework/commit/390bb871d85f56aaeed98aeb45d688fcf35af8e7 {quote}some servers are not parsing properly such header values and assume that `boundary` is the last directive in the `Content-Type` header.{quote} The meaning for charset for multipart/form-data is not defined, and it causes issues, so why generating it in the first place? > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827891#comment-17827891 ] Michael Osipov commented on HTTPCLIENT-2325: This is the same as with {{application/json}}, peers can ignore undefined parameters. I don't understand why IIS is trying to process it especially because it does not have any semantic meaning to the content type... > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827890#comment-17827890 ] Oleg Kalnichevski commented on HTTPCLIENT-2325: --- > Oleg, as they say in [https://github.com/akka/akka-http/issues/338], IIS 8.5 > does not understand what multipart with charset means. [~vladimirsitnikov] How is this our problem, and not that of Microsoft? > We can't immediately bump HTC in Apache JMeter from 4.5.x to 5.x for backward > compatibility reasons, so it would be nice if there was 4.x release though. I can back-port the fix to 4.5 but I still cannot promise there would be an official release from the 4.5.x branch any time soon, if ever. Please consider upgrading to 5.x Oleg > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827888#comment-17827888 ] Vladimir Sitnikov commented on HTTPCLIENT-2325: --- Oleg, as they say in https://github.com/akka/akka-http/issues/338, IIS 8.5 does not understand what multipart with charset means. >Please note there will be no changes to 4.5.x beyond critical fixes. We can't immediately bump HTC in JMeter from 4.5.x to 5.x for backward compatibility reasons, so it would be nice if there was 4.x release though. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Comment Edited] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827888#comment-17827888 ] Vladimir Sitnikov edited comment on HTTPCLIENT-2325 at 3/18/24 9:08 AM: Oleg, as they say in https://github.com/akka/akka-http/issues/338, IIS 8.5 does not understand what multipart with charset means. >Please note there will be no changes to 4.5.x beyond critical fixes. We can't immediately bump HTC in Apache JMeter from 4.5.x to 5.x for backward compatibility reasons, so it would be nice if there was 4.x release though. was (Author: vladimirsitnikov): Oleg, as they say in https://github.com/akka/akka-http/issues/338, IIS 8.5 does not understand what multipart with charset means. >Please note there will be no changes to 4.5.x beyond critical fixes. We can't immediately bump HTC in JMeter from 4.5.x to 5.x for backward compatibility reasons, so it would be nice if there was 4.x release though. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827877#comment-17827877 ] Oleg Kalnichevski commented on HTTPCLIENT-2325: --- [~vladimirsitnikov] Any half-decent HTTP protocol handler must be able to parse `Content-Type` header correctly, pick out parameters that it understands and ignore those that it does not. In my option this is non-issue. Having said that you are welcome to raise a PR against master (5.4) with the changes you are proposing. Please note there will be no changes to 4.5.x beyond critical fixes. Oleg > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Comment Edited] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827871#comment-17827871 ] Michael Osipov edited comment on HTTPCLIENT-2325 at 3/18/24 8:26 AM: - I consider this as a duplicate/part of HTTPCLIENT-2159. I think this needs to be solved with a boolean flag for implicit or explicit character encodings. was (Author: michael-o): I consider this as a duplicate of HTTPCLIENT-2159. I think this needs to be solved with a boolean flag for implicit or explicit character encodings. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Commented] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
[ https://issues.apache.org/jira/browse/HTTPCLIENT-2325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17827871#comment-17827871 ] Michael Osipov commented on HTTPCLIENT-2325: I consider this as a duplicate of HTTPCLIENT-2159. I think this needs to be solved with a boolean flag for implicit or explicit character encodings. > Avoid adding "; charset=" for multipart/form-data requests > -- > > Key: HTTPCLIENT-2325 > URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 > Project: HttpComponents HttpClient > Issue Type: Improvement > Components: HttpClient (classic) >Affects Versions: 4.5.14 >Reporter: Vladimir Sitnikov >Priority: Major > > Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which > both > 1) Breaks certain HTTP servers: see > https://github.com/apache/jmeter/pull/6251, > https://github.com/akka/akka-http/issues/338 > 2) Does not follow RFC 2046 and RFC 7578 > Even though including "charset" parameter is not explicitly forbidden by > RFCs, there are known HTTP servers that can't parse such requests, so why > generating the "charset=..." for multipart/form-data in the first place? > See how RFC 7578 suggests setting the default charset: > https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 > They mention a {{_charset_}} field instead. > > Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in > the caller's code is not enough as HttpClient uses the supplied charset in > {{HttpBrowserCompatibleMultipart}}. > --- > I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, > so it includes only {{boundary}} just like RFC 7578 samples. > In other words, I suggest removing these lines: > https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org
[jira] [Created] (HTTPCLIENT-2325) Avoid adding "; charset=" for multipart/form-data requests
Vladimir Sitnikov created HTTPCLIENT-2325: - Summary: Avoid adding "; charset=" for multipart/form-data requests Key: HTTPCLIENT-2325 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2325 Project: HttpComponents HttpClient Issue Type: Improvement Components: HttpClient (classic) Affects Versions: 4.5.14 Reporter: Vladimir Sitnikov Currently, HttpClient adds {{; charset=}} to {{multipart/form-data}} which both 1) Breaks certain HTTP servers: see https://github.com/apache/jmeter/pull/6251, https://github.com/akka/akka-http/issues/338 2) Does not follow RFC 2046 and RFC 7578 Even though including "charset" parameter is not explicitly forbidden by RFCs, there are known HTTP servers that can't parse such requests, so why generating the "charset=..." for multipart/form-data in the first place? See how RFC 7578 suggests setting the default charset: https://datatracker.ietf.org/doc/html/rfc7578#section-5.1.2 They mention a {{_charset_}} field instead. Unfortunately, removal of {{multipartEntityBuilder.setCharset(charset);}} in the caller's code is not enough as HttpClient uses the supplied charset in {{HttpBrowserCompatibleMultipart}}. --- I suggest to avoid sending {{charset}} within {{multipart/form-data}} header, so it includes only {{boundary}} just like RFC 7578 samples. In other words, I suggest removing these lines: https://github.com/apache/httpcomponents-client/blob/54900db4653d7f207477e6ee40135b88e9bcf832/httpmime/src/main/java/org/apache/http/entity/mime/MultipartEntityBuilder.java#L215-L217 -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org