python - With Bottle, how could I just peek the head of http request instead of receiving whole http request? -


i don't know if possible bottle. website (powered bottle) allow users upload image files. limited size of 100k. use following code in web server that.

    uploadlimit = 100 #  100k     uploadlimitinbyte = uploadlimit* 2**10      print("before call request.headers.get('content-length')")     contentlen =  request.headers.get('content-length')      if contentlen:         contentlen = int(contentlen)         if contentlen > uploadlimitinbyte:                             return httpresponse('upload limit 100k') 

but when clicked upload button in web browser upload file size 2mb, seems server receiving whole 2mb http request. expect above code receive http headers instead of receiving whole http request. not prevent wasting time on receving unecessary bytes


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -