[Bug 61282] org.apache.catalina.connector.CoyoteInputStream asynchronous read

2017-07-11 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61282

--- Comment #2 from Jack <94544...@qq.com> ---
(In reply to Violeta Georgieva from comment #1)
> What is the problem that you think there is?
I am sorry, let me state it one more time, I hope I can make it clear this
time.

servlet specification support nio, so when a user upload a file to server, at
the server side, a servlet does not have to use the
inputstream=request.getInputStream() to read the data. Instead, we set a
readListener to the inputstream, when data is available, we got notified
onDataAvailable(). This is good.

The problem is that inside onDataAvailable, we read data
byte[] ab=new byte[4096];
int len=is.read(ab,0,ab.length);

we have to use ab inside onDataAvailable method, once this method returns, the
content of ab will be changed for no reason! This is very weird, and should not
happen unless the specification indicates the data is only valid inside
onDataAvailable method. 

so what I do to get around it is to copy the data.
byte[] ab2=new byte[len];
System.arraycopy(ab,0,ab2,0,len);

then the content of ab2 is reliable, even after long time, the content of ab2
is not changed.


Did I succeed in explaining this? Let me know if you have any doubt.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61232] Disabling rotation on the FileHandler creates 'catalina..log' instead of 'catalina.log'

2017-07-11 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61232

--- Comment #2 from Violeta Georgieva  ---
PR https://github.com/apache/tomcat/pull/69

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] tomcat pull request #69: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=...

2017-07-11 Thread violetagg
Github user violetagg commented on a diff in the pull request:

https://github.com/apache/tomcat/pull/69#discussion_r126773883
  
--- Diff: test/org/apache/juli/TestFileHandlerNonRotatable.java ---
@@ -0,0 +1,59 @@
+package org.apache.juli;
--- End diff --

Please add copyright header


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] tomcat pull request #69: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=...

2017-07-11 Thread violetagg
Github user violetagg commented on a diff in the pull request:

https://github.com/apache/tomcat/pull/69#discussion_r126779410
  
--- Diff: test/org/apache/juli/TestFileHandlerNonRotatable.java ---
@@ -0,0 +1,59 @@
+package org.apache.juli;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
+import org.apache.catalina.startup.LoggingBaseTest;
+import org.junit.After;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestFileHandlerNonRotatable extends LoggingBaseTest {
+private FileHandler testHandler;
+
+@BeforeClass
+public static void setUpPerTestClass() throws Exception {
+System.setProperty("java.util.logging.manager",
+"org.apache.juli.ClassLoaderLogManager");
+System.setProperty("java.util.logging.config.file",
+TestFileHandlerNonRotatable.class
+.getResource("logging-non-rotatable.properties")
+.getFile());
+}
--- End diff --

This is not working on my system as I have **space** in the path:

```
java.io.FileNotFoundException: 
/.../tc9.0.x%20(trunk)/.../org/apache/juli/logging-non-rotatable.properties (No 
such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at 
org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:469)
at 
org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:309)
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] tomcat pull request #5: Add maxStartTime to RequestInfo & RequestGroupInfo.

2017-07-11 Thread markt-asf
Github user markt-asf closed the pull request at:

https://github.com/apache/tomcat/pull/5


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] tomcat issue #5: Add maxStartTime to RequestInfo & RequestGroupInfo.

2017-07-11 Thread markt-asf
Github user markt-asf commented on the issue:

https://github.com/apache/tomcat/pull/5
  
As requested.
Note: normally projects can't close PRs like this but I can because of my 
infra role.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61282] org.apache.catalina.connector.CoyoteInputStream asynchronous read

2017-07-11 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61282

--- Comment #1 from Violeta Georgieva  ---
Hi,

What is the problem that you think there is?


Regards,
Violeta

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GitHub] tomcat issue #5: Add maxStartTime to RequestInfo & RequestGroupInfo.

2017-07-11 Thread csutherl
Github user csutherl commented on the issue:

https://github.com/apache/tomcat/pull/5
  
@kkolinko or @markt-asf can we close this PR? It doesn't have any changes 
in it and is pretty old.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 55662] Add a way to set an instance of java.sql.Driver directly on org.apache.tomcat.jdbc.pool.DataSource

2017-07-11 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=55662

--- Comment #2 from Jonathan Leech  ---
The DataSource or the ConnectionPool should also own the Driver instance,
rather than the PooledConnection object. That a new instance of the Driver is
instantiated via reflection for every Connection the pool creates is benign in
most cases and catastrophic in others (e.g. Apache Phoenix will create a set of
zookeeper connections for each instance of PhoenixDriver, which blows up
spectacularly). Standard JDBC has the DriverManager create the single instance
of the driver. Tomcat-dbcp seems to get it mostly right, although I think
Java's DriverManager may create an instance of the Driver, and each pool may
create a redundant one.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61282] New: org.apache.catalina.connector.CoyoteInputStream asynchronous read

2017-07-11 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61282

Bug ID: 61282
   Summary: org.apache.catalina.connector.CoyoteInputStream
asynchronous read
   Product: Tomcat 9
   Version: 9.0.0.M22
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: 94544...@qq.com
  Target Milestone: -

the byte array
byte[] ab=new byte[4096];
int len=is.read(ab,0,ab.length);

After onDataAvailable returns to container, the content of ab is changed if
len==4096, the content of ab is not changed if len!=4096.


The following is the java class I used to do the test. I issue is explained in
the onComplete method.
===


package zede.consult.webapp;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.Iterator;
import java.util.concurrent.ConcurrentLinkedQueue;
import javax.servlet.AsyncContext;
import javax.servlet.AsyncEvent;
import javax.servlet.ReadListener;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import zede.util.Util;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.json.Json;
import javax.json.stream.JsonGenerator;
import javax.servlet.AsyncListener;

public class BAtest extends HttpServlet {

static String dirUpload;
public static String dirTmp, dirTarget, dirTargetPost;

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {

StringWriter sw = new StringWriter();
try {
JsonGenerator g = Json.createGenerator(sw); //out
g.writeStartObject().write("idReq", 0);
if (WebApp.writeReason(g, null)) { //no more information
}
g.writeEnd();
g.flush();
} catch (Throwable t) {
if (WebApp.debug) {
t.printStackTrace(WebApp.out);
WebApp.out.flush();
}
try {
sw = new StringWriter();
JsonGenerator g = Json.createGenerator(sw); //out
g.writeStartObject().write("idReq", 0);
if (WebApp.writeReason(g, null)) { //no more information
}
g.writeEnd();
g.flush();
} catch (Throwable t2) {
return;
}
}
try {
WebApp.sendRes_json(sw.toString(), response);
//os.close(); we do not open it.
//PrintWriter out=response.getWriter();
//out.print(json);out.flush();
} catch (Throwable ex) {
//just swallow it
//Logger.getLogger(BA.class.getName()).log(Level.SEVERE, null, ex);
}
}

@Override
protected void doPut(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException {
AsyncContext ac = request.startAsync();
ACHandler_Put h = new ACHandler_Put(ac, request, response);
ac.addListener(h);
ac.start(h);
}

class ACHandler_Put implements ReadListener, AsyncListener, Runnable {

ServletInputStream is;
int bytesReceived, bytesSaved; //this is different from ut.saved which
is got from harddisk, this is instructed to save.
int saved, size; //int for length is more than enough.
ConcurrentLinkedQueue q2save = new
ConcurrentLinkedQueue<>();
public final AsyncContext ac;
public final HttpServletRequest request;
public final HttpServletResponse response;
public int idReq;
public Ex_Coded4Web exweb;

public ACHandler_Put(AsyncContext ac, HttpServletRequest request,
HttpServletResponse response) {
this.ac = ac;
this.request = request;
this.response = response;
}

@Override
public void run() {
try {
String slength = request.getHeader("Content-Length");
if (slength == null) {
//in this case, because the fault of the client's agent, we
should reject it,
//but since we are nice, so we accept it, but the length is
the length specified in the UpLoadTask
} else {
try {
size = Integer.parseInt(slength);
} catch (Throwable t) {
 

[GitHub] tomcat pull request #69: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=...

2017-07-11 Thread katya-stoycheva
GitHub user katya-stoycheva opened a pull request:

https://github.com/apache/tomcat/pull/69

Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=61232

Checks for one char separator only, not specifically for "."

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/katya-stoycheva/tomcat trunk

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/tomcat/pull/69.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #69






---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 61280] New: Support characters sets other than ISO 8859-1 in HTTP Basic authentication

2017-07-11 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=61280

Bug ID: 61280
   Summary: Support characters sets other than ISO 8859-1 in HTTP
Basic authentication
   Product: Tomcat 9
   Version: unspecified
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: ril...@novomind.com
  Target Milestone: -

https://tools.ietf.org/html/rfc7617

This RFC describes how to implement Basic authentication for usernames and
passwords that are not restricted to characters below U+0100.

The BasicAuthenticator class should be updated to refer to RFC 7617 instead of
the obsolete RFC 2617.

The character set used in BasicAuthenticator class should be made configurable.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org