我有一个关于网址的问题:
我已经阅读了RFC 3986,但仍然有一个关于一个URL的问题:
如果URI包含权限组件,则路径组件
必须为空或以斜杠("/")字符开头.如果URI不包含权限组件,则路径不能
以两个斜杠字符("//")开头.此外,URI引用
(第4.1节)可以是相对路径引用,在这种情况下,
第一个路径段不能包含冒号(":")字符.ABNF
需要五个单独的规则来消除这些情况的歧义,其中只有一个与给定URI引用中的路径子字符串匹配.我们使用通用术语"路径组件"来描述
解析器与其中一个规则匹配的URI子字符串.
我知道,这//server.com:80/path/info是有效的(它是一个架构相对URL)
我也知道这http://server.com:80/path//info是有效的.
但我不确定以下一个是否有效:
http://server.com:80//path/info
Run Code Online (Sandbox Code Playgroud)
我的问题背后的问题是,http://server.com:80//path/info当URI http://server.com:80/path/info由限制创建时,不会发送cookie/path
要创建自定义错误处理,我想切换 MongoDbException 的 errorcode 属性。
有官方的错误代码列表吗?
我知道112is a WriteConflict,16608表示除以 0,并且16610是对零取模。
error_codes.yml不完整,缺少16608和16610。
我看过以下帖子.我的代码看起来完全相同,但不起作用:
Inno Setup检查运行过程
我从http://www.vincenzo.net/isxkb/index.php?title=PSVince复制了这个例子
但是这个例子也不起作用,即使我改变了这样的代码:
[Code]
function IsModuleLoaded(modulename: AnsiString): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';
Run Code Online (Sandbox Code Playgroud)
代码总是返回false(程序没有运行,即使它正在运行).在Windows 2008 R2和Windows 7上测试过.
事实上我想检查,如果它tomcat5.exe正在运行.所以我想我不能用AppMutex.
我也看过https://code.google.com/p/psvince/source/detail?r=5
但我找不到有关该DLL兼容性的任何事实.
完整代码:
[Files]
Source: psvince.dll; Flags: dontcopy
[Code]
function IsModuleLoaded(modulename: AnsiString ): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';
function InitializeSetup(): Boolean;
begin
if(IsModuleLoaded( 'notepad.exe' )) then
begin
MsgBox('Running', mbInformation, MB_OK);
Result := false;
end
else
begin
MsgBox('Not running', mbInformation, MB_OK);
Result := true;
end
end;
Run Code Online (Sandbox Code Playgroud) 我有一些用户输入.在我的代码中,我确保以下符号被转义:
& -> &
< -> <
> -> >
Run Code Online (Sandbox Code Playgroud)
OWASP表示有更多的字符要被转义.
对于属性,我做了另一种转义:
& -> &
" -> "
Run Code Online (Sandbox Code Playgroud)
这确保所有属性都包含在".这使我确定我的html属性,但不是HTML本身.
我想知道我的逃跑是否足够.我读过这篇文章,但我仍然不确定我的担忧.
(使用OWASP-Library转义JavaScripts)
我已经弄清楚如何逐行阅读并逐行显示文本文档的内容到jtextarea我已经想出如何逐行写出从字符串数组到文本文档.我只是很难从textarea获得每一行,只要我能将每一行都放到一个数组中我就好了.下面是我将用于将每行写入文件的代码...
public class FileWrite {
public static void FileClear(String FileName) throws IOException{
FileWriter fstream = new FileWriter(FileName,true);
BufferedWriter out = new BufferedWriter(fstream);
out.write("");
}
public static void FileWriters(String FileName, String Content) throws IOException
{
FileWriter fstream = new FileWriter(FileName,true);
BufferedWriter out = new BufferedWriter(fstream);
out.append(Content);
out.newLine();
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
C
我有一个应用程序,显示一些静态文件供下载.此应用程序创建隐藏的iframe并将源设置为file-url.
浏览器显示另存为对话框.
但在Microsoft Office中没有另存为对话框,并且未启动filedownload.
该文件随附Content-Disposition: Attachment.工作解决方案只需打开一个新的浏览器实例并触发文件下载.我不想打开一个可以获得焦点的新窗口.
<!DOCTYPE html>
<html>
<head>
<script>
function di(){
document.getElementById("d").src="blob.dat";
}
</script>
<title>download</title>
</head>
<body>
<h1>file loading</h1>
<h2>works</h2>
<p>But opens a new window</p>
<a href="blob.dat" target="_blank"> a blank </a><br>
<a href="blob.dat" target="download"> named frame </a>
<h2>won't work</h2>
<a href="blob.dat"> a self </a><br>
<a href="blob.dat" target="_self"> a self </a><br>
<a href="blob.dat" target="_top"> a top </a><br>
<a href="#" onclick="di();"> iframe </a><br><br>
<iframe id="d"></iframe>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我认为这是一个严重的错误,如果网络应用程序无法跟踪链接.
我有一个用于Android的cordova 2.0应用程序.我使用FileTransfer插件,将一些数据加载到我的服务器.第一次执行上传,一切正常.但后来我收到EPIPE(Broken Pipe)错误.如果我再次按下上传按钮,它就可以了.
如何防止错误?
09-28 17:31:12.304: W/FileTransfer(29497): Error getting HTTP status code from connection.
09-28 17:31:12.304: W/FileTransfer(29497): java.net.SocketException: sendto failed: EPIPE (Broken pipe)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.io.IoBridge.sendto(IoBridge.java:475)
09-28 17:31:12.304: W/FileTransfer(29497): at java.net.PlainSocketImpl.write(PlainSocketImpl.java:507)
09-28 17:31:12.304: W/FileTransfer(29497): at java.net.PlainSocketImpl.access$100(PlainSocketImpl.java:46)
09-28 17:31:12.304: W/FileTransfer(29497): at java.net.PlainSocketImpl$PlainSocketOutputStream.write(PlainSocketImpl.java:269)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.net.http.ChunkedOutputStream.writeHex(ChunkedOutputStream.java:102)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.net.http.ChunkedOutputStream.writeBufferedChunkToSocket(ChunkedOutputStream.java:128)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.net.http.ChunkedOutputStream.close(ChunkedOutputStream.java:118)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:804)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
09-28 17:31:12.304: W/FileTransfer(29497): at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486)
09-28 17:31:12.304: …Run Code Online (Sandbox Code Playgroud) 您好我有以下问题:
在卸载过程中,我加载了一个JAR(jdbc-driver).
URL pDriverJar = jarToDelete.toURI().toURL();
URL[] lURLList = new URL[]{pDriverJar};
URLClassLoader lLoader = new URLClassLoader(lURLList, Thread.currentThread().getContextClassLoader());
Thread.currentThread().setContextClassLoader(lLoader);
Class<?> aClass = Class.forName("jdbc.Driver"); // was Oracle: oracle.jdbc.OracleDriver but should not be important
if(jarToDelete.delete()){
System.out.println("deleted");
}else {
jarToDelete.deleteOnExit();
}
Run Code Online (Sandbox Code Playgroud)
在终止JVM之后,jar仍然存在.
作为一个workarround,我创建了一个临时文件,并将Jar复制到该tempfile.但是现在Tempfile不会被删除.
我读过,如果ClassLoad是GC,可以删除加载的jar.
有没有人有想法,如何删除此文件?
如何在最后一个char(.; + _等)之后获取值:例如
string.name + org.com
我想得到"com".在jQuery中有任何功能吗?
所以我想搜索一个字符串,看它是否包含我正在寻找的子字符串.这是我写的算法:
//Declares the String to be searched
String temp = "Hello World?";
//A String array is created to store the individual
//substrings in temp
String[] array = temp.split(" ");
//Iterates through String array and determines if the
//substring is present
for(String a : array)
{
if(a.equalsIgnoreCase("hello"))
{
System.out.println("Found");
break;
}
System.out.println("Not Found");
}
Run Code Online (Sandbox Code Playgroud)
这个算法适用于"你好",但我不知道如何让它为"世界"工作,因为它附有一个问号.
谢谢你的帮助!
$msg_box_ok_id=smthin;
print<<HTML_alert;
<script type="text/javascript" language="JavaScript">
if (browserName=="Microsoft Internet Explorer"){
$msg_box_ok_id=somthinnew;
}
</script>
HTML_alert
;
Run Code Online (Sandbox Code Playgroud)
我正在使用此代码,但javascript无法识别变量.
所以变量$ msg_box_ok_id不会改变.
java ×4
javascript ×3
html ×2
32bit-64bit ×1
android ×1
classloader ×1
cookies ×1
cordova ×1
delete-file ×1
escaping ×1
file-io ×1
http ×1
inno-setup ×1
jar ×1
jquery ×1
mongodb ×1
ms-office ×1
office-js ×1
owasp ×1
pascalscript ×1
perl ×1
rfc3986 ×1
search ×1
url ×1
windows ×1
xss ×1