Skip to content
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

Sometimes existing folders are not found and creation fails #22

Closed
fkalis opened this issue Mar 8, 2016 · 2 comments
Closed

Sometimes existing folders are not found and creation fails #22

fkalis opened this issue Mar 8, 2016 · 2 comments
Labels

Comments

@fkalis
Copy link
Owner

fkalis commented Mar 8, 2016

This is a follow-up to #12.

Sometimes it happens, that the folder traversel does not return the id of an existing folder. Therefore the script tries to create the folder and fails because the folder does already exist.

The folder traversel should rely on HTTP status codes instead of curl return codes.

Idea:

Simultanous retrieval of status code and content with curl:

curl -w "%{http_code}" -o >(cat >&1) 'http://example.com' 2>/dev/null | tail -n 1
curl -qfsw "%{http_code}" 'http://example.com' | tail -n1
curl -w "###HTTP_CODE###: %{http_code}\n" -o >(cat >&1) 'http://example.com' 2>/dev/null | grep "^###HTTP_CODE###: " | cut -d\  -f2
curl -qfsw "\n###HTTP_CODE###:%{http_code}" 'http://example.com' | grep "^###HTTP_CODE###:" | cut -d: -f2

and

curl -w "%{http_code}" -o >(cat >&1) 'http://example.com' 2>/dev/null | head -n-1
curl -qfsw "%{http_code}" 'http://example.com' | head -n-1
curl -w "###HTTP_CODE###: %{http_code}\n" -o >(cat >&1) 'http://example.com' 2>/dev/null | grep -v "^###HTTP_CODE###: "
curl -qfsw "\n###HTTP_CODE###:%{http_code}" 'http://example.com' | grep -v "^###HTTP_CODE###:"

Warning: head -n-1 does not work under OS X, using grep seems to be the most compatible solution.

@fkalis fkalis added the bug label Mar 8, 2016
fkalis added a commit that referenced this issue Mar 11, 2016
A failed request is either a timeout or a status code 5xx.

This refs #22, #15.
This closes #8.
@fkalis
Copy link
Owner Author

fkalis commented Mar 17, 2016

This behaviour is reproducible with special characters (e.g. German Umlauts).

fkalis added a commit that referenced this issue Mar 17, 2016
@fkalis fkalis closed this as completed Mar 17, 2016
@fkalis
Copy link
Owner Author

fkalis commented Mar 17, 2016

Closed until I see this happen again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant