Re: [Patch] User-Agent is PARAMETER, not HEADER in Command-line interface
OK; I was unaware of the meaning of the flags in bugzilla. I have a second patch for the trunk branch, but have not inserted it into Bugzilla yet. Will do so this afternoon... As for committing, I cannot as I am no Cocoon regular developer. Could someone else do so? James -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sun 22/05/2005 22:41 To: James Bates Subject: DO NOT REPLY [Bug 34906] -[Patch] User-Agent is PARAMETER, not HEADER in Command-line interface DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://issues.apache.org/bugzilla/show_bug.cgi?id=34906. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=34906 [EMAIL PROTECTED] changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | Summary|User-Agent is PARAMETER, not|[Patch] User-Agent is |HEADER in Command-line |PARAMETER, not HEADER in |interface |Command-line interface --- Additional Comments From [EMAIL PROTECTED] 2005-05-22 22:41 --- AFAICS this patch has not been committed yet, so it is better to not set the bug to fixed. Otherwise the patch won't be applied. Joerg -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug, or are watching the assignee. You reported the bug, or are watching the reporter.
RE: [Patch] User-Agent is PARAMETER, not HEADER in Command-line interface
DONE -Original Message- From: James Bates [mailto:[EMAIL PROTECTED] Sent: 23 May 2005 11:53 To: [EMAIL PROTECTED] Subject: Re: [Patch] User-Agent is PARAMETER, not HEADER in Command-line interface OK; I was unaware of the meaning of the flags in bugzilla. I have a second patch for the trunk branch, but have not inserted it into Bugzilla yet. Will do so this afternoon... As for committing, I cannot as I am no Cocoon regular developer. Could someone else do so? James -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sun 22/05/2005 22:41 To: James Bates Subject: DO NOT REPLY [Bug 34906] -[Patch] User-Agent is PARAMETER, not HEADER in Command-line interface DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT http://issues.apache.org/bugzilla/show_bug.cgi?id=34906. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=34906 [EMAIL PROTECTED] changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | Summary|User-Agent is PARAMETER, not|[Patch] User-Agent is |HEADER in Command-line |PARAMETER, not HEADER in |interface |Command-line interface --- Additional Comments From [EMAIL PROTECTED] 2005-05-22 22:41 --- AFAICS this patch has not been committed yet, so it is better to not set the bug to fixed. Otherwise the patch won't be applied. Joerg -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email --- You are receiving this mail because: --- You are the assignee for the bug, or are watching the assignee. You reported the bug, or are watching the reporter.
Re: User-Agent in Command-line interface
Upayavira wrote: James Bates wrote: The Cocoon command line interface provides a switch for simulating the Cocoon User-Agent header that would be sent by a browser. The idea being that it could be used by e.g. the browser selector to detect that a request is coming from the CLI. When investigating however, I noticed that the Cocoon bean (the class that implements the CLI) does not place the User-Agent into a HEDAER, but into a request PARAMETER instead (occurs on line 407 of CocoonWrapper.java, in method processURI() in BRANCH_2_1_X; line 421 of the same file in 2.2 trunk). Is there a particular reason for this behaviour? Would it be desirable to change the behaviour so the User-Agent is indeed submitted as a request HEADER, thus perfectly emulating a HTTP call? I am perfectly willing to submit a patch to that effect... The CLI/bean should work exactly the same as a browser. I have seen that on occasions and wondered about it. What you are saying makes sense, and I'd happily commit a patch of yours. Regards, Upayavira Sorry people; had some trouble subscribing to the mailing list; but it's done now. Below is a svn patch against the BRANCH_2_1_X development tree that changes the behaviour as described above... Careful before committing: the code ALTERS the behaviour sothat any existing implemenetations that depend on the user agent being in a PARAMETER and not a HEADER when running the CLI will break... It would be recommended I imagine to mention this in the Changes file? Regards, James cli-user-agent-header.patch -- Index: src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment .java === --- src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment .java (revision 17) +++ src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment .java (working copy) @@ -31,7 +31,7 @@ * * @author a href=mailto:[EMAIL PROTECTED]Stefano Mazzocchi/a * @author a href=mailto:[EMAIL PROTECTED]Upayavira/a - * @version CVS $Id: FileSavingEnvironment.java,v 1.6 2004/03/05 13:02:54 bdelacretaz Exp $ + * @version CVS $Id$ */ public class FileSavingEnvironment extends AbstractCommandLineEnvironment { @@ -43,6 +43,7 @@ File context, Map attributes, Map parameters, + Map headers, Map links, List gatheredLinks, CommandLineContext cliContext, @@ -51,7 +52,7 @@ throws MalformedURLException { super(uri, null, context, stream, log); this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, - new CommandLineRequest(this, null, uri, null, attributes, parameters)); + new CommandLineRequest(this, null, uri, null, attributes, parameters, headers)); this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, new CommandLineResponse()); this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, @@ -64,18 +65,19 @@ this.objectModel.put(Constants.LINK_COLLECTION_OBJECT, gatheredLinks); } } - + public FileSavingEnvironment(String uri, File context, Map attributes, Map parameters, + Map headers, Map links, List gatheredLinks, CommandLineContext cliContext, OutputStream stream, Logger log) throws MalformedURLException { -this(uri, 0L, context, attributes, parameters, links, gatheredLinks, cliContext, stream, log); +this(uri, 0L, context, attributes, parameters, headers, links, gatheredLinks, cliContext, stream, log); } /** Index: src/java/org/apache/cocoon/bean/CocoonWrapper.java === --- src/java/org/apache/cocoon/bean/CocoonWrapper.java (revision 17) +++ src/java/org/apache/cocoon/bean/CocoonWrapper.java (working copy) @@ -83,8 +83,8 @@ private String logKit = null; protected String logger = null; protected String logLevel = ERROR; -private String userAgent = DEFAULT_USER_AGENT; -private String accept = DEFAULT_ACCEPT; +protected String userAgent = DEFAULT_USER_AGENT; +protected String accept = DEFAULT_ACCEPT; private List classList = new ArrayList(); // Objects used alongside User Supplied Parameters @@ -190,7 +190,7 @@ } }.instance(); } - + protected
Re: User-Agent in Command-line interface
Upayavira wrote: James Bates wrote: The Cocoon command line interface provides a switch for simulating the Cocoon User-Agent header that would be sent by a browser. The idea being that it could be used by e.g. the browser selector to detect that a request is coming from the CLI. When investigating however, I noticed that the Cocoon bean (the class that implements the CLI) does not place the User-Agent into a HEDAER, but into a request PARAMETER instead (occurs on line 407 of CocoonWrapper.java, in method processURI() in BRANCH_2_1_X; line 421 of the same file in 2.2 trunk). Is there a particular reason for this behaviour? Would it be desirable to change the behaviour so the User-Agent is indeed submitted as a request HEADER, thus perfectly emulating a HTTP call? I am perfectly willing to submit a patch to that effect... The CLI/bean should work exactly the same as a browser. I have seen that on occasions and wondered about it. What you are saying makes sense, and I'd happily commit a patch of yours. Regards, Upayavira Sorry people; had some trouble subscribing to the mailing list; but it's done now. Below is a svn patch against the BRANCH_2_1_X development tree that changes the behaviour as described above... Careful before committing: the code ALTERS the behaviour sothat any existing implemenetations that depend on the user agent being in a PARAMETER and not a HEADER when running the CLI will break... It would be recommended I imagine to mention this in the Changes file? Regards, James cli-user-agent-header.patch -- Index: src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment.java === --- src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment.java (revision 17) +++ src/java/org/apache/cocoon/environment/commandline/FileSavingEnvironment.java (working copy) @@ -31,7 +31,7 @@ * * @author a href=mailto:[EMAIL PROTECTED]Stefano Mazzocchi/a * @author a href=mailto:[EMAIL PROTECTED]Upayavira/a - * @version CVS $Id: FileSavingEnvironment.java,v 1.6 2004/03/05 13:02:54 bdelacretaz Exp $ + * @version CVS $Id$ */ public class FileSavingEnvironment extends AbstractCommandLineEnvironment { @@ -43,6 +43,7 @@ File context, Map attributes, Map parameters, + Map headers, Map links, List gatheredLinks, CommandLineContext cliContext, @@ -51,7 +52,7 @@ throws MalformedURLException { super(uri, null, context, stream, log); this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, - new CommandLineRequest(this, null, uri, null, attributes, parameters)); + new CommandLineRequest(this, null, uri, null, attributes, parameters, headers)); this.objectModel.put(ObjectModelHelper.RESPONSE_OBJECT, new CommandLineResponse()); this.objectModel.put(ObjectModelHelper.CONTEXT_OBJECT, @@ -64,18 +65,19 @@ this.objectModel.put(Constants.LINK_COLLECTION_OBJECT, gatheredLinks); } } - + public FileSavingEnvironment(String uri, File context, Map attributes, Map parameters, + Map headers, Map links, List gatheredLinks, CommandLineContext cliContext, OutputStream stream, Logger log) throws MalformedURLException { -this(uri, 0L, context, attributes, parameters, links, gatheredLinks, cliContext, stream, log); +this(uri, 0L, context, attributes, parameters, headers, links, gatheredLinks, cliContext, stream, log); } /** Index: src/java/org/apache/cocoon/bean/CocoonWrapper.java === --- src/java/org/apache/cocoon/bean/CocoonWrapper.java (revision 17) +++ src/java/org/apache/cocoon/bean/CocoonWrapper.java (working copy) @@ -83,8 +83,8 @@ private String logKit = null; protected String logger = null; protected String logLevel = ERROR; -private String userAgent = DEFAULT_USER_AGENT; -private String accept = DEFAULT_ACCEPT; +protected String userAgent = DEFAULT_USER_AGENT; +protected String accept = DEFAULT_ACCEPT; private List classList = new ArrayList(); // Objects used alongside User Supplied Parameters @@ -190,7 +190,7 @@ } }.instance
RE: User-Agent in Command-line interface
Haven't used bugzilla before, but I'll try ;-) -Original Message- From: Torsten Curdt [mailto:[EMAIL PROTECTED] Sent: 13 May 2005 12:49 To: dev@cocoon.apache.org Subject: Re: User-Agent in Command-line interface Sorry people; had some trouble subscribing to the mailing list; but it's done now. Below is a svn patch against the BRANCH_2_1_X development tree that changes the behaviour as described above... Careful before committing: the code ALTERS the behaviour sothat any existing implemenetations that depend on the user agent being in a PARAMETER and not a HEADER when running the CLI will break... It would be recommended I imagine to mention this in the Changes file? James, thanks for that ...could you maybe file it to bugzilla thanks -- Torsten
User-Agent in Command-line interface
The Cocoon command line interface provides a switch for simulating the Cocoon User-Agent header that would be sent by a browser. The idea being that it could be used by e.g. the browser selector to detect that a request is coming from the CLI. When investigating however, I noticed that the Cocoon bean (the class that implements the CLI) does not place the User-Agent into a HEDAER, but into a request PARAMETER instead (occurs on line 407 of CocoonWrapper.java, in method processURI() in BRANCH_2_1_X; line 421 of the same file in 2.2 trunk). Is there a particular reason for this behaviour? Would it be desirable to change the behaviour so the User-Agent is indeed submitted as a request HEADER, thus perfectly emulating a HTTP call? I am perfectly willing to submit a patch to that effect... Thanks, James Bates