-
Notifications
You must be signed in to change notification settings - Fork 833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP server should support HEAD method against Python-generated content #256
Comments
There are two main cases here. The homepage (HTML vs JSON-LD) and the per-term documentation. To be able to get the content-length info needed for HEAD would require some reorg / tidying so that content generation was more nicely separated from sending it via GET. Other cases like favicon, docs/full.html too. |
From @mfhepp in a duplicate report: Also note that the current implementation does not support HTTP HEAD requests, which it should, IMO. Evidence: $ curl -i http://www.schema.org/ $ curl -i http://www.schema.org/Thing $ curl -I http://schema.org |
And @timbl nudges us on this again. /cc @RichardWallis The tricky part is the Content-Length:, as it requires " def get(self, node):" to execute (e.g. on /Person) yet not emit any actual content over the connection. I've had a look around to see if there's a best practice for this, but didn't find much. |
Options:
|
In sdoapp.py we could handle a lot of things here, e.g. add a muted=False or restructure to distinguish generating the content from emitting it. |
I've merged @RichardWallis 's implementation, which is now live on our testing / staging site: http://webschemas.org/ ... please take a look if you care about this issue! |
At this point the change is live on our staging / testing server webschemas.org but not yet at schema.org. For example: $ curl --head http://schema.org/Person $ curl --head http://webschemas.org/Person |
As noted in the Pull Request (#1080), this implementation also introduces the functionality to respond with a HTTP '304 - Not Modified' when receiving either If-None-Match or If-Unmodified-Since request header values containing the appropriate values. |
A detail: should etags be suppressed on 404s? curl --head http://webschemas.org/QWERTY etc. http://python.6.x6.nabble.com/etag-and-404-td102123.html debates that but seems to settle on avoiding 404 etags. |
Published - see http://schema.org/docs/releases.html |
Commandline curl -I flag fails ("HTTP/1.1 405 Method Not Allowed") on all our python-generated URLs.
http://curl.haxx.se/docs/manpage.html
-i, --include
(HTTP) Include the HTTP-header in the output. The HTTP-header includes things like server-name, date of the document, HTTP-version and more...
-I, --head
(HTTP/FTP/FILE) Fetch the HTTP-header only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document. When used on an FTP or FILE file, curl displays the file size and last modification time only.
Appengine automatically responds to HTTP HEAD for static URLs e.g. most of docs/* but for python scripted content we need to implement a head function, see https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass#RequestHandler_head for details.
See the corresponding 'get' function for details, https://github.com/schemaorg/schemaorg/blob/master/api.py#L865
It is not a huge task but needs some care to deal with the content negotiation (HTML vs JSON-LD) of the homepage.
The text was updated successfully, but these errors were encountered: