about summary refs log tree commit diff stats
path: root/src/loader
diff options
context:
space:
mode:
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/cgi.nim4
-rw-r--r--src/loader/loader.nim16
-rw-r--r--src/loader/request.nim14
3 files changed, 17 insertions, 17 deletions
diff --git a/src/loader/cgi.nim b/src/loader/cgi.nim
index 467e2087..4b61399e 100644
--- a/src/loader/cgi.nim
+++ b/src/loader/cgi.nim
@@ -37,7 +37,7 @@ proc setupEnv(cmd, scriptName, pathInfo, requestURI: string, request: Request,
   putEnv("SCRIPT_NAME", scriptName)
   putEnv("SCRIPT_FILENAME", cmd)
   putEnv("REQUEST_URI", requestURI)
-  putEnv("REQUEST_METHOD", $request.httpmethod)
+  putEnv("REQUEST_METHOD", $request.httpMethod)
   var headers = ""
   for k, v in request.headers:
     headers &= k & ": " & v & "\r\n"
@@ -48,7 +48,7 @@ proc setupEnv(cmd, scriptName, pathInfo, requestURI: string, request: Request,
     putEnv("PATH_INFO", pathInfo)
   if url.query.isSome:
     putEnv("QUERY_STRING", url.query.get)
-  if request.httpmethod == HTTP_POST:
+  if request.httpMethod == HTTP_POST:
     if request.multipart.isSome:
       putEnv("CONTENT_TYPE", request.multipart.get.getContentType())
     else:
diff --git a/src/loader/loader.nim b/src/loader/loader.nim
index 44d6034b..72f30cbd 100644
--- a/src/loader/loader.nim
+++ b/src/loader/loader.nim
@@ -146,7 +146,7 @@ proc loadResource(ctx: LoaderContext, request: Request, handle: LoaderHandle) =
         ctx.handleMap[fd] = handle
     else:
       prevurl = request.url
-      case ctx.config.urimethodmap.findAndRewrite(request.url)
+      case ctx.config.uriMethodMap.findAndRewrite(request.url)
       of URI_RESULT_SUCCESS:
         inc tries
         redo = true
@@ -168,7 +168,7 @@ proc onLoad(ctx: LoaderContext, stream: SocketStream) =
     stream.close()
   else:
     let handle = newLoaderHandle(stream, request.canredir)
-    for k, v in ctx.config.defaultHeaders.table:
+    for k, v in ctx.config.defaultheaders.table:
       if k notin request.headers.table:
         request.headers.table[k] = v
     if ctx.config.cookiejar != nil and ctx.config.cookiejar.cookies.len > 0:
@@ -272,7 +272,7 @@ proc initLoaderContext(fd: cint, config: LoaderConfig): LoaderContext =
 
 proc runFileLoader*(fd: cint, config: LoaderConfig) =
   var ctx = initLoaderContext(fd, config)
-  var buffer {.noInit.}: array[16384, uint8]
+  var buffer {.noinit.}: array[16384, uint8]
   while ctx.alive:
     let events = ctx.selector.select(-1)
     var unreg: seq[int]
@@ -344,17 +344,17 @@ proc applyHeaders(loader: FileLoader, request: Request, response: Response) =
   if "Location" in response.headers.table:
     if response.status in 301u16..303u16 or response.status in 307u16..308u16:
       let location = response.headers.table["Location"][0]
-      let url = parseUrl(location, option(request.url))
+      let url = parseURL(location, option(request.url))
       if url.isSome:
         if (response.status == 303 and
-            request.httpmethod notin {HTTP_GET, HTTP_HEAD}) or
+            request.httpMethod notin {HTTP_GET, HTTP_HEAD}) or
             (response.status == 301 or response.status == 302 and
-            request.httpmethod == HTTP_POST):
+            request.httpMethod == HTTP_POST):
           response.redirect = newRequest(url.get, HTTP_GET,
             mode = request.mode, credentialsMode = request.credentialsMode,
             destination = request.destination)
         else:
-          response.redirect = newRequest(url.get, request.httpmethod,
+          response.redirect = newRequest(url.get, request.httpMethod,
             body = request.body, multipart = request.multipart,
             mode = request.mode, credentialsMode = request.credentialsMode,
             destination = request.destination)
@@ -490,7 +490,7 @@ proc onError*(loader: FileLoader, fd: int) =
   loader.ongoing.withValue(fd, buffer):
     let response = buffer[].response
     when defined(debug):
-      var lbuf {.noInit.}: array[BufferSize, char]
+      var lbuf {.noinit.}: array[BufferSize, char]
       if not response.body.atEnd():
         let n = response.body.readData(addr lbuf[0], lbuf.len)
         assert n == 0
diff --git a/src/loader/request.nim b/src/loader/request.nim
index aea5bd46..521362bc 100644
--- a/src/loader/request.nim
+++ b/src/loader/request.nim
@@ -69,8 +69,8 @@ type
 type
   Request* = ref RequestObj
   RequestObj* = object
-    httpmethod*: HttpMethod
-    url*: Url
+    httpMethod*: HttpMethod
+    url*: URL
     headers* {.jsget.}: Headers
     body*: Opt[string]
     multipart*: Opt[FormData]
@@ -158,14 +158,14 @@ proc newReadableStream*(isource: Stream): ReadableStream =
   if len != 0:
     isource.readStr(len, result.buf)
 
-func newRequest*(url: URL, httpmethod = HTTP_GET, headers = newHeaders(),
+func newRequest*(url: URL, httpMethod = HTTP_GET, headers = newHeaders(),
     body = opt(string), multipart = opt(FormData), mode = RequestMode.NO_CORS,
     credentialsMode = CredentialsMode.SAME_ORIGIN,
     destination = RequestDestination.NO_DESTINATION, proxy: URL = nil,
     referrer: URL = nil, canredir = false): Request =
   return Request(
     url: url,
-    httpmethod: httpmethod,
+    httpMethod: httpMethod,
     headers: headers,
     body: body,
     multipart: multipart,
@@ -176,7 +176,7 @@ func newRequest*(url: URL, httpmethod = HTTP_GET, headers = newHeaders(),
     proxy: proxy
   )
 
-func newRequest*(url: URL, httpmethod = HTTP_GET,
+func newRequest*(url: URL, httpMethod = HTTP_GET,
     headers: seq[(string, string)] = @[], body = opt(string),
     multipart = opt(FormData), mode = RequestMode.NO_CORS, proxy: URL = nil,
     canredir = false):
@@ -185,7 +185,7 @@ func newRequest*(url: URL, httpmethod = HTTP_GET,
   for pair in headers:
     let (k, v) = pair
     hl.table[k] = @[v]
-  return newRequest(url, httpmethod, hl, body, multipart, mode, proxy = proxy)
+  return newRequest(url, httpMethod, hl, body, multipart, mode, proxy = proxy)
 
 func createPotentialCORSRequest*(url: URL, destination: RequestDestination, cors: CORSAttribute, fallbackFlag = false): Request =
   var mode = if cors == NO_CORS:
@@ -312,7 +312,7 @@ func newRequest*[T: string|Request](ctx: JSContext, resource: T,
     proxyUrl = init.proxyUrl
   return ok(Request(
     url: url,
-    httpmethod: httpmethod,
+    httpMethod: httpMethod,
     headers: headers,
     body: body,
     multipart: multipart,