devel of web frontend

This commit is contained in:
rumpf_a@web.de 2010-01-10 17:53:33 +01:00
commit 55e900bba2
9 changed files with 189 additions and 9 deletions

View file

@ -12,7 +12,7 @@
import strutils, os, osproc, strtabs, streams, sockets
const
wwwNL = "\r\L"
wwwNL* = "\r\L"
ServerSig = "Server: httpserver.nim/1.0.0" & wwwNL
# --------------- output messages --------------------------------------------
@ -222,12 +222,12 @@ proc run*(handleRequest: proc (client: TSocket, path, query: string): bool,
## encapsulates the server object and main loop
var s: TServer
open(s, port)
echo("httpserver running on port ", s.port)
#echo("httpserver running on port ", s.port)
while true:
next(s)
if handleRequest(s.client, s.path, s.query): break
close(s.client)
close(s.socket)
close(s)
when false:
proc main =

View file

@ -1,7 +1,7 @@
#
#
# Nimrod's Runtime Library
# (c) Copyright 2009 Andreas Rumpf
# (c) Copyright 2010 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
@ -33,7 +33,7 @@ type
TProcessOption* = enum ## options that can be passed `startProcess`
poEchoCmd, ## echo the command before execution
poUseShell, ## use the shell to execute the command; NOTE: This
## often creates a security whole!
## often creates a security hole!
poStdErrToStdOut, ## merge stdout and stderr to the stdout stream
poParentStreams ## use the parent's streams

View file

@ -6,6 +6,7 @@
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# leave out unused functions so the unit can be used on win2000 as well
#+-------------------------------------------------------------------------

View file

@ -60,6 +60,8 @@ const
STD_ERROR_HANDLE* = -12'i32
DETACHED_PROCESS* = 8'i32
SW_SHOWNORMAL* = 1'i32
proc CloseHandle*(hObject: THANDLE): WINBOOL {.stdcall, dynlib: "kernel32",
importc: "CloseHandle".}
@ -190,4 +192,8 @@ proc rdFileTime*(f: FILETIME): int64 =
proc Sleep*(dwMilliseconds: int32){.stdcall, dynlib: "kernel32",
importc: "Sleep".}
proc ShellExecute*(HWND: THandle, lpOperation, lpFile,
lpParameters, lpDirectory: cstring,
nShowCmd: int32): THandle{.
stdcall, dynlib: "shell32.dll", importc: "ShellExecuteA".}