Java、PhpBB 和新主题的创建
我需要以编程方式在我的板上创建主题。我为此使用 Java 和 HtmlUnit。 但有一个问题 - 如果程序发布一次一切都好(论坛响应是 http 200),但如果再次启动程序,那么 PhpBB 响应是“http 304”并重定向到新主题应位于但未添加主题的类别。问题是如何解决这个问题?
以下是首次成功添加主题(登录、发布)的 WireShark 转储: http://a2k.in/2ai
这是相同的请求,但使用 304 重定向: http://a2k.in/2aj
发帖来自管理员帐户,没有发帖时间限制。 这是来自浏览器(Chrome)日志的发布: http://a2k.in/2ak
问题是什么?我的请求和浏览器请求之间的区别在于标头 «Cache-Control: max-age=0», «Origin: http://localhost»。也许缓存控制器有问题?
I need to programmly create topics on my board. I use Java and HtmlUnit for this.
But there is one problem — if program post once all is okay (forum response is http 200), but if start program again then PhpBB response is «http 304» and redirection to category where new topic should be located but topic not added. The question is how to fix this?
Here is WireShark dump of first successfull topic addition (login, posting):
http://a2k.in/2ai
And here is same request but with 304 redirect:
http://a2k.in/2aj
Posting is from admin account with not posting time limitations.
Here is posting from browser (Chrome) log:
http://a2k.in/2ak
What is the problem? The difference between my request and browser request is in header «Cache-Control: max-age=0», «Origin: http://localhost». Maybe there is problem in cache-controller?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许有点晚了..但刚刚看到这个...
在发布多个线程时遇到了同样的问题。
看起来 phpbb 有某种防洪功能。
至少对于我的实现来说,它有助于在帖子之间简单地添加一个计时器/延迟...(我想我将其设置为大约 3 秒。可能也适用于一两个,但不确定...不着急。)
maybe a bit late.. but just saw this...
had the same problem when posting more then one thread.
looks like phpbb has some kind of flood protection.
At least for my implementation it helped to simply add a timer /delay between posts... (think i got it set to somewhere around 3 sec. may work with one or two as well not sure... wasnt in a hurry.)