• R/O
  • SSH
  • HTTPS

webserver: Commit


Commit MetaInfo

Revision46 (tree)
Time2010-09-19 01:08:17
Authorhoritaku

Log Message

修正

Change Summary

Incremental Difference

--- branch/Basic 0.2x/src/servercore/http/HttpRequest.java (revision 45)
+++ branch/Basic 0.2x/src/servercore/http/HttpRequest.java (revision 46)
@@ -9,7 +9,10 @@
99 POST,
1010 HEAD,
1111 PUT,
12- DELETE
12+ DELETE,
13+ OPTION,
14+ TRACE,
15+ CONNECT
1316 }
1417 private String extension = null;
1518 private METHOD reqest_method = null;
--- branch/Basic 0.2x/src/servercore/tcp/TcpInstance.java (revision 45)
+++ branch/Basic 0.2x/src/servercore/tcp/TcpInstance.java (revision 46)
@@ -29,7 +29,6 @@
2929 ips = socket.getInputStream();
3030 JobWorker job = new JobWorker();
3131
32- // TODO \r\n\r\nが来るまで
3332 job.execute(ops, ips);
3433
3534 } catch(Exception e){
--- branch/Basic 0.2x/src/servercore/job/JobWorker.java (revision 45)
+++ branch/Basic 0.2x/src/servercore/job/JobWorker.java (revision 46)
@@ -22,7 +22,9 @@
2222 String ext = req.getExtesion();
2323
2424 System.out.print(req.getMethod() + "\t" + req.getRowPath() + "\t");
25+
2526 HttpResponse res = GeneratePage.execute(req);
27+ System.out.println(res.getStatusCore());
2628
2729 String resStr = "";
2830 String CrtDate = editTimeZone(System.currentTimeMillis());
@@ -31,6 +33,8 @@
3133 resStr += "HTTP/1.1 200 OK\r\n";
3234 } else if(res.getStatusCore() == 404) {
3335 resStr += "HTTP/1.1 404 Not found\r\n";
36+ } else if(res.getStatusCore() == 500) {
37+ resStr += "HTTP/1.1 500 Internal sever error\r\n";
3438 }
3539 resStr += "Date: " + CrtDate + " GMT\r\n";
3640 resStr += "Last-Modified: " + LastMod + " GMT\r\n";
@@ -58,7 +62,6 @@
5862
5963 ops.write(resStr.getBytes());
6064 ops.write(res.getResponseByte());
61- System.out.println("200");
6265
6366 }
6467 public HttpRequest analyzeReq(InputStream ips) throws IOException {
--- branch/Basic 0.2x/src/servercore/job/GeneratePage.java (revision 45)
+++ branch/Basic 0.2x/src/servercore/job/GeneratePage.java (revision 46)
@@ -14,13 +14,13 @@
1414 File ifThisIsFile = null;
1515 HttpResponse res = new HttpResponse();
1616 String realPath = req.getPath();
17- String rowPath = req.getRowPath();
18- rowPath = rowPath.replaceAll("\\/", ".");
17+ String cgiPath = req.getRowPath();
18+ cgiPath = cgiPath.replaceAll("\\/", ".");
1919 String ext = req.getExtesion();
2020 try {
2121 if("do".equals(ext)) {
22- int index = rowPath.indexOf(".do");
23- String pkg = "refrect_action" + rowPath.substring(0, index);
22+ int index = cgiPath.indexOf(".do");
23+ String pkg = "refrect_action" + cgiPath.substring(0, index);
2424 StringBuffer sb = executeCgi(req, pkg);
2525 res.setStatusCore(200);
2626 res.setResponseStr(sb.toString());
@@ -31,8 +31,7 @@
3131 if(!ifThisIsFile.exists()) {
3232
3333 res.setStatusCore(404);
34- res.setResponseStr((rowPath + " was not found"));
35- System.out.println("404");
34+ res.setResponseStr((req.getRowPath() + " was not found"));
3635 return res;
3736 }
3837 res.setStatusCore(200);
@@ -39,9 +38,11 @@
3938 res.setResponseByte(ByteUtil.ByteReadFromFileName(realPath));
4039 res.setLastModified(ifThisIsFile.lastModified());
4140 } catch(NoClassDefFoundError e) {
42- e.printStackTrace();
43- res.setResponseStr((rowPath + " was not found"));
41+ res.setResponseStr((req.getRowPath() + " was not found"));
4442 res.setStatusCore(404);
43+ } catch(ClassNotFoundException e) {
44+ res.setResponseStr((req.getRowPath() + " was not found"));
45+ res.setStatusCore(404);
4546 } catch (Exception e) {
4647 res.setStatusCore(500);
4748 e.printStackTrace();
Show on old repository browser