Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Limit in website URL length?

    Hi,

    I'm making queries to a website to detect the language of a URL-encoded text. For an example, see

    Code:
    mata cat("http://ws.detectlanguage.com/0.2/detect?q=buenos+dias+se%C3%B1or&key=demo")
    (In this example, the text input is "buenos+dias+se%C3%B1or".)

    When the URL string becomes long (2076 characters) due to a long input text, Stata issues the following error message.

    Code:
    host not found
                     fopen():   631  host not found
                       cat():     -  function returned error
    I figured that it is not a Mata-specific problem, because the same thing happens when Stata's file open command is used. It rather appears to be a problem of URL length: Reading a URL with 2075 characters works just fine, but for 2076 characters or more Stata complains.
    However, if I manually copy the long URL into a browser (I use Chrome), the query works and the server responds well. That is, the server accepts long URLs (I also tried even longer ones). So I believe the restriction lies somewhere on Stata's end. I could not find any such restriction in URL length in the documentation (I understand that it is neither a problem of limitation in Mata's string scalars nor in Stata's filename string).

    Thank you for any clarification or help on this issue!

  • #2
    I think this question would be best posed to Stata Technical Services. I agree with you that Stata's documentation seems to offer no apparent explanation.

    Comment

    Working...
    X