├── .gitignore ├── .travis.yml ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── main.go ├── mime.types ├── src ├── fileserver.go ├── fileserver_test.go ├── query.go └── scan.go └── vendor └── vendor.json /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/* 2 | !vendor/vendor.json 3 | fileserver 4 | coverage.txt 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | 3 | go: 4 | - "1.10.1" 5 | 6 | before_install: 7 | - go get -u github.com/kardianos/govendor 8 | 9 | install: 10 | - govendor sync 11 | 12 | script: 13 | - go test -race -coverprofile=coverage.txt -covermode=atomic ./src 14 | 15 | after_success: 16 | - bash <(curl -s https://codecov.io/bash) 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Build stage 2 | FROM golang:1.10-alpine3.7 3 | MAINTAINER Hung-Wei Chiu 4 | 5 | WORKDIR /go/src/github.com/hwchiu/fileserver 6 | COPY src /go/src/github.com/hwchiu/fileserver/src 7 | COPY main.go /go/src/github.com/hwchiu/fileserver 8 | COPY vendor /go/src/github.com/hwchiu/fileserver/vendor 9 | 10 | COPY mime.types /etc/ 11 | 12 | ENV PORT 33333 13 | ENV ROOT / 14 | 15 | RUN apk add --no-cache git bzr 16 | RUN go get github.com/kardianos/govendor 17 | RUN govendor sync 18 | RUN go install . 19 | ENTRYPOINT /go/bin/fileserver -host localhost -port ${PORT} -documentRoot ${ROOT} 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Linker Networks 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SHELL := /bin/bash 2 | 3 | GO_VENDOR := $(shell which govendor) 4 | VENDOR_JSON_FILE := vendor/vendor.json 5 | 6 | PUBLIC_DOCKER_REGISTRY = docker.io 7 | DOCKER_PROJECT = linkernetworks 8 | 9 | BUILD_DATE := $(shell date +%Y.%m.%d.%H:%M:%S) 10 | 11 | GIT_SYMREF := $(shell git rev-parse --abbrev-ref HEAD | sed -e 's![^A-Za-z0-9]!-!g') 12 | GIT_REV_SHORT := $(shell git rev-parse --short HEAD) 13 | GIT_DESCRIBE := $(shell git describe --all --long) 14 | BUILD_REVISION := $(GIT_REV_SHORT) 15 | 16 | # container image definitions 17 | # IMAGE_TAG := latest 18 | # IMAGE_TAG := $(shell git rev-parse --abbrev-ref HEAD) 19 | ifeq ($(IMAGE_TAG),) 20 | IMAGE_TAG := $(GIT_SYMREF)-$(GIT_REV_SHORT) 21 | endif 22 | 23 | # image anchor tag should refers to "latest" or "develop" 24 | ifeq ($(IMAGE_ANCHOR_TAG),) 25 | IMAGE_ANCHOR_TAG := $(GIT_SYMREF) 26 | endif 27 | 28 | all: build build-image push-image 29 | 30 | build: vendor/.deps 31 | go build . 32 | clean: 33 | @rm -rf fileserver 34 | 35 | tool-govendor: 36 | if [ "$(GO_VENDOR)" == "" ] ; then go get github.com/kardianos/govendor ; fi 37 | 38 | vendor/.deps: tool-govendor $(VENDOR_JSON_FILE) 39 | govendor sync 40 | touch $@ 41 | 42 | build-image: 43 | time docker build $(DOCKER_BUILD_FLAGS) \ 44 | --tag $(PUBLIC_DOCKER_REGISTRY)/$(DOCKER_PROJECT)/fileserver:$(IMAGE_TAG) \ 45 | --tag $(PUBLIC_DOCKER_REGISTRY)/$(DOCKER_PROJECT)/fileserver:$(IMAGE_ANCHOR_TAG) \ 46 | . 47 | push-image: 48 | docker push $(PUBLIC_DOCKER_REGISTRY)/$(DOCKER_PROJECT)/fileserver:$(IMAGE_ANCHOR_TAG) 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Fileserver [![Build Status](https://travis-ci.org/hwchiu/fileserver.svg?branch=master)](https://travis-ci.org/hwchiu/fileserver) [![codecov](https://codecov.io/gh/hwchiu/fileserver/branch/master/graph/badge.svg)](https://codecov.io/gh/hwchiu/fileserver) [![Docker Build Status](https://img.shields.io/docker/build/hwchiu/fileserver.svg)](https://hub.docker.com/r/hwchiu/fileserver/) 2 | ============ 3 | A simple www server which is written in golang supports the scan/read/write/delete function 4 | 5 | Usage 6 | ===== 7 | ### Build the fileserver binary 8 | You should install the golang environment into your system first. 9 | Type the following command to build the binary 10 | ```sh 11 | make build 12 | ``` 13 | 14 | ### Run the fileserver 15 | The fileserverlisten on `localhost:33333` by default and you should use the `-documentRoot` to change the root of all files path operations. 16 | For example, if the `-documentRoot` is `/tmp`, the scan operation will scan all directories/files under /tmp. 17 | Use the following command to run a fileserver 18 | ``` sh 19 | ./fileserver -documentRoot /tmp 20 | ``` 21 | 22 | After the fileserver is running, we can use the curl to send the HTTP request. 23 | ### Scan 24 | the basic URL usage is `/scan/{path}` and the fileserver will scan all directories/files under `-documentRoot`/{path}. 25 | 26 | For example 27 | `curl -X GET -i http://localhost:33333/scan` will scan the directory /tmp and `curl -X GET -i http://localhost:33333/scan/data` will scan /tmp/data/. 28 | 29 | ### Download 30 | Send the HTTP GET to the path `/download/{path}` and the server will return the file (don't support directory) 31 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "flag" 6 | "net" 7 | "net/http" 8 | "os" 9 | "os/signal" 10 | "syscall" 11 | "time" 12 | 13 | "github.com/c9s/gomon/logger" 14 | fs "github.com/hwchiu/fileserver/src" 15 | 16 | "github.com/gorilla/mux" 17 | ) 18 | 19 | func newRouterServer(root string, basepath string) http.Handler { 20 | router := mux.NewRouter() 21 | if len(basepath) > 0 { 22 | router = router.PathPrefix(basepath).Subrouter() 23 | } 24 | router.HandleFunc("/scan/{path:.*}", fs.GetScanDirHandler(root)).Methods("GET") 25 | router.HandleFunc("/scan", fs.GetScanDirHandler(root)).Methods("GET") 26 | router.HandleFunc("/read/{path:.*}", fs.GetReadFileHandler(root)).Methods("GET") 27 | router.HandleFunc("/write/{path:.*}", fs.GetWriteFileHandler(root)).Methods("POST") 28 | router.HandleFunc("/delete/{path:.*}", fs.GetRemoveFileHandler(root)).Methods("DELETE") 29 | router.HandleFunc("/download/{path:.*}", fs.GetDownloadFileHandler(root)).Methods("GET") 30 | return router 31 | } 32 | 33 | func main() { 34 | var host string 35 | var port string 36 | var documentRoot string 37 | var basePath string 38 | 39 | flag.StringVar(&documentRoot, "documentRoot", "/workspace", "the document root of the file server") 40 | flag.StringVar(&basePath, "basePath", "", "the url base path of the APIs") 41 | flag.StringVar(&host, "host", "0.0.0.0", "hostname") 42 | flag.StringVar(&port, "port", "33333", "port") 43 | flag.Parse() 44 | 45 | logger.Infof("Serving document root: %s at %s", documentRoot, basePath) 46 | router := newRouterServer(documentRoot, basePath) 47 | 48 | bind := net.JoinHostPort(host, port) 49 | logger.Infof("Listening at %s", bind) 50 | server := &http.Server{Addr: bind, Handler: logRequest(router)} 51 | 52 | sigC := make(chan os.Signal) 53 | signal.Notify(sigC, syscall.SIGTERM) 54 | go func() { 55 | <-sigC 56 | logger.Infof("caught signal SIGTERM, terminating fileserver...") 57 | ctx, _ := context.WithTimeout(context.Background(), 10*time.Second) 58 | server.Shutdown(ctx) 59 | os.Exit(0) 60 | }() 61 | 62 | server.ListenAndServe() 63 | } 64 | 65 | func logRequest(handler http.Handler) http.Handler { 66 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { 67 | logger.Infof("[%s] %s %s", r.RemoteAddr, r.Method, r.URL) 68 | handler.ServeHTTP(w, r) 69 | }) 70 | } 71 | -------------------------------------------------------------------------------- /mime.types: -------------------------------------------------------------------------------- 1 | # This file maps Internet media types to unique file extension(s). 2 | # Although created for httpd, this file is used by many software systems 3 | # and has been placed in the public domain for unlimited redisribution. 4 | # 5 | # The table below contains both registered and (common) unregistered types. 6 | # A type that has no unique extension can be ignored -- they are listed 7 | # here to guide configurations toward known types and to make it easier to 8 | # identify "new" types. File extensions are also commonly used to indicate 9 | # content languages and encodings, so choose them carefully. 10 | # 11 | # Internet media types should be registered as described in RFC 4288. 12 | # The registry is at . 13 | # 14 | # MIME type (lowercased) Extensions 15 | # ============================================ ========== 16 | # application/1d-interleaved-parityfec 17 | # application/3gpdash-qoe-report+xml 18 | # application/3gpp-ims+xml 19 | # application/a2l 20 | # application/activemessage 21 | # application/alto-costmap+json 22 | # application/alto-costmapfilter+json 23 | # application/alto-directory+json 24 | # application/alto-endpointcost+json 25 | # application/alto-endpointcostparams+json 26 | # application/alto-endpointprop+json 27 | # application/alto-endpointpropparams+json 28 | # application/alto-error+json 29 | # application/alto-networkmap+json 30 | # application/alto-networkmapfilter+json 31 | # application/aml 32 | application/andrew-inset ez 33 | # application/applefile 34 | application/applixware aw 35 | # application/atf 36 | # application/atfx 37 | application/atom+xml atom 38 | application/atomcat+xml atomcat 39 | # application/atomdeleted+xml 40 | # application/atomicmail 41 | application/atomsvc+xml atomsvc 42 | # application/atxml 43 | # application/auth-policy+xml 44 | # application/bacnet-xdd+zip 45 | # application/batch-smtp 46 | # application/beep+xml 47 | # application/calendar+json 48 | # application/calendar+xml 49 | # application/call-completion 50 | # application/cals-1840 51 | # application/cbor 52 | # application/ccmp+xml 53 | application/ccxml+xml ccxml 54 | # application/cdfx+xml 55 | application/cdmi-capability cdmia 56 | application/cdmi-container cdmic 57 | application/cdmi-domain cdmid 58 | application/cdmi-object cdmio 59 | application/cdmi-queue cdmiq 60 | # application/cdni 61 | # application/cea 62 | # application/cea-2018+xml 63 | # application/cellml+xml 64 | # application/cfw 65 | # application/cms 66 | # application/cnrp+xml 67 | # application/coap-group+json 68 | # application/commonground 69 | # application/conference-info+xml 70 | # application/cpl+xml 71 | # application/csrattrs 72 | # application/csta+xml 73 | # application/cstadata+xml 74 | # application/csvm+json 75 | application/cu-seeme cu 76 | # application/cybercash 77 | # application/dash+xml 78 | # application/dashdelta 79 | application/davmount+xml davmount 80 | # application/dca-rft 81 | # application/dcd 82 | # application/dec-dx 83 | # application/dialog-info+xml 84 | # application/dicom 85 | # application/dii 86 | # application/dit 87 | # application/dns 88 | application/docbook+xml dbk 89 | # application/dskpp+xml 90 | application/dssc+der dssc 91 | application/dssc+xml xdssc 92 | # application/dvcs 93 | application/ecmascript ecma 94 | # application/edi-consent 95 | # application/edi-x12 96 | # application/edifact 97 | # application/efi 98 | # application/emergencycalldata.comment+xml 99 | # application/emergencycalldata.deviceinfo+xml 100 | # application/emergencycalldata.providerinfo+xml 101 | # application/emergencycalldata.serviceinfo+xml 102 | # application/emergencycalldata.subscriberinfo+xml 103 | application/emma+xml emma 104 | # application/emotionml+xml 105 | # application/encaprtp 106 | # application/epp+xml 107 | application/epub+zip epub 108 | # application/eshop 109 | # application/example 110 | application/exi exi 111 | # application/fastinfoset 112 | # application/fastsoap 113 | # application/fdt+xml 114 | # application/fits 115 | # application/font-sfnt 116 | application/font-tdpfr pfr 117 | application/font-woff woff 118 | # application/framework-attributes+xml 119 | # application/geo+json 120 | application/gml+xml gml 121 | application/gpx+xml gpx 122 | application/gxf gxf 123 | # application/gzip 124 | # application/h224 125 | # application/held+xml 126 | # application/http 127 | application/hyperstudio stk 128 | # application/ibe-key-request+xml 129 | # application/ibe-pkg-reply+xml 130 | # application/ibe-pp-data 131 | # application/iges 132 | # application/im-iscomposing+xml 133 | # application/index 134 | # application/index.cmd 135 | # application/index.obj 136 | # application/index.response 137 | # application/index.vnd 138 | application/inkml+xml ink inkml 139 | # application/iotp 140 | application/ipfix ipfix 141 | # application/ipp 142 | # application/isup 143 | # application/its+xml 144 | application/java-archive jar 145 | application/java-serialized-object ser 146 | application/java-vm class 147 | application/javascript js 148 | # application/jose 149 | # application/jose+json 150 | # application/jrd+json 151 | application/json json 152 | # application/json-patch+json 153 | # application/json-seq 154 | application/jsonml+json jsonml 155 | # application/jwk+json 156 | # application/jwk-set+json 157 | # application/jwt 158 | # application/kpml-request+xml 159 | # application/kpml-response+xml 160 | # application/ld+json 161 | # application/lgr+xml 162 | # application/link-format 163 | # application/load-control+xml 164 | application/lost+xml lostxml 165 | # application/lostsync+xml 166 | # application/lxf 167 | application/mac-binhex40 hqx 168 | application/mac-compactpro cpt 169 | # application/macwriteii 170 | application/mads+xml mads 171 | application/marc mrc 172 | application/marcxml+xml mrcx 173 | application/mathematica ma nb mb 174 | application/mathml+xml mathml 175 | # application/mathml-content+xml 176 | # application/mathml-presentation+xml 177 | # application/mbms-associated-procedure-description+xml 178 | # application/mbms-deregister+xml 179 | # application/mbms-envelope+xml 180 | # application/mbms-msk+xml 181 | # application/mbms-msk-response+xml 182 | # application/mbms-protection-description+xml 183 | # application/mbms-reception-report+xml 184 | # application/mbms-register+xml 185 | # application/mbms-register-response+xml 186 | # application/mbms-schedule+xml 187 | # application/mbms-user-service-description+xml 188 | application/mbox mbox 189 | # application/media-policy-dataset+xml 190 | # application/media_control+xml 191 | application/mediaservercontrol+xml mscml 192 | # application/merge-patch+json 193 | application/metalink+xml metalink 194 | application/metalink4+xml meta4 195 | application/mets+xml mets 196 | # application/mf4 197 | # application/mikey 198 | application/mods+xml mods 199 | # application/moss-keys 200 | # application/moss-signature 201 | # application/mosskey-data 202 | # application/mosskey-request 203 | application/mp21 m21 mp21 204 | application/mp4 mp4s 205 | # application/mpeg4-generic 206 | # application/mpeg4-iod 207 | # application/mpeg4-iod-xmt 208 | # application/mrb-consumer+xml 209 | # application/mrb-publish+xml 210 | # application/msc-ivr+xml 211 | # application/msc-mixer+xml 212 | application/msword doc dot 213 | application/mxf mxf 214 | # application/nasdata 215 | # application/news-checkgroups 216 | # application/news-groupinfo 217 | # application/news-transmission 218 | # application/nlsml+xml 219 | # application/nss 220 | # application/ocsp-request 221 | # application/ocsp-response 222 | application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy mobipocket-ebook 223 | application/oda oda 224 | # application/odx 225 | application/oebps-package+xml opf 226 | application/ogg ogx 227 | application/omdoc+xml omdoc 228 | application/onenote onetoc onetoc2 onetmp onepkg 229 | application/oxps oxps 230 | # application/p2p-overlay+xml 231 | # application/parityfec 232 | application/patch-ops-error+xml xer 233 | application/pdf pdf 234 | # application/pdx 235 | application/pgp-encrypted pgp 236 | # application/pgp-keys 237 | application/pgp-signature asc sig 238 | application/pics-rules prf 239 | # application/pidf+xml 240 | # application/pidf-diff+xml 241 | application/pkcs10 p10 242 | # application/pkcs12 243 | application/pkcs7-mime p7m p7c 244 | application/pkcs7-signature p7s 245 | application/pkcs8 p8 246 | application/pkix-attr-cert ac 247 | application/pkix-cert cer 248 | application/pkix-crl crl 249 | application/pkix-pkipath pkipath 250 | application/pkixcmp pki 251 | application/pls+xml pls 252 | # application/poc-settings+xml 253 | application/postscript ai eps ps 254 | # application/ppsp-tracker+json 255 | # application/problem+json 256 | # application/problem+xml 257 | # application/provenance+xml 258 | # application/prs.alvestrand.titrax-sheet 259 | application/prs.cww cww 260 | # application/prs.hpub+zip 261 | # application/prs.nprend 262 | # application/prs.plucker 263 | # application/prs.rdf-xml-crypt 264 | # application/prs.xsf+xml 265 | application/pskc+xml pskcxml 266 | # application/qsig 267 | # application/raptorfec 268 | # application/rdap+json 269 | application/rdf+xml rdf 270 | application/reginfo+xml rif 271 | application/relax-ng-compact-syntax rnc 272 | # application/remote-printing 273 | # application/reputon+json 274 | application/resource-lists+xml rl 275 | application/resource-lists-diff+xml rld 276 | # application/rfc+xml 277 | # application/riscos 278 | # application/rlmi+xml 279 | application/rls-services+xml rs 280 | application/rpki-ghostbusters gbr 281 | application/rpki-manifest mft 282 | application/rpki-roa roa 283 | # application/rpki-updown 284 | application/rsd+xml rsd 285 | application/rss+xml rss 286 | application/rtf rtf 287 | # application/rtploopback 288 | # application/rtx 289 | # application/samlassertion+xml 290 | # application/samlmetadata+xml 291 | application/sbml+xml sbml 292 | # application/scaip+xml 293 | # application/scim+json 294 | application/scvp-cv-request scq 295 | application/scvp-cv-response scs 296 | application/scvp-vp-request spq 297 | application/scvp-vp-response spp 298 | application/sdp sdp 299 | # application/sep+xml 300 | # application/sep-exi 301 | # application/session-info 302 | # application/set-payment 303 | application/set-payment-initiation setpay 304 | # application/set-registration 305 | application/set-registration-initiation setreg 306 | # application/sgml 307 | # application/sgml-open-catalog 308 | application/shf+xml shf 309 | # application/sieve 310 | # application/simple-filter+xml 311 | # application/simple-message-summary 312 | # application/simplesymbolcontainer 313 | # application/slate 314 | # application/smil 315 | application/smil+xml smi smil 316 | # application/smpte336m 317 | # application/soap+fastinfoset 318 | # application/soap+xml 319 | application/sparql-query rq 320 | application/sparql-results+xml srx 321 | # application/spirits-event+xml 322 | # application/sql 323 | application/srgs gram 324 | application/srgs+xml grxml 325 | application/sru+xml sru 326 | application/ssdl+xml ssdl 327 | application/ssml+xml ssml 328 | # application/tamp-apex-update 329 | # application/tamp-apex-update-confirm 330 | # application/tamp-community-update 331 | # application/tamp-community-update-confirm 332 | # application/tamp-error 333 | # application/tamp-sequence-adjust 334 | # application/tamp-sequence-adjust-confirm 335 | # application/tamp-status-query 336 | # application/tamp-status-response 337 | # application/tamp-update 338 | # application/tamp-update-confirm 339 | application/tei+xml tei teicorpus 340 | application/thraud+xml tfi 341 | # application/timestamp-query 342 | # application/timestamp-reply 343 | application/timestamped-data tsd 344 | # application/ttml+xml 345 | # application/tve-trigger 346 | # application/ulpfec 347 | # application/urc-grpsheet+xml 348 | # application/urc-ressheet+xml 349 | # application/urc-targetdesc+xml 350 | # application/urc-uisocketdesc+xml 351 | # application/vcard+json 352 | # application/vcard+xml 353 | # application/vemmi 354 | # application/vividence.scriptfile 355 | # application/vnd.3gpp-prose+xml 356 | # application/vnd.3gpp-prose-pc3ch+xml 357 | # application/vnd.3gpp.access-transfer-events+xml 358 | # application/vnd.3gpp.bsf+xml 359 | # application/vnd.3gpp.mid-call+xml 360 | application/vnd.3gpp.pic-bw-large plb 361 | application/vnd.3gpp.pic-bw-small psb 362 | application/vnd.3gpp.pic-bw-var pvb 363 | # application/vnd.3gpp.sms 364 | # application/vnd.3gpp.sms+xml 365 | # application/vnd.3gpp.srvcc-ext+xml 366 | # application/vnd.3gpp.srvcc-info+xml 367 | # application/vnd.3gpp.state-and-event-info+xml 368 | # application/vnd.3gpp.ussd+xml 369 | # application/vnd.3gpp2.bcmcsinfo+xml 370 | # application/vnd.3gpp2.sms 371 | application/vnd.3gpp2.tcap tcap 372 | # application/vnd.3lightssoftware.imagescal 373 | application/vnd.3m.post-it-notes pwn 374 | application/vnd.accpac.simply.aso aso 375 | application/vnd.accpac.simply.imp imp 376 | application/vnd.acucobol acu 377 | application/vnd.acucorp atc acutc 378 | application/vnd.adobe.air-application-installer-package+zip air 379 | # application/vnd.adobe.flash.movie 380 | application/vnd.adobe.formscentral.fcdt fcdt 381 | application/vnd.adobe.fxp fxp fxpl 382 | # application/vnd.adobe.partial-upload 383 | application/vnd.adobe.xdp+xml xdp 384 | application/vnd.adobe.xfdf xfdf 385 | # application/vnd.aether.imp 386 | # application/vnd.ah-barcode 387 | application/vnd.ahead.space ahead 388 | application/vnd.airzip.filesecure.azf azf 389 | application/vnd.airzip.filesecure.azs azs 390 | application/vnd.amazon.ebook azw 391 | # application/vnd.amazon.mobi8-ebook 392 | application/vnd.americandynamics.acc acc 393 | application/vnd.amiga.ami ami 394 | # application/vnd.amundsen.maze+xml 395 | application/vnd.android.package-archive apk 396 | # application/vnd.anki 397 | application/vnd.anser-web-certificate-issue-initiation cii 398 | application/vnd.anser-web-funds-transfer-initiation fti 399 | application/vnd.antix.game-component atx 400 | # application/vnd.apache.thrift.binary 401 | # application/vnd.apache.thrift.compact 402 | # application/vnd.apache.thrift.json 403 | # application/vnd.api+json 404 | application/vnd.apple.installer+xml mpkg 405 | application/vnd.apple.mpegurl m3u8 406 | # application/vnd.arastra.swi 407 | application/vnd.aristanetworks.swi swi 408 | # application/vnd.artsquare 409 | application/vnd.astraea-software.iota iota 410 | application/vnd.audiograph aep 411 | # application/vnd.autopackage 412 | # application/vnd.avistar+xml 413 | # application/vnd.balsamiq.bmml+xml 414 | # application/vnd.balsamiq.bmpr 415 | # application/vnd.bekitzur-stech+json 416 | # application/vnd.biopax.rdf+xml 417 | application/vnd.blueice.multipass mpm 418 | # application/vnd.bluetooth.ep.oob 419 | # application/vnd.bluetooth.le.oob 420 | application/vnd.bmi bmi 421 | application/vnd.businessobjects rep 422 | # application/vnd.cab-jscript 423 | # application/vnd.canon-cpdl 424 | # application/vnd.canon-lips 425 | # application/vnd.cendio.thinlinc.clientconf 426 | # application/vnd.century-systems.tcp_stream 427 | application/vnd.chemdraw+xml cdxml 428 | # application/vnd.chess-pgn 429 | application/vnd.chipnuts.karaoke-mmd mmd 430 | application/vnd.cinderella cdy 431 | # application/vnd.cirpack.isdn-ext 432 | # application/vnd.citationstyles.style+xml 433 | application/vnd.claymore cla 434 | application/vnd.cloanto.rp9 rp9 435 | application/vnd.clonk.c4group c4g c4d c4f c4p c4u 436 | application/vnd.cluetrust.cartomobile-config c11amc 437 | application/vnd.cluetrust.cartomobile-config-pkg c11amz 438 | # application/vnd.coffeescript 439 | # application/vnd.collection+json 440 | # application/vnd.collection.doc+json 441 | # application/vnd.collection.next+json 442 | # application/vnd.comicbook+zip 443 | # application/vnd.commerce-battelle 444 | application/vnd.commonspace csp 445 | application/vnd.contact.cmsg cdbcmsg 446 | # application/vnd.coreos.ignition+json 447 | application/vnd.cosmocaller cmc 448 | application/vnd.crick.clicker clkx 449 | application/vnd.crick.clicker.keyboard clkk 450 | application/vnd.crick.clicker.palette clkp 451 | application/vnd.crick.clicker.template clkt 452 | application/vnd.crick.clicker.wordbank clkw 453 | application/vnd.criticaltools.wbs+xml wbs 454 | application/vnd.ctc-posml pml 455 | # application/vnd.ctct.ws+xml 456 | # application/vnd.cups-pdf 457 | # application/vnd.cups-postscript 458 | application/vnd.cups-ppd ppd 459 | # application/vnd.cups-raster 460 | # application/vnd.cups-raw 461 | # application/vnd.curl 462 | application/vnd.curl.car car 463 | application/vnd.curl.pcurl pcurl 464 | # application/vnd.cyan.dean.root+xml 465 | # application/vnd.cybank 466 | application/vnd.dart dart 467 | application/vnd.data-vision.rdz rdz 468 | # application/vnd.debian.binary-package 469 | application/vnd.dece.data uvf uvvf uvd uvvd 470 | application/vnd.dece.ttml+xml uvt uvvt 471 | application/vnd.dece.unspecified uvx uvvx 472 | application/vnd.dece.zip uvz uvvz 473 | application/vnd.denovo.fcselayout-link fe_launch 474 | # application/vnd.desmume.movie 475 | # application/vnd.dir-bi.plate-dl-nosuffix 476 | # application/vnd.dm.delegation+xml 477 | application/vnd.dna dna 478 | # application/vnd.document+json 479 | application/vnd.dolby.mlp mlp 480 | # application/vnd.dolby.mobile.1 481 | # application/vnd.dolby.mobile.2 482 | # application/vnd.doremir.scorecloud-binary-document 483 | application/vnd.dpgraph dpg 484 | application/vnd.dreamfactory dfac 485 | # application/vnd.drive+json 486 | application/vnd.ds-keypoint kpxx 487 | # application/vnd.dtg.local 488 | # application/vnd.dtg.local.flash 489 | # application/vnd.dtg.local.html 490 | application/vnd.dvb.ait ait 491 | # application/vnd.dvb.dvbj 492 | # application/vnd.dvb.esgcontainer 493 | # application/vnd.dvb.ipdcdftnotifaccess 494 | # application/vnd.dvb.ipdcesgaccess 495 | # application/vnd.dvb.ipdcesgaccess2 496 | # application/vnd.dvb.ipdcesgpdd 497 | # application/vnd.dvb.ipdcroaming 498 | # application/vnd.dvb.iptv.alfec-base 499 | # application/vnd.dvb.iptv.alfec-enhancement 500 | # application/vnd.dvb.notif-aggregate-root+xml 501 | # application/vnd.dvb.notif-container+xml 502 | # application/vnd.dvb.notif-generic+xml 503 | # application/vnd.dvb.notif-ia-msglist+xml 504 | # application/vnd.dvb.notif-ia-registration-request+xml 505 | # application/vnd.dvb.notif-ia-registration-response+xml 506 | # application/vnd.dvb.notif-init+xml 507 | # application/vnd.dvb.pfr 508 | application/vnd.dvb.service svc 509 | # application/vnd.dxr 510 | application/vnd.dynageo geo 511 | # application/vnd.dzr 512 | # application/vnd.easykaraoke.cdgdownload 513 | # application/vnd.ecdis-update 514 | application/vnd.ecowin.chart mag 515 | # application/vnd.ecowin.filerequest 516 | # application/vnd.ecowin.fileupdate 517 | # application/vnd.ecowin.series 518 | # application/vnd.ecowin.seriesrequest 519 | # application/vnd.ecowin.seriesupdate 520 | # application/vnd.emclient.accessrequest+xml 521 | application/vnd.enliven nml 522 | # application/vnd.enphase.envoy 523 | # application/vnd.eprints.data+xml 524 | application/vnd.epson.esf esf 525 | application/vnd.epson.msf msf 526 | application/vnd.epson.quickanime qam 527 | application/vnd.epson.salt slt 528 | application/vnd.epson.ssf ssf 529 | # application/vnd.ericsson.quickcall 530 | application/vnd.eszigno3+xml es3 et3 531 | # application/vnd.etsi.aoc+xml 532 | # application/vnd.etsi.asic-e+zip 533 | # application/vnd.etsi.asic-s+zip 534 | # application/vnd.etsi.cug+xml 535 | # application/vnd.etsi.iptvcommand+xml 536 | # application/vnd.etsi.iptvdiscovery+xml 537 | # application/vnd.etsi.iptvprofile+xml 538 | # application/vnd.etsi.iptvsad-bc+xml 539 | # application/vnd.etsi.iptvsad-cod+xml 540 | # application/vnd.etsi.iptvsad-npvr+xml 541 | # application/vnd.etsi.iptvservice+xml 542 | # application/vnd.etsi.iptvsync+xml 543 | # application/vnd.etsi.iptvueprofile+xml 544 | # application/vnd.etsi.mcid+xml 545 | # application/vnd.etsi.mheg5 546 | # application/vnd.etsi.overload-control-policy-dataset+xml 547 | # application/vnd.etsi.pstn+xml 548 | # application/vnd.etsi.sci+xml 549 | # application/vnd.etsi.simservs+xml 550 | # application/vnd.etsi.timestamp-token 551 | # application/vnd.etsi.tsl+xml 552 | # application/vnd.etsi.tsl.der 553 | # application/vnd.eudora.data 554 | application/vnd.ezpix-album ez2 555 | application/vnd.ezpix-package ez3 556 | # application/vnd.f-secure.mobile 557 | # application/vnd.fastcopy-disk-image 558 | application/vnd.fdf fdf 559 | application/vnd.fdsn.mseed mseed 560 | application/vnd.fdsn.seed seed dataless 561 | # application/vnd.ffsns 562 | # application/vnd.filmit.zfc 563 | # application/vnd.fints 564 | # application/vnd.firemonkeys.cloudcell 565 | application/vnd.flographit gph 566 | application/vnd.fluxtime.clip ftc 567 | # application/vnd.font-fontforge-sfd 568 | application/vnd.framemaker fm frame maker book 569 | application/vnd.frogans.fnc fnc 570 | application/vnd.frogans.ltf ltf 571 | application/vnd.fsc.weblaunch fsc 572 | application/vnd.fujitsu.oasys oas 573 | application/vnd.fujitsu.oasys2 oa2 574 | application/vnd.fujitsu.oasys3 oa3 575 | application/vnd.fujitsu.oasysgp fg5 576 | application/vnd.fujitsu.oasysprs bh2 577 | # application/vnd.fujixerox.art-ex 578 | # application/vnd.fujixerox.art4 579 | application/vnd.fujixerox.ddd ddd 580 | application/vnd.fujixerox.docuworks xdw 581 | application/vnd.fujixerox.docuworks.binder xbd 582 | # application/vnd.fujixerox.docuworks.container 583 | # application/vnd.fujixerox.hbpl 584 | # application/vnd.fut-misnet 585 | application/vnd.fuzzysheet fzs 586 | application/vnd.genomatix.tuxedo txd 587 | # application/vnd.geo+json 588 | # application/vnd.geocube+xml 589 | application/vnd.geogebra.file ggb 590 | application/vnd.geogebra.tool ggt 591 | application/vnd.geometry-explorer gex gre 592 | application/vnd.geonext gxt 593 | application/vnd.geoplan g2w 594 | application/vnd.geospace g3w 595 | # application/vnd.gerber 596 | # application/vnd.globalplatform.card-content-mgt 597 | # application/vnd.globalplatform.card-content-mgt-response 598 | application/vnd.gmx gmx 599 | application/vnd.google-earth.kml+xml kml 600 | application/vnd.google-earth.kmz kmz 601 | # application/vnd.gov.sk.e-form+xml 602 | # application/vnd.gov.sk.e-form+zip 603 | # application/vnd.gov.sk.xmldatacontainer+xml 604 | application/vnd.grafeq gqf gqs 605 | # application/vnd.gridmp 606 | application/vnd.groove-account gac 607 | application/vnd.groove-help ghf 608 | application/vnd.groove-identity-message gim 609 | application/vnd.groove-injector grv 610 | application/vnd.groove-tool-message gtm 611 | application/vnd.groove-tool-template tpl 612 | application/vnd.groove-vcard vcg 613 | # application/vnd.hal+json 614 | application/vnd.hal+xml hal 615 | application/vnd.handheld-entertainment+xml zmm 616 | application/vnd.hbci hbci 617 | # application/vnd.hcl-bireports 618 | # application/vnd.hdt 619 | # application/vnd.heroku+json 620 | application/vnd.hhe.lesson-player les 621 | application/vnd.hp-hpgl hpgl 622 | application/vnd.hp-hpid hpid 623 | application/vnd.hp-hps hps 624 | application/vnd.hp-jlyt jlt 625 | application/vnd.hp-pcl pcl 626 | application/vnd.hp-pclxl pclxl 627 | # application/vnd.httphone 628 | application/vnd.hydrostatix.sof-data sfd-hdstx 629 | # application/vnd.hyperdrive+json 630 | # application/vnd.hzn-3d-crossword 631 | # application/vnd.ibm.afplinedata 632 | # application/vnd.ibm.electronic-media 633 | application/vnd.ibm.minipay mpy 634 | application/vnd.ibm.modcap afp listafp list3820 635 | application/vnd.ibm.rights-management irm 636 | application/vnd.ibm.secure-container sc 637 | application/vnd.iccprofile icc icm 638 | # application/vnd.ieee.1905 639 | application/vnd.igloader igl 640 | application/vnd.immervision-ivp ivp 641 | application/vnd.immervision-ivu ivu 642 | # application/vnd.ims.imsccv1p1 643 | # application/vnd.ims.imsccv1p2 644 | # application/vnd.ims.imsccv1p3 645 | # application/vnd.ims.lis.v2.result+json 646 | # application/vnd.ims.lti.v2.toolconsumerprofile+json 647 | # application/vnd.ims.lti.v2.toolproxy+json 648 | # application/vnd.ims.lti.v2.toolproxy.id+json 649 | # application/vnd.ims.lti.v2.toolsettings+json 650 | # application/vnd.ims.lti.v2.toolsettings.simple+json 651 | # application/vnd.informedcontrol.rms+xml 652 | # application/vnd.informix-visionary 653 | # application/vnd.infotech.project 654 | # application/vnd.infotech.project+xml 655 | # application/vnd.innopath.wamp.notification 656 | application/vnd.insors.igm igm 657 | application/vnd.intercon.formnet xpw xpx 658 | application/vnd.intergeo i2g 659 | # application/vnd.intertrust.digibox 660 | # application/vnd.intertrust.nncp 661 | application/vnd.intu.qbo qbo 662 | application/vnd.intu.qfx qfx 663 | # application/vnd.iptc.g2.catalogitem+xml 664 | # application/vnd.iptc.g2.conceptitem+xml 665 | # application/vnd.iptc.g2.knowledgeitem+xml 666 | # application/vnd.iptc.g2.newsitem+xml 667 | # application/vnd.iptc.g2.newsmessage+xml 668 | # application/vnd.iptc.g2.packageitem+xml 669 | # application/vnd.iptc.g2.planningitem+xml 670 | application/vnd.ipunplugged.rcprofile rcprofile 671 | application/vnd.irepository.package+xml irp 672 | application/vnd.is-xpr xpr 673 | application/vnd.isac.fcs fcs 674 | application/vnd.jam jam 675 | # application/vnd.japannet-directory-service 676 | # application/vnd.japannet-jpnstore-wakeup 677 | # application/vnd.japannet-payment-wakeup 678 | # application/vnd.japannet-registration 679 | # application/vnd.japannet-registration-wakeup 680 | # application/vnd.japannet-setstore-wakeup 681 | # application/vnd.japannet-verification 682 | # application/vnd.japannet-verification-wakeup 683 | application/vnd.jcp.javame.midlet-rms rms 684 | application/vnd.jisp jisp 685 | application/vnd.joost.joda-archive joda 686 | # application/vnd.jsk.isdn-ngn 687 | application/vnd.kahootz ktz ktr 688 | application/vnd.kde.karbon karbon 689 | application/vnd.kde.kchart chrt 690 | application/vnd.kde.kformula kfo 691 | application/vnd.kde.kivio flw 692 | application/vnd.kde.kontour kon 693 | application/vnd.kde.kpresenter kpr kpt 694 | application/vnd.kde.kspread ksp 695 | application/vnd.kde.kword kwd kwt 696 | application/vnd.kenameaapp htke 697 | application/vnd.kidspiration kia 698 | application/vnd.kinar kne knp 699 | application/vnd.koan skp skd skt skm 700 | application/vnd.kodak-descriptor sse 701 | application/vnd.las.las+xml lasxml 702 | # application/vnd.liberty-request+xml 703 | application/vnd.llamagraphics.life-balance.desktop lbd 704 | application/vnd.llamagraphics.life-balance.exchange+xml lbe 705 | application/vnd.lotus-1-2-3 123 706 | application/vnd.lotus-approach apr 707 | application/vnd.lotus-freelance pre 708 | application/vnd.lotus-notes nsf 709 | application/vnd.lotus-organizer org 710 | application/vnd.lotus-screencam scm 711 | application/vnd.lotus-wordpro lwp 712 | application/vnd.macports.portpkg portpkg 713 | # application/vnd.mapbox-vector-tile 714 | # application/vnd.marlin.drm.actiontoken+xml 715 | # application/vnd.marlin.drm.conftoken+xml 716 | # application/vnd.marlin.drm.license+xml 717 | # application/vnd.marlin.drm.mdcf 718 | # application/vnd.mason+json 719 | # application/vnd.maxmind.maxmind-db 720 | application/vnd.mcd mcd 721 | application/vnd.medcalcdata mc1 722 | application/vnd.mediastation.cdkey cdkey 723 | # application/vnd.meridian-slingshot 724 | application/vnd.mfer mwf 725 | application/vnd.mfmp mfm 726 | # application/vnd.micro+json 727 | application/vnd.micrografx.flo flo 728 | application/vnd.micrografx.igx igx 729 | # application/vnd.microsoft.portable-executable 730 | # application/vnd.miele+json 731 | application/vnd.mif mif 732 | # application/vnd.minisoft-hp3000-save 733 | # application/vnd.mitsubishi.misty-guard.trustweb 734 | application/vnd.mobius.daf daf 735 | application/vnd.mobius.dis dis 736 | application/vnd.mobius.mbk mbk 737 | application/vnd.mobius.mqy mqy 738 | application/vnd.mobius.msl msl 739 | application/vnd.mobius.plc plc 740 | application/vnd.mobius.txf txf 741 | application/vnd.mophun.application mpn 742 | application/vnd.mophun.certificate mpc 743 | # application/vnd.motorola.flexsuite 744 | # application/vnd.motorola.flexsuite.adsi 745 | # application/vnd.motorola.flexsuite.fis 746 | # application/vnd.motorola.flexsuite.gotap 747 | # application/vnd.motorola.flexsuite.kmr 748 | # application/vnd.motorola.flexsuite.ttc 749 | # application/vnd.motorola.flexsuite.wem 750 | # application/vnd.motorola.iprm 751 | application/vnd.mozilla.xul+xml xul 752 | # application/vnd.ms-3mfdocument 753 | application/vnd.ms-artgalry cil 754 | # application/vnd.ms-asf 755 | application/vnd.ms-cab-compressed cab 756 | # application/vnd.ms-color.iccprofile 757 | application/vnd.ms-excel xls xlm xla xlc xlt xlw 758 | application/vnd.ms-excel.addin.macroenabled.12 xlam 759 | application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb 760 | application/vnd.ms-excel.sheet.macroenabled.12 xlsm 761 | application/vnd.ms-excel.template.macroenabled.12 xltm 762 | application/vnd.ms-fontobject eot 763 | application/vnd.ms-htmlhelp chm 764 | application/vnd.ms-ims ims 765 | application/vnd.ms-lrm lrm 766 | # application/vnd.ms-office.activex+xml 767 | application/vnd.ms-officetheme thmx 768 | # application/vnd.ms-opentype 769 | # application/vnd.ms-package.obfuscated-opentype 770 | application/vnd.ms-pki.seccat cat 771 | application/vnd.ms-pki.stl stl 772 | # application/vnd.ms-playready.initiator+xml 773 | application/vnd.ms-powerpoint ppt pps pot 774 | application/vnd.ms-powerpoint.addin.macroenabled.12 ppam 775 | application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm 776 | application/vnd.ms-powerpoint.slide.macroenabled.12 sldm 777 | application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm 778 | application/vnd.ms-powerpoint.template.macroenabled.12 potm 779 | # application/vnd.ms-printdevicecapabilities+xml 780 | # application/vnd.ms-printing.printticket+xml 781 | # application/vnd.ms-printschematicket+xml 782 | application/vnd.ms-project mpp mpt 783 | # application/vnd.ms-tnef 784 | # application/vnd.ms-windows.devicepairing 785 | # application/vnd.ms-windows.nwprinting.oob 786 | # application/vnd.ms-windows.printerpairing 787 | # application/vnd.ms-windows.wsd.oob 788 | # application/vnd.ms-wmdrm.lic-chlg-req 789 | # application/vnd.ms-wmdrm.lic-resp 790 | # application/vnd.ms-wmdrm.meter-chlg-req 791 | # application/vnd.ms-wmdrm.meter-resp 792 | application/vnd.ms-word.document.macroenabled.12 docm 793 | application/vnd.ms-word.template.macroenabled.12 dotm 794 | application/vnd.ms-works wps wks wcm wdb 795 | application/vnd.ms-wpl wpl 796 | application/vnd.ms-xpsdocument xps 797 | # application/vnd.msa-disk-image 798 | application/vnd.mseq mseq 799 | # application/vnd.msign 800 | # application/vnd.multiad.creator 801 | # application/vnd.multiad.creator.cif 802 | # application/vnd.music-niff 803 | application/vnd.musician mus 804 | application/vnd.muvee.style msty 805 | application/vnd.mynfc taglet 806 | # application/vnd.ncd.control 807 | # application/vnd.ncd.reference 808 | # application/vnd.nervana 809 | # application/vnd.netfpx 810 | application/vnd.neurolanguage.nlu nlu 811 | # application/vnd.nintendo.nitro.rom 812 | # application/vnd.nintendo.snes.rom 813 | application/vnd.nitf ntf nitf 814 | application/vnd.noblenet-directory nnd 815 | application/vnd.noblenet-sealer nns 816 | application/vnd.noblenet-web nnw 817 | # application/vnd.nokia.catalogs 818 | # application/vnd.nokia.conml+wbxml 819 | # application/vnd.nokia.conml+xml 820 | # application/vnd.nokia.iptv.config+xml 821 | # application/vnd.nokia.isds-radio-presets 822 | # application/vnd.nokia.landmark+wbxml 823 | # application/vnd.nokia.landmark+xml 824 | # application/vnd.nokia.landmarkcollection+xml 825 | # application/vnd.nokia.n-gage.ac+xml 826 | application/vnd.nokia.n-gage.data ngdat 827 | application/vnd.nokia.n-gage.symbian.install n-gage 828 | # application/vnd.nokia.ncd 829 | # application/vnd.nokia.pcd+wbxml 830 | # application/vnd.nokia.pcd+xml 831 | application/vnd.nokia.radio-preset rpst 832 | application/vnd.nokia.radio-presets rpss 833 | application/vnd.novadigm.edm edm 834 | application/vnd.novadigm.edx edx 835 | application/vnd.novadigm.ext ext 836 | # application/vnd.ntt-local.content-share 837 | # application/vnd.ntt-local.file-transfer 838 | # application/vnd.ntt-local.ogw_remote-access 839 | # application/vnd.ntt-local.sip-ta_remote 840 | # application/vnd.ntt-local.sip-ta_tcp_stream 841 | application/vnd.oasis.opendocument.chart odc 842 | application/vnd.oasis.opendocument.chart-template otc 843 | application/vnd.oasis.opendocument.database odb 844 | application/vnd.oasis.opendocument.formula odf 845 | application/vnd.oasis.opendocument.formula-template odft 846 | application/vnd.oasis.opendocument.graphics odg 847 | application/vnd.oasis.opendocument.graphics-template otg 848 | application/vnd.oasis.opendocument.image odi 849 | application/vnd.oasis.opendocument.image-template oti 850 | application/vnd.oasis.opendocument.presentation odp 851 | application/vnd.oasis.opendocument.presentation-template otp 852 | application/vnd.oasis.opendocument.spreadsheet ods 853 | application/vnd.oasis.opendocument.spreadsheet-template ots 854 | application/vnd.oasis.opendocument.text odt 855 | application/vnd.oasis.opendocument.text-master odm 856 | application/vnd.oasis.opendocument.text-template ott 857 | application/vnd.oasis.opendocument.text-web oth 858 | # application/vnd.obn 859 | # application/vnd.oftn.l10n+json 860 | # application/vnd.oipf.contentaccessdownload+xml 861 | # application/vnd.oipf.contentaccessstreaming+xml 862 | # application/vnd.oipf.cspg-hexbinary 863 | # application/vnd.oipf.dae.svg+xml 864 | # application/vnd.oipf.dae.xhtml+xml 865 | # application/vnd.oipf.mippvcontrolmessage+xml 866 | # application/vnd.oipf.pae.gem 867 | # application/vnd.oipf.spdiscovery+xml 868 | # application/vnd.oipf.spdlist+xml 869 | # application/vnd.oipf.ueprofile+xml 870 | # application/vnd.oipf.userprofile+xml 871 | application/vnd.olpc-sugar xo 872 | # application/vnd.oma-scws-config 873 | # application/vnd.oma-scws-http-request 874 | # application/vnd.oma-scws-http-response 875 | # application/vnd.oma.bcast.associated-procedure-parameter+xml 876 | # application/vnd.oma.bcast.drm-trigger+xml 877 | # application/vnd.oma.bcast.imd+xml 878 | # application/vnd.oma.bcast.ltkm 879 | # application/vnd.oma.bcast.notification+xml 880 | # application/vnd.oma.bcast.provisioningtrigger 881 | # application/vnd.oma.bcast.sgboot 882 | # application/vnd.oma.bcast.sgdd+xml 883 | # application/vnd.oma.bcast.sgdu 884 | # application/vnd.oma.bcast.simple-symbol-container 885 | # application/vnd.oma.bcast.smartcard-trigger+xml 886 | # application/vnd.oma.bcast.sprov+xml 887 | # application/vnd.oma.bcast.stkm 888 | # application/vnd.oma.cab-address-book+xml 889 | # application/vnd.oma.cab-feature-handler+xml 890 | # application/vnd.oma.cab-pcc+xml 891 | # application/vnd.oma.cab-subs-invite+xml 892 | # application/vnd.oma.cab-user-prefs+xml 893 | # application/vnd.oma.dcd 894 | # application/vnd.oma.dcdc 895 | application/vnd.oma.dd2+xml dd2 896 | # application/vnd.oma.drm.risd+xml 897 | # application/vnd.oma.group-usage-list+xml 898 | # application/vnd.oma.lwm2m+json 899 | # application/vnd.oma.lwm2m+tlv 900 | # application/vnd.oma.pal+xml 901 | # application/vnd.oma.poc.detailed-progress-report+xml 902 | # application/vnd.oma.poc.final-report+xml 903 | # application/vnd.oma.poc.groups+xml 904 | # application/vnd.oma.poc.invocation-descriptor+xml 905 | # application/vnd.oma.poc.optimized-progress-report+xml 906 | # application/vnd.oma.push 907 | # application/vnd.oma.scidm.messages+xml 908 | # application/vnd.oma.xcap-directory+xml 909 | # application/vnd.omads-email+xml 910 | # application/vnd.omads-file+xml 911 | # application/vnd.omads-folder+xml 912 | # application/vnd.omaloc-supl-init 913 | # application/vnd.onepager 914 | # application/vnd.openblox.game+xml 915 | # application/vnd.openblox.game-binary 916 | # application/vnd.openeye.oeb 917 | application/vnd.openofficeorg.extension oxt 918 | # application/vnd.openxmlformats-officedocument.custom-properties+xml 919 | # application/vnd.openxmlformats-officedocument.customxmlproperties+xml 920 | # application/vnd.openxmlformats-officedocument.drawing+xml 921 | # application/vnd.openxmlformats-officedocument.drawingml.chart+xml 922 | # application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml 923 | # application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml 924 | # application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml 925 | # application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml 926 | # application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml 927 | # application/vnd.openxmlformats-officedocument.extended-properties+xml 928 | # application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml 929 | # application/vnd.openxmlformats-officedocument.presentationml.comments+xml 930 | # application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml 931 | # application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml 932 | # application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml 933 | application/vnd.openxmlformats-officedocument.presentationml.presentation pptx 934 | # application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml 935 | # application/vnd.openxmlformats-officedocument.presentationml.presprops+xml 936 | application/vnd.openxmlformats-officedocument.presentationml.slide sldx 937 | # application/vnd.openxmlformats-officedocument.presentationml.slide+xml 938 | # application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml 939 | # application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml 940 | application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx 941 | # application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml 942 | # application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml 943 | # application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml 944 | # application/vnd.openxmlformats-officedocument.presentationml.tags+xml 945 | application/vnd.openxmlformats-officedocument.presentationml.template potx 946 | # application/vnd.openxmlformats-officedocument.presentationml.template.main+xml 947 | # application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml 948 | # application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml 949 | # application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml 950 | # application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml 951 | # application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml 952 | # application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml 953 | # application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml 954 | # application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml 955 | # application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml 956 | # application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml 957 | # application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml 958 | # application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml 959 | # application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml 960 | # application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml 961 | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx 962 | # application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml 963 | # application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml 964 | # application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml 965 | # application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml 966 | # application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml 967 | application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx 968 | # application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml 969 | # application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml 970 | # application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml 971 | # application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml 972 | # application/vnd.openxmlformats-officedocument.theme+xml 973 | # application/vnd.openxmlformats-officedocument.themeoverride+xml 974 | # application/vnd.openxmlformats-officedocument.vmldrawing 975 | # application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml 976 | application/vnd.openxmlformats-officedocument.wordprocessingml.document docx 977 | # application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml 978 | # application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml 979 | # application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml 980 | # application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml 981 | # application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml 982 | # application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml 983 | # application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml 984 | # application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml 985 | # application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml 986 | application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx 987 | # application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml 988 | # application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml 989 | # application/vnd.openxmlformats-package.core-properties+xml 990 | # application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml 991 | # application/vnd.openxmlformats-package.relationships+xml 992 | # application/vnd.oracle.resource+json 993 | # application/vnd.orange.indata 994 | # application/vnd.osa.netdeploy 995 | application/vnd.osgeo.mapguide.package mgp 996 | # application/vnd.osgi.bundle 997 | application/vnd.osgi.dp dp 998 | application/vnd.osgi.subsystem esa 999 | # application/vnd.otps.ct-kip+xml 1000 | # application/vnd.oxli.countgraph 1001 | # application/vnd.pagerduty+json 1002 | application/vnd.palm pdb pqa oprc 1003 | # application/vnd.panoply 1004 | # application/vnd.paos.xml 1005 | application/vnd.pawaafile paw 1006 | # application/vnd.pcos 1007 | application/vnd.pg.format str 1008 | application/vnd.pg.osasli ei6 1009 | # application/vnd.piaccess.application-licence 1010 | application/vnd.picsel efif 1011 | application/vnd.pmi.widget wg 1012 | # application/vnd.poc.group-advertisement+xml 1013 | application/vnd.pocketlearn plf 1014 | application/vnd.powerbuilder6 pbd 1015 | # application/vnd.powerbuilder6-s 1016 | # application/vnd.powerbuilder7 1017 | # application/vnd.powerbuilder7-s 1018 | # application/vnd.powerbuilder75 1019 | # application/vnd.powerbuilder75-s 1020 | # application/vnd.preminet 1021 | application/vnd.previewsystems.box box 1022 | application/vnd.proteus.magazine mgz 1023 | application/vnd.publishare-delta-tree qps 1024 | application/vnd.pvi.ptid1 ptid 1025 | # application/vnd.pwg-multiplexed 1026 | # application/vnd.pwg-xhtml-print+xml 1027 | # application/vnd.qualcomm.brew-app-res 1028 | # application/vnd.quarantainenet 1029 | application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb 1030 | # application/vnd.quobject-quoxdocument 1031 | # application/vnd.radisys.moml+xml 1032 | # application/vnd.radisys.msml+xml 1033 | # application/vnd.radisys.msml-audit+xml 1034 | # application/vnd.radisys.msml-audit-conf+xml 1035 | # application/vnd.radisys.msml-audit-conn+xml 1036 | # application/vnd.radisys.msml-audit-dialog+xml 1037 | # application/vnd.radisys.msml-audit-stream+xml 1038 | # application/vnd.radisys.msml-conf+xml 1039 | # application/vnd.radisys.msml-dialog+xml 1040 | # application/vnd.radisys.msml-dialog-base+xml 1041 | # application/vnd.radisys.msml-dialog-fax-detect+xml 1042 | # application/vnd.radisys.msml-dialog-fax-sendrecv+xml 1043 | # application/vnd.radisys.msml-dialog-group+xml 1044 | # application/vnd.radisys.msml-dialog-speech+xml 1045 | # application/vnd.radisys.msml-dialog-transform+xml 1046 | # application/vnd.rainstor.data 1047 | # application/vnd.rapid 1048 | # application/vnd.rar 1049 | application/vnd.realvnc.bed bed 1050 | application/vnd.recordare.musicxml mxl 1051 | application/vnd.recordare.musicxml+xml musicxml 1052 | # application/vnd.renlearn.rlprint 1053 | application/vnd.rig.cryptonote cryptonote 1054 | application/vnd.rim.cod cod 1055 | application/vnd.rn-realmedia rm 1056 | application/vnd.rn-realmedia-vbr rmvb 1057 | application/vnd.route66.link66+xml link66 1058 | # application/vnd.rs-274x 1059 | # application/vnd.ruckus.download 1060 | # application/vnd.s3sms 1061 | application/vnd.sailingtracker.track st 1062 | # application/vnd.sbm.cid 1063 | # application/vnd.sbm.mid2 1064 | # application/vnd.scribus 1065 | # application/vnd.sealed.3df 1066 | # application/vnd.sealed.csf 1067 | # application/vnd.sealed.doc 1068 | # application/vnd.sealed.eml 1069 | # application/vnd.sealed.mht 1070 | # application/vnd.sealed.net 1071 | # application/vnd.sealed.ppt 1072 | # application/vnd.sealed.tiff 1073 | # application/vnd.sealed.xls 1074 | # application/vnd.sealedmedia.softseal.html 1075 | # application/vnd.sealedmedia.softseal.pdf 1076 | application/vnd.seemail see 1077 | application/vnd.sema sema 1078 | application/vnd.semd semd 1079 | application/vnd.semf semf 1080 | application/vnd.shana.informed.formdata ifm 1081 | application/vnd.shana.informed.formtemplate itp 1082 | application/vnd.shana.informed.interchange iif 1083 | application/vnd.shana.informed.package ipk 1084 | application/vnd.simtech-mindmapper twd twds 1085 | # application/vnd.siren+json 1086 | application/vnd.smaf mmf 1087 | # application/vnd.smart.notebook 1088 | application/vnd.smart.teacher teacher 1089 | # application/vnd.software602.filler.form+xml 1090 | # application/vnd.software602.filler.form-xml-zip 1091 | application/vnd.solent.sdkm+xml sdkm sdkd 1092 | application/vnd.spotfire.dxp dxp 1093 | application/vnd.spotfire.sfs sfs 1094 | # application/vnd.sss-cod 1095 | # application/vnd.sss-dtf 1096 | # application/vnd.sss-ntf 1097 | application/vnd.stardivision.calc sdc 1098 | application/vnd.stardivision.draw sda 1099 | application/vnd.stardivision.impress sdd 1100 | application/vnd.stardivision.math smf 1101 | application/vnd.stardivision.writer sdw vor 1102 | application/vnd.stardivision.writer-global sgl 1103 | application/vnd.stepmania.package smzip 1104 | application/vnd.stepmania.stepchart sm 1105 | # application/vnd.street-stream 1106 | # application/vnd.sun.wadl+xml 1107 | application/vnd.sun.xml.calc sxc 1108 | application/vnd.sun.xml.calc.template stc 1109 | application/vnd.sun.xml.draw sxd 1110 | application/vnd.sun.xml.draw.template std 1111 | application/vnd.sun.xml.impress sxi 1112 | application/vnd.sun.xml.impress.template sti 1113 | application/vnd.sun.xml.math sxm 1114 | application/vnd.sun.xml.writer sxw 1115 | application/vnd.sun.xml.writer.global sxg 1116 | application/vnd.sun.xml.writer.template stw 1117 | application/vnd.sus-calendar sus susp 1118 | application/vnd.svd svd 1119 | # application/vnd.swiftview-ics 1120 | application/vnd.symbian.install sis sisx 1121 | application/vnd.syncml+xml xsm 1122 | application/vnd.syncml.dm+wbxml bdm 1123 | application/vnd.syncml.dm+xml xdm 1124 | # application/vnd.syncml.dm.notification 1125 | # application/vnd.syncml.dmddf+wbxml 1126 | # application/vnd.syncml.dmddf+xml 1127 | # application/vnd.syncml.dmtnds+wbxml 1128 | # application/vnd.syncml.dmtnds+xml 1129 | # application/vnd.syncml.ds.notification 1130 | application/vnd.tao.intent-module-archive tao 1131 | application/vnd.tcpdump.pcap pcap cap dmp 1132 | # application/vnd.tmd.mediaflex.api+xml 1133 | # application/vnd.tml 1134 | application/vnd.tmobile-livetv tmo 1135 | application/vnd.trid.tpt tpt 1136 | application/vnd.triscape.mxs mxs 1137 | application/vnd.trueapp tra 1138 | # application/vnd.truedoc 1139 | # application/vnd.ubisoft.webplayer 1140 | application/vnd.ufdl ufd ufdl 1141 | application/vnd.uiq.theme utz 1142 | application/vnd.umajin umj 1143 | application/vnd.unity unityweb 1144 | application/vnd.uoml+xml uoml 1145 | # application/vnd.uplanet.alert 1146 | # application/vnd.uplanet.alert-wbxml 1147 | # application/vnd.uplanet.bearer-choice 1148 | # application/vnd.uplanet.bearer-choice-wbxml 1149 | # application/vnd.uplanet.cacheop 1150 | # application/vnd.uplanet.cacheop-wbxml 1151 | # application/vnd.uplanet.channel 1152 | # application/vnd.uplanet.channel-wbxml 1153 | # application/vnd.uplanet.list 1154 | # application/vnd.uplanet.list-wbxml 1155 | # application/vnd.uplanet.listcmd 1156 | # application/vnd.uplanet.listcmd-wbxml 1157 | # application/vnd.uplanet.signal 1158 | # application/vnd.uri-map 1159 | # application/vnd.valve.source.material 1160 | application/vnd.vcx vcx 1161 | # application/vnd.vd-study 1162 | # application/vnd.vectorworks 1163 | # application/vnd.vel+json 1164 | # application/vnd.verimatrix.vcas 1165 | # application/vnd.vidsoft.vidconference 1166 | application/vnd.visio vsd vst vss vsw 1167 | application/vnd.visionary vis 1168 | # application/vnd.vividence.scriptfile 1169 | application/vnd.vsf vsf 1170 | # application/vnd.wap.sic 1171 | # application/vnd.wap.slc 1172 | application/vnd.wap.wbxml wbxml 1173 | application/vnd.wap.wmlc wmlc 1174 | application/vnd.wap.wmlscriptc wmlsc 1175 | application/vnd.webturbo wtb 1176 | # application/vnd.wfa.p2p 1177 | # application/vnd.wfa.wsc 1178 | # application/vnd.windows.devicepairing 1179 | # application/vnd.wmc 1180 | # application/vnd.wmf.bootstrap 1181 | # application/vnd.wolfram.mathematica 1182 | # application/vnd.wolfram.mathematica.package 1183 | application/vnd.wolfram.player nbp 1184 | application/vnd.wordperfect wpd 1185 | application/vnd.wqd wqd 1186 | # application/vnd.wrq-hp3000-labelled 1187 | application/vnd.wt.stf stf 1188 | # application/vnd.wv.csp+wbxml 1189 | # application/vnd.wv.csp+xml 1190 | # application/vnd.wv.ssp+xml 1191 | # application/vnd.xacml+json 1192 | application/vnd.xara xar 1193 | application/vnd.xfdl xfdl 1194 | # application/vnd.xfdl.webform 1195 | # application/vnd.xmi+xml 1196 | # application/vnd.xmpie.cpkg 1197 | # application/vnd.xmpie.dpkg 1198 | # application/vnd.xmpie.plan 1199 | # application/vnd.xmpie.ppkg 1200 | # application/vnd.xmpie.xlim 1201 | application/vnd.yamaha.hv-dic hvd 1202 | application/vnd.yamaha.hv-script hvs 1203 | application/vnd.yamaha.hv-voice hvp 1204 | application/vnd.yamaha.openscoreformat osf 1205 | application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg 1206 | # application/vnd.yamaha.remote-setup 1207 | application/vnd.yamaha.smaf-audio saf 1208 | application/vnd.yamaha.smaf-phrase spf 1209 | # application/vnd.yamaha.through-ngn 1210 | # application/vnd.yamaha.tunnel-udpencap 1211 | # application/vnd.yaoweme 1212 | application/vnd.yellowriver-custom-menu cmp 1213 | application/vnd.zul zir zirz 1214 | application/vnd.zzazz.deck+xml zaz 1215 | application/voicexml+xml vxml 1216 | # application/vq-rtcpxr 1217 | # application/watcherinfo+xml 1218 | # application/whoispp-query 1219 | # application/whoispp-response 1220 | application/widget wgt 1221 | application/winhlp hlp 1222 | # application/wita 1223 | # application/wordperfect5.1 1224 | application/wsdl+xml wsdl 1225 | application/wspolicy+xml wspolicy 1226 | application/x-7z-compressed 7z 1227 | application/x-abiword abw 1228 | application/x-ace-compressed ace 1229 | # application/x-amf 1230 | application/x-apple-diskimage dmg 1231 | application/x-authorware-bin aab x32 u32 vox 1232 | application/x-authorware-map aam 1233 | application/x-authorware-seg aas 1234 | application/x-bcpio bcpio 1235 | application/x-bittorrent torrent 1236 | application/x-blorb blb blorb 1237 | application/x-bzip bz 1238 | application/x-bzip2 bz2 boz 1239 | application/x-cbr cbr cba cbt cbz cb7 1240 | application/x-cdlink vcd 1241 | application/x-cfs-compressed cfs 1242 | application/x-chat chat 1243 | application/x-chess-pgn pgn 1244 | # application/x-compress 1245 | application/x-conference nsc 1246 | application/x-cpio cpio 1247 | application/x-csh csh 1248 | application/x-debian-package deb udeb 1249 | application/x-dgc-compressed dgc 1250 | application/x-director dir dcr dxr cst cct cxt w3d fgd swa 1251 | application/x-doom wad 1252 | application/x-dtbncx+xml ncx 1253 | application/x-dtbook+xml dtb 1254 | application/x-dtbresource+xml res 1255 | application/x-dvi dvi 1256 | application/x-envoy evy 1257 | application/x-eva eva 1258 | application/x-font-bdf bdf 1259 | # application/x-font-dos 1260 | # application/x-font-framemaker 1261 | application/x-font-ghostscript gsf 1262 | # application/x-font-libgrx 1263 | application/x-font-linux-psf psf 1264 | application/x-font-otf otf 1265 | application/x-font-pcf pcf 1266 | application/x-font-snf snf 1267 | # application/x-font-speedo 1268 | # application/x-font-sunos-news 1269 | application/x-font-ttf ttf ttc 1270 | application/x-font-type1 pfa pfb pfm afm 1271 | # application/x-font-vfont 1272 | application/x-freearc arc 1273 | application/x-futuresplash spl 1274 | application/x-gca-compressed gca 1275 | application/x-glulx ulx 1276 | application/x-gnumeric gnumeric 1277 | application/x-gramps-xml gramps 1278 | application/x-gtar gtar 1279 | # application/x-gzip 1280 | application/x-hdf hdf 1281 | application/x-install-instructions install 1282 | application/x-iso9660-image iso 1283 | application/x-java-jnlp-file jnlp 1284 | application/x-latex latex 1285 | application/x-lzh-compressed lzh lha 1286 | application/x-mie mie 1287 | application/x-mobipocket-ebook prc mobi 1288 | application/x-mpegurl m3u8 1289 | application/x-ms-application application 1290 | application/x-ms-shortcut lnk 1291 | application/x-ms-wmd wmd 1292 | application/x-ms-wmz wmz 1293 | application/x-ms-xbap xbap 1294 | application/x-msaccess mdb 1295 | application/x-msbinder obd 1296 | application/x-mscardfile crd 1297 | application/x-msclip clp 1298 | application/x-msdownload exe dll com bat msi 1299 | application/x-msmediaview mvb m13 m14 1300 | application/x-msmetafile wmf wmz emf emz 1301 | application/x-msmoney mny 1302 | application/x-mspublisher pub 1303 | application/x-msschedule scd 1304 | application/x-msterminal trm 1305 | application/x-mswrite wri 1306 | application/x-netcdf nc cdf 1307 | application/x-nzb nzb 1308 | application/x-pkcs12 p12 pfx 1309 | application/x-pkcs7-certificates p7b spc 1310 | application/x-pkcs7-certreqresp p7r 1311 | application/x-rar-compressed rar 1312 | application/x-research-info-systems ris 1313 | application/x-sh sh 1314 | application/x-shar shar 1315 | application/x-shockwave-flash swf 1316 | application/x-silverlight-app xap 1317 | application/x-sql sql 1318 | application/x-stuffit sit 1319 | application/x-stuffitx sitx 1320 | application/x-subrip srt 1321 | application/x-sv4cpio sv4cpio 1322 | application/x-sv4crc sv4crc 1323 | application/x-t3vm-image t3 1324 | application/x-tads gam 1325 | application/x-tar tar 1326 | application/x-tcl tcl 1327 | application/x-tex tex 1328 | application/x-tex-tfm tfm 1329 | application/x-texinfo texinfo texi 1330 | application/x-tgif obj 1331 | application/x-ustar ustar 1332 | application/x-wais-source src 1333 | # application/x-www-form-urlencoded 1334 | application/x-x509-ca-cert der crt 1335 | application/x-xfig fig 1336 | application/x-xliff+xml xlf 1337 | application/x-xpinstall xpi 1338 | application/x-xz xz 1339 | application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 1340 | # application/x400-bp 1341 | # application/xacml+xml 1342 | application/xaml+xml xaml 1343 | # application/xcap-att+xml 1344 | # application/xcap-caps+xml 1345 | application/xcap-diff+xml xdf 1346 | # application/xcap-el+xml 1347 | # application/xcap-error+xml 1348 | # application/xcap-ns+xml 1349 | # application/xcon-conference-info+xml 1350 | # application/xcon-conference-info-diff+xml 1351 | application/xenc+xml xenc 1352 | application/xhtml+xml xhtml xht 1353 | # application/xhtml-voice+xml 1354 | application/xml xml xsl 1355 | application/xml-dtd dtd 1356 | # application/xml-external-parsed-entity 1357 | # application/xml-patch+xml 1358 | # application/xmpp+xml 1359 | application/xop+xml xop 1360 | application/xproc+xml xpl 1361 | application/xslt+xml xslt 1362 | application/xspf+xml xspf 1363 | application/xv+xml mxml xhvml xvml xvm 1364 | application/yang yang 1365 | application/yin+xml yin 1366 | application/zip zip 1367 | # application/zlib 1368 | # audio/1d-interleaved-parityfec 1369 | # audio/32kadpcm 1370 | # audio/3gpp 1371 | # audio/3gpp2 1372 | # audio/ac3 1373 | audio/adpcm adp 1374 | # audio/amr 1375 | # audio/amr-wb 1376 | # audio/amr-wb+ 1377 | # audio/aptx 1378 | # audio/asc 1379 | # audio/atrac-advanced-lossless 1380 | # audio/atrac-x 1381 | # audio/atrac3 1382 | audio/basic au snd 1383 | # audio/bv16 1384 | # audio/bv32 1385 | # audio/clearmode 1386 | # audio/cn 1387 | # audio/dat12 1388 | # audio/dls 1389 | # audio/dsr-es201108 1390 | # audio/dsr-es202050 1391 | # audio/dsr-es202211 1392 | # audio/dsr-es202212 1393 | # audio/dv 1394 | # audio/dvi4 1395 | # audio/eac3 1396 | # audio/encaprtp 1397 | # audio/evrc 1398 | # audio/evrc-qcp 1399 | # audio/evrc0 1400 | # audio/evrc1 1401 | # audio/evrcb 1402 | # audio/evrcb0 1403 | # audio/evrcb1 1404 | # audio/evrcnw 1405 | # audio/evrcnw0 1406 | # audio/evrcnw1 1407 | # audio/evrcwb 1408 | # audio/evrcwb0 1409 | # audio/evrcwb1 1410 | # audio/evs 1411 | # audio/example 1412 | # audio/fwdred 1413 | # audio/g711-0 1414 | # audio/g719 1415 | # audio/g722 1416 | # audio/g7221 1417 | # audio/g723 1418 | # audio/g726-16 1419 | # audio/g726-24 1420 | # audio/g726-32 1421 | # audio/g726-40 1422 | # audio/g728 1423 | # audio/g729 1424 | # audio/g7291 1425 | # audio/g729d 1426 | # audio/g729e 1427 | # audio/gsm 1428 | # audio/gsm-efr 1429 | # audio/gsm-hr-08 1430 | # audio/ilbc 1431 | # audio/ip-mr_v2.5 1432 | # audio/isac 1433 | # audio/l16 1434 | # audio/l20 1435 | # audio/l24 1436 | # audio/l8 1437 | # audio/lpc 1438 | audio/midi mid midi kar rmi 1439 | # audio/mobile-xmf 1440 | audio/mp4 m4a mp4a 1441 | # audio/mp4a-latm 1442 | audio/mp4a-latm m4a m4p 1443 | # audio/mpa 1444 | # audio/mpa-robust 1445 | audio/mpeg mpga mp2 mp2a mp3 m2a m3a 1446 | # audio/mpeg4-generic 1447 | # audio/musepack 1448 | audio/ogg oga ogg spx 1449 | # audio/opus 1450 | # audio/parityfec 1451 | # audio/pcma 1452 | # audio/pcma-wb 1453 | # audio/pcmu 1454 | # audio/pcmu-wb 1455 | # audio/prs.sid 1456 | # audio/qcelp 1457 | # audio/raptorfec 1458 | # audio/red 1459 | # audio/rtp-enc-aescm128 1460 | # audio/rtp-midi 1461 | # audio/rtploopback 1462 | # audio/rtx 1463 | audio/s3m s3m 1464 | audio/silk sil 1465 | # audio/smv 1466 | # audio/smv-qcp 1467 | # audio/smv0 1468 | # audio/sp-midi 1469 | # audio/speex 1470 | # audio/t140c 1471 | # audio/t38 1472 | # audio/telephone-event 1473 | # audio/tone 1474 | # audio/uemclip 1475 | # audio/ulpfec 1476 | # audio/vdvi 1477 | # audio/vmr-wb 1478 | # audio/vnd.3gpp.iufp 1479 | # audio/vnd.4sb 1480 | # audio/vnd.audiokoz 1481 | # audio/vnd.celp 1482 | # audio/vnd.cisco.nse 1483 | # audio/vnd.cmles.radio-events 1484 | # audio/vnd.cns.anp1 1485 | # audio/vnd.cns.inf1 1486 | audio/vnd.dece.audio uva uvva 1487 | audio/vnd.digital-winds eol 1488 | # audio/vnd.dlna.adts 1489 | # audio/vnd.dolby.heaac.1 1490 | # audio/vnd.dolby.heaac.2 1491 | # audio/vnd.dolby.mlp 1492 | # audio/vnd.dolby.mps 1493 | # audio/vnd.dolby.pl2 1494 | # audio/vnd.dolby.pl2x 1495 | # audio/vnd.dolby.pl2z 1496 | # audio/vnd.dolby.pulse.1 1497 | audio/vnd.dra dra 1498 | audio/vnd.dts dts 1499 | audio/vnd.dts.hd dtshd 1500 | # audio/vnd.dvb.file 1501 | # audio/vnd.everad.plj 1502 | # audio/vnd.hns.audio 1503 | audio/vnd.lucent.voice lvp 1504 | audio/vnd.ms-playready.media.pya pya 1505 | # audio/vnd.nokia.mobile-xmf 1506 | # audio/vnd.nortel.vbk 1507 | audio/vnd.nuera.ecelp4800 ecelp4800 1508 | audio/vnd.nuera.ecelp7470 ecelp7470 1509 | audio/vnd.nuera.ecelp9600 ecelp9600 1510 | # audio/vnd.octel.sbc 1511 | # audio/vnd.qcelp 1512 | # audio/vnd.rhetorex.32kadpcm 1513 | audio/vnd.rip rip 1514 | # audio/vnd.sealedmedia.softseal.mpeg 1515 | # audio/vnd.vmx.cvsd 1516 | # audio/vorbis 1517 | # audio/vorbis-config 1518 | audio/webm weba 1519 | audio/x-aac aac 1520 | audio/x-aiff aif aiff aifc 1521 | audio/x-caf caf 1522 | audio/x-flac flac 1523 | audio/x-matroska mka 1524 | audio/x-mpegurl m3u 1525 | audio/x-ms-wax wax 1526 | audio/x-ms-wma wma 1527 | audio/x-pn-realaudio ram ra 1528 | audio/x-pn-realaudio-plugin rmp 1529 | # audio/x-tta 1530 | audio/x-wav wav 1531 | audio/xm xm 1532 | chemical/x-cdx cdx 1533 | chemical/x-cif cif 1534 | chemical/x-cmdf cmdf 1535 | chemical/x-cml cml 1536 | chemical/x-csml csml 1537 | # chemical/x-pdb 1538 | chemical/x-xyz xyz 1539 | image/bmp bmp 1540 | image/cgm cgm 1541 | # image/dicom-rle 1542 | # image/emf 1543 | # image/example 1544 | # image/fits 1545 | image/g3fax g3 1546 | image/gif gif 1547 | image/ief ief 1548 | # image/jls 1549 | # image/jp2 1550 | image/jp2 jp2 1551 | image/jpeg jpeg jpg jpe 1552 | # image/jpm 1553 | # image/jpx 1554 | image/ktx ktx 1555 | # image/naplps 1556 | image/pict pict pic pct 1557 | image/png png 1558 | image/prs.btif btif 1559 | # image/prs.pti 1560 | # image/pwg-raster 1561 | image/sgi sgi 1562 | image/svg+xml svg svgz 1563 | # image/t38 1564 | image/tiff tiff tif 1565 | # image/tiff-fx 1566 | image/vnd.adobe.photoshop psd 1567 | # image/vnd.airzip.accelerator.azv 1568 | # image/vnd.cns.inf2 1569 | image/vnd.dece.graphic uvi uvvi uvg uvvg 1570 | image/vnd.djvu djvu djv 1571 | image/vnd.dvb.subtitle sub 1572 | image/vnd.dwg dwg 1573 | image/vnd.dxf dxf 1574 | image/vnd.fastbidsheet fbs 1575 | image/vnd.fpx fpx 1576 | image/vnd.fst fst 1577 | image/vnd.fujixerox.edmics-mmr mmr 1578 | image/vnd.fujixerox.edmics-rlc rlc 1579 | # image/vnd.globalgraphics.pgb 1580 | # image/vnd.microsoft.icon 1581 | # image/vnd.mix 1582 | # image/vnd.mozilla.apng 1583 | image/vnd.ms-modi mdi 1584 | image/vnd.ms-photo wdp 1585 | image/vnd.net-fpx npx 1586 | # image/vnd.radiance 1587 | # image/vnd.sealed.png 1588 | # image/vnd.sealedmedia.softseal.gif 1589 | # image/vnd.sealedmedia.softseal.jpg 1590 | # image/vnd.svf 1591 | # image/vnd.tencent.tap 1592 | # image/vnd.valve.source.texture 1593 | image/vnd.wap.wbmp wbmp 1594 | image/vnd.xiff xif 1595 | # image/vnd.zbrush.pcx 1596 | image/webp webp 1597 | # image/wmf 1598 | image/x-3ds 3ds 1599 | image/x-cmu-raster ras 1600 | image/x-cmx cmx 1601 | image/x-freehand fh fhc fh4 fh5 fh7 1602 | image/x-icon ico 1603 | image/x-macpaint pntg pnt mac 1604 | image/x-mrsid-image sid 1605 | image/x-pcx pcx 1606 | image/x-pict pic pct 1607 | image/x-portable-anymap pnm 1608 | image/x-portable-bitmap pbm 1609 | image/x-portable-graymap pgm 1610 | image/x-portable-pixmap ppm 1611 | image/x-quicktime qtif qti 1612 | image/x-rgb rgb 1613 | image/x-tga tga 1614 | image/x-xbitmap xbm 1615 | image/x-xpixmap xpm 1616 | image/x-xwindowdump xwd 1617 | # message/cpim 1618 | # message/delivery-status 1619 | # message/disposition-notification 1620 | # message/example 1621 | # message/external-body 1622 | # message/feedback-report 1623 | # message/global 1624 | # message/global-delivery-status 1625 | # message/global-disposition-notification 1626 | # message/global-headers 1627 | # message/http 1628 | # message/imdn+xml 1629 | # message/news 1630 | # message/partial 1631 | message/rfc822 eml mime 1632 | # message/s-http 1633 | # message/sip 1634 | # message/sipfrag 1635 | # message/tracking-status 1636 | # message/vnd.si.simp 1637 | # message/vnd.wfa.wsc 1638 | # model/example 1639 | # model/gltf+json 1640 | model/iges igs iges 1641 | model/mesh msh mesh silo 1642 | model/vnd.collada+xml dae 1643 | model/vnd.dwf dwf 1644 | # model/vnd.flatland.3dml 1645 | model/vnd.gdl gdl 1646 | # model/vnd.gs-gdl 1647 | # model/vnd.gs.gdl 1648 | model/vnd.gtw gtw 1649 | # model/vnd.moml+xml 1650 | model/vnd.mts mts 1651 | # model/vnd.opengex 1652 | # model/vnd.parasolid.transmit.binary 1653 | # model/vnd.parasolid.transmit.text 1654 | # model/vnd.rosette.annotated-data-model 1655 | # model/vnd.valve.source.compiled-map 1656 | model/vnd.vtu vtu 1657 | model/vrml wrl vrml 1658 | model/x3d+binary x3db x3dbz 1659 | # model/x3d+fastinfoset 1660 | model/x3d+vrml x3dv x3dvz 1661 | model/x3d+xml x3d x3dz 1662 | # model/x3d-vrml 1663 | # multipart/alternative 1664 | # multipart/appledouble 1665 | # multipart/byteranges 1666 | # multipart/digest 1667 | # multipart/encrypted 1668 | # multipart/example 1669 | # multipart/form-data 1670 | # multipart/header-set 1671 | # multipart/mixed 1672 | # multipart/parallel 1673 | # multipart/related 1674 | # multipart/report 1675 | # multipart/signed 1676 | # multipart/voice-message 1677 | # multipart/x-mixed-replace 1678 | text/cache-manifest manifest 1679 | # text/1d-interleaved-parityfec 1680 | text/cache-manifest appcache 1681 | text/calendar ics ifb 1682 | text/css css 1683 | text/csv csv 1684 | # text/csv-schema 1685 | # text/directory 1686 | # text/dns 1687 | # text/ecmascript 1688 | # text/encaprtp 1689 | # text/enriched 1690 | # text/example 1691 | # text/fwdred 1692 | # text/grammar-ref-list 1693 | text/html html htm 1694 | # text/javascript 1695 | # text/jcr-cnd 1696 | # text/markdown 1697 | # text/mizar 1698 | text/n3 n3 1699 | # text/parameters 1700 | # text/parityfec 1701 | text/plain txt text conf def list log in 1702 | # text/provenance-notation 1703 | # text/prs.fallenstein.rst 1704 | text/prs.lines.tag dsc 1705 | # text/prs.prop.logic 1706 | # text/raptorfec 1707 | # text/red 1708 | # text/rfc822-headers 1709 | text/richtext rtx 1710 | # text/rtf 1711 | # text/rtp-enc-aescm128 1712 | # text/rtploopback 1713 | # text/rtx 1714 | text/sgml sgml sgm 1715 | # text/t140 1716 | text/tab-separated-values tsv 1717 | text/troff t tr roff man me ms 1718 | text/turtle ttl 1719 | # text/ulpfec 1720 | text/uri-list uri uris urls 1721 | text/vcard vcard 1722 | # text/vnd.a 1723 | # text/vnd.abc 1724 | text/vnd.curl curl 1725 | text/vnd.curl.dcurl dcurl 1726 | text/vnd.curl.mcurl mcurl 1727 | text/vnd.curl.scurl scurl 1728 | # text/vnd.debian.copyright 1729 | # text/vnd.dmclientscript 1730 | text/vnd.dvb.subtitle sub 1731 | # text/vnd.esmertec.theme-descriptor 1732 | text/vnd.fly fly 1733 | text/vnd.fmi.flexstor flx 1734 | text/vnd.graphviz gv 1735 | text/vnd.in3d.3dml 3dml 1736 | text/vnd.in3d.spot spot 1737 | # text/vnd.iptc.newsml 1738 | # text/vnd.iptc.nitf 1739 | # text/vnd.latex-z 1740 | # text/vnd.motorola.reflex 1741 | # text/vnd.ms-mediapackage 1742 | # text/vnd.net2phone.commcenter.command 1743 | # text/vnd.radisys.msml-basic-layout 1744 | # text/vnd.si.uricatalogue 1745 | text/vnd.sun.j2me.app-descriptor jad 1746 | # text/vnd.trolltech.linguist 1747 | # text/vnd.wap.si 1748 | # text/vnd.wap.sl 1749 | text/vnd.wap.wml wml 1750 | text/vnd.wap.wmlscript wmls 1751 | text/x-asm s asm 1752 | text/x-c c cc cxx cpp h hh dic 1753 | text/x-fortran f for f77 f90 1754 | text/x-java-source java 1755 | text/x-nfo nfo 1756 | text/x-opml opml 1757 | text/x-pascal p pas 1758 | text/x-setext etx 1759 | text/x-sfv sfv 1760 | text/x-uuencode uu 1761 | text/x-vcalendar vcs 1762 | text/x-vcard vcf 1763 | # text/xml 1764 | # text/xml-external-parsed-entity 1765 | # video/1d-interleaved-parityfec 1766 | video/3gpp 3gp 1767 | # video/3gpp-tt 1768 | video/3gpp2 3g2 1769 | # video/bmpeg 1770 | # video/bt656 1771 | # video/celb 1772 | # video/dv 1773 | # video/encaprtp 1774 | # video/example 1775 | video/h261 h261 1776 | video/h263 h263 1777 | # video/h263-1998 1778 | # video/h263-2000 1779 | video/h264 h264 1780 | # video/h264-rcdo 1781 | # video/h264-svc 1782 | # video/h265 1783 | # video/iso.segment 1784 | video/jpeg jpgv 1785 | # video/jpeg2000 1786 | video/jpm jpm jpgm 1787 | video/mj2 mj2 mjp2 1788 | # video/mp1s 1789 | # video/mp2p 1790 | # video/mp4v-es 1791 | video/mp2t ts 1792 | video/mp4 mp4 mp4v mpg4 m4v 1793 | video/mpeg mpeg mpg mpe m1v m2v 1794 | # video/mpeg4-generic 1795 | # video/mpv 1796 | # video/nv 1797 | video/ogg ogv 1798 | # video/parityfec 1799 | # video/pointer 1800 | video/quicktime qt mov 1801 | # video/raptorfec 1802 | # video/raw 1803 | # video/rtp-enc-aescm128 1804 | # video/rtploopback 1805 | # video/rtx 1806 | # video/smpte292m 1807 | # video/ulpfec 1808 | # video/vc1 1809 | # video/vnd.cctv 1810 | video/vnd.dece.hd uvh uvvh 1811 | video/vnd.dece.mobile uvm uvvm 1812 | # video/vnd.dece.mp4 1813 | video/vnd.dece.pd uvp uvvp 1814 | video/vnd.dece.sd uvs uvvs 1815 | video/vnd.dece.video uvv uvvv 1816 | # video/vnd.directv.mpeg 1817 | # video/vnd.directv.mpeg-tts 1818 | # video/vnd.dlna.mpeg-tts 1819 | video/vnd.dvb.file dvb 1820 | video/vnd.fvt fvt 1821 | # video/vnd.hns.video 1822 | # video/vnd.iptvforum.1dparityfec-1010 1823 | # video/vnd.iptvforum.1dparityfec-2005 1824 | # video/vnd.iptvforum.2dparityfec-1010 1825 | # video/vnd.iptvforum.2dparityfec-2005 1826 | # video/vnd.iptvforum.ttsavc 1827 | # video/vnd.iptvforum.ttsmpeg2 1828 | # video/vnd.motorola.video 1829 | # video/vnd.motorola.videop 1830 | video/vnd.mpegurl mxu m4u 1831 | video/vnd.ms-playready.media.pyv pyv 1832 | # video/vnd.nokia.interleaved-multimedia 1833 | # video/vnd.nokia.videovoip 1834 | # video/vnd.objectvideo 1835 | # video/vnd.radgamettools.bink 1836 | # video/vnd.radgamettools.smacker 1837 | # video/vnd.sealed.mpeg1 1838 | # video/vnd.sealed.mpeg4 1839 | # video/vnd.sealed.swf 1840 | # video/vnd.sealedmedia.softseal.mov 1841 | video/vnd.uvvu.mp4 uvu uvvu 1842 | video/vnd.vivo viv 1843 | # video/vp8 1844 | video/x-dv dv dif 1845 | video/webm webm 1846 | video/x-f4v f4v 1847 | video/x-fli fli 1848 | video/x-flv flv 1849 | video/x-m4v m4v 1850 | video/x-matroska mkv mk3d mks 1851 | video/x-mng mng 1852 | video/x-ms-asf asf asx 1853 | video/x-ms-vob vob 1854 | video/x-ms-wm wm 1855 | video/x-ms-wmv wmv 1856 | video/x-ms-wmx wmx 1857 | video/x-ms-wvx wvx 1858 | video/x-msvideo avi 1859 | video/x-sgi-movie movie 1860 | video/x-smv smv 1861 | x-conference/x-cooltalk ice 1862 | -------------------------------------------------------------------------------- /src/fileserver.go: -------------------------------------------------------------------------------- 1 | package fileserver 2 | 3 | import ( 4 | "github.com/c9s/gomon/logger" 5 | 6 | "encoding/json" 7 | "github.com/gorilla/mux" 8 | "io" 9 | "io/ioutil" 10 | "mime" 11 | "net/http" 12 | "os" 13 | "path" 14 | ) 15 | 16 | const root = "/workspace" 17 | 18 | type FileContent struct { 19 | Name string `json:"name"` 20 | Ext string `json:"ext"` 21 | Type string `json:"type"` 22 | Content []byte `json:"content"` 23 | } 24 | 25 | func writeError(w http.ResponseWriter, err error, code int) { 26 | w.WriteHeader(code) 27 | w.Write([]byte(err.Error())) 28 | } 29 | 30 | func GetRemoveFileHandler(root string) func(w http.ResponseWriter, r *http.Request) { 31 | return func(w http.ResponseWriter, r *http.Request) { 32 | RemoveFileHandler(root, w, r) 33 | } 34 | } 35 | 36 | func GetWriteFileHandler(root string) func(w http.ResponseWriter, r *http.Request) { 37 | return func(w http.ResponseWriter, r *http.Request) { 38 | WriteFileHandler(root, w, r) 39 | } 40 | } 41 | 42 | func GetReadFileHandler(root string) func(w http.ResponseWriter, r *http.Request) { 43 | return func(w http.ResponseWriter, r *http.Request) { 44 | ReadFileHandler(root, w, r) 45 | } 46 | } 47 | 48 | func GetScanDirHandler(root string) func(w http.ResponseWriter, r *http.Request) { 49 | return func(w http.ResponseWriter, r *http.Request) { 50 | ScanDirHandler(root, w, r) 51 | } 52 | } 53 | 54 | func GetDownloadFileHandler(root string) func(w http.ResponseWriter, r *http.Request) { 55 | return func(w http.ResponseWriter, r *http.Request) { 56 | DownloadFileHandler(root, w, r) 57 | } 58 | } 59 | 60 | func RemoveFileHandler(root string, w http.ResponseWriter, r *http.Request) { 61 | values := mux.Vars(r) 62 | p := path.Join(root, values["path"]) 63 | 64 | if err := os.RemoveAll(p); err != nil { 65 | logger.Errorf("remove error: %v", err) 66 | writeError(w, err, http.StatusInternalServerError) 67 | return 68 | } 69 | 70 | w.WriteHeader(http.StatusOK) 71 | } 72 | func WriteFileHandler(root string, w http.ResponseWriter, r *http.Request) { 73 | values := mux.Vars(r) 74 | 75 | p := path.Join(root, values["path"]) 76 | 77 | file, header, err := r.FormFile("file") 78 | if err != nil { 79 | logger.Errorf("Get the file information fail: %v", err) 80 | writeError(w, err, http.StatusInternalServerError) 81 | return 82 | } 83 | defer file.Close() 84 | 85 | filePath := p + "/" + header.Filename 86 | fileHandler, err := os.Create(filePath) 87 | defer fileHandler.Close() 88 | if _, err := io.Copy(fileHandler, file); err != nil { 89 | logger.Errorf("write error: %v", err) 90 | writeError(w, err, http.StatusInternalServerError) 91 | return 92 | } 93 | w.WriteHeader(http.StatusOK) 94 | } 95 | 96 | func ReadFileHandler(root string, w http.ResponseWriter, r *http.Request) { 97 | values := mux.Vars(r) 98 | p := path.Join(root, values["path"]) 99 | 100 | bytes, err := ioutil.ReadFile(p) 101 | if err != nil { 102 | logger.Errorf("read error: %v", err) 103 | writeError(w, err, http.StatusNotFound) 104 | return 105 | } 106 | 107 | response, err := json.Marshal(FileContent{ 108 | Name: path.Base(p), 109 | Ext: path.Ext(p), 110 | Type: mime.TypeByExtension(path.Ext(p)), 111 | Content: bytes, 112 | }) 113 | w.Header().Set("Content-Type", "text/json") 114 | w.WriteHeader(http.StatusOK) 115 | w.Write(response) 116 | } 117 | 118 | func ScanDirHandler(root string, w http.ResponseWriter, r *http.Request) { 119 | values := mux.Vars(r) 120 | p := root 121 | if subPath, ok := values["path"]; ok { 122 | p = path.Join(root, subPath) 123 | } 124 | 125 | //default behavior is ignore the hidden files 126 | excludePattern := []string{"^\\."} 127 | query := New(r.URL.Query()) 128 | if value, ok := query.Str("hidden"); ok { 129 | // 1 means we want to show the hidden files, so don't set any excludePattern here 130 | if value == "1" { 131 | excludePattern = []string{} 132 | } 133 | } 134 | 135 | infos, err := ScanDir(p, excludePattern) 136 | if err != nil { 137 | logger.Errorf("scan dir error: %v", err) 138 | writeError(w, err, http.StatusNotFound) 139 | return 140 | } 141 | 142 | response, err := json.Marshal(infos) 143 | if err != nil { 144 | logger.Errorf("json error: %v", err) 145 | writeError(w, err, http.StatusInternalServerError) 146 | return 147 | } 148 | w.Header().Set("Content-Type", "application/json") 149 | w.WriteHeader(http.StatusOK) 150 | w.Write(response) 151 | } 152 | 153 | func DownloadFileHandler(root string, w http.ResponseWriter, r *http.Request) { 154 | values := mux.Vars(r) 155 | p := path.Join(root, values["path"]) 156 | 157 | outfile, err := os.OpenFile(p, os.O_RDONLY, 0x0444) 158 | if nil != err { 159 | logger.Errorf("Open file fail: %v", err) 160 | writeError(w, err, http.StatusNotFound) 161 | return 162 | } 163 | 164 | // 32k buffer copy 165 | written, err := io.Copy(w, outfile) 166 | if nil != err { 167 | logger.Errorf("Copy file fail: %v", err) 168 | writeError(w, err, http.StatusInternalServerError) 169 | return 170 | } 171 | 172 | logger.Info("Downlaod file", outfile.Name(), " lenght", written) 173 | w.Header().Set("Content-Type", mime.TypeByExtension(path.Ext(p))) 174 | w.WriteHeader(http.StatusOK) 175 | } 176 | -------------------------------------------------------------------------------- /src/fileserver_test.go: -------------------------------------------------------------------------------- 1 | package fileserver 2 | 3 | import ( 4 | "bytes" 5 | "encoding/json" 6 | "io/ioutil" 7 | "mime" 8 | "mime/multipart" 9 | "net/http" 10 | "net/http/httptest" 11 | "os" 12 | "testing" 13 | 14 | "github.com/gorilla/mux" 15 | "github.com/stretchr/testify/assert" 16 | ) 17 | 18 | const invalidDir = "/invalidpath/ignore/me" 19 | 20 | func newRouterServer() http.Handler { 21 | router := mux.NewRouter() 22 | 23 | root := "/" 24 | router.HandleFunc("/scan/{path:.*}", GetScanDirHandler(root)).Methods("GET") 25 | router.HandleFunc("/scan", GetScanDirHandler(root)).Methods("GET") 26 | router.HandleFunc("/read/{path:.*}", GetReadFileHandler(root)).Methods("GET") 27 | router.HandleFunc("/write/{path:.*}", GetWriteFileHandler(root)).Methods("POST") 28 | router.HandleFunc("/delete/{path:.*}", GetRemoveFileHandler(root)).Methods("DELETE") 29 | router.HandleFunc("/download/{path:.*}", GetDownloadFileHandler(root)).Methods("GET") 30 | 31 | return router 32 | } 33 | 34 | func createTempDir(t *testing.T, prefix string) string { 35 | dir, err := ioutil.TempDir(".", prefix) 36 | assert.NoError(t, err) 37 | 38 | return dir 39 | } 40 | 41 | func createTempFile(t *testing.T, dir, name string, contents []byte) { 42 | f, err := os.Create(dir + "/" + name) 43 | assert.NoError(t, err) 44 | 45 | f.Write(contents) 46 | f.Close() 47 | } 48 | 49 | func TestScanDir(t *testing.T) { 50 | dirPrefix := "loadDir" 51 | //Create a file under testdir 52 | tmpDir := createTempDir(t, dirPrefix) 53 | defer os.RemoveAll(tmpDir) 54 | targetfile := []string{".hidden_one", ".hidden_two", "i_am_not_hidden"} 55 | for _, v := range targetfile { 56 | createTempFile(t, tmpDir, v, []byte{}) 57 | } 58 | 59 | pwd, err := os.Getwd() 60 | assert.NoError(t, err) 61 | //Get the abosolute path for testing dir 62 | dir := pwd + "/" + tmpDir 63 | 64 | req, err := http.NewRequest("GET", "/scan"+dir, nil) 65 | assert.NoError(t, err) 66 | 67 | res := httptest.NewRecorder() 68 | newRouterServer().ServeHTTP(res, req) 69 | 70 | //Test Status Code 71 | assert.Equal(t, res.Code, 200) 72 | 73 | //Test Files 74 | var fi []FileInfo 75 | err = json.Unmarshal(res.Body.Bytes(), &fi) 76 | assert.NoError(t, err) 77 | 78 | assert.Equal(t, 1, len(fi)) 79 | assert.Equal(t, fi[0].Name, "i_am_not_hidden") 80 | assert.Equal(t, fi[0].Size, int64(0)) 81 | assert.Equal(t, fi[0].Type, "") 82 | assert.Equal(t, fi[0].IsDir, false) 83 | } 84 | 85 | func TestScanDirWithHidden(t *testing.T) { 86 | dirPrefix := "loadDir" 87 | //Create a file under testdir 88 | tmpDir := createTempDir(t, dirPrefix) 89 | defer os.RemoveAll(tmpDir) 90 | targetfile := []string{".hidden_one", ".hidden_two", "i_am_not_hidden"} 91 | for _, v := range targetfile { 92 | createTempFile(t, tmpDir, v, []byte{}) 93 | } 94 | 95 | pwd, err := os.Getwd() 96 | assert.NoError(t, err) 97 | //Get the abosolute path for testing dir 98 | dir := pwd + "/" + tmpDir 99 | 100 | req, err := http.NewRequest("GET", "/scan"+dir+"/?hidden=1", nil) 101 | assert.NoError(t, err) 102 | 103 | res := httptest.NewRecorder() 104 | newRouterServer().ServeHTTP(res, req) 105 | 106 | //Test Status Code 107 | assert.Equal(t, res.Code, 200) 108 | 109 | //Test Files 110 | var fi []FileInfo 111 | err = json.Unmarshal(res.Body.Bytes(), &fi) 112 | assert.NoError(t, err) 113 | assert.Equal(t, 3, len(fi)) 114 | 115 | for i, _ := range targetfile { 116 | assert.Equal(t, fi[i].Name, targetfile[i]) 117 | assert.Equal(t, fi[i].Size, int64(0)) 118 | assert.Equal(t, fi[i].Type, "") 119 | assert.Equal(t, fi[i].IsDir, false) 120 | } 121 | } 122 | 123 | func TestReadFile(t *testing.T) { 124 | dirPrefix := "readDir" 125 | testFileExt := ".txt" 126 | testFileName := "readMe" 127 | testFileContents := []byte{12, 3, 4, 1, 213, 213, 13} 128 | testFile := testFileName + testFileExt 129 | 130 | //Create a file under testdir 131 | tmpDir := createTempDir(t, dirPrefix) 132 | defer os.RemoveAll(tmpDir) 133 | createTempFile(t, tmpDir, testFile, testFileContents) 134 | 135 | pwd, err := os.Getwd() 136 | assert.NoError(t, err) 137 | //Get the abosolute path for testing dir 138 | filePath := pwd + "/" + tmpDir + "/" + testFile 139 | 140 | req, err := http.NewRequest("GET", "/read"+filePath, nil) 141 | assert.NoError(t, err) 142 | 143 | res := httptest.NewRecorder() 144 | newRouterServer().ServeHTTP(res, req) 145 | 146 | //Test Status Code 147 | assert.Equal(t, res.Code, 200) 148 | 149 | //Test Files 150 | var fc FileContent 151 | err = json.Unmarshal(res.Body.Bytes(), &fc) 152 | assert.NoError(t, err) 153 | 154 | assert.Equal(t, testFile, fc.Name) 155 | assert.Equal(t, testFileContents, fc.Content) 156 | } 157 | 158 | func TestUploadFile(t *testing.T) { 159 | 160 | //Generate a simple file 161 | dirPrefix := "uploadDir" 162 | inputFile := "uploadMe.txt" 163 | testFileContents := []byte{1, 123, 123, 213, 13, 213, 3} 164 | //Create a file under testdir 165 | tmpDir := createTempDir(t, dirPrefix) 166 | defer os.RemoveAll(tmpDir) 167 | createTempFile(t, tmpDir, inputFile, testFileContents) 168 | 169 | path := tmpDir + "/" + inputFile 170 | file, err := os.Open(path) 171 | assert.NoError(t, err) 172 | fileContents, err := ioutil.ReadAll(file) 173 | assert.NoError(t, err) 174 | file.Close() 175 | 176 | //Load the file we created above and use the write API to write new file 177 | testFile := "readme.txt" 178 | body := new(bytes.Buffer) 179 | writer := multipart.NewWriter(body) 180 | part, err := writer.CreateFormFile("file", testFile) 181 | assert.NoError(t, err) 182 | part.Write(fileContents) 183 | 184 | err = writer.Close() 185 | assert.NoError(t, err) 186 | 187 | pwd, err := os.Getwd() 188 | filePath := pwd + "/" + testFile 189 | req, err := http.NewRequest("POST", "/write"+pwd, body) 190 | assert.NoError(t, err) 191 | req.Header.Add("Content-Type", writer.FormDataContentType()) 192 | 193 | res := httptest.NewRecorder() 194 | newRouterServer().ServeHTTP(res, req) 195 | defer os.RemoveAll(filePath) 196 | 197 | //Read the file and check the filename and type 198 | req, err = http.NewRequest("GET", "/read"+filePath, nil) 199 | assert.NoError(t, err) 200 | 201 | res = httptest.NewRecorder() 202 | newRouterServer().ServeHTTP(res, req) 203 | 204 | //Test Status Code 205 | assert.Equal(t, 200, res.Code) 206 | 207 | //Test Files 208 | var fc FileContent 209 | err = json.Unmarshal(res.Body.Bytes(), &fc) 210 | assert.NoError(t, err) 211 | 212 | assert.Equal(t, fc.Name, testFile) 213 | assert.Equal(t, fc.Content, testFileContents) 214 | } 215 | 216 | func TestDeleteFile(t *testing.T) { 217 | dirPrefix := "deleteDir" 218 | testFile := "ignoreme" 219 | //Create a file under testdir 220 | tmpDir := createTempDir(t, dirPrefix) 221 | defer os.RemoveAll(tmpDir) 222 | createTempFile(t, tmpDir, testFile, []byte{}) 223 | 224 | pwd, err := os.Getwd() 225 | assert.NoError(t, err) 226 | //Get the abosolute path for testing dir 227 | filePath := pwd + "/" + tmpDir + "/" + testFile 228 | 229 | req, err := http.NewRequest("DELETE", "/delete"+filePath, nil) 230 | assert.NoError(t, err) 231 | 232 | res := httptest.NewRecorder() 233 | newRouterServer().ServeHTTP(res, req) 234 | 235 | //Test Status Code 236 | assert.Equal(t, res.Code, 200) 237 | 238 | //Readfile again, check the file content 239 | req, err = http.NewRequest("GET", "/read"+filePath, nil) 240 | assert.NoError(t, err) 241 | 242 | res = httptest.NewRecorder() 243 | newRouterServer().ServeHTTP(res, req) 244 | 245 | //Test Status Code 246 | assert.Equal(t, res.Code, 404) 247 | } 248 | 249 | func TestDownloadFile(t *testing.T) { 250 | dirPrefix := "downloadDir" 251 | testFileExt := ".txt" 252 | testFileName := "readMe" 253 | testFileContents := []byte{12, 3, 4, 1, 213, 213, 13} 254 | testFile := testFileName + testFileExt 255 | 256 | //Create a file under testdir 257 | tmpDir := createTempDir(t, dirPrefix) 258 | defer os.RemoveAll(tmpDir) 259 | createTempFile(t, tmpDir, testFile, testFileContents) 260 | 261 | pwd, err := os.Getwd() 262 | assert.NoError(t, err) 263 | //Get the abosolute path for testing dir 264 | filePath := pwd + "/" + tmpDir + "/" + testFile 265 | 266 | req, err := http.NewRequest("GET", "/download"+filePath, nil) 267 | assert.NoError(t, err) 268 | 269 | res := httptest.NewRecorder() 270 | newRouterServer().ServeHTTP(res, req) 271 | 272 | //Test Status Code 273 | assert.Equal(t, res.Code, 200) 274 | assert.Equal(t, testFileContents, res.Body.Bytes()) 275 | assert.Equal(t, mime.TypeByExtension(testFileExt), res.Header().Get("Content-Type")) 276 | } 277 | 278 | func TestInvalidPath(t *testing.T) { 279 | type testCases struct { 280 | Cases string 281 | URL string 282 | Method string 283 | } 284 | 285 | data := []testCases{ 286 | {"Load", "/scan", "GET"}, 287 | {"Read", "/read", "GET"}, 288 | {"Download", "/download", "GET"}, 289 | } 290 | 291 | for _, v := range data { 292 | t.Run(v.Cases, func(t *testing.T) { 293 | req, err := http.NewRequest(v.Method, v.URL+invalidDir, nil) 294 | assert.NoError(t, err) 295 | 296 | res := httptest.NewRecorder() 297 | newRouterServer().ServeHTTP(res, req) 298 | 299 | //Test Status Code 300 | assert.Equal(t, res.Code, 404) 301 | }) 302 | } 303 | } 304 | -------------------------------------------------------------------------------- /src/query.go: -------------------------------------------------------------------------------- 1 | package fileserver 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | type QueryUrl struct { 8 | Url url.Values `json:"url"` 9 | } 10 | 11 | func New(url url.Values) *QueryUrl { 12 | return &QueryUrl{ 13 | Url: url, 14 | } 15 | } 16 | 17 | func (query *QueryUrl) Str(key string) (string, bool) { 18 | values := query.Url[key] 19 | 20 | if len(values) == 0 { 21 | return "", false 22 | } 23 | 24 | return values[0], true 25 | } 26 | -------------------------------------------------------------------------------- /src/scan.go: -------------------------------------------------------------------------------- 1 | package fileserver 2 | 3 | import ( 4 | "io/ioutil" 5 | "mime" 6 | "path" 7 | "regexp" 8 | "time" 9 | ) 10 | 11 | type FileInfo struct { 12 | Name string `json:"name"` 13 | Size int64 `json:"size"` 14 | Type string `json:"type"` 15 | ModTime time.Time `json:"mtime"` 16 | IsDir bool `json:"isDir"` 17 | } 18 | 19 | func ScanDir(p string, excludePatterns []string) ([]FileInfo, error) { 20 | fileInfos := []FileInfo{} 21 | files, err := ioutil.ReadDir(p) 22 | if err != nil { 23 | return fileInfos, err 24 | } 25 | 26 | exPattern := []regexp.Regexp{} 27 | for _, v := range excludePatterns { 28 | exPattern = append(exPattern, *regexp.MustCompile(v)) 29 | } 30 | 31 | CheckFile: 32 | for _, file := range files { 33 | for _, v := range exPattern { 34 | if v.MatchString(file.Name()) { 35 | continue CheckFile 36 | } 37 | } 38 | fileInfos = append(fileInfos, FileInfo{ 39 | Name: file.Name(), 40 | Size: file.Size(), 41 | ModTime: file.ModTime(), 42 | IsDir: file.IsDir(), 43 | Type: mime.TypeByExtension(path.Ext(file.Name())), 44 | }) 45 | } 46 | 47 | return fileInfos, nil 48 | } 49 | -------------------------------------------------------------------------------- /vendor/vendor.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment": "", 3 | "ignore": "test", 4 | "package": [ 5 | { 6 | "checksumSHA1": "PQl3vEq5V+klWv1/ZdJ35U/G44U=", 7 | "path": "github.com/c9s/gomon/logger", 8 | "revision": "52a3eced35f062395d8da8bf955dd7f0508719d8", 9 | "revisionTime": "2018-02-01T04:54:51Z" 10 | }, 11 | { 12 | "checksumSHA1": "CSPbwbyzqA6sfORicn4HFtIhF/c=", 13 | "path": "github.com/davecgh/go-spew/spew", 14 | "revision": "8991bc29aa16c548c550c7ff78260e27b9ab7c73", 15 | "revisionTime": "2018-02-21T22:46:20Z" 16 | }, 17 | { 18 | "checksumSHA1": "g/V4qrXjUGG9B+e3hB+4NAYJ5Gs=", 19 | "path": "github.com/gorilla/context", 20 | "revision": "08b5f424b9271eedf6f9f0ce86cb9396ed337a42", 21 | "revisionTime": "2016-08-17T18:46:32Z" 22 | }, 23 | { 24 | "checksumSHA1": "YuYKzn2jczaM6DQcFDmukvAHUX4=", 25 | "path": "github.com/gorilla/mux", 26 | "revision": "b57cb1605fd11ba2ecfa7f68992b4b9cc791934d", 27 | "revisionTime": "2018-04-16T20:45:19Z" 28 | }, 29 | { 30 | "checksumSHA1": "SEnjvwVyfuU2xBaOfXfwPD5MZqk=", 31 | "path": "github.com/mattn/go-colorable", 32 | "revision": "efa589957cd060542a26d2dd7832fd6a6c6c3ade", 33 | "revisionTime": "2018-03-10T13:32:14Z" 34 | }, 35 | { 36 | "checksumSHA1": "w5RcOnfv5YDr3j2bd1YydkPiZx4=", 37 | "path": "github.com/mattn/go-isatty", 38 | "revision": "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c", 39 | "revisionTime": "2017-11-07T05:05:31Z" 40 | }, 41 | { 42 | "checksumSHA1": "CIK3BBNX3nuUQCmNqTQydNfMNKI=", 43 | "path": "github.com/mgutz/ansi", 44 | "revision": "9520e82c474b0a04dd04f8a40959027271bab992", 45 | "revisionTime": "2017-02-06T15:57:36Z" 46 | }, 47 | { 48 | "checksumSHA1": "LuFv4/jlrmFNnDb/5SCSEPAM9vU=", 49 | "path": "github.com/pmezard/go-difflib/difflib", 50 | "revision": "792786c7400a136282c1664665ae0a8db921c6c2", 51 | "revisionTime": "2016-01-10T10:55:54Z" 52 | }, 53 | { 54 | "checksumSHA1": "9ZSqjmvF/JE6Qj/5xOoCAmUgXz8=", 55 | "path": "github.com/sirupsen/logrus", 56 | "revision": "778f2e774c725116edbc3d039dc0dfc1cc62aae8", 57 | "revisionTime": "2018-03-29T22:59:52Z" 58 | }, 59 | { 60 | "checksumSHA1": "6LwXZI7kXm1C0h4Ui0Y52p9uQhk=", 61 | "path": "github.com/stretchr/testify/assert", 62 | "revision": "c679ae2cc0cb27ec3293fea7e254e47386f05d69", 63 | "revisionTime": "2018-03-14T08:05:35Z" 64 | }, 65 | { 66 | "checksumSHA1": "L1vKtjhZ2Lej0kfsLaTUm7ps/Yg=", 67 | "path": "github.com/x-cray/logrus-prefixed-formatter", 68 | "revision": "bb2702d423886830dee131692131d35648c382e2", 69 | "revisionTime": "2017-07-31T09:11:26Z" 70 | }, 71 | { 72 | "checksumSHA1": "BGm8lKZmvJbf/YOJLeL1rw2WVjA=", 73 | "path": "golang.org/x/crypto/ssh/terminal", 74 | "revision": "b0697eccbea9adec5b7ba8008f4c33d98d733388", 75 | "revisionTime": "2018-04-23T13:30:03Z" 76 | }, 77 | { 78 | "checksumSHA1": "RSCMWnn21rwYF//Yt89AC1f1wXY=", 79 | "path": "golang.org/x/sys/unix", 80 | "revision": "79b0c6888797020a994db17c8510466c72fe75d9", 81 | "revisionTime": "2018-04-18T21:20:05Z" 82 | }, 83 | { 84 | "checksumSHA1": "Dfz4tGItokMvHZENCsBmPPB8FGQ=", 85 | "path": "golang.org/x/sys/windows", 86 | "revision": "79b0c6888797020a994db17c8510466c72fe75d9", 87 | "revisionTime": "2018-04-18T21:20:05Z" 88 | } 89 | ], 90 | "rootPath": "github.com/hwchiu/fileserver" 91 | } 92 | --------------------------------------------------------------------------------