;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\311%\210\312\313\314\315\310\305\316\317&\210\312\320\306\321\310\305\316\322&\210\312\323\324\325\310\305\316\326&\210\312\327\330\331\310\305\316\332&\210\312\333\334\335\310\305\316\336&\210\312\337\334\340\310\305\316\336&\210\312\341\334\342\310\305\316\336&\210\312\343\306\344\310\305\316\345&\210\312\346\306\347\310\305\316\345&\207" [require cl-lib pp url-util custom-declare-group simple-httpd nil "A simple web server." :group comm custom-declare-variable httpd-ip-family 'ipv4 "Web server IP family used by `make-network-process'." :type symbol httpd-host "Web server host name used by `make-network-process'." (choice (const nil) (const local) string) httpd-port 8080 "Web server port." integer httpd-root "~/public_html" "Web server file root." directory httpd-serve-files t "Enable serving files from `httpd-root'." boolean httpd-listings "If true, serve directory listings." httpd-servlets "Enable servlets." httpd-start-hook "Hook to run when the server has started." hook httpd-stop-hook "Hook to run when the server has stopped."] 8) #@37 String to use in the Server header. (defvar httpd-server-name (format "simple-httpd (Emacs %s)" emacs-version) (#$ . 1222)) #@25 MIME types for headers. (defvar httpd-mime-types '(("png" . "image/png") ("gif" . "image/gif") ("jpg" . "image/jpeg") ("jpeg" . "image/jpeg") ("tif" . "image/tif") ("tiff" . "image/tiff") ("ico" . "image/x-icon") ("svg" . "image/svg+xml") ("css" . "text/css") ("htm" . "text/html") ("html" . "text/html") ("xml" . "text/xml") ("rss" . "text/xml") ("atom" . "text/xml") ("txt" . "text/plain") ("el" . "text/plain") ("js" . "text/javascript") ("md" . "text/x-markdown") ("gz" . "application/octet-stream") ("ps" . "application/postscript") ("eps" . "application/postscript") ("pdf" . "application/pdf") ("tar" . "application/x-tar") ("zip" . "application/zip") ("mp3" . "audio/mpeg") ("wav" . "audio/x-wav") ("flac" . "audio/flac") ("spx" . "audio/ogg") ("oga" . "audio/ogg") ("ogg" . "audio/ogg") ("ogv" . "video/ogg") ("mp4" . "video/mp4") ("mkv" . "video/x-matroska") ("webm" . "video/webm")) (#$ . 1352)) #@52 File served by default when accessing a directory. (defvar httpd-indexes '("index.html" "index.htm" "index.xml") (#$ . 2265)) #@20 HTTP status codes. (defvar httpd-status-codes '((100 . "Continue") (101 . "Switching Protocols") (102 . "Processing") (200 . "OK") (201 . "Created") (202 . "Accepted") (203 . "Non-authoritative Information") (204 . "No Content") (205 . "Reset Content") (206 . "Partial Content") (207 . "Multi-Status") (208 . "Already Reported") (226 . "IM Used") (300 . "Multiple Choices") (301 . "Moved Permanently") (302 . "Found") (303 . "See Other") (304 . "Not Modified") (305 . "Use Proxy") (307 . "Temporary Redirect") (308 . "Permanent Redirect") (400 . "Bad Request") (401 . "Unauthorized") (402 . "Payment Required") (403 . "Forbidden") (404 . "Not Found") (405 . "Method Not Allowed") (406 . "Not Acceptable") (407 . "Proxy Authentication Required") (408 . "Request Timeout") (409 . "Conflict") (410 . "Gone") (411 . "Length Required") (412 . "Precondition Failed") (413 . "Payload Too Large") (414 . "Request-URI Too Long") (415 . "Unsupported Media Type") (416 . "Requested Range Not Satisfiable") (417 . "Expectation Failed") (418 . "I'm a teapot") (421 . "Misdirected Request") (422 . "Unprocessable Entity") (423 . "Locked") (424 . "Failed Dependency") (426 . "Upgrade Required") (428 . "Precondition Required") (429 . "Too Many Requests") (431 . "Request Header Fields Too Large") (444 . "Connection Closed Without Response") (451 . "Unavailable For Legal Reasons") (499 . "Client Closed Request") (500 . "Internal Server Error") (501 . "Not Implemented") (502 . "Bad Gateway") (503 . "Service Unavailable") (504 . "Gateway Timeout") (505 . "HTTP Version Not Supported") (506 . "Variant Also Negotiates") (507 . "Insufficient Storage") (508 . "Loop Detected") (510 . "Not Extended") (511 . "Network Authentication Required") (599 . "Network Connect Timeout Error")) (#$ . 2397)) #@26 HTML for various errors. (defvar httpd-html '((403 . "\n\n403 Forbidden\n\n

Forbidden

\n

The requested URL is forbidden.

\n
%s
\n") (404 . "\n\n404 Not Found\n\n

Not Found

\n

The requested URL was not found on this server.

\n
%s
\n") (500 . "\n\n500 Internal Error\n\n

500 Internal Error

\n

Internal error when handling this request.

\n
%s
\n")) (#$ . 4183)) #@149 Start the web server process. If the server is already running, this will restart the server. There is only one server instance per Emacs instance. (defalias 'httpd-start #[nil "\303 \210\304\305\306 D!\210\307\310\311\312\313\314\315 \316\n\317\320\321\322\323\324\325\326&\210\327\330!\207" [httpd-port httpd-host httpd-ip-family httpd-stop httpd-log start current-time-string make-network-process :name "httpd" :service :server t :host :family :filter httpd--filter :filter-multibyte nil :coding binary :log httpd--log run-hooks httpd-start-hook] 19 (#$ . 4819) nil]) #@71 Stop the web server if it is currently running, otherwise do nothing. (defalias 'httpd-stop #[nil "\300\301!\205\302\301!\210\303\304\305 D!\210\306\307!\207" [process-status "httpd" delete-process httpd-log stop current-time-string run-hooks httpd-stop-hook] 3 (#$ . 5398) nil]) #@55 Return non-nil if the simple-httpd server is running. (defalias 'httpd-running-p #[nil "\300\301!??\207" [process-status "httpd"] 2 (#$ . 5686)]) #@62 Start the web server with given `directory' as `httpd-root'. (defalias 'httpd-serve-directory #[(directory) "\304 \210\305\306\n\307=\203\310\202\n\311=\203\312\202\n $\207" [directory httpd-root httpd-host httpd-port httpd-start message "Started simple-httpd on %s:%d, serving: %s" nil "0.0.0.0" local "localhost"] 5 (#$ . 5838) "DServe directory: \n"]) #@189 Never returns, holding the server open indefinitely for batch mode. Logs are redirected to stdout. To use, invoke Emacs like this: emacs -Q -batch -l simple-httpd.elc -f httpd-batch-start (defalias 'httpd-batch-start #[nil "\204\301\302!\207\303 \210\304\305\306\"\210\307\310!\210\202" [noninteractive error "Only use `httpd-batch-start' in batch mode!" httpd-start defalias httpd-log pp sleep-for 60] 3 (#$ . 6211)]) #@40 Return an HTTP date string (RFC 1123). (defalias 'httpd-date-string #[(&optional date) "\301\302\303#\207" [date format-time-string "%a, %e %b %Y %T GMT" t] 4 (#$ . 6641)]) #@28 Compute the ETag for FILE. (defalias 'httpd-etag #[(file) "\301\302\303\304!!!\305\306O\301Q\207" [file "\"" sha1 prin1-to-string file-attributes -16 nil] 5 (#$ . 6821)]) #@41 Turn a string designator into a string. (defalias 'httpd--stringify #[(designator) "\302\303\"\304!\203 \305\306O\202 )\207" [designator string format "%s" keywordp 1 nil] 3 (#$ . 6999)]) #@61 Return non-nil if the client requested "connection: close". (defalias 'httpd--connection-close-p #[(request) "\301\302\"A\303\232\206\301\304\"AA\305\232\207" [request assoc "Connection" ("close") "GET" ("HTTP/1.0")] 3 (#$ . 7200)]) #@40 Runs each time client makes a request. (defalias 'httpd--filter #[(proc chunk) "r\306\307\"q\210db\210 c\210\306\310\"\211\204'\311 \211\203'e`|\210\312\310\n#\210\n\205\300\313\314\n\"A@\211\203?\315 \316 !U\205\277\317 \n@A@\320 \260!\211$@%\321$A@\322\f!\"&\323%!'\324 \210\312\310\325#\210\326\fD\n\237B\237\327\302\330\331 D\332\333!@D\334%D\335\nB\257!\210'\204\230\336\337\"\210\202\264\3401\252'%&\n$0\210\202\264(\336\341(#)\210\342\n!\205\275\343!.)*\207" [proc chunk request content-length content uri process-get :request-buffer :request httpd-parse process-put assoc "Content-Length" buffer-size string-to-number buffer-string httpd-parse-uri append httpd-parse-args httpd-get-servlet erase-buffer nil "Content" httpd-log date httpd-date-string address process-contact get headers httpd--error-safe 404 (error) 500 httpd--connection-close-p process-send-eof parsed-uri uri-path uri-query servlet error-case] 8 (#$ . 7443)]) #@39 Runs each time a new client connects. (defalias 'httpd--log #[(server proc message) "r\301\302!q\210\303\304!\210\305\306p#\210)\307\310\"\210\311\312\313!@D!\207" [proc generate-new-buffer " *httpd-client*" set-buffer-multibyte nil process-put :request-buffer set-process-sentinel httpd--sentinel httpd-log connection process-contact] 4 (#$ . 8427)]) #@43 Runs when a client closes the connection. (defalias 'httpd--sentinel #[(proc message) "\304\305\306\307#)\266\203?\205\310\n\311\"\211\205\312 !)\207" [message inhibit-changing-match-data proc buffer "^open " nil t string-match process-get :request-buffer kill-buffer] 8 (#$ . 8788)]) #@40 Pretty print a lisp object to the log. (defalias 'httpd-log #[(item) "r\304\305!q\210\306`dU\212db\210\307\np\"\210) \203db\210)\310\211\311\306!)\207" [buffer-read-only follow item truncate-lines get-buffer-create "*httpd*" nil pp t set-buffer-modified-p] 4 (#$ . 9089)]) #@38 The process object currently in use. (defvar httpd-current-proc nil (#$ . 9374)) #@63 Buffer-local variable indicating if the header has been sent. (defvar httpd--header-sent nil (#$ . 9461)) (make-variable-buffer-local 'httpd--header-sent) #@71 Return the correct process to use. This handles `httpd-current-proc'. (defalias 'httpd-resolve-proc #[(proc) "\302=\203 \207\207" [proc httpd-current-proc t] 2 (#$ . 9622)]) #@282 Create a temporary buffer, set it as the current buffer, and, at the end of body, automatically serve it to an HTTP client with an HTTP header indicating the specified MIME type. Additionally, `standard-output' is set to this output buffer and `httpd-current-proc' is set to PROC. (defalias 'with-httpd-buffer '(macro . #[(proc mime &rest body) "\304\305!\306 DC\307\310\306\311\312DD\nBB\313\314\315 \316BBBEFE)\207" [proc-sym proc body mime make-symbol "--proc--" let with-temp-buffer (setf major-mode 'httpd-buffer) (standard-output (current-buffer)) httpd-current-proc unless httpd--header-sent httpd-send-header (200)] 11 (#$ . 9807)])) (byte-code "\300\301\302\303#\300\207" [function-put with-httpd-buffer lisp-indent-function defun] 4) #@105 Don't respond using current server buffer (`with-httpd-buffer'). Returns a process for future response. (defalias 'httpd-discard-buffer #[nil "\303=\203\304\n\207" [major-mode httpd--header-sent httpd-current-proc httpd-buffer t] 2 (#$ . 10562)]) #@424 Defines a simple httpd servelet. The servlet runs in a temporary buffer which is automatically served to the client along with a header. A servlet that serves the contents of *scratch*, (defservlet scratch text/plain () (insert-buffer-substring (get-buffer-create "*scratch*"))) A servlet that says hello, (defservlet hello-world text/plain (path) (insert "hello, " (file-name-nondirectory path)))) (defalias 'defservlet '(macro . #[(name mime path-query-request &rest body) "\306\307!\310\311\312!P!\313 \n\314 \315\316 D\"B\317\n\320\f! BBBF*\207" [name fname proc-sym path-query-request mime body make-symbol "proc" intern "httpd/" symbol-name defun append &rest cl-gensym with-httpd-buffer httpd--stringify] 7 (#$ . 10820)])) (byte-code "\300\301\302\303#\300\207" [function-put defservlet lisp-indent-function defun] 4) #@67 Parse an endpoint definition template for use with `defservlet*'. (defalias 'httpd-parse-endpoint #[(symbol) "\3062W\307\310!\311\"\312\313\312\211 :\203G @\211G\313V\2039\n\313H\314=\2039\f\315\n\316\312O! BC\244\202> \nC\244 A T\202\317\306\315\320\321 \311#!\fD\"\210-\3120\207" [symbol #1=#:--cl-var-- item n vars path --cl-block-nil-- split-string symbol-name "/" nil 0 58 intern 1 throw mapconcat identity] 8 (#$ . 11678)]) #@39 Anaphoric variable for `defservlet*'. (defvar httpd-path nil (#$ . 12132)) #@39 Anaphoric variable for `defservlet*'. (defvar httpd-query nil (#$ . 12213)) #@39 Anaphoric variable for `defservlet*'. (defvar httpd-request nil (#$ . 12295)) #@39 Anaphoric variable for `defservlet*'. (defvar httpd-split-path nil (#$ . 12379)) #@1046 Like `defservlet', but automatically bind variables/arguments to the request. Trailing components of the ENDPOINT can be bound by prefixing these components with a colon, acting like a template. (defservlet* packages/:package/:version text/plain (verbose) (insert (format "%s\n%s\n" package version)) (princ (get-description package version)) (when verbose (insert (format "%S" (get-dependencies package version))))) When accessed from this URL, http://example.com/packages/foobar/1.0?verbose=1 the variables package, version, and verbose will be bound to the associated components of the URL. Components not provided are bound to nil. The query arguments can use the Common Lisp &key form (variable default provided-p). (defservlet* greeting/:name text/plain ((greeting "hi" greeting-p)) (princ (format "%s, %s (provided: %s)" greeting name greeting-p))) The original path, query, and request can be accessed by the anaphoric special variables `httpd-path', `httpd-query', and `httpd-request'. (defalias 'defservlet* '(macro . #[(endpoint mime args &rest body) "\306 \306 \306 \307 !\211@\fA@#\310 $\n E\311\312\nD\313 D\314D\315\316\317\n\320BB\321BBDF\311#%\322\211&'\322\211()\323*%:\203y%@\211&\211A&\242'\324\325&\326BBD('(D)B)%A%\322*\202G)\237.\311+,\322\211-.\322\211/0\3221\3232,:\203,@\211-<\211.\205\255-G\327U/\330.\203\273-@\202\275-!0.\203\344-@\311\331\3320\333BBDC\334\331\335-A@FED1B1\202\364-\336\3320\337BBDD1B1/\203-AA@\340\341\3320\342BBDDD1B1,A,\3222\202\2251\237.3BBEE\257.\207" [request-lexical query-lexical path-lexical endpoint #1=#:--cl-var-- path cl-gensym httpd-parse-endpoint defservlet let httpd-path httpd-query httpd-request httpd-split-path split-string substring (1) ("/") nil t httpd-unhex nth (httpd-split-path) 3 symbol-name value assoc (httpd-query) if (cl-second value) cl-second (httpd-query) not null (httpd-query) vars mime #2=#:--cl-var-- pos var extract #3=#:--cl-var-- #4=#:--cl-var-- args #5=#:--cl-var-- arg has-default has-default-p arg-name #6=#:--cl-var-- #7=#:--cl-var-- body] 17 (#$ . 12468)])) (byte-code "\300\301\302\303#\304\305\306\"\207" [function-put defservlet* lisp-indent-function defun font-lock-add-keywords emacs-lisp-mode (("(\\<\\(defservlet\\*?\\)\\> +\\([^ ()]+\\) +\\([^ ()]+\\)" (1 'font-lock-keyword-face) (2 'font-lock-function-name-face) (3 'font-lock-type-face)))] 4) #@207 Defines a servlet that serves files from ROOT under the route NAME. (httpd-def-file-servlet my/www "/var/www/") Automatically handles redirects and uses `httpd-serve-root' to actually serve up files. (defalias 'httpd-def-file-servlet '(macro . #[(name root) "\305\306!!\211\307P\211G\310\311\312\313\314\315\316 E\317\320\nE\321\322\323\324 EDC\325\320\f\326BBBEF\257+\207" [name short-root path-root chop root directory-file-name symbol-name "/" defservlet nil (uri-path query request) (setf httpd--header-sent t) if = (length uri-path) httpd-redirect t let path substring uri-path httpd-serve-root (path request)] 15 (#$ . 14956)])) #@52 Destructively capitalize the components of HEADER. (defalias 'httpd--normalize-header #[(header) "\301\302\303\304\"\304#\207" [header mapconcat capitalize split-string "-"] 5 (#$ . 15609)]) #@172 Parse HTTP header in current buffer into association list. Leaves the point at the start of the request content. Returns nil if it failed to parse a complete HTTP header. (defalias 'httpd-parse #[nil "eb\210\306\307!\205Q\310\311!\312\310\313!\314\"\310\315!\316\317\225b\210\306\320!\203?\317\225b\210\310\311!\310\313!\321 !\312\f\314\"DB*\202\306\322!\205P\317\225b\210 \n E\237B,\207" [headers version path method value name looking-at "\\([^ ]+\\) +\\([^ ]+\\) +\\([^ ]+\\) \n" match-string 1 decode-coding-string 2 iso-8859-1 3 nil 0 "\\([-!#-'*+.0-9A-Z^_`a-z|~]+\\): *\\([^ ]+\\) \n" httpd--normalize-header " \n"] 4 (#$ . 15808)]) #@55 Fully decode the URL encoding in STR (including +'s). (defalias 'httpd-unhex #[(str) "\205\302\303\304#\305\306 \307\"\310\")\207" [str nonplussed replace-regexp-in-string "\\+" " " decode-coding-string url-unhex-string t utf-8] 4 (#$ . 16467)]) #@50 Parse a string containing URL encoded arguments. (defalias 'httpd-parse-args #[(argstr) "G\301U?\205\302\303\304\305\"\"\207" [argstr 0 mapcar #[(str) "\301\302\303\304\"\"\207" [str mapcar httpd-unhex split-string "="] 5] split-string "&"] 5 (#$ . 16724)]) #@187 Split a URI into its components. The first element of the return value is the script path, the second element is an alist of variable/value pairs, and the third element is the fragment. (defalias 'httpd-parse-uri #[(uri) "\304\305\"\304\306\"\307\n\205\310\nT\307O! B \205%\311 T\nO! B\312 \206/\nO B\211+\207" [uri retval p2 p1 string-match "\\?" "#" nil httpd-unhex httpd-parse-args 0] 4 (#$ . 16994)]) #@33 Determine status code for PATH. (defalias 'httpd-status #[(path) "\302!\204\303\207\304!\204\305\207\306!\203 \204\305\207\307\207" [path httpd-listings file-exists-p 404 file-readable-p 403 file-directory-p 200] 2 (#$ . 17420)]) #@60 Clean dangerous .. from PATH and remove the leading slash. (defalias 'httpd-clean-path #[(path) "\305>\203\n\306\202 \307\310\311\312\n \"\"\313\314\310\315 \"\307#\316\fP+\207" [system-type sep path split unsplit (windows-nt ms-dos) "[/\\]" "/" delete ".." split-string mapconcat identity "" "./"] 5 (#$ . 17667)]) #@54 Translate GET to secure path in ROOT (`httpd-root'). (defalias 'httpd-gen-path #[(path &optional root) "\306\307! \206 \n\"\310 !\203/\311 !\312\313\314\f\" \"\315\316\"\211@\206+\f+\2020 )\207" [path root httpd-root clean dir httpd-indexes expand-file-name httpd-clean-path file-directory-p file-name-as-directory cl-mapcar apply-partially concat cl-remove-if-not file-exists-p indexes existing] 5 (#$ . 17995)]) #@52 Determine the servlet to be executed for URI-PATH. (defalias 'httpd-get-servlet #[(uri-path) "\204\304\207\305\306\307\n!\310\"A\311\312\313\314\315 \316 !\"\"\"\206 \304*\207" [httpd-servlets #1=#:--cl-cat-- uri-path parts httpd/ #[(x) "\301\302\303\304!\305#P\207" [x "httpd/" mapconcat identity reverse "/"] 5] split-string directory-file-name "/" cl-find-if fboundp mapcar intern-soft cl-maplist reverse] 8 (#$ . 18428)]) #@50 Securely serve a file from ROOT from under PATH. (defalias 'httpd-serve-root #[(proc root uri-path &optional request) "\306 \"\307\n!\211\310U\204\311\f \"\202)\312\n!\203$\313\f\n#\202)\314\f\n #*\207" [uri-path root path status proc request httpd-gen-path httpd-status 200 httpd-error file-directory-p httpd-send-directory httpd-send-file] 5 (#$ . 18867)]) #@70 Default root servlet which serves files when httpd-serve-files is T. (defalias 'httpd/ #[(proc uri-path query request) "\203 \203\305\n \f$\207\306\n\307\"\207" [httpd-serve-files httpd-root proc uri-path request httpd-serve-root httpd-error 403] 5 (#$ . 19241)]) #@43 Fetch MIME type given the file extention. (defalias 'httpd-get-mime #[(ext) "\203 \302\227 \"A\206\303\207" [ext httpd-mime-types assoc "application/octet-stream"] 3 (#$ . 19517)]) #@279 Send an HTTP header with given MIME type and STATUS, followed by the current buffer. If PROC is T use the `httpd-current-proc' as the process. Extra headers can be sent by supplying them like keywords, i.e. (httpd-send-header t "text/plain" 200 :X-Powered-By "simple-httpd") (defalias 'httpd-send-header #[(proc mime status &rest header-keys) " \236A\306\nB\307\310 B\311\312\313 !B\314\315 B\257?\205\315\316\317\320\316\"rq\210\321\216\322\323 #c\210\324\211 !\324\211\"#\324\211$%\316&:\203\215\211\"\211A\"\242 \"@!\325 !\326\324O#\322\327!\"$%#$BC\244%AA\324&\202O\f%\244.\f\324 \211'\203\267'@ \322\330 @ A#c\210'A\211'\204\236*\331c\210\332\333(!ed#\210+\332\333(!ed#*\207" [status httpd-status-codes httpd-server-name mime headers status-str "Server" "Date" httpd-date-string ("Connection" . "keep-alive") "Content-Type" httpd--stringify "Content-Length" httpd--buffer-size t generate-new-buffer " *temp*" #[nil "\301!\205 \302!\207" [#1=#:temp-buffer buffer-name kill-buffer] 2] format "HTTP/1.1 %d %s \n" nil symbol-name 1 "%s" "%s: %s \n" " \n" process-send-region httpd-resolve-proc httpd--header-sent #1# header-keys #2=#:--cl-var-- header value #3=#:--cl-var-- header-name value-name extras #4=#:--cl-var-- --dolist-tail-- proc] 8 (#$ . 19710)]) #@102 Redirect the client to PATH (default 301). If PROC is T use the `httpd-current-proc' as the process. (defalias 'httpd-redirect #[(proc path &optional code) "\304\305D!\210\306 \210\307\310\311\"r q\210\312\216\313\n\314 \206\315\316%+\207" [path #1=#:temp-buffer proc code httpd-log redirect httpd-discard-buffer generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] httpd-send-header "text/plain" 301 :Location] 6 (#$ . 21047)]) #@92 Serve file to the given client. If PROC is T use the `httpd-current-proc' as the process. (defalias 'httpd-send-file #[(proc path &optional req) "\306 \210\307\310\"A@\311 !\312\313\314 !8!\211 \232\2039\315\316\317\"r q\210\320\216\321\322 \323BB!\210\324 \325\326#+\202d\321\322 D!\210\315\316\317\"!r!q\210\327\216\330\331!\210\332 !\210\324 \333\334 !!\335\336\n\337 &++\207" [req path mtime etag req-etag #1=#:temp-buffer httpd-discard-buffer assoc "If-None-Match" httpd-etag httpd-date-string 4 file-attributes generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] httpd-log file (not-modified) httpd-send-header "text/plain" 304 #[nil "\301!\205 \302!\207" [#2=#:temp-buffer buffer-name kill-buffer] 2] set-buffer-multibyte nil insert-file-contents httpd-get-mime file-name-extension 200 :Last-Modified :ETag proc #2#] 9 (#$ . 21530)]) #@95 Serve a file listing to the client. If PROC is T use the `httpd-current-proc' as the process. (defalias 'httpd-send-directory #[(proc path uri-path) "\306 \210\307\310!P\311\312O\313\232\203\214\314\315\316\"r\nq\210\317\216\320\321 D!\210\322\312!\210\323c\210\324 \325\261\210\326 \327\261\210\330 !\312\211\203~ @\211\331H\332=\204w\333\f \"&\334&!\203\\\313\202]\335'\310\f!(\336\f!)\337\340)'('%c\210, A\211\204@*\341c\210\342*\343\344#+\202\223\345*\313P\")\207" [uri-path title #1=#:temp-buffer path file --dolist-tail-- httpd-discard-buffer "Directory listing for " url-insert-entities-in-string -1 nil "/" generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] httpd-log directory set-buffer-multibyte "\n" "\n" "\n" "\n

" "

\n
\n\n
\n\n" httpd-send-header "text/html" 200 httpd-redirect full tail f l proc] 7 (#$ . 22437)]) #@31 Get the buffer size in bytes. (defalias 'httpd--buffer-size #[(&optional buffer) "\304r \206\npq\210\305\306!\210\307 \n\203\305\n!\210) *\207" [enable-multibyte-characters size orig buffer 0 set-buffer-multibyte nil buffer-size] 2 (#$ . 23565)]) #@160 Send an error page appropriate for STATUS to the client, optionally inserting object INFO into page. If PROC is T use the `httpd-current-proc' as the process. (defalias 'httpd-error #[(proc status &optional info) "\306 \210\307\310 E!\210\311\312\313\"r\nq\210\314\216 \236A\206\315\316\317\320 \"!\317 \203/\f\2020\315\"c\210*\321\322#+\207" [status info #1=#:temp-buffer httpd-html erro html httpd-discard-buffer httpd-log error generate-new-buffer " *temp*" t #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] "" url-insert-entities-in-string format "error: %s" httpd-send-header "text/html" proc] 5 (#$ . 23826)]) #@50 Call httpd-error and report failures to *httpd*. (defalias 'httpd--error-safe #[(&rest args) "\3021\n\303\304\"0\207\305\306 D!)\207" [args error-case (error) apply httpd-error httpd-log hard-error] 3 (#$ . 24477)]) (provide 'simple-httpd)