NetTalk Central

Author Topic: _SendFile in WebHandler  (Read 3101 times)

Matthew

  • Full Member
  • ***
  • Posts: 137
    • View Profile
    • Email
_SendFile in WebHandler
« on: March 28, 2013, 05:11:20 AM »
Hello

I need some help.

How can I prevent sending some file by server?

For example:

I click on my website download file. File path: uploads/Private/test.pdf

In previous NetTalk I could stop sending the file by server in _SendFile procedure in WebHandler. Before ParentCall I checked if the file was from "uploads/Private" folder. If yes then I put RETURN and server didn't send file.

In NetTalk 7.07 this is not working.

So how can I prevent sending some file by server?

Regards,
Matthew

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: _SendFile in WebHandler
« Reply #1 on: March 28, 2013, 08:27:40 AM »
Hi Matthew,

I've done some testing here, and as far as I can see, the PDF will not actually get served.
What is sent though is a header (with a zero content length). that's ok, but not ideal.
You can suppress that by putting

      self.Flushed = 1

inside your rejection. For example, in my testing here I rejected all pdf files with this code;

    self._trace('loc:filename=' & loc:filename)
    if instring('pdf',loc:filename,1,1)
      self._trace('rejecting pdf')   
      self.Flushed = 1
      return
    end 


Cheers
Bruce