claudiodangelis/qrcp

server closed when scan the qrcode

Closed this issue · 14 comments

I'm opening this issue because:

  • I have found a bug
  • I want to request a feature
  • I have a question
  • Other

Server closed when scan the qrcode by my Android 8.0 phone(before the downloading), I didn't install Go on my macOS 10.14.6, But receiving files from mobile works fine.

Hello @Symous, thanks for reporting. Let me ask you a few questions:

  1. Which browser did you use on Android?
  2. What was, approximately, the size of the file(s) you wanted to send?
  3. After scanning the code, did Android ask you to choose which browser you wanted to use?

Thanks,
C

hi @claudiodangelis, I also fount this BUG ,when i scan the qrcode,the browser will ask me is sure to download this file,but the qrcp is exit at the same time. when i add the -k tag is ok to download the file.

@claudiodangelis Thanks for your help.

  1. I use a browser made in China based on WebKit 537.36 Chrome 62.0.3202.97
  2. I try to send a 16KB png file
  3. I use the browser to scan the QR-Code directly, so there is no selection dialog after scanning.

hi @claudiodangelis, I also fount this BUG ,when i scan the qrcode,the browser will ask me is sure to download this file,but the qrcp is exit at the same time. when i add the -k tag is ok to download the file.

@heyv5 I have seen this issue before but I could not reproduce it. Which type of file were you attempting to transfer?

@claudiodangelis Thanks for your help.

1. I use a browser made in China based on WebKit 537.36 Chrome 62.0.3202.97

2. I try to send a 16KB png file

3. I use the browser to scan the QR-Code directly, so there is no selection dialog after scanning.

@Symous thanks, could you please try passing the -k flag? (it means "keep alive") and tell me if it works?

I will investigate meanwhile.
Thanks for your patience,
C

hi @claudiodangelis, I also fount this BUG ,when i scan the qrcode,the browser will ask me is sure to download this file,but the qrcp is exit at the same time. when i add the -k tag is ok to download the file.

@heyv5 I have seen this issue before but I could not reproduce it. Which type of file were you attempting to transfer?

@claudiodangelis Thanks for your help.

1. I use a browser made in China based on WebKit 537.36 Chrome 62.0.3202.97

2. I try to send a 16KB png file

3. I use the browser to scan the QR-Code directly, so there is no selection dialog after scanning.

@Symous thanks, could you please try passing the -k flag? (it means "keep alive") and tell me if it works?

I will investigate meanwhile.
Thanks for your patience,
C

is PNG file too

@claudiodangelis yes, it works fine after add -k flag.

terev commented

One thought I'm just throwing out there is if https://github.com/claudiodangelis/qrcp/blob/master/server/server.go#L171 is not synchronous ( for a multipart response i believe it's not https://golang.org/src/net/http/fs.go?s=19375:19432#L268 ) the send handler goroutine would exit decrementing the waitgroup in turn triggering shutdown of the server. So maybe if a file is being sent as a multipart response the transfer starts but since execution continues on the main goroutine the server shuts down.

One possible way to debug this is view the network log on the receiving browser to see if the connection is closed prematurely . Another option is to craft a request including a range header https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range and send using an http client like curl.

terev commented

Hrm i tried this and i was able to receive all parts before the server closed. I didn't consider that graceful shutdown would handle this case. I believe my hypothesis is disproved.

it's android's shit->Android browser issue. Download makes two requests instead one

Technically this should be already covered in the code, though from time to time I get a similar issue.
Will review the code soon and push a fix for the next release.

Thanks,
C

I'm getting this with Firefox Android 80, I assumed it was because Firefox asks to confirm the download and that the app fails to take that into account, or maybe it's something else.

Hello, are you still experiencing this issue? If so, please feel free to reopen the issue. Thanks!

I am still suffering from this bug.

Yeah me too. Latest version of MacOS and iOS Safari