Multipart/formdata server
see examples/multiparttest.nim for a concrete example.
Types
PartState = enum HeaderReady, ## New part starts. [parseContentDisposition] is your friend here. For accessing other fields, use http.headers BodyChunk, ## More data for the current part body has arrived BodyReady, ## Current part is received Failed, ## See contents of chunk for potential additional info Completed ## That's it
- State of the request delivery inside the receiveParts iterator
Procs
proc newMultipartServer(onrequestcallback: proc () {....gcsafe, nimcall, ...raises: [].}; loglevel = lvlWarn; headerfields: openArray[string] = []): HttpServer {. ...raises: [], tags: [], forbids: [].}
- Note: headerfields concern only the whole request, not part headers
proc parseContentDisposition(): (string, string) {....raises: [], tags: [], forbids: [].}
- Returns values of name and filename properties of the content-disposition header field
Iterators
iterator receiveParts(parsepartheaders: bool = true): (PartState, string) {. ...raises: [], tags: [RootEffect], forbids: [].}
- Iterator for streaming in multipart/formdata
Exports
-
shortdivider, prepareHttpContext, checkSocketState, server, closeSocket, reply, shutdown, reply, closeSocket, isUri, replyStartChunked, GuildenServerObj, parseMethod, parseRequestLine, replyFinish, ThreadFinalizerCallback, reply, log, readHeader, replyFinishChunked, replyContinueChunked, newHttpServer, SocketCloseCause, epollSupported, lvlTRACE, handleRead, isHttpContext, reply, getRequest, initializeThread, LogLevel, GuildenSternVersion, SocketState, SetFlagsCallback, getMethod, thesocket, receiveStream, log, initialize, setFlags, SocketContext, getFlags, replyMore, reply, startsUri, handleHttpThreadInitialization, socketcontext, getBodylen, replyStart, reply, SuspendCallback, reply, http, MSG_MORE, longdivider, shutdownCallbacks, shuttingdown, HandlerCallback, reply, LogCallback, HttpServer, reply, socketdata, initHttpServer, getUri, replyMore, getBody, suspend, isMethod, $, HttpContext, MSG_DONTWAIT, GetFlagsCallback, closeOtherSocket, ThreadInitializerCallback, GuildenServer, CloseSocketCallback, ContentType, getContentLength, replyStart, isBody, isHeaderreceived, initialbackoff, OnCloseSocketCallback, suspend, HttpServerObj