http-party / http-server

a simple zero-configuration command-line http server
MIT License
13.42k stars 1.48k forks source link

added code for creating robots.txt #838

Closed rskbansal closed 1 year ago

rskbansal commented 1 year ago

Description

Previously, the code was written so as to return text data when localhost/robots.txt is visited by providing the -r or the --robots argument. Now, if the above mentioned arguments are passed, it creates a robots.txt file in the root directory of the server (either ./ or ./public).

Relevant issues

Fixes #825

Contributor checklist

Maintainer checklist

rskbansal commented 1 year ago

@thornjad

BigBlueHat commented 1 year ago

@rskbansal not sure we want an http-server writing files. What's the motivation for the change?

rskbansal commented 1 year ago

A robots.txt file shall be physically present on the server, that's what it is meant to be

zbynek commented 1 year ago

file shall be physically present

but why? For the user it's only important that the response for localhost/robots.txt contains the data, not that the file exists. The current implementation looks fine (except for the === true check mentioned in #825)

BigBlueHat commented 1 year ago

A robots.txt file shall be physically present on the server, that's what it is meant to be

If the file needs to be physically present for your use case, I'd recommend generating it prior to hosting and just not using the --robots option.

@zbynek thinks for connecting to #825. That does need a fix.