Skip to content

Commit

Permalink
Added 302 redirect support
Browse files Browse the repository at this point in the history
  • Loading branch information
unixpunk committed Jan 6, 2019
1 parent b865607 commit 5db6501
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/legal_info_html.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ package_table_items () {
if [ $(echo "$tmp" | head -1 | grep "301" | wc -l) -gt 0 ] ; then
url=$(echo "$tmp" | grep -i "Location:" | awk '{print $2}' | sed -e 's/^[ \t]*//;s/[ \t]*$//')
url=${url%$'\r'}
elif [ $(echo "$tmp" | head -1 | grep "302" | wc -l) -gt 0 ] ; then
url=$(echo "$tmp" | grep -i "Location:" | awk '{print $2}' | sed -e 's/^[ \t]*//;s/[ \t]*$//')
url=${url%$'\r'}
elif [ $(echo "$tmp" | head -1 | grep "404" | wc -l) -gt 0 ] ; then
url=$(echo $url | sed 's#/[^/]*$##' )
elif [ $(echo "$tmp" | head -1 | grep "200" | wc -l) -gt 0 ] ; then
Expand Down

4 comments on commit 5db6501

@rgetz
Copy link

@rgetz rgetz commented on 5db6501 Jan 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for letting us know.

You should be able to change the grep in line 167 to "... | grep -E '301|302' | ..." since you are doing the same thing (getting the url) in both cases...

If that works - let me know, and i can change that upstream.

@unixpunk
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, overlooked the easy route, apparently. :) While this does work, there are still cases where I get stuck in a malformed URL error from curl, over and over. I think there is room for improvement in that while/loop to avoid an infinite loop when unexpected responses are encountered. (I didn't save the example/error, sorry.)

@unixpunk
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the other example I'm getting, though maybe not helpful. Happy to test.
unknown error while trying /gnu/ftp/gnu/wget

curl: (3) malformed
unknown error while trying /gnu/ftp/gnu/wget

curl: (3) malformed
unknown error while trying /gnu/ftp/gnu/wget

curl: (3) malformed
unknown error while trying /gnu/ftp/gnu/wget

curl: (3) malformed
unknown error while trying /gnu/ftp/gnu/wget

curl: (3) malformed
unknown error while trying /gnu/ftp/gnu/wget

curl: (3) malformed
unknown error while trying /gnu/ftp/gnu/wget

curl: (3) malformed
^CMakefile:91: recipe for target 'buildroot/output/images/rootfs.cpio.gz' failed
make: *** [buildroot/output/images/rootfs.cpio.gz] Interrupt

@unixpunk
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, obvious answer right in my face. :) A break @ 177 would do it.

Please sign in to comment.